svn commit: r237778 - stable/9/lib/libutil
Baptiste Daroussin
bapt at FreeBSD.org
Fri Jun 29 13:00:29 UTC 2012
Author: bapt
Date: Fri Jun 29 13:00:28 2012
New Revision: 237778
URL: http://svn.freebsd.org/changeset/base/237778
Log:
MFC: r237268
early MFC to get this important bugfix into 9.1
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.
Reported by: Claude Buisson <clbuisson at orange.fr>
Approved by: des (mentor)
Modified:
stable/9/lib/libutil/pw_util.c
Directory Properties:
stable/9/lib/libutil/ (props changed)
Modified: stable/9/lib/libutil/pw_util.c
==============================================================================
--- stable/9/lib/libutil/pw_util.c Fri Jun 29 12:55:36 2012 (r237777)
+++ stable/9/lib/libutil/pw_util.c Fri Jun 29 13:00:28 2012 (r237778)
@@ -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);
More information about the svn-src-stable-9
mailing list