Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/user Fix from Brian Poole <raj%cerias.purdue.edu@localhost> f...
details: https://anonhg.NetBSD.org/src/rev/60c86150a603
branches: trunk
changeset: 526425:60c86150a603
user: agc <agc%NetBSD.org@localhost>
date: Fri May 03 10:05:28 2002 +0000
description:
Fix from Brian Poole <raj%cerias.purdue.edu@localhost> for improper handling of
UID ranges. Previous behaviour is demonstrated below...
# useradd -D
group users
base_dir /home
skel_dir /etc/skel
shell /bin/csh
class
inactive 0
expire Null (unset)
range 10200..10300
# useradd -D -r 10200..10300 -r 10400..10500
# useradd -D
group users
base_dir /home
skel_dir /etc/skel
shell /bin/csh
class
inactive 0
expire Null (unset)
range 10400..10500
The second command should have put 2 ranges back into the config file,
but it really only put one because the first range on the command line
was marked as a duplicate (but when it got to writing the config file,
it only wrote command line ranges, so the 10200 got skipped). Fix
this by initializing defrc to 0 and then only looking after defrc for
duplicate ranges.
diffstat:
usr.sbin/user/user.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (35 lines):
diff -r 7507d97f4eb0 -r 60c86150a603 usr.sbin/user/user.c
--- a/usr.sbin/user/user.c Fri May 03 08:58:45 2002 +0000
+++ b/usr.sbin/user/user.c Fri May 03 10:05:28 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: user.c,v 1.48 2002/05/03 08:07:02 agc Exp $ */
+/* $NetBSD: user.c,v 1.49 2002/05/03 10:05:28 agc Exp $ */
/*
* Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
@@ -35,7 +35,7 @@
#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1999 \
The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: user.c,v 1.48 2002/05/03 08:07:02 agc Exp $");
+__RCSID("$NetBSD: user.c,v 1.49 2002/05/03 10:05:28 agc Exp $");
#endif
#include <sys/types.h>
@@ -678,7 +678,7 @@
RENEW(range_t, up->u_rv, up->u_rsize, return(0));
}
if (up->u_rv && sscanf(cp, "%d..%d", &from, &to) == 2) {
- for (i = 0 ; i < up->u_rc ; i++) {
+ for (i = up->u_defrc ; i < up->u_rc ; i++) {
if (up->u_rv[i].r_from == from && up->u_rv[i].r_to == to) {
break;
}
@@ -766,6 +766,7 @@
memsave(&up->u_class, DEF_CLASS, strlen(DEF_CLASS));
#endif
up->u_rsize = 16;
+ up->u_defrc = 0;
NEWARRAY(range_t, up->u_rv, up->u_rsize, exit(1));
up->u_inactive = DEF_INACTIVE;
up->u_expire = DEF_EXPIRE;
Home |
Main Index |
Thread Index |
Old Index