From a83e7725c4dd1880b14c5018ef321804fc17fdee Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 25 Nov 2001 01:36:02 +0000 Subject: use generate_random_str() (This used to be commit 720c50a7514febdd7cfd6ce40b7b5a0c5cc0abf8) --- source3/utils/net_ads.c | 51 ++++--------------------------------------------- 1 file changed, 4 insertions(+), 47 deletions(-) (limited to 'source3/utils/net_ads.c') diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 87db4ada34..d9b99c77dc 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -23,48 +23,6 @@ #ifdef HAVE_ADS -/* a lame random number generator - used /dev/urandom if possible */ -static unsigned one_random(void) -{ - int fd = -1; - static int initialised; - unsigned ret; - - if (!initialised) { - initialised = 1; - fd = open("/dev/urandom", O_RDONLY); - srandom(time(NULL) ^ getpid()); - } - - if (fd == -1) { - return random(); - } - - read(fd, &ret, sizeof(ret)); - return ret; -} - -/* - * Generate a simple random password of 15 chars - not a cryptographic one - */ -static char *generate_random_password(int len) -{ - int i; - char *pass; - - if (!(pass = malloc(len+1))) - return NULL; - - for (i=0; irealm); + free(password); + return 0; } -- cgit