]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gensec: Declare vars closer to their use
authorVolker Lendecke <vl@samba.org>
Mon, 6 Jul 2026 11:59:26 +0000 (13:59 +0200)
committerAnoop C S <anoopcs@samba.org>
Mon, 3 Aug 2026 09:05:30 +0000 (09:05 +0000)
We don't need "workstation" and "domain" in the client case.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
auth/gensec/schannel.c

index 10157fffba5bdb3b5b113b654582f737a4b66024..4b046b8b7ba10416eff0552c79d8ddede93019ca 100644 (file)
@@ -824,13 +824,7 @@ static NTSTATUS schannel_update_internal(struct gensec_security *gensec_security
                struct schannel_state);
        NTSTATUS status;
        enum ndr_err_code ndr_err;
-       struct NL_AUTH_MESSAGE bind_schannel = {
-               .Flags = 0,
-       };
-       struct NL_AUTH_MESSAGE bind_schannel_ack;
        struct netlogon_creds_CredentialState *creds;
-       const char *workstation;
-       const char *domain;
 
        *out = data_blob(NULL, 0);
 
@@ -845,7 +839,9 @@ static NTSTATUS schannel_update_internal(struct gensec_security *gensec_security
        }
 
        switch (gensec_security->gensec_role) {
-       case GENSEC_CLIENT:
+       case GENSEC_CLIENT: {
+               struct NL_AUTH_MESSAGE bind_schannel = {};
+
                if (state != NULL) {
                        /* we could parse the bind ack, but we don't know what it is yet */
                        return NT_STATUS_OK;
@@ -897,7 +893,12 @@ static NTSTATUS schannel_update_internal(struct gensec_security *gensec_security
                }
 
                return NT_STATUS_MORE_PROCESSING_REQUIRED;
-       case GENSEC_SERVER:
+       }
+       case GENSEC_SERVER: {
+               struct NL_AUTH_MESSAGE bind_schannel = {};
+               struct NL_AUTH_MESSAGE bind_schannel_ack = {};
+               const char *workstation = NULL;
+               const char *domain = NULL;
 
                if (state != NULL) {
                        /* no third leg on this protocol */
@@ -985,6 +986,7 @@ static NTSTATUS schannel_update_internal(struct gensec_security *gensec_security
 
                return NT_STATUS_OK;
        }
+       }
        return NT_STATUS_INVALID_PARAMETER;
 }