From owner-svn-src-all@FreeBSD.ORG Sun Mar 10 00:36:29 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 96738CB0; Sun, 10 Mar 2013 00:36:29 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 704FA2A9; Sun, 10 Mar 2013 00:36:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2A0aTWM074439; Sun, 10 Mar 2013 00:36:29 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2A0aTGw074438; Sun, 10 Mar 2013 00:36:29 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201303100036.r2A0aTGw074438@svn.freebsd.org> From: Baptiste Daroussin Date: Sun, 10 Mar 2013 00:36:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r248120 - stable/8/lib/libutil X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Mar 2013 00:36:29 -0000 Author: bapt Date: Sun Mar 10 00:36:28 2013 New Revision: 248120 URL: http://svnweb.freebsd.org/changeset/base/248120 Log: MFC r237268 Revert user comparison back to user names as some user can share uids (root/toor for example) get the username information from old_pw structures to still allow renaming of a user. Approved by: re (jpaetzel) Modified: stable/8/lib/libutil/pw_util.c Directory Properties: stable/8/lib/libutil/ (props changed) Modified: stable/8/lib/libutil/pw_util.c ============================================================================== --- stable/8/lib/libutil/pw_util.c Sat Mar 9 23:55:23 2013 (r248119) +++ stable/8/lib/libutil/pw_util.c Sun Mar 10 00:36:28 2013 (r248120) @@ -436,14 +436,21 @@ pw_copy(int ffd, int tfd, const struct p size_t len; int eof, readlen; - spw = pw; + if (old_pw == NULL && pw == NULL) + return (-1); + + spw = old_pw; + /* deleting a user */ if (pw == NULL) { line = NULL; - if (old_pw == NULL) + } else { + if ((line = pw_make(pw)) == NULL) return (-1); - spw = old_pw; - } else if ((line = pw_make(pw)) == NULL) - return (-1); + } + + /* adding a user */ + if (spw == NULL) + spw = pw; eof = 0; len = 0; @@ -510,7 +517,7 @@ pw_copy(int ffd, int tfd, const struct p */ *q = t; - if (fpw == NULL || fpw->pw_uid != spw->pw_uid) { + if (fpw == NULL || strcmp(fpw->pw_name, spw->pw_name) != 0) { /* nope */ if (fpw != NULL) free(fpw);