Changeset 740 for vendor/current/libcli/security/secace.c
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/libcli/security/secace.c
r414 r740 23 23 #include "includes.h" 24 24 #include "librpc/gen_ndr/ndr_security.h" 25 #include "libcli/security/dom_sid.h" 25 #include "libcli/security/security.h" 26 #include "lib/util/tsort.h" 26 27 27 28 #define SEC_ACE_HEADER_SIZE (2 * sizeof(uint8_t) + sizeof(uint16_t) + sizeof(uint32_t)) … … 44 45 * copy a struct security_ace structure. 45 46 */ 46 void sec_ace_copy(struct security_ace *ace_dest, struct security_ace *ace_src)47 void sec_ace_copy(struct security_ace *ace_dest, const struct security_ace *ace_src) 47 48 { 48 49 ace_dest->type = ace_src->type; … … 63 64 t->type = type; 64 65 t->flags = flag; 65 t->size = ndr_size_dom_sid(sid, NULL,0) + 8;66 t->size = ndr_size_dom_sid(sid, 0) + 8; 66 67 t->access_mask = mask; 67 68 … … 73 74 ********************************************************************/ 74 75 75 NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, struct security_ace **pp_new, struct security_ace *old, unsigned *num, struct dom_sid *sid, uint32_t mask)76 NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, struct security_ace **pp_new, struct security_ace *old, unsigned *num, const struct dom_sid *sid, uint32_t mask) 76 77 { 77 78 unsigned int i = 0; … … 89 90 (*pp_new)[i].type = SEC_ACE_TYPE_ACCESS_ALLOWED; 90 91 (*pp_new)[i].flags = 0; 91 (*pp_new)[i].size = SEC_ACE_HEADER_SIZE + ndr_size_dom_sid(sid, NULL,0);92 (*pp_new)[i].size = SEC_ACE_HEADER_SIZE + ndr_size_dom_sid(sid, 0); 92 93 (*pp_new)[i].access_mask = mask; 93 94 (*pp_new)[i].trustee = *sid; … … 99 100 ********************************************************************/ 100 101 101 NTSTATUS sec_ace_mod_sid(struct security_ace *ace, size_t num, struct dom_sid *sid, uint32_t mask)102 NTSTATUS sec_ace_mod_sid(struct security_ace *ace, size_t num, const struct dom_sid *sid, uint32_t mask) 102 103 { 103 104 unsigned int i = 0; … … 118 119 ********************************************************************/ 119 120 120 NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, struct security_ace **pp_new, struct security_ace *old, uint32_t *num, struct dom_sid *sid)121 NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, struct security_ace **pp_new, struct security_ace *old, uint32_t *num, const struct dom_sid *sid) 121 122 { 122 123 unsigned int i = 0; … … 150 151 ********************************************************************/ 151 152 152 bool sec_ace_equal( struct security_ace *s1,struct security_ace *s2)153 bool sec_ace_equal(const struct security_ace *s1, const struct security_ace *s2) 153 154 { 154 155 /* Trivial case */ … … 178 179 } 179 180 180 int nt_ace_inherit_comp( struct security_ace *a1,struct security_ace *a2)181 int nt_ace_inherit_comp(const struct security_ace *a1, const struct security_ace *a2) 181 182 { 182 183 int a1_inh = a1->flags & SEC_ACE_FLAG_INHERITED_ACE; … … 195 196 *******************************************************************/ 196 197 197 int nt_ace_canon_comp( struct security_ace *a1,struct security_ace *a2)198 int nt_ace_canon_comp( const struct security_ace *a1, const struct security_ace *a2) 198 199 { 199 200 if ((a1->type == SEC_ACE_TYPE_ACCESS_DENIED) && … … 258 259 259 260 /* Sort so that non-inherited ACE's come first. */ 260 qsort( srclist, num_aces, sizeof(srclist[0]), QSORT_CASTnt_ace_inherit_comp);261 TYPESAFE_QSORT(srclist, num_aces, nt_ace_inherit_comp); 261 262 262 263 /* Find the boundary between non-inherited ACEs. */ … … 271 272 272 273 /* Sort the non-inherited ACEs. */ 273 if (i) 274 qsort( srclist, i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp); 274 TYPESAFE_QSORT(srclist, i, nt_ace_canon_comp); 275 275 276 276 /* Now sort the inherited ACEs. */ 277 if (num_aces - i) 278 qsort( &srclist[i], num_aces - i, sizeof(srclist[0]), QSORT_CAST nt_ace_canon_comp); 279 } 280 281 277 TYPESAFE_QSORT(&srclist[i], num_aces - i, nt_ace_canon_comp); 278 } 279 280
Note:
See TracChangeset
for help on using the changeset viewer.