netlogond3: only call make_auth_context_subsystem() in one place
authorStefan Metzmacher <metze@samba.org>
Thu, 16 Mar 2017 14:54:18 +0000 (15:54 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 24 Mar 2017 10:57:08 +0000 (11:57 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=2976

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/rpc_server/netlogon/srv_netlog_nt.c

index 09feb130a8756360708978582272fa9a429e9217..088ffe12d4edbeb5d6ebe02ada9dbd2cc29ea1d0 100644 (file)
@@ -1580,6 +1580,12 @@ static NTSTATUS _netr_LogonSamLogon_base(struct pipes_struct *p,
                                              r->in.logon_level,
                                              logon);
 
+       status = make_auth_context_subsystem(talloc_tos(),
+                                            &auth_context);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
        switch (r->in.logon_level) {
        case NetlogonNetworkInformation:
        case NetlogonNetworkTransitiveInformation:
@@ -1588,12 +1594,6 @@ static NTSTATUS _netr_LogonSamLogon_base(struct pipes_struct *p,
                const char *workgroup = lp_workgroup();
                bool ok;
 
-               status = make_auth_context_subsystem(talloc_tos(),
-                                                    &auth_context);
-               if (!NT_STATUS_IS_OK(status)) {
-                       return status;
-               }
-
                ok = auth3_context_set_challenge(
                        auth_context, logon->network->challenge, "fixed");
                if (!ok) {
@@ -1658,11 +1658,6 @@ static NTSTATUS _netr_LogonSamLogon_base(struct pipes_struct *p,
                DEBUG(100,("decrypt of nt owf password:"));
                dump_data(100, logon->password->ntpassword.hash, 16);
 #endif
-               status = make_auth_context_subsystem(talloc_tos(),
-                                                    &auth_context);
-               if (!NT_STATUS_IS_OK(status)) {
-                       return status;
-               }
 
                auth_get_ntlm_challenge(auth_context, chal);