From 3bc87626ae7894269535333aadb45ec786f3908d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 4 Dec 2001 05:03:03 +0000 Subject: Add 'net rpc join' to match the ADS equiv. This kills off the offending code in smbpasswd -j -Uab%c In the process we have changed from unsing compelatly random passwords to random, 15 char ascii strings. While this does produce a decrese in entropy, it is still vastly greater than we need, considering the application. In the meantime this allows us to actually *type* the machine account password duruign debugging. This code also adds a 'check' step to the join, confirming that the stored password does indeed do somthing of value :-) Andrew Bartlett (This used to be commit c0b7ee6ee547dc7ff798eaf8cb63fbe344073029) --- source3/libsmb/smbencrypt.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'source3/libsmb/smbencrypt.c') diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c index 2e27455362..b0fecd1c19 100644 --- a/source3/libsmb/smbencrypt.c +++ b/source3/libsmb/smbencrypt.c @@ -262,27 +262,20 @@ void SMBsesskeygen_ntv1(const uchar kr[16], } /*********************************************************** - encode a password buffer + encode a password buffer. The caller gets to figure out + what to put in it. ************************************************************/ -BOOL encode_pw_buffer(char buffer[516], const char *new_pass, - int new_pw_len, BOOL nt_pass_set) +BOOL encode_pw_buffer(char buffer[516], char *new_pw, int new_pw_length) { generate_random_buffer((unsigned char *)buffer, 516, True); - if (nt_pass_set) { - new_pw_len *= 2; - push_ucs2(NULL, &buffer[512 - new_pw_len], new_pass, - new_pw_len, 0); - } else { - push_ascii(&buffer[512 - new_pw_len], new_pass, - new_pw_len, 0); - } + memcpy(&buffer[512 - new_pw_length], new_pw, new_pw_length); /* * The length of the new password is in the last 4 bytes of * the data buffer. */ - SIVAL(buffer, 512, new_pw_len); + SIVAL(buffer, 512, new_pw_length); return True; } -- cgit