Author: jerry
Date: 2005-08-26 16:06:17 +0000 (Fri, 26 Aug 2005)
New Revision: 9653

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9653

Log:
adding common popt args to profiles tool (needed for debuglevel to regfio lib)
Modified:
   branches/SAMBA_3_0/source/Makefile.in
   branches/SAMBA_3_0/source/utils/profiles.c


Changeset:
Modified: branches/SAMBA_3_0/source/Makefile.in
===================================================================
--- branches/SAMBA_3_0/source/Makefile.in       2005-08-26 14:26:53 UTC (rev 
9652)
+++ branches/SAMBA_3_0/source/Makefile.in       2005-08-26 16:06:17 UTC (rev 
9653)
@@ -332,7 +332,8 @@
 PROFILES_OBJ = utils/profiles.o \
                $(REGFIO_OBJ) $(REGOBJS_OBJ) $(ERRORMAP_OBJ) \
               $(RPC_PARSE_OBJ1) $(PARAM_OBJ) $(LIBSAMBA_OBJ) \
-               $(DOSERR_OBJ) $(LIB_OBJ) $(LIB_DUMMY_OBJ)
+               $(DOSERR_OBJ) $(LIB_OBJ) $(LIB_DUMMY_OBJ) \
+               $(POPT_LIB_OBJ) $(SECRETS_OBJ)
 
 OPLOCK_OBJ = smbd/oplock.o smbd/oplock_irix.o smbd/oplock_linux.o
 

Modified: branches/SAMBA_3_0/source/utils/profiles.c
===================================================================
--- branches/SAMBA_3_0/source/utils/profiles.c  2005-08-26 14:26:53 UTC (rev 
9652)
+++ branches/SAMBA_3_0/source/utils/profiles.c  2005-08-26 16:06:17 UTC (rev 
9653)
@@ -25,7 +25,6 @@
 
 /* GLOBAL VARIABLES */
 
-int verbose = 0;
 DOM_SID old_sid, new_sid;
 int change = 0, new_val = 0;
 
@@ -33,21 +32,30 @@
 /********************************************************************
 ********************************************************************/
 
-static void swap_sid_in_acl( SEC_DESC *sd, DOM_SID *s1, DOM_SID *s2 )
+static BOOL swap_sid_in_acl( SEC_DESC *sd, DOM_SID *s1, DOM_SID *s2 )
 {
        SEC_ACL *acl = sd->dacl;
        int i;
+       BOOL update = False;
 
-       if ( sid_equal( sd->owner_sid, s1 ) )
+       if ( sid_equal( sd->owner_sid, s1 ) ) {
                sid_copy( sd->owner_sid, s2 );
+               update = True;
+       }
 
-       if ( sid_equal( sd->grp_sid, s1 ) )
+       if ( sid_equal( sd->grp_sid, s1 ) ) {
                sid_copy( sd->grp_sid, s2 );
+               update = True;
+       }
 
        for ( i=0; i<acl->num_aces; i++ ) {
-               if ( sid_equal( &acl->ace[i].trustee, s1 ) )
+               if ( sid_equal( &acl->ace[i].trustee, s1 ) ) {
                        sid_copy( &acl->ace[i].trustee, s2 );
+                       update = True;
+               }
        }
+
+       return update;
 }
 
 /********************************************************************
@@ -71,7 +79,8 @@
                return False;
        }
 
-       swap_sid_in_acl( new_sd, &old_sid, &new_sid );
+       if ( swap_sid_in_acl( new_sd, &old_sid, &new_sid ) )
+               DEBUG(1,("Updating ACL for %s\n", nk->keyname ));
 
        regsubkey_ctr_init( &subkeys );
        regval_ctr_init( &values );
@@ -104,8 +113,7 @@
        regval_ctr_destroy( &values );
        regsubkey_ctr_destroy( &subkeys );
 
-       if ( verbose )
-               printf("[%s]\n", path );
+       DEBUG(2,("[%s]\n", path));
 
        return True;
 }
@@ -121,14 +129,19 @@
        pstring orig_filename, new_filename;
        struct poptOption long_options[] = {
                POPT_AUTOHELP
-               { "verbose", 'v', POPT_ARG_NONE, NULL, 'v', "Sets verbose mode" 
},
                { "change-sid", 'c', POPT_ARG_STRING, NULL, 'c', "Provides SID 
to change" },
                { "new-sid", 'n', POPT_ARG_STRING, NULL, 'n', "Provides SID to 
change to" },
-               { 0, 0, 0, 0 }
+               POPT_COMMON_SAMBA
+               POPT_COMMON_VERSION
+               POPT_TABLEEND
        };
+       poptContext pc;
 
+       /* setup logging options */
 
-       poptContext pc;
+       setup_logging( "profiles", True );
+       dbf = x_stderr;
+       x_setbuf( x_stderr, NULL );
 
        pc = poptGetContext("profiles", argc, (const char **)argv, 
long_options, 
                POPT_CONTEXT_KEEP_FIRST);
@@ -157,13 +170,10 @@
                        }
                        break;
 
-               case 'v':
-                       verbose++;
-                       break;
                }
        }
 
-       poptGetArg(pc); /* To get argv[0] */
+       poptGetArg(pc); 
 
        if (!poptPeekArg(pc)) {
                poptPrintUsage(pc, stderr, 0);

Reply via email to