cosmetic changes

This commit is contained in:
Koichiro IWAO 2017-10-06 10:55:37 +09:00
parent 844799049e
commit 8493e08667
No known key found for this signature in database
GPG Key ID: 9F72CDBC01BF10EB
2 changed files with 12 additions and 12 deletions

View File

@ -50,16 +50,16 @@ add_xtmp_entry(int pid, const char *line, const char *user, const char *rhostnam
_utmp ut;
struct timeval tv;
memset (&ut, 0, sizeof (ut));
memset(&ut, 0, sizeof(ut));
ut.ut_type=state;
ut.ut_pid = pid;
gettimeofday(&tv, NULL);
ut.ut_tv.tv_sec = tv.tv_sec;
ut.ut_tv.tv_usec = tv.tv_usec;
strncpy(ut.ut_line, line , sizeof (ut.ut_line));
strncpy(ut.ut_user, user , sizeof (ut.ut_user));
strncpy(ut.ut_host, rhostname, sizeof (ut.ut_host));
strncpy(ut.ut_line, line , sizeof(ut.ut_line));
strncpy(ut.ut_user, user , sizeof(ut.ut_user));
strncpy(ut.ut_host, rhostname, sizeof(ut.ut_host));
/* utmp */
setutxent();
@ -74,6 +74,7 @@ add_xtmp_entry(int pid, const char *line, const char *user, const char *rhostnam
log_message(LOG_LEVEL_DEBUG, "HAVE_UTMP_H");
updwtmp("/var/log/wtmp", &ut);
#endif
return 0;
}
@ -83,9 +84,10 @@ utmp_login(int pid, int display, const char *user, const char *rhostname)
char str_display[16];
log_message(LOG_LEVEL_DEBUG,
"adding login info for utmp/wtmp: %d - %d - %s - %s",
pid, display, user, rhostname);
"adding login info for utmp/wtmp: %d - %d - %s - %s",
pid, display, user, rhostname);
g_snprintf(str_display, 15, XRDP_LINE_FORMAT, display);
return add_xtmp_entry(pid, str_display, user, rhostname, USER_PROCESS);
}
@ -95,8 +97,9 @@ utmp_logout(int pid, int display, const char *user, const char *rhostname)
char str_display[16];
log_message(LOG_LEVEL_DEBUG,
"adding logout info for utmp/wtmp: %d - %d - %s - %s",
pid, display, user, rhostname);
"adding logout info for utmp/wtmp: %d - %d - %s - %s",
pid, display, user, rhostname);
g_snprintf(str_display, 15, XRDP_LINE_FORMAT, display);
return add_xtmp_entry(pid, str_display, user, rhostname, DEAD_PROCESS);
}

View File

@ -26,7 +26,6 @@
#ifndef SESSIONRECORD_H
#define SESSIONRECORD_H
#ifdef HAVE_UTMPX_H
#include <utmpx.h>
typedef struct utmpx _utmp;
@ -35,10 +34,8 @@ typedef struct utmpx _utmp;
typedef struct utmp _utmp;
#endif
#define XRDP_LINE_FORMAT "xrdp:%d"
/**
*
* @brief