pw_user.c (30259) | pw_user.c (42245) |
---|---|
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$"; | 29 "$Id: pw_user.c,v 1.23 1997/10/10 06:23:39 charnier 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> --- 882 unchanged lines hidden (view full) --- 920 srandomdev(); 921#else 922 srandom((unsigned long) (time(NULL) ^ getpid())); 923#endif 924 } 925 l = (random() % 8 + 8); /* 8 - 16 chars */ 926 pw_getrand(rndbuf, l); 927 for (i = 0; i < l; i++) | 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> --- 882 unchanged lines hidden (view full) --- 920 srandomdev(); 921#else 922 srandom((unsigned long) (time(NULL) ^ getpid())); 923#endif 924 } 925 l = (random() % 8 + 8); /* 8 - 16 chars */ 926 pw_getrand(rndbuf, l); 927 for (i = 0; i < l; i++) |
928 pwbuf[i] = chars[rndbuf[i] % sizeof(chars)]; | 928 pwbuf[i] = chars[rndbuf[i] % (sizeof(chars)-1)]; |
929 pwbuf[i] = '\0'; 930 931 /* 932 * We give this information back to the user 933 */ 934 if (getarg(args, 'h') == NULL && getarg(args, 'N') == NULL) { 935 if (isatty(1)) 936 printf("Password for '%s' is: ", user); --- 175 unchanged lines hidden --- | 929 pwbuf[i] = '\0'; 930 931 /* 932 * We give this information back to the user 933 */ 934 if (getarg(args, 'h') == NULL && getarg(args, 'N') == NULL) { 935 if (isatty(1)) 936 printf("Password for '%s' is: ", user); --- 175 unchanged lines hidden --- |