summaryrefslogtreecommitdiffstats
path: root/chpass/edit.c
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1995-02-09 11:14:39 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1995-02-09 11:14:39 +0000
commit1175e543201444659522baa004c976838ecdc606 (patch)
treea13785db2f8ccd3f5cc27a84853476c3eb37f056 /chpass/edit.c
parente6fc7aa8756963973843f735b76491e20a4a37b8 (diff)
downloadpw-darwin-1175e543201444659522baa004c976838ecdc606.tar.gz
pw-darwin-1175e543201444659522baa004c976838ecdc606.tar.zst
pw-darwin-1175e543201444659522baa004c976838ecdc606.zip
Fixes for chpass.
Submitted by: Heikki Suonsivu <hsu@cs.hut.fi>
Diffstat (limited to 'chpass/edit.c')
-rw-r--r--chpass/edit.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/chpass/edit.c b/chpass/edit.c
index 34bd35b..b62b40f 100644
--- a/chpass/edit.c
+++ b/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);