Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Mar 2017 16:18:58 +0000 (UTC)
From:      Eugene Grosbein <eugen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315912 - head/usr.sbin/pw
Message-ID:  <201703241618.v2OGIweq080946@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eugen (ports committer)
Date: Fri Mar 24 16:18:57 2017
New Revision: 315912
URL: https://svnweb.freebsd.org/changeset/base/315912

Log:
  Properly initialise with content of pw.conf(5) that was mistakenly ignored.
  Also, respect "defaultgroup" if specified there.
  
  PR:		217934
  Reported by:	Victor Sudakov <vas@mpeks.tomsk.su>
  Reviewed by:	bapt
  Approved by:	bapt, vsevolod (mentor)
  MFC after:	1 week

Modified:
  head/usr.sbin/pw/pw_user.c

Modified: head/usr.sbin/pw/pw_user.c
==============================================================================
--- head/usr.sbin/pw/pw_user.c	Fri Mar 24 16:18:20 2017	(r315911)
+++ head/usr.sbin/pw/pw_user.c	Fri Mar 24 16:18:57 2017	(r315912)
@@ -1177,7 +1177,7 @@ pw_user_add(int argc, char **argv, char 
 	char line[_PASSWORD_LEN+1], path[MAXPATHLEN];
 	char *gecos, *homedir, *skel, *walk, *userid, *groupid, *grname;
 	char *default_passwd, *name, *p;
-	const char *cfg;
+	const char *cfg = NULL;
 	login_cap_t *lc;
 	FILE *pfp, *fp;
 	intmax_t id = -1;
@@ -1356,6 +1356,9 @@ pw_user_add(int argc, char **argv, char 
 	if (GETPWNAM(name) != NULL)
 		errx(EX_DATAERR, "login name `%s' already exists", name);
 
+	if (!grname)
+		grname = cmdcnf->default_group;
+
 	pwd = &fakeuser;
 	pwd->pw_name = name;
 	pwd->pw_class = cmdcnf->default_class ? cmdcnf->default_class : "";
@@ -1485,7 +1488,7 @@ pw_user_mod(int argc, char **argv, char 
 	struct group *grp;
 	StringList *groups = NULL;
 	char args[] = "C:qn:u:c:d:e:p:g:G:mM:l:k:s:w:L:h:H:NPYy:";
-	const char *cfg;
+	const char *cfg = NULL;
 	char *gecos, *homedir, *grname, *name, *newname, *walk, *skel, *shell;
 	char *passwd, *class, *nispasswd;
 	login_cap_t *lc;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703241618.v2OGIweq080946>