diff options
Diffstat (limited to 'src/sh_login_track.c')
-rw-r--r-- | src/sh_login_track.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/sh_login_track.c b/src/sh_login_track.c index 854df9e..7df22fe 100644 --- a/src/sh_login_track.c +++ b/src/sh_login_track.c @@ -231,7 +231,7 @@ static struct sh_track * load_data_int (char * path) struct sh_track * urecord; urecord = SH_ALLOC(sizeof(struct sh_track)); - memset(urecord, '\0', sizeof(struct sh_track)); + memset(urecord, 0, sizeof(struct sh_track)); uhead = &(urecord->head); uhead->version = SH_LTRACK_VERSION; @@ -401,7 +401,7 @@ static struct sh_track_dates * find_user(const char * user) while(u) { - if (0 == strcmp(user, u->user)) + if (0 == sl_strcmp(user, u->user)) { return u; } @@ -444,7 +444,7 @@ int sh_login_set_user_allow(const char * c) if (!u) { u = SH_ALLOC(sizeof(struct sh_track_dates)); - memset(u, '\0', sizeof(struct sh_track_dates)); + memset(u, 0, sizeof(struct sh_track_dates)); sl_strlcpy(u->user, user, SH_LTRACK_USIZE); flag = 1; } @@ -838,15 +838,17 @@ static char * stripped_hostname (const char * host) } else { - q = strchr(host, '.'); + char * tmp = sh_util_strdup(host); + q = strchr(tmp, '.'); if (q && *q) { ++q; p = sh_util_strdup(q); + SH_FREE(tmp); } else { - p = sh_util_strdup(host); + p = tmp; } } return p; @@ -912,7 +914,7 @@ static struct sh_track_entry * check_host(struct sh_track_entry * list, else { entry = SH_ALLOC(sizeof(struct sh_track_entry)); - memset(entry, '\0', sizeof(struct sh_track_entry)); + memset(entry, 0, sizeof(struct sh_track_entry)); (entry->data).last_login = time; (entry->data).array[index] = 1; sl_strlcpy((entry->data).hostname, q, SH_LTRACK_HSIZE); |