|
@ -1,4 +1,4 @@ |
|
|
/* $OpenBSD: passwd.c,v 1.48 2006/12/17 20:50:51 ray Exp $ */ |
|
|
|
|
|
|
|
|
/* $OpenBSD: passwd.c,v 1.49 2006/12/20 23:07:36 ray Exp $ */ |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
* Copyright (c) 1987, 1993, 1994, 1995 |
|
|
* Copyright (c) 1987, 1993, 1994, 1995 |
|
@ -322,7 +322,7 @@ pw_copy(int ffd, int tfd, const struct passwd *pw, const struct passwd *opw) |
|
|
if (done) { |
|
|
if (done) { |
|
|
(void)fprintf(to, "%s", buf); |
|
|
(void)fprintf(to, "%s", buf); |
|
|
if (ferror(to)) |
|
|
if (ferror(to)) |
|
|
goto err; |
|
|
|
|
|
|
|
|
goto fail; |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
if (!(p = strchr(buf, ':'))) { |
|
|
if (!(p = strchr(buf, ':'))) { |
|
@ -334,7 +334,7 @@ pw_copy(int ffd, int tfd, const struct passwd *pw, const struct passwd *opw) |
|
|
*p = ':'; |
|
|
*p = ':'; |
|
|
(void)fprintf(to, "%s", buf); |
|
|
(void)fprintf(to, "%s", buf); |
|
|
if (ferror(to)) |
|
|
if (ferror(to)) |
|
|
goto err; |
|
|
|
|
|
|
|
|
goto fail; |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
if (opw != NULL) { |
|
|
if (opw != NULL) { |
|
@ -354,7 +354,7 @@ pw_copy(int ffd, int tfd, const struct passwd *pw, const struct passwd *opw) |
|
|
pw->pw_shell); |
|
|
pw->pw_shell); |
|
|
done = 1; |
|
|
done = 1; |
|
|
if (ferror(to)) |
|
|
if (ferror(to)) |
|
|
goto err; |
|
|
|
|
|
|
|
|
goto fail; |
|
|
} |
|
|
} |
|
|
if (!done) |
|
|
if (!done) |
|
|
(void)fprintf(to, "%s:%s:%d:%d:%s:%d:%d:%s:%s:%s\n", |
|
|
(void)fprintf(to, "%s:%s:%d:%d:%s:%d:%d:%s:%s:%s\n", |
|
@ -363,7 +363,7 @@ pw_copy(int ffd, int tfd, const struct passwd *pw, const struct passwd *opw) |
|
|
pw->pw_dir, pw->pw_shell); |
|
|
pw->pw_dir, pw->pw_shell); |
|
|
|
|
|
|
|
|
if (ferror(to)) |
|
|
if (ferror(to)) |
|
|
err: |
|
|
|
|
|
|
|
|
fail: |
|
|
pw_error(NULL, 0, 1); |
|
|
pw_error(NULL, 0, 1); |
|
|
free(master); |
|
|
free(master); |
|
|
(void)fclose(to); |
|
|
(void)fclose(to); |
|
@ -461,11 +461,11 @@ fmt: warnx("corrupted entry"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
__dead void |
|
|
__dead void |
|
|
pw_error(const char *name, int err, int eval) |
|
|
|
|
|
|
|
|
pw_error(const char *name, int error, int eval) |
|
|
{ |
|
|
{ |
|
|
char *master = pw_file(_PATH_MASTERPASSWD); |
|
|
char *master = pw_file(_PATH_MASTERPASSWD); |
|
|
|
|
|
|
|
|
if (err) { |
|
|
|
|
|
|
|
|
if (error) { |
|
|
if (name) |
|
|
if (name) |
|
|
warn("%s", name); |
|
|
warn("%s", name); |
|
|
else |
|
|
else |
|
|