summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-10-19 22:13:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:00 -0500
commit4e18fa46d54b65a2145da769cb5e26b63eee1b1d (patch)
treed46a00214ca399edacdd8cbffc77be0f52ef8b27 /source3/rpc_server
parent7d4eaf8a9b9de38c4bbd144e18eacde456a68250 (diff)
downloadsamba-4e18fa46d54b65a2145da769cb5e26b63eee1b1d.tar.gz
samba-4e18fa46d54b65a2145da769cb5e26b63eee1b1d.tar.bz2
samba-4e18fa46d54b65a2145da769cb5e26b63eee1b1d.zip
r3069: add 'force printername' service parameter for people that want to enforce printername == sharename for spoolss printing
(This used to be commit d47b8a0b4f348171df35b3b0028ce7d99fab8af3)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 2d230b07bb..fad5555cea 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -529,12 +529,20 @@ static BOOL set_printer_hnd_name(Printer_entry *Printer, char *handlename)
}
}
+
/* do another loop to look for printernames */
for (snum=0; !found && snum<n_services; snum++) {
- if ( !(lp_snum_ok(snum) && lp_print_ok(snum) ) )
+ /* no point in checking if this is not a printer or
+ we aren't allowing printername != sharename */
+
+ if ( !(lp_snum_ok(snum)
+ && lp_print_ok(snum)
+ && !lp_force_printername(snum)) )
+ {
continue;
+ }
fstrcpy(sname, lp_servicename(snum));
@@ -555,16 +563,16 @@ static BOOL set_printer_hnd_name(Printer_entry *Printer, char *handlename)
}
printername++;
-
+
if ( strequal(printername, aprinter) ) {
found = True;
}
DEBUGADD(10, ("printername: %s\n", printername));
- free_a_printer( &printer, 2);
+ free_a_printer( &printer, 2);
}
-
+
if ( !found ) {
DEBUGADD(4,("Printer not found\n"));
return False;
@@ -5955,18 +5963,26 @@ static BOOL check_printer_ok(NT_PRINTER_INFO_LEVEL_2 *info, int snum)
slprintf(info->servername, sizeof(info->servername)-1, "\\\\%s", global_myname());
fstrcpy(info->sharename, lp_servicename(snum));
- /* make sure printername is in \\server\printername format */
+ /* check to see if we allow printername != sharename */
+
+ if ( lp_force_printername(snum) ) {
+ slprintf(info->printername, sizeof(info->printername)-1, "\\\\%s\\%s",
+ global_myname(), info->sharename );
+ } else {
+
+ /* make sure printername is in \\server\printername format */
- fstrcpy( printername, info->printername );
- p = printername;
- if ( printername[0] == '\\' && printername[1] == '\\' ) {
- if ( (p = strchr_m( &printername[2], '\\' )) != NULL )
- p++;
+ fstrcpy( printername, info->printername );
+ p = printername;
+ if ( printername[0] == '\\' && printername[1] == '\\' ) {
+ if ( (p = strchr_m( &printername[2], '\\' )) != NULL )
+ p++;
+ }
+
+ slprintf(info->printername, sizeof(info->printername)-1, "\\\\%s\\%s",
+ global_myname(), p );
}
-
- slprintf(info->printername, sizeof(info->printername)-1, "\\\\%s\\%s",
- global_myname(), p );
-
+
info->attributes |= PRINTER_ATTRIBUTE_SAMBA;
info->attributes &= ~PRINTER_ATTRIBUTE_NOT_SAMBA;