From 22f17ad123576a56d6500c3982621dff9bd53b29 Mon Sep 17 00:00:00 2001 From: BLINDAUER Emmanuel Date: Sun, 12 Nov 2017 17:18:15 +0100 Subject: [PATCH] More g_* functions usage Follow coding standard --- sesman/sesexec/sessionrecord.c | 9 +++++---- sesman/sesexec/sessionrecord.h | 14 ++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/sesman/sesexec/sessionrecord.c b/sesman/sesexec/sessionrecord.c index 0402ad72..979c778e 100644 --- a/sesman/sesexec/sessionrecord.c +++ b/sesman/sesexec/sessionrecord.c @@ -38,6 +38,7 @@ #include "log.h" #include "os_calls.h" +#include "string_calls.h" #include "sessionrecord.h" /* @@ -51,16 +52,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)); + g_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)); + g_strncpy(ut.ut_line, line , sizeof(ut.ut_line)); + g_strncpy(ut.ut_user, user , sizeof(ut.ut_user)); + g_strncpy(ut.ut_host, rhostname, sizeof(ut.ut_host)); /* utmp */ setutxent(); diff --git a/sesman/sesexec/sessionrecord.h b/sesman/sesexec/sessionrecord.h index b52c3093..e72d4e88 100644 --- a/sesman/sesexec/sessionrecord.h +++ b/sesman/sesexec/sessionrecord.h @@ -36,16 +36,14 @@ typedef struct utmp _utmp; #define XRDP_LINE_FORMAT "xrdp:%d" -/** - * - * @brief - * - * @param pid - * @return 0 - */ - int add_xtmp_entry(int pid, const char *line, const char *user, const char *rhostname, short state); +/** + * @brief functions for adding utmp entries. one at login, one for logout + * + * @param pid of the session, display, login, and hostname + * @return 0 + */ int utmp_login(int pid, int display, const char *user, const char *rhostname); int utmp_logout(int pid, int display, const char *user, const char *rhostname);