pw_user.c (42287) | pw_user.c (43780) |
---|---|
1/*- 2 * Copyright (C) 1996 3 * David L. Nugent. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#ifndef lint 28static const char rcsid[] = | 1/*- 2 * Copyright (C) 1996 3 * David L. Nugent. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#ifndef lint 28static const char rcsid[] = |
29 "$Id: pw_user.c,v 1.24 1999/01/02 04:37:46 billf Exp $"; | 29 "$Id: pw_user.c,v 1.25 1999/01/04 14:07:53 billf Exp $"; |
30#endif /* not lint */ 31 32#include <ctype.h> 33#include <err.h> 34#include <fcntl.h> 35#include <sys/param.h> 36#include <dirent.h> 37#include <paths.h> --- 248 unchanged lines hidden (view full) --- 286 if (a_name == NULL) 287 errx(EX_DATAERR, "user name or id required"); 288 289 /* 290 * Determine whether 'n' switch is name or uid - we don't 291 * really don't really care which we have, but we need to 292 * know. 293 */ | 30#endif /* not lint */ 31 32#include <ctype.h> 33#include <err.h> 34#include <fcntl.h> 35#include <sys/param.h> 36#include <dirent.h> 37#include <paths.h> --- 248 unchanged lines hidden (view full) --- 286 if (a_name == NULL) 287 errx(EX_DATAERR, "user name or id required"); 288 289 /* 290 * Determine whether 'n' switch is name or uid - we don't 291 * really don't really care which we have, but we need to 292 * know. 293 */ |
294 if (mode != M_ADD && pwd == NULL && isdigit(*a_name->val) && atoi(a_name->val) > 0) { /* Assume uid */ | 294 if (mode != M_ADD && pwd == NULL 295 && strspn(a_name->val, "0123456789") == strlen(a_name->val) 296 && atoi(a_name->val) > 0) { /* Assume uid */ |
295 (a_uid = a_name)->ch = 'u'; 296 a_name = NULL; 297 } 298 } 299 /* 300 * Update, delete & print require that the user exists 301 */ 302 if (mode == M_UPDATE || mode == M_DELETE || mode == M_PRINT) { --- 809 unchanged lines hidden --- | 297 (a_uid = a_name)->ch = 'u'; 298 a_name = NULL; 299 } 300 } 301 /* 302 * Update, delete & print require that the user exists 303 */ 304 if (mode == M_UPDATE || mode == M_DELETE || mode == M_PRINT) { --- 809 unchanged lines hidden --- |