diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-06-07 19:33:25 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-06-07 19:33:25 +0000 |
commit | fd1b4fc5f4c3f3eb1ee87ab1f07b7640efd15792 (patch) | |
tree | 021a93deb9a9c3dc06d5d56be3addb65fa7c988c /pw/pw_group.c | |
parent | ecddcdd12d894cb5522d8c22536d53f1c8cce857 (diff) | |
download | pw-darwin-fd1b4fc5f4c3f3eb1ee87ab1f07b7640efd15792.tar.gz pw-darwin-fd1b4fc5f4c3f3eb1ee87ab1f07b7640efd15792.tar.zst pw-darwin-fd1b4fc5f4c3f3eb1ee87ab1f07b7640efd15792.zip |
In case of rename validate the length of the new name
Check early that the new name fits MAXLOGNAME and store it in pwconf
Diffstat (limited to 'pw/pw_group.c')
-rw-r--r-- | pw/pw_group.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/pw/pw_group.c b/pw/pw_group.c index b06b59e..f95d263 100644 --- a/pw/pw_group.c +++ b/pw/pw_group.c @@ -51,7 +51,6 @@ int pw_group(int mode, char *name, long id, struct cargs * args) { int rc; - struct carg *a_newname = getarg(args, 'l'); struct carg *arg; struct group *grp = NULL; int grmembers = 0; @@ -133,8 +132,8 @@ pw_group(int mode, char *name, long id, struct cargs * args) if (id > 0) grp->gr_gid = (gid_t) id; - if (a_newname != NULL) - grp->gr_name = pw_checkname(a_newname->val, 0); + if (conf.newname != NULL) + grp->gr_name = pw_checkname(conf.newname, 0); } else { if (name == NULL) /* Required */ errx(EX_DATAERR, "group name required"); @@ -262,8 +261,8 @@ pw_group(int mode, char *name, long id, struct cargs * args) err(EX_IOERR, "group update"); } - if (a_newname != NULL) - name = a_newname->val; + if (conf.newname != NULL) + name = conf.newname; /* grp may have been invalidated */ if ((grp = GETGRNAM(name)) == NULL) errx(EX_SOFTWARE, "group disappeared during update"); |