svn commit: samba r16303 - in trunk/source: lib printing

vlendec at samba.org vlendec at samba.org
Fri Jun 16 21:55:48 GMT 2006


Author: vlendec
Date: 2006-06-16 21:55:47 +0000 (Fri, 16 Jun 2006)
New Revision: 16303

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

Log:
Remove sub_snum. Same argument as sub_conn.

With this, none of the substitute routines themselves reference
current_user[_info] anymore.

Volker


Modified:
   trunk/source/lib/substitute.c
   trunk/source/printing/print_generic.c
   trunk/source/printing/printing.c


Changeset:
Modified: trunk/source/lib/substitute.c
===================================================================
--- trunk/source/lib/substitute.c	2006-06-16 21:23:13 UTC (rev 16302)
+++ trunk/source/lib/substitute.c	2006-06-16 21:55:47 UTC (rev 16303)
@@ -745,30 +745,3 @@
 		SAFE_FREE( s );
 	}
 }
-
-/****************************************************************************
- Like standard_sub but by snum.
-****************************************************************************/
-
-void standard_sub_snum(int snum, char *str, size_t len)
-{
-	static uid_t cached_uid = -1;
-	static fstring cached_user;
-	char *s;
-	
-	/* calling uidtoname() on every substitute would be too expensive, so
-	   we cache the result here as nearly every call is for the same uid */
-
-	if (cached_uid != current_user.ut.uid) {
-		fstrcpy(cached_user, uidtoname(current_user.ut.uid));
-		cached_uid = current_user.ut.uid;
-	}
-
-	s = alloc_sub_advanced(snum, cached_user, "", current_user.ut.gid,
-			       smb_user_name, current_user_info.domain, str);
-
-	if ( s ) {
-		strncpy( str, s, len );
-		SAFE_FREE( s );
-	}
-}

Modified: trunk/source/printing/print_generic.c
===================================================================
--- trunk/source/printing/print_generic.c	2006-06-16 21:23:13 UTC (rev 16302)
+++ trunk/source/printing/print_generic.c	2006-06-16 21:55:47 UTC (rev 16303)
@@ -30,7 +30,9 @@
 static int print_run_command(int snum, const char* printername, BOOL do_sub,
 			     const char *command, int *outfd, ...)
 {
-
+	extern struct current_user current_user;
+	extern userdom_struct current_user_info;
+	
 	pstring syscmd;
 	char *arg;
 	int ret;
@@ -56,7 +58,11 @@
 	pstring_sub( syscmd, "%p", printername );
 
 	if ( do_sub && snum != -1 )
-		standard_sub_snum(snum,syscmd,sizeof(syscmd));
+		standard_sub_advanced(snum, current_user_info.unix_name, "",
+				      current_user.ut.gid,
+				      get_current_username(),
+				      current_user_info.domain,
+				      syscmd, sizeof(syscmd));
 		
 	ret = smbrun(syscmd,outfd);
 

Modified: trunk/source/printing/printing.c
===================================================================
--- trunk/source/printing/printing.c	2006-06-16 21:23:13 UTC (rev 16302)
+++ trunk/source/printing/printing.c	2006-06-16 21:55:47 UTC (rev 16303)
@@ -1439,6 +1439,8 @@
 
 static void print_queue_update(int snum, BOOL force)
 {
+	extern struct current_user current_user;
+	extern userdom_struct current_user_info;
 	fstring key;
 	fstring sharename;
 	pstring lpqcommand, lprmcommand;
@@ -1456,12 +1458,20 @@
 	pstrcpy( lpqcommand, lp_lpqcommand(snum));
 	string_sub2( lpqcommand, "%p", PRINTERNAME(snum), sizeof(lpqcommand), 
 		     False, False, False );
-	standard_sub_snum( snum, lpqcommand, sizeof(lpqcommand) );
+	standard_sub_advanced(snum, current_user_info.unix_name, "",
+			      current_user.ut.gid,
+			      get_current_username(),
+			      current_user_info.domain,
+			      lpqcommand, sizeof(lpqcommand) );
 	
 	pstrcpy( lprmcommand, lp_lprmcommand(snum));
 	string_sub2( lprmcommand, "%p", PRINTERNAME(snum), sizeof(lprmcommand), 
 		     False, False, False );
-	standard_sub_snum( snum, lprmcommand, sizeof(lprmcommand) );
+	standard_sub_advanced(snum, current_user_info.unix_name, "",
+			      current_user.ut.gid,
+			      get_current_username(),
+			      current_user_info.domain,
+			      lprmcommand, sizeof(lprmcommand) );
 	
 	/* 
 	 * Make sure that the background queue process exists.  



More information about the samba-cvs mailing list