summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-02-09 11:14:39 +0000
committerjkh <jkh@FreeBSD.org>1995-02-09 11:14:39 +0000
commitef60271dc002b54fc9f8cbb2ae5b8a30bbd38ddd (patch)
tree29f6a7cff3fdc647d7d5c49ab80b3b3946209734
parent2cbfd0e2291ab1de5ac76880a140f673c1a1f3d6 (diff)
downloadFreeBSD-src-ef60271dc002b54fc9f8cbb2ae5b8a30bbd38ddd.zip
FreeBSD-src-ef60271dc002b54fc9f8cbb2ae5b8a30bbd38ddd.tar.gz
Fixes for chpass.
Submitted by: Heikki Suonsivu <hsu@cs.hut.fi>
-rw-r--r--usr.bin/chpass/edit.c32
-rw-r--r--usr.bin/chpass/table.c2
2 files changed, 25 insertions, 9 deletions
diff --git a/usr.bin/chpass/edit.c b/usr.bin/chpass/edit.c
index 34bd35b..b62b40f 100644
--- a/usr.bin/chpass/edit.c
+++ b/usr.bin/chpass/edit.c
@@ -118,16 +118,32 @@ display(fd, pw)
(void)fprintf(fp, "Shell: %s\n",
*pw->pw_shell ? pw->pw_shell : _PATH_BSHELL);
else
- list[E_SHELL].restricted = 1;
+ list[E_SHELL].restricted = 1;
bp = pw->pw_gecos;
+
p = strsep(&bp, ",");
- (void)fprintf(fp, "Full Name: %s\n", p ? p : "");
- p = strsep(&bp, ",");
- (void)fprintf(fp, "Location: %s\n", p ? p : "");
- p = strsep(&bp, ",");
- (void)fprintf(fp, "Office Phone: %s\n", p ? p : "");
- p = strsep(&bp, ",");
- (void)fprintf(fp, "Home Phone: %s\n", p ? p : "");
+ if (p)
+ list[E_NAME].save = strdup(p);
+ if (!list[E_NAME].restricted)
+ (void)fprintf(fp, "Full Name: %s\n", p ? p : "");
+
+ p = strsep(&bp, ",");
+ if (p)
+ list[E_LOCATE].save = strdup(p);
+ if (!list[E_LOCATE].restricted)
+ (void)fprintf(fp, "Location: %s\n", p ? p : "");
+
+ p = strsep(&bp, ",");
+ if (p)
+ list[E_BPHONE].save = strdup(p);
+ if (!list[E_BPHONE].restricted)
+ (void)fprintf(fp, "Office Phone: %s\n", p ? p : "");
+
+ p = strsep(&bp, ",");
+ if (p)
+ list[E_HPHONE].save = strdup(p);
+ if (!list[E_HPHONE].restricted)
+ (void)fprintf(fp, "Home Phone: %s\n", p ? p : "");
(void)fchown(fd, getuid(), getgid());
(void)fclose(fp);
diff --git a/usr.bin/chpass/table.c b/usr.bin/chpass/table.c
index 46a12d1..c6b76b3 100644
--- a/usr.bin/chpass/table.c
+++ b/usr.bin/chpass/table.c
@@ -50,7 +50,7 @@ ENTRY list[] = {
{ "class", p_class, 1, 5, e1, },
{ "change", p_change, 1, 6, NULL, },
{ "expire", p_expire, 1, 6, NULL, },
- { "full name", p_gecos, 0, 9, e2, },
+ { "full name", p_gecos, 1, 9, e2, },
{ "office phone", p_gecos, 0, 12, e2, },
{ "home phone", p_gecos, 0, 10, e2, },
{ "location", p_gecos, 0, 8, e2, },
OpenPOWER on IntegriCloud