Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/user Search uid ranges properly, using command line...



details:   https://anonhg.NetBSD.org/src/rev/8511a3468302
branches:  trunk
changeset: 521785:8511a3468302
user:      agc <agc%NetBSD.org@localhost>
date:      Tue Feb 05 19:18:29 2002 +0000

description:
Search uid ranges properly, using command line ranges if provided, and
using the default range last.

Problem reported by Cillian Sharkey <cns%redbrick.dcu.ie@localhost>

diffstat:

 usr.sbin/user/user.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r e468e8e8871a -r 8511a3468302 usr.sbin/user/user.c
--- a/usr.sbin/user/user.c      Tue Feb 05 18:26:07 2002 +0000
+++ b/usr.sbin/user/user.c      Tue Feb 05 19:18:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: user.c,v 1.45 2001/10/22 11:00:05 agc Exp $ */
+/* $NetBSD: user.c,v 1.46 2002/02/05 19:18:29 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.45 2001/10/22 11:00:05 agc Exp $");
+__RCSID("$NetBSD: user.c,v 1.46 2002/02/05 19:18:29 agc Exp $");
 #endif
 
 #include <sys/types.h>
@@ -899,7 +899,8 @@
        /* if no uid was specified, get next one in [low_uid..high_uid] range */
        sync_uid_gid = (strcmp(up->u_primgrp, "=uid") == 0);
        if (up->u_uid == -1) {
-               for (i = 0 ; i < up->u_rc ; i++) {
+               /* default is in index '0' in array */
+               for (i = up->u_rc - 1 ; i >= 0 ; --i) {
                        if (getnextuid(sync_uid_gid, &up->u_uid, up->u_rv[i].r_from, up->u_rv[i].r_to)) {
                                break;
                        }



Home | Main Index | Thread Index | Old Index