]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:kdc: Flip sense of condition
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Fri, 16 Jun 2023 02:32:09 +0000 (14:32 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 25 Jun 2023 23:29:33 +0000 (23:29 +0000)
A negative condition incurs more cognitive load.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/kdc/pac-glue.c

index 7000e3a53e47fcee883e417627190f3300713565..10d63848857314bb580b2bf69f5639d2f61cce58 100644 (file)
@@ -2493,7 +2493,26 @@ krb5_error_code samba_kdc_update_pac(TALLOC_CTX *mem_ctx,
                goto done;
        }
 
-       if (!client_pac_is_trusted) {
+       if (client_pac_is_trusted) {
+               pac_blob = talloc_zero(mem_ctx, DATA_BLOB);
+               if (pac_blob == NULL) {
+                       code = ENOMEM;
+                       goto done;
+               }
+
+               nt_status = samba_get_logon_info_pac_blob(mem_ctx,
+                                                         user_info_dc,
+                                                         _resource_groups,
+                                                         group_inclusion,
+                                                         pac_blob);
+               if (!NT_STATUS_IS_OK(nt_status)) {
+                       DBG_ERR("samba_get_logon_info_pac_blob failed: %s\n",
+                               nt_errstr(nt_status));
+
+                       code = EINVAL;
+                       goto done;
+               }
+       } else {
                nt_status = samba_kdc_get_logon_info_blob(mem_ctx,
                                                       user_info_dc,
                                                       group_inclusion,
@@ -2535,25 +2554,6 @@ krb5_error_code samba_kdc_update_pac(TALLOC_CTX *mem_ctx,
                        code = EINVAL;
                        goto done;
                }
-       } else {
-               pac_blob = talloc_zero(mem_ctx, DATA_BLOB);
-               if (pac_blob == NULL) {
-                       code = ENOMEM;
-                       goto done;
-               }
-
-               nt_status = samba_get_logon_info_pac_blob(mem_ctx,
-                                                         user_info_dc,
-                                                         _resource_groups,
-                                                         group_inclusion,
-                                                         pac_blob);
-               if (!NT_STATUS_IS_OK(nt_status)) {
-                       DBG_ERR("samba_get_logon_info_pac_blob failed: %s\n",
-                               nt_errstr(nt_status));
-
-                       code = EINVAL;
-                       goto done;
-               }
        }
 
        /* Check the types of the given PAC */