summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorJoseph Sutton <josephsutton@catalyst.net.nz>2023-03-17 08:02:24 +1300
committerAndrew Bartlett <abartlet@samba.org>2023-03-20 00:22:32 +0000
commit2e8e93fdd196f885b1811457e3a6d2d9c5c63f05 (patch)
treeb31c4d5f28de42516150ac956a1fa98a3ef38ecd /librpc
parentfa901e7346d36ae64a7ceab5dcf76bc210a67c93 (diff)
downloadsamba-2e8e93fdd196f885b1811457e3a6d2d9c5c63f05.tar.gz
s4:kdc: Refactor PAC handling
It's getting unwieldy adding new PAC buffer types when each one has to have its own handling. It also makes the possibility of mistakes more likely. Add a new container, 'struct pac_blobs', containing the types of PAC buffers in a given PAC, with an index for quick access to the types we support specifically. We can add new blobs (overriding existing ones) by calling pac_blobs_add_blob(), and override certain blobs that must be present with pac_blobs_replace_existing(). This removes the need to have a complicated 'switch' statement with different logic for each PAC buffer type, or a dozen index variables. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'librpc')
-rw-r--r--librpc/idl/krb5pac.idl8
1 files changed, 8 insertions, 0 deletions
diff --git a/librpc/idl/krb5pac.idl b/librpc/idl/krb5pac.idl
index 57c37656eb6..6655e2ff5b7 100644
--- a/librpc/idl/krb5pac.idl
+++ b/librpc/idl/krb5pac.idl
@@ -168,8 +168,16 @@ interface krb5pac
PAC_TYPE_ATTRIBUTES_INFO = 17,
PAC_TYPE_REQUESTER_SID = 18,
PAC_TYPE_FULL_CHECKSUM = 19
+ /*
+ * Note! when adding new types, adjust the value of PAC_TYPE_END
+ * to equal one more than the highest supported type.
+ */
} PAC_TYPE;
+ const uint32 PAC_TYPE_BEGIN = 1;
+ const uint32 PAC_TYPE_END = 20;
+ const uint32 PAC_TYPE_COUNT = PAC_TYPE_END - PAC_TYPE_BEGIN;
+
typedef struct {
[flag(NDR_REMAINING)] DATA_BLOB remaining;
} DATA_BLOB_REM;