diff options
Diffstat (limited to 'login-utils')
-rw-r--r-- | login-utils/chfn.c | 2 | ||||
-rw-r--r-- | login-utils/last.c | 3 | ||||
-rw-r--r-- | login-utils/login.c | 5 | ||||
-rw-r--r-- | login-utils/su-common.c | 4 |
4 files changed, 6 insertions, 8 deletions
diff --git a/login-utils/chfn.c b/login-utils/chfn.c index a2e6e099e..b7395552b 100644 --- a/login-utils/chfn.c +++ b/login-utils/chfn.c @@ -376,7 +376,7 @@ static int save_new_data(struct chfn_control *ctl) ctl->newf.other); /* remove trailing empty fields (but not subfields of ctl->newf.other) */ - if (!ctl->newf.other) { + if (!ctl->newf.other || !*ctl->newf.other) { while (len > 0 && gecos[len - 1] == ',') len--; gecos[len] = 0; diff --git a/login-utils/last.c b/login-utils/last.c index 2f7d9d48f..1b1a74191 100644 --- a/login-utils/last.c +++ b/login-utils/last.c @@ -394,8 +394,7 @@ static int list(const struct last_control *ctl, struct utmpx *p, time_t logout_t /* * uucp and ftp have special-type entries */ - utline[0] = 0; - strncat(utline, p->ut_line, sizeof(utline) - 1); + mem2strcpy(utline, p->ut_line, sizeof(p->ut_line), sizeof(utline)); if (strncmp(utline, "ftp", 3) == 0 && isdigit(utline[3])) utline[3] = 0; if (strncmp(utline, "uucp", 4) == 0 && isdigit(utline[4])) diff --git a/login-utils/login.c b/login-utils/login.c index ce112b54e..6b9d27e3e 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -1355,10 +1355,7 @@ int main(int argc, char **argv) /* if the shell field has a space: treat it like a shell script */ if (strchr(pwd->pw_shell, ' ')) { - buff = xmalloc(strlen(pwd->pw_shell) + 6); - - strcpy(buff, "exec "); - strcat(buff, pwd->pw_shell); + xasprintf(&buff, "exec %s", pwd->pw_shell); childArgv[childArgc++] = "/bin/sh"; childArgv[childArgc++] = "-sh"; childArgv[childArgc++] = "-c"; diff --git a/login-utils/su-common.c b/login-utils/su-common.c index caabe23a6..4d91b22e4 100644 --- a/login-utils/su-common.c +++ b/login-utils/su-common.c @@ -1446,7 +1446,9 @@ int su_main(int argc, char **argv, int mode) || !su->pwd->pw_passwd || !su->pwd->pw_name || !*su->pwd->pw_name || !su->pwd->pw_dir || !*su->pwd->pw_dir) - errx(EXIT_FAILURE, _("user %s does not exist"), su->new_user); + errx(EXIT_FAILURE, + _("user %s does not exist or the user entry does not " + "contain all the required fields"), su->new_user); su->new_user = su->pwd->pw_name; su->old_user = xgetlogin(); |