X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=include%2Fwimlib%2Fsecurity.h;h=002aef4cc36d16f7b829882bc21fa8da51db99d1;hb=2fc33f535a398ea85964c0e483c5692821d775f3;hp=7fa122ee8f8b82c1cba0e7029a42484c414470f6;hpb=e8c3ca2d1d0cac3d64985b45a9f654d2029a7518;p=wimlib diff --git a/include/wimlib/security.h b/include/wimlib/security.h index 7fa122ee..002aef4c 100644 --- a/include/wimlib/security.h +++ b/include/wimlib/security.h @@ -1,15 +1,17 @@ #ifndef _WIMLIB_SECURITY_H #define _WIMLIB_SECURITY_H -#include "wimlib/rbtree.h" #include "wimlib/types.h" -/* Red-black tree that maps SHA1 message digests of security descriptors to - * security IDs, which are themselves indices into the table of security - * descriptors in the 'struct wim_security_data'. */ +struct wim_security_data; +struct avl_tree_node; + +/* Map from SHA1 message digests of security descriptors to security IDs, which + * are themselves indices into the table of security descriptors in the 'struct + * wim_security_data'. */ struct wim_sd_set { struct wim_security_data *sd; - struct rb_root rb_root; + struct avl_tree_node *root; int32_t orig_num_entries; }; @@ -18,29 +20,28 @@ struct wim_security_data { /* The total length of the security data, in bytes. If there are no * security descriptors, this field, when read from the on-disk metadata * resource, may be either 8 (which is correct) or 0 (which is - * interpreted as 0). */ + * interpreted as 8). */ u32 total_length; - /* The number of security descriptors in the array @descriptors, below. - * It is really an unsigned int on-disk, but it must fit into an int - * because the security ID's are signed. (Not like you would ever have - * more than a few hundred security descriptors anyway.) */ - int32_t num_entries; + /* The number of security descriptors in the array @descriptors. */ + u32 num_entries; - /* Array of sizes of the descriptors in the array @descriptors. */ + /* Array of sizes of the descriptors, in bytes, in the array + * @descriptors. */ u64 *sizes; - /* Array of descriptors. */ + /* Array of pointers to the security descriptors in the + * SECURITY_DESCRIPTOR_RELATIVE format. */ u8 **descriptors; }; extern void -destroy_sd_set(struct wim_sd_set *sd_set, bool rollback); +rollback_new_security_descriptors(struct wim_sd_set *sd_set); -extern int -lookup_sd(struct wim_sd_set *set, const u8 hash[]); +extern void +destroy_sd_set(struct wim_sd_set *sd_set); -extern int +extern int32_t sd_set_add_sd(struct wim_sd_set *sd_set, const char descriptor[], size_t size); @@ -51,15 +52,17 @@ extern struct wim_security_data * new_wim_security_data(void); extern int -read_security_data(const u8 metadata_resource[], - u64 metadata_resource_len, struct wim_security_data **sd_p); -extern void -print_security_data(const struct wim_security_data *sd); +read_wim_security_data(const u8 *buf, size_t buf_len, + struct wim_security_data **sd_ret); extern u8 * -write_security_data(const struct wim_security_data *sd, u8 *p); +write_wim_security_data(const struct wim_security_data * restrict sd, + u8 * restrict p); + +extern void +print_wim_security_data(const struct wim_security_data *sd); extern void -free_security_data(struct wim_security_data *sd); +free_wim_security_data(struct wim_security_data *sd); #endif /* _WIMLIB_SECURITY_H */