Module Name:    src
Committed By:   blymn
Date:           Wed Nov 28 11:20:58 UTC 2012

Modified Files:
        src/usr.sbin/user: user.c

Log Message:
Google Code In bug fix by Philip Hayes, fixes bin/41049


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/usr.sbin/user/user.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/user/user.c
diff -u src/usr.sbin/user/user.c:1.129 src/usr.sbin/user/user.c:1.130
--- src/usr.sbin/user/user.c:1.129	Thu Dec  1 00:34:05 2011
+++ src/usr.sbin/user/user.c	Wed Nov 28 11:20:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: user.c,v 1.129 2011/12/01 00:34:05 dholland Exp $ */
+/* $NetBSD: user.c,v 1.130 2012/11/28 11:20:58 blymn Exp $ */
 
 /*
  * Copyright (c) 1999 Alistair G. Crooks.  All rights reserved.
@@ -33,7 +33,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1999\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: user.c,v 1.129 2011/12/01 00:34:05 dholland Exp $");
+__RCSID("$NetBSD: user.c,v 1.130 2012/11/28 11:20:58 blymn Exp $");
 #endif
 
 #include <sys/types.h>
@@ -1579,6 +1579,12 @@ moduser(char *login_name, char *newlogin
 					    login_name, up->u_uid);
 				}
 				pwp->pw_gid = pwp->pw_uid;
+				if (!creategid(newlogin, pwp->pw_uid, "")) {
+					errx(EXIT_FAILURE, 
+					    "Could not create group %s "
+					    "with uid %d", newlogin, 
+					    up->u_uid);
+				}
 			} else if ((grp = getgrnam(up->u_primgrp)) != NULL) {
 				pwp->pw_gid = grp->gr_gid;
 			} else if (is_number(up->u_primgrp) &&

Reply via email to