mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
r11860: BUG 3156: don't use find_service() when explicitly looking for a printer as the username map might get in the way
(This used to be commit 46bf28c81c
)
This commit is contained in:
parent
4826f9d413
commit
f2ecd4fed0
@ -227,7 +227,16 @@ static int key_printers_fetch_keys( const char *key, REGSUBKEY_CTR *subkeys )
|
||||
|
||||
reg_split_path( printers_key, &printername, &printerdatakey );
|
||||
|
||||
if ( find_service(printername) == -1
|
||||
/* validate the printer name */
|
||||
|
||||
for (snum=0; snum<n_services; snum++) {
|
||||
if ( !lp_snum_ok(snum) || !lp_print_ok(snum) )
|
||||
continue;
|
||||
if (strequal( lp_servicename(snum), printername ) )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( snum>=n_services
|
||||
|| !W_ERROR_IS_OK( get_a_printer(NULL, &printer, 2, printername) ) )
|
||||
{
|
||||
return -1;
|
||||
|
@ -479,28 +479,29 @@ static BOOL set_printer_hnd_name(Printer_entry *Printer, char *handlename)
|
||||
DEBUGADD(5, ("searching for [%s]\n", aprinter ));
|
||||
|
||||
/* Search all sharenames first as this is easier than pulling
|
||||
the printer_info_2 off of disk */
|
||||
|
||||
snum = find_service(aprinter);
|
||||
|
||||
if ( lp_snum_ok(snum) && lp_print_ok(snum) ) {
|
||||
found = True;
|
||||
fstrcpy( sname, aprinter );
|
||||
}
|
||||
the printer_info_2 off of disk. Don't use find_service() since
|
||||
that calls out to map_username() */
|
||||
|
||||
/* do another loop to look for printernames */
|
||||
|
||||
for (snum=0; !found && snum<n_services; snum++) {
|
||||
|
||||
/* no point in checking if this is not a printer or
|
||||
/* no point going on if this is not a printer */
|
||||
|
||||
if ( !(lp_snum_ok(snum) && lp_print_ok(snum)) )
|
||||
continue;
|
||||
|
||||
fstrcpy(sname, lp_servicename(snum));
|
||||
if ( strequal( aprinter, sname ) ) {
|
||||
found = True;
|
||||
break;
|
||||
}
|
||||
|
||||
/* no point looking up the printer object if
|
||||
we aren't allowing printername != sharename */
|
||||
|
||||
if ( !(lp_snum_ok(snum)
|
||||
&& lp_print_ok(snum)
|
||||
&& !lp_force_printername(snum)) )
|
||||
{
|
||||
if ( lp_force_printername(snum) )
|
||||
continue;
|
||||
}
|
||||
|
||||
fstrcpy(sname, lp_servicename(snum));
|
||||
|
||||
@ -524,6 +525,7 @@ static BOOL set_printer_hnd_name(Printer_entry *Printer, char *handlename)
|
||||
|
||||
if ( strequal(printername, aprinter) ) {
|
||||
found = True;
|
||||
break;
|
||||
}
|
||||
|
||||
DEBUGADD(10, ("printername: %s\n", printername));
|
||||
|
Loading…
Reference in New Issue
Block a user