]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:kdc: Make pac_blobs_remove_blob() never fail
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 5 Sep 2023 00:55:04 +0000 (12:55 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Sep 2023 21:35:29 +0000 (21:35 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/kdc/pac-blobs.c
source4/kdc/pac-blobs.h
source4/kdc/pac-glue.c

index 627a527c7855c1abcd2ce6edb12e7c400b7173c5..9cf79e7dc2a2aebe4d20c9dac9ae4071b5ad96ee 100644 (file)
@@ -200,8 +200,8 @@ krb5_error_code pac_blobs_add_blob(struct pac_blobs *pac_blobs,
        return 0;
 }
 
-krb5_error_code pac_blobs_remove_blob(struct pac_blobs *pac_blobs,
-                                     const uint32_t type)
+void pac_blobs_remove_blob(struct pac_blobs *pac_blobs,
+                          const uint32_t type)
 {
        struct type_data *type_blobs = NULL;
        size_t found_index;
@@ -211,7 +211,7 @@ krb5_error_code pac_blobs_remove_blob(struct pac_blobs *pac_blobs,
        found_index = *pac_blobs_get_index(pac_blobs, type);
        if (found_index == SIZE_MAX) {
                /* We don't have a PAC buffer of this type, so we're done. */
-               return 0;
+               return;
        }
 
        /* Since the PAC buffer is present, there will be at least one type in the array. */
@@ -247,12 +247,7 @@ krb5_error_code pac_blobs_remove_blob(struct pac_blobs *pac_blobs,
                                    pac_blobs->type_blobs,
                                    struct type_data,
                                    --pac_blobs->num_types);
-       if (type_blobs == NULL) {
-               DBG_ERR("Out of memory\n");
-               return ENOMEM;
+       if (type_blobs != NULL) {
+               pac_blobs->type_blobs = type_blobs;
        }
-
-       pac_blobs->type_blobs = type_blobs;
-
-       return 0;
 }
index ca3dcf9280df86b17faf2e088001e1ff8a1b3903..0c5f034df6e566355e90fb026a83513688abcb91 100644 (file)
@@ -79,5 +79,5 @@ krb5_error_code pac_blobs_add_blob(struct pac_blobs *pac_blobs,
                                   const uint32_t type,
                                   const DATA_BLOB *blob);
 
-krb5_error_code pac_blobs_remove_blob(struct pac_blobs *pac_blobs,
-                                     const uint32_t type);
+void pac_blobs_remove_blob(struct pac_blobs *pac_blobs,
+                          const uint32_t type);
index 3aafcd5aafed625654dae523af9090b779bfa5ba..978d1ad90a4f5b2a7e4a3db558d1da40d71e204f 100644 (file)
@@ -2721,19 +2721,13 @@ krb5_error_code samba_kdc_update_pac(TALLOC_CTX *mem_ctx,
        }
 
        if (!client_pac_is_trusted || !is_tgs) {
-               code = pac_blobs_remove_blob(pac_blobs,
-                                            PAC_TYPE_ATTRIBUTES_INFO);
-               if (code != 0) {
-                       goto done;
-               }
+               pac_blobs_remove_blob(pac_blobs,
+                                     PAC_TYPE_ATTRIBUTES_INFO);
        }
 
        if (!is_tgs) {
-               code = pac_blobs_remove_blob(pac_blobs,
-                                            PAC_TYPE_REQUESTER_SID);
-               if (code != 0) {
-                       goto done;
-               }
+               pac_blobs_remove_blob(pac_blobs,
+                                     PAC_TYPE_REQUESTER_SID);
        } else {
                code = pac_blobs_add_blob(pac_blobs,
                                          PAC_TYPE_REQUESTER_SID,