[PATCH] pdb_unix

Jelmer Vernooij jelmer at nl.linux.org
Sun Apr 14 14:45:02 GMT 2002


Hi!

Here's an update of my previous pdb_unix patch. It makes the option
variables in pdbedit.c static, not global (fix for sunos)

See previous email for other details,

Jelmer

-- 
Jelmer Vernooij <jelmer at nl.linux.org> - http://nl.linux.org/~jelmer/
Development And Underdevelopment: http://library.thinkquest.org/C0110231/
Listening to Radio 3FM
 22:42:03 up  9:48,  9 users,  load average: 2.31, 2.14, 1.80
-------------- next part --------------
? pdb_unix.diff
? pdbedit-sun.diff
? source/passdb/pdb_unix.c
Index: docs/docbook/manpages/pdbedit.8.sgml
===================================================================
RCS file: /cvsroot/samba/docs/docbook/manpages/pdbedit.8.sgml,v
retrieving revision 1.3
diff -u -3 -p -r1.3 pdbedit.8.sgml
--- docs/docbook/manpages/pdbedit.8.sgml	8 Jan 2002 22:53:58 -0000	1.3
+++ docs/docbook/manpages/pdbedit.8.sgml	14 Apr 2002 21:42:26 -0000
@@ -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>
 
@@ -233,16 +235,24 @@
 		
 
 		<varlistentry>
-		<term>-i file</term>
-		<listitem><para>This command is used to import a smbpasswd
-		file into the database.</para>
-
-		<para>This option will ease migration from the plain smbpasswd
-		file database to more powerful backend databases like tdb and
-		ldap.</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>Example: <command>pdbedit -i /etc/smbpasswd.old</command>
+		<para>This option will ease migration from one passdb backend to another.
 		</para>
+
+		<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>
Index: docs/docbook/manpages/smb.conf.5.sgml
===================================================================
RCS file: /cvsroot/samba/docs/docbook/manpages/smb.conf.5.sgml,v
retrieving revision 1.29
diff -u -3 -p -r1.29 smb.conf.5.sgml
--- docs/docbook/manpages/smb.conf.5.sgml	14 Apr 2002 12:14:51 -0000	1.29
+++ docs/docbook/manpages/smb.conf.5.sgml	14 Apr 2002 21:42:32 -0000
@@ -5136,7 +5136,14 @@
                         <para>Any characters after the (optional) second : are passed to the plugin
                         for its own processing</para>
                         </listitem>
-			
+		
+						<listitem><para><command>unixsam</command> - Allows samba to map all (other) available unix users</para>
+
+						<para>This backend uses the standard unix database for retrieving users. Users included in this pdb are NOT listed in samba user listings and users included in this pdb won't be able to login. The use of this backend is to always be able to display the owner of a file on the samba server - even when the user doesn't have a 'real' samba account in one of the other passdb backends.
+						</para>
+
+						<para>This backend should always be the last backend listed, since it contains all users in the unix passdb and might 'override' mappings if specified earlier. It's meant to only return accounts for users that aren't covered by the previous backends.</para>
+			</listitem>
 		</itemizedlist>
 		</para>
 
Index: source/Makefile.in
===================================================================
RCS file: /cvsroot/samba/source/Makefile.in,v
retrieving revision 1.470
diff -u -3 -p -r1.470 Makefile.in
--- source/Makefile.in	13 Apr 2002 11:45:33 -0000	1.470
+++ source/Makefile.in	14 Apr 2002 21:42:33 -0000
@@ -190,7 +190,7 @@ RPC_CLIENT_OBJ = rpc_client/cli_netlogon
 LOCKING_OBJ = locking/locking.o locking/brlock.o locking/posix.o
 
 PASSDB_OBJ = passdb/passdb.o passdb/pdb_interface.o passdb/pdb_get_set.o \
-		passdb/machine_sid.o passdb/pdb_smbpasswd.o \
+		passdb/machine_sid.o passdb/pdb_smbpasswd.o passdb/pdb_unix.o \
 		passdb/pdb_tdb.o passdb/pdb_ldap.o passdb/pdb_plugin.o \
 		passdb/pdb_nisplus.o
 
Index: source/passdb/pdb_interface.c
===================================================================
RCS file: /cvsroot/samba/source/passdb/pdb_interface.c,v
retrieving revision 1.12
diff -u -3 -p -r1.12 pdb_interface.c
--- source/passdb/pdb_interface.c	13 Apr 2002 09:35:51 -0000	1.12
+++ source/passdb/pdb_interface.c	14 Apr 2002 21:42:34 -0000
@@ -30,6 +30,7 @@ const struct pdb_init_function_entry bui
 	{ "tdbsam_nua", pdb_init_tdbsam_nua },
 	{ "ldapsam", pdb_init_ldapsam },
 	{ "ldapsam_nua", pdb_init_ldapsam_nua },
+    { "unixsam", pdb_init_unixsam },
 	{ "plugin", pdb_init_plugin },
 	{ NULL, NULL}
 };
Index: source/utils/pdbedit.c
===================================================================
RCS file: /cvsroot/samba/source/utils/pdbedit.c,v
retrieving revision 1.41
diff -u -3 -p -r1.41 pdbedit.c
--- source/utils/pdbedit.c	13 Apr 2002 10:32:09 -0000	1.41
+++ source/utils/pdbedit.c	14 Apr 2002 21:42:34 -0000
@@ -394,24 +394,25 @@ static int delete_machine_entry (struct 
 
 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);
@@ -484,14 +485,14 @@ 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);
+								  home_dir,
+								  home_drive,
+								  logon_script,
+								  profile_path);
 		else
 			return print_user_info (in, user_name, verbose, spstyle);
 	}
@@ -501,8 +502,8 @@ int main (int argc, char **argv)
 
 	if (backend_out)
 		return export_database(in, backend_out);
-	
+
 	poptPrintHelp(pc, stderr, 0);
-	
+
 	return 1;
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pdb_unix.c
Type: text/x-csrc
Size: 5464 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20020414/06090250/pdb_unix.bin


More information about the samba-technical mailing list