Another patch from jelmer:
authorAndrew Bartlett <abartlet@samba.org>
Mon, 15 Apr 2002 08:50:36 +0000 (08:50 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 15 Apr 2002 08:50:36 +0000 (08:50 +0000)
Doco for pdbedit and (ugly, but the best we could come up with) fix
for compiling pdbedit on some non-gcc compilers.

Andrew Bartlett
(This used to be commit 80adf1dbb56cf8bdbfbcc2c8c7b670c0a23c97f8)

docs/docbook/manpages/pdbedit.8.sgml
source3/utils/pdbedit.c

index eeb1fb0d2c68051c04c70c16f663178cc49b348b..3f6023d16fa85234fee25f92397446d816ae72dc 100644 (file)
@@ -27,7 +27,9 @@
                <arg choice="opt">-a</arg>      
                <arg choice="opt">-m</arg>      
                <arg choice="opt">-x</arg>      
-               <arg choice="opt">-i file</arg> 
+               <arg choice="opt">-i passdb-backend</arg>       
+               <arg choice="opt">-e passdb-backend</arg>   
+               <arg choice="opt">-D debuglevel</arg>
        </cmdsynopsis>
 </refsynopsisdiv>
 
                
 
                <varlistentry>
-               <term>-i file</term>
-               <listitem><para>This command is used to import a smbpasswd
-               file into the database.</para>
+               <term>-i passdb-backend</term>
+               <listitem><para>Use a different passdb backend to retrieve users than the one specified in smb.conf.</para>
 
-               <para>This option will ease migration from the plain smbpasswd
-               file database to more powerful backend databases like tdb and
-               ldap.</para>
+               <para>This option will ease migration from one passdb backend to another.
+               </para>
 
-               <para>Example: <command>pdbedit -i /etc/smbpasswd.old</command>
+               <para>Example: <command>pdbedit -i smbpasswd:/etc/smbpasswd.old -e tdbsam:/etc/samba/passwd.tdb</command>
                </para>
                </listitem>
                </varlistentry>
+
+               <varlistentry>
+               <term>-e passdb-backend</term>
+               <listitem><para>Export all currently available users to the specified password database backend.</para>
+
+               <para>This option will ease migration from one passdb backend to another and will ease backupping</para>
+               
+               <para>Example: <command>pdbedit -e smbpasswd:/root/samba-users.backup</command></para>
+               </listitem>
+               </varlistentry>
        </variablelist>
 </refsect1>
 
index c63ed295299527f5c549d80b3f07aef11d91f8bd..2cbc9eb71dfbc64ccf5b9874aa40c30cac50fb1e 100644 (file)
@@ -394,24 +394,25 @@ static int delete_machine_entry (struct pdb_context *in, char *machinename)
 
 int main (int argc, char **argv)
 {
-       struct pdb_context *in;
-       BOOL list_users = False;
-       BOOL verbose = False;
-       BOOL spstyle = False;
-       BOOL setparms = False;
-       BOOL machine = False;
-       BOOL add_user = False;
-       BOOL delete_user = False;
-       BOOL import = False;
+       static BOOL list_users = False;
+       static BOOL verbose = False;
+       static BOOL spstyle = False;
+       static BOOL setparms = False;
+       static BOOL machine = False;
+       static BOOL add_user = False;
+       static BOOL delete_user = False;
+       static BOOL import = False;
        int opt;
-       char *full_name = NULL;
-       char *user_name = NULL;
-       char *home_dir = NULL;
-       char *home_drive = NULL;
-       char *backend_in = NULL;
-       char *backend_out = NULL;
-       char *logon_script = NULL;
-       char *profile_path = NULL;
+       static char *full_name = NULL;
+       static char *user_name = NULL;
+       static char *home_dir = NULL;
+       static char *home_drive = NULL;
+       static char *backend_in = NULL;
+       static char *backend_out = NULL;
+       static char *logon_script = NULL;
+       static char *profile_path = NULL;
+
+       struct pdb_context *in;
        poptContext pc;
        struct poptOption long_options[] = {
                POPT_AUTOHELP
@@ -432,14 +433,14 @@ int main (int argc, char **argv)
                {"debuglevel",'D',POPT_ARG_INT,&DEBUGLEVEL,0,"set debuglevel",NULL},
                {0,0,0,0}
        };
-       
+
        DEBUGLEVEL = 1;
        setup_logging("pdbedit", True);
        AllowDebugChange = False;
-       
+
        if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
                fprintf(stderr, "Can't load %s - run testparm to debug it\n", 
-                       dyn_CONFIGFILE);
+                               dyn_CONFIGFILE);
                exit(1);
        }
 
@@ -456,7 +457,7 @@ int main (int argc, char **argv)
                fprintf (stderr, "Incompatible options on command line!\n");
                exit(1);
        }
-       
+
 
        if(!NT_STATUS_IS_OK(make_pdb_context_name(&in, backend_in))){
                fprintf(stderr, "Can't initialize %s.\n", backend_in);
@@ -471,7 +472,9 @@ int main (int argc, char **argv)
                if (machine)
                        return new_machine (in, user_name);
                else
-                       return new_user (in, user_name, full_name, home_dir, home_drive, logon_script, profile_path);
+                       return new_user (in, user_name, full_name, home_dir, 
+                                        home_drive, logon_script, 
+                                        profile_path);
        }
 
        if (delete_user) {
@@ -484,16 +487,17 @@ int main (int argc, char **argv)
                else
                        return delete_user_entry (in, user_name);
        }
-       
+
        if (user_name) {
                if (setparms)
-                       return set_user_info (in,       user_name, full_name,
-                                               home_dir,
-                                               home_drive,
-                                               logon_script,
-                                               profile_path);
+                       return set_user_info (in, user_name, full_name,
+                                             home_dir,
+                                             home_drive,
+                                             logon_script,
+                                             profile_path);
                else
-                       return print_user_info (in, user_name, verbose, spstyle);
+                       return print_user_info (in, user_name, verbose, 
+                                               spstyle);
        }
 
        if (list_users) 
@@ -501,8 +505,10 @@ int main (int argc, char **argv)
 
        if (backend_out)
                return export_database(in, backend_out);
-       
+
        poptPrintHelp(pc, stderr, 0);
-       
+
        return 1;
 }
+
+