More changes to editreg to make it less tetchy.
authorRichard Sharpe <sharpe@samba.org>
Mon, 2 Jun 2003 06:12:54 +0000 (06:12 +0000)
committerRichard Sharpe <sharpe@samba.org>
Mon, 2 Jun 2003 06:12:54 +0000 (06:12 +0000)
(This used to be commit 30e1431e937325da414493bf0a6d4281b9c1501f)

source3/utils/editreg.c

index 27e3f7398c420e853dffe03115c43e848f802e20..54148fdcf8ec06650ad1cf8b5c2a1adff32bd5c3 100644 (file)
@@ -412,16 +412,16 @@ typedef struct val_list_s {
 #define MAXSUBAUTHS 15
 #endif
 
 #define MAXSUBAUTHS 15
 #endif
 
-typedef struct dom_sid_s {
+typedef struct sid_s {
   unsigned char ver, auths;
   unsigned char auth[6];
   unsigned int sub_auths[MAXSUBAUTHS];
   unsigned char ver, auths;
   unsigned char auth[6];
   unsigned int sub_auths[MAXSUBAUTHS];
-} DOM_SID;
+} sid_t;
 
 typedef struct ace_struct_s {
   unsigned char type, flags;
   unsigned int perms;   /* Perhaps a better def is in order */
 
 typedef struct ace_struct_s {
   unsigned char type, flags;
   unsigned int perms;   /* Perhaps a better def is in order */
-  DOM_SID *trustee;
+  sid_t *trustee;
 } ACE; 
 
 typedef struct acl_struct_s {
 } ACE; 
 
 typedef struct acl_struct_s {
@@ -432,7 +432,7 @@ typedef struct acl_struct_s {
 
 typedef struct sec_desc_s {
   unsigned int rev, type;
 
 typedef struct sec_desc_s {
   unsigned int rev, type;
-  DOM_SID *owner, *group;
+  sid_t *owner, *group;
   ACL *sacl, *dacl;
 } SEC_DESC;
 
   ACL *sacl, *dacl;
 } SEC_DESC;
 
@@ -537,7 +537,7 @@ typedef struct ace_struct {
     unsigned char flags;
     unsigned short length;
     unsigned int perms;
     unsigned char flags;
     unsigned short length;
     unsigned int perms;
-    DOM_SID trustee;
+    sid_t trustee;
 } REG_ACE;
 
 typedef struct acl_struct {
 } REG_ACE;
 
 typedef struct acl_struct {
@@ -904,7 +904,7 @@ int nt_delete_key_by_name(REGF *regf, char *name)
 }
 
 static
 }
 
 static
-int nt_delete_sid(DOM_SID *sid)
+int nt_delete_sid(sid_t *sid)
 {
 
   if (sid) free(sid);
 {
 
   if (sid) free(sid);
@@ -1173,15 +1173,15 @@ VAL_KEY *nt_delete_reg_value(REG_KEY *key, char *name)
  * Convert a string of the form S-1-5-x[-y-z-r] to a SID
  */
 static
  * Convert a string of the form S-1-5-x[-y-z-r] to a SID
  */
 static
-int sid_string_to_sid(DOM_SID **sid, const char *sid_str)
+int sid_string_to_sid(sid_t **sid, const char *sid_str)
 {
   int i = 0, auth;
   const char *lstr; 
 
 {
   int i = 0, auth;
   const char *lstr; 
 
-  *sid = (DOM_SID *)malloc(sizeof(DOM_SID));
+  *sid = (sid_t *)malloc(sizeof(sid_t));
   if (!*sid) return 0;
 
   if (!*sid) return 0;
 
-  bzero(*sid, sizeof(DOM_SID));
+  bzero(*sid, sizeof(sid_t));
 
   if (strncmp(sid_str, "S-1-5", 5)) {
     fprintf(stderr, "Does not conform to S-1-5...: %s\n", sid_str);
 
   if (strncmp(sid_str, "S-1-5", 5)) {
     fprintf(stderr, "Does not conform to S-1-5...: %s\n", sid_str);
@@ -1829,9 +1829,9 @@ KEY_SEC_DESC *lookup_create_sec_key(REGF *regf, SK_MAP *sk_map, int sk_off)
  * We could allocate the SID to be only the size needed, but I am too lazy. 
  */
 static
  * We could allocate the SID to be only the size needed, but I am too lazy. 
  */
 static
-DOM_SID *dup_sid(DOM_SID *sid)
+sid_t *dup_sid(sid_t *sid)
 {
 {
-  DOM_SID *tmp = (DOM_SID *)malloc(sizeof(DOM_SID));
+  sid_t *tmp = (sid_t *)malloc(sizeof(sid_t));
   int i;
   
   if (!tmp) return NULL;
   int i;
   
   if (!tmp) return NULL;
@@ -1916,12 +1916,12 @@ SEC_DESC *process_sec_desc(REGF *regf, REG_SEC_DESC *sec_desc)
                       IVAL(&sec_desc->group_off));
   if (verbose) fprintf(stdout, "SEC_DESC DACL Off: %0X\n",
                       IVAL(&sec_desc->dacl_off));
                       IVAL(&sec_desc->group_off));
   if (verbose) fprintf(stdout, "SEC_DESC DACL Off: %0X\n",
                       IVAL(&sec_desc->dacl_off));
-  tmp->owner = dup_sid((DOM_SID *)((char *)sec_desc + IVAL(&sec_desc->owner_off)));
+  tmp->owner = dup_sid((sid_t *)((char *)sec_desc + IVAL(&sec_desc->owner_off)));
   if (!tmp->owner) {
     free(tmp);
     return NULL;
   }
   if (!tmp->owner) {
     free(tmp);
     return NULL;
   }
-  tmp->group = dup_sid((DOM_SID *)((char *)sec_desc + IVAL(&sec_desc->group_off)));
+  tmp->group = dup_sid((sid_t *)((char *)sec_desc + IVAL(&sec_desc->group_off)));
   if (!tmp->group) {
     free(tmp);
     return NULL;
   if (!tmp->group) {
     free(tmp);
     return NULL;
@@ -2618,7 +2618,7 @@ void *nt_alloc_regf_space(REGF *regf, int size, unsigned int *off)
  * Compute the size of a SID stored ...
  */
 static
  * Compute the size of a SID stored ...
  */
 static
-unsigned int sid_size(DOM_SID *sid)
+unsigned int sid_size(sid_t *sid)
 {
   unsigned int size;
 
 {
   unsigned int size;
 
@@ -2686,7 +2686,7 @@ unsigned int sec_desc_size(SEC_DESC *sd)
  * Store a SID at the location provided
  */
 static
  * Store a SID at the location provided
  */
 static
-int nt_store_SID(REGF *regf, DOM_SID *sid, unsigned char *locn)
+int nt_store_SID(REGF *regf, sid_t *sid, unsigned char *locn)
 {
   int i;
   unsigned char *p = locn;
 {
   int i;
   unsigned char *p = locn;
@@ -3864,7 +3864,7 @@ void print_perms(int perms)
 }
 
 static
 }
 
 static
-void print_sid(DOM_SID *sid)
+void print_sid(sid_t *sid)
 {
   int i, comps = sid->auths;
   fprintf(stdout, "S-%u-%u", sid->ver, sid->auth[5]);
 {
   int i, comps = sid->auths;
   fprintf(stdout, "S-%u-%u", sid->ver, sid->auth[5]);
@@ -3955,7 +3955,7 @@ int main(int argc, char *argv[])
   char *cmd_file_name = NULL;
   char *out_file_name = NULL;
   CMD_FILE *cmd_file = NULL;
   char *cmd_file_name = NULL;
   char *out_file_name = NULL;
   CMD_FILE *cmd_file = NULL;
-  DOM_SID *lsid;
+  sid_t *lsid;
 
   if (argc < 2) {
     usage();
 
   if (argc < 2) {
     usage();