From 185815a6472a7a09602b3c51198e20257241dfa7 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 24 Jan 2010 13:46:59 +0100 Subject: s3: Remove some calls to memset -- reduces text size by some bytes for me --- source3/auth/auth_util.c | 11 +++-------- source3/libsmb/ntlmssp.c | 7 ++----- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index de552cf57e..46b7af4d87 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -1267,7 +1267,7 @@ static NTSTATUS make_new_server_info_guest(struct auth_serversupplied_info **ser struct samu *sampass = NULL; DOM_SID guest_sid; bool ret; - char zeros[16]; + static const char zeros[16] = {0, }; fstring tmp; if ( !(sampass = samu_new( NULL )) ) { @@ -1302,7 +1302,6 @@ static NTSTATUS make_new_server_info_guest(struct auth_serversupplied_info **ser /* annoying, but the Guest really does have a session key, and it is all zeros! */ - ZERO_STRUCT(zeros); (*server_info)->user_session_key = data_blob(zeros, sizeof(zeros)); (*server_info)->lm_session_key = data_blob(zeros, sizeof(zeros)); @@ -1622,7 +1621,7 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, struct auth_serversupplied_info **server_info, struct netr_SamInfo3 *info3) { - char zeros[16]; + static const char zeros[16] = {0, }; NTSTATUS nt_status = NT_STATUS_OK; char *found_username = NULL; @@ -1838,8 +1837,6 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, /* ensure we are never given NULL session keys */ - ZERO_STRUCT(zeros); - if (memcmp(info3->base.key.key, zeros, sizeof(zeros)) == 0) { result->user_session_key = data_blob_null; } else { @@ -1873,7 +1870,7 @@ NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx, const struct wbcAuthUserInfo *info, struct auth_serversupplied_info **server_info) { - char zeros[16]; + static const char zeros[16] = {0, }; NTSTATUS nt_status = NT_STATUS_OK; char *found_username = NULL; @@ -2083,8 +2080,6 @@ NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx, /* ensure we are never given NULL session keys */ - ZERO_STRUCT(zeros); - if (memcmp(info->user_session_key, zeros, sizeof(zeros)) == 0) { result->user_session_key = data_blob_null; } else { diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c index 7fffe7cea3..1d20ee5026 100644 --- a/source3/libsmb/ntlmssp.c +++ b/source3/libsmb/ntlmssp.c @@ -803,8 +803,7 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state *ntlmssp_state, session_key.data); DEBUG(10,("ntlmssp_server_auth: Created NTLM session key.\n")); } else { - uint8 zeros[24]; - ZERO_STRUCT(zeros); + static const uint8 zeros[24] = {0, }; session_key = data_blob_talloc( ntlmssp_state, NULL, 16); if (session_key.data == NULL) { @@ -1062,11 +1061,9 @@ static NTSTATUS ntlmssp_client_challenge(struct ntlmssp_state *ntlmssp_state, } if (!ntlmssp_state->nt_hash || !ntlmssp_state->lm_hash) { - uchar zeros[16]; + static const uint8_t zeros[16] = {0, }; /* do nothing - blobs are zero length */ - ZERO_STRUCT(zeros); - /* session key is all zeros */ session_key = data_blob_talloc(ntlmssp_state, zeros, 16); -- cgit