From owner-svn-src-head@freebsd.org Fri Mar 24 16:18:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50714D1B3D0; Fri, 24 Mar 2017 16:18:59 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 156D314E4; Fri, 24 Mar 2017 16:18:59 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2OGIwcx080947; Fri, 24 Mar 2017 16:18:58 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2OGIweq080946; Fri, 24 Mar 2017 16:18:58 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201703241618.v2OGIweq080946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Fri, 24 Mar 2017 16:18:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315912 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Mar 2017 16:18:59 -0000 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 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;