diff options
author | Jeremy Allison <jra@samba.org> | 2007-12-16 18:32:03 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-12-16 18:32:03 -0800 |
commit | 26daf2b479d1e6833f417b5d6c3d073ec0828935 (patch) | |
tree | b9a62487d955234dde7b5409bbed28ce045a6731 /source3/auth | |
parent | bd1172d106cff332b642e02c144922ed55508be4 (diff) | |
download | samba-26daf2b479d1e6833f417b5d6c3d073ec0828935.tar.gz samba-26daf2b479d1e6833f417b5d6c3d073ec0828935.tar.bz2 samba-26daf2b479d1e6833f417b5d6c3d073ec0828935.zip |
Remove another static string and static passwd.
Jeremy.
(This used to be commit 2a700c5a57a417add3b1975b2c396d20c8a5f301)
Diffstat (limited to 'source3/auth')
-rw-r--r-- | source3/auth/auth_server.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c index 7c99848612..9f90ef8ccd 100644 --- a/source3/auth/auth_server.c +++ b/source3/auth/auth_server.c @@ -268,8 +268,6 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context auth_serversupplied_info **server_info) { struct cli_state *cli; - static unsigned char badpass[24]; - static fstring baduser; static bool tested_password_server = False; static bool bad_password_server = False; NTSTATUS nt_status = NT_STATUS_NOT_IMPLEMENTED; @@ -300,23 +298,6 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context } } - if(badpass[0] == 0) - memset(badpass, 0x1f, sizeof(badpass)); - - if((user_info->nt_resp.length == sizeof(badpass)) && - !memcmp(badpass, user_info->nt_resp.data, sizeof(badpass))) { - /* - * Very unlikely, our random bad password is the same as the users - * password. - */ - memset(badpass, badpass[0]+1, sizeof(badpass)); - } - - if(baduser[0] == 0) { - fstrcpy(baduser, INVALID_USER_PREFIX); - fstrcat(baduser, global_myname()); - } - /* * Attempt a session setup with a totally incorrect password. * If this succeeds with the guest bit *NOT* set then the password @@ -330,6 +311,28 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context */ if ((!tested_password_server) && (lp_paranoid_server_security())) { + unsigned char badpass[24]; + char *baduser = NULL; + + memset(badpass, 0x1f, sizeof(badpass)); + + if((user_info->nt_resp.length == sizeof(badpass)) && + !memcmp(badpass, user_info->nt_resp.data, sizeof(badpass))) { + /* + * Very unlikely, our random bad password is the same as the users + * password. + */ + memset(badpass, badpass[0]+1, sizeof(badpass)); + } + + baduser = talloc_asprintf(mem_ctx, + "%s%s", + INVALID_USER_PREFIX, + global_myname()); + if (!baduser) { + return NT_STATUS_NO_MEMORY; + } + if (NT_STATUS_IS_OK(cli_session_setup(cli, baduser, (char *)badpass, sizeof(badpass), |