From 064e7447bebd715c8351d9a0ee31f648990f2336 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 15 May 2004 07:51:38 +0000 Subject: r743: Start on a NETLOGON server in Samba4. Currently this only authentiates the machine, not real users. As a consequence of running the Samba4 NETLOGON test against Samba4, I found a number of issues in the SAMR server, which I have addressed. There are more templates in the provison.ldif for this reason. I also added some debug to our credentials code, and fixed some bugs in the auth_sam module. The static buffer in generate_random_string() bit me badly, so I removed it in favor of a talloc based system. Andrew Bartlett (This used to be commit 94624e519b66def97758b8a48a01ffe9029176f0) --- source4/lib/genrand.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/genrand.c b/source4/lib/genrand.c index f891ac883a..fdd4bb14fc 100644 --- a/source4/lib/genrand.c +++ b/source4/lib/genrand.c @@ -269,15 +269,14 @@ BOOL check_password_quality(const char *s) static char c_list[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_-#.,"; -char *generate_random_str(size_t len) +char *generate_random_str(TALLOC_CTX *mem_ctx, size_t len) { - static unsigned char retstr[256]; size_t i; - memset(retstr, '\0', sizeof(retstr)); + char *retstr = talloc(mem_ctx, len + 1); - if (len > sizeof(retstr)-1) - len = sizeof(retstr) -1; + if (!retstr) + return NULL; again: generate_random_buffer(retstr, len, False); @@ -292,5 +291,5 @@ again: goto again; } - return (char *)retstr; + return retstr; } -- cgit