From owner-svn-src-stable@freebsd.org Wed Dec 30 23:25:46 2015 Return-Path: Delivered-To: svn-src-stable@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 B0D77A563DE; Wed, 30 Dec 2015 23:25:46 +0000 (UTC) (envelope-from bapt@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 66DAB1437; Wed, 30 Dec 2015 23:25:46 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBUNPjta059002; Wed, 30 Dec 2015 23:25:45 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBUNPjwU058999; Wed, 30 Dec 2015 23:25:45 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201512302325.tBUNPjwU058999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 30 Dec 2015 23:25:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292965 - stable/10/usr.sbin/pw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2015 23:25:46 -0000 Author: bapt Date: Wed Dec 30 23:25:45 2015 New Revision: 292965 URL: https://svnweb.freebsd.org/changeset/base/292965 Log: MFC: r292846, r292847, r292849 Restore dryrun support for pw groupmod Remove useless assignement of linelen Simplify code for parsing extra groups Modified: stable/10/usr.sbin/pw/pw_conf.c stable/10/usr.sbin/pw/pw_group.c stable/10/usr.sbin/pw/pw_vpw.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/pw_conf.c ============================================================================== --- stable/10/usr.sbin/pw/pw_conf.c Wed Dec 30 23:04:08 2015 (r292964) +++ stable/10/usr.sbin/pw/pw_conf.c Wed Dec 30 23:25:45 2015 (r292965) @@ -313,7 +313,7 @@ read_userconfig(char const * file) ? NULL : newstr(q); break; case _UC_EXTRAGROUPS: - for (i = 0; q != NULL; q = strtok(NULL, toks)) { + while ((q = strtok(NULL, toks)) != NULL) { if (config.groups == NULL) config.groups = sl_init(); sl_add(config.groups, newstr(q)); Modified: stable/10/usr.sbin/pw/pw_group.c ============================================================================== --- stable/10/usr.sbin/pw/pw_group.c Wed Dec 30 23:04:08 2015 (r292964) +++ stable/10/usr.sbin/pw/pw_group.c Wed Dec 30 23:25:45 2015 (r292965) @@ -664,6 +664,11 @@ pw_group_mod(int argc, char **argv, char grp_add_members(&grp, newmembers); } + if (dryrun) { + print_group(grp, pretty); + return (EXIT_SUCCESS); + } + if ((rc = chggrent(name, grp)) != 0) { if (rc == -1) errx(EX_IOERR, "group '%s' not available (NIS?)", Modified: stable/10/usr.sbin/pw/pw_vpw.c ============================================================================== --- stable/10/usr.sbin/pw/pw_vpw.c Wed Dec 30 23:04:08 2015 (r292964) +++ stable/10/usr.sbin/pw/pw_vpw.c Wed Dec 30 23:25:45 2015 (r292965) @@ -70,7 +70,6 @@ vnextpwent(char const *nam, uid_t uid, i pw = NULL; line = NULL; linecap = 0; - linelen = 0; if (pwd_fp != NULL || (pwd_fp = fopen(getpwpath(_MASTERPASSWD), "r")) != NULL) { while ((linelen = getline(&line, &linecap, pwd_fp)) > 0) { @@ -153,7 +152,6 @@ vnextgrent(char const *nam, gid_t gid, i gr = NULL; line = NULL; linecap = 0; - linelen = 0; if (grp_fp != NULL || (grp_fp = fopen(getgrpath(_GROUP), "r")) != NULL) { while ((linelen = getline(&line, &linecap, grp_fp)) > 0) {