summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-05-15 07:51:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:53:46 -0500
commit064e7447bebd715c8351d9a0ee31f648990f2336 (patch)
tree156925cd7c8d4616f0eca3a743b7323b3b0b23b7 /source4/lib
parent31b9470996632d717c3c74482308e200906fdb8f (diff)
downloadsamba-064e7447bebd715c8351d9a0ee31f648990f2336.tar.gz
samba-064e7447bebd715c8351d9a0ee31f648990f2336.tar.bz2
samba-064e7447bebd715c8351d9a0ee31f648990f2336.zip
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)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/genrand.c11
1 files changed, 5 insertions, 6 deletions
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;
}