s3: Remove some calls to memset -- reduces text size by some bytes for me
authorVolker Lendecke <vl@samba.org>
Sun, 24 Jan 2010 12:46:59 +0000 (13:46 +0100)
committerVolker Lendecke <vl@samba.org>
Sun, 24 Jan 2010 13:52:33 +0000 (14:52 +0100)
source3/auth/auth_util.c
source3/libsmb/ntlmssp.c

index de552cf57efebc891a9040bf52cf785ff3051ee0..46b7af4d87c9f7a82471659e09992222e4131feb 100644 (file)
@@ -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 {
index 7fffe7cea30e3e3f9541e1666eb66e5a0db502a4..1d20ee5026dd6d4b3f7410749f4dcff75779d76c 100644 (file)
@@ -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);