From 81f1af28378f4592c548e31c2e088de08294fa0b Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 22 Nov 2005 15:52:22 +0000 Subject: [PATCH] r11860: BUG 3156: don't use find_service() when explicitly looking for a printer as the username map might get in the way --- source/registry/reg_printing.c | 11 ++++++++++- source/rpc_server/srv_spoolss_nt.c | 30 ++++++++++++++++-------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/source/registry/reg_printing.c b/source/registry/reg_printing.c index b07c8e9644f..592069052f8 100644 --- a/source/registry/reg_printing.c +++ b/source/registry/reg_printing.c @@ -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 || !W_ERROR_IS_OK( get_a_printer(NULL, &printer, 2, printername) ) ) { return -1; diff --git a/source/rpc_server/srv_spoolss_nt.c b/source/rpc_server/srv_spoolss_nt.c index e5b3ca3947d..f0ba863b4d7 100644 --- a/source/rpc_server/srv_spoolss_nt.c +++ b/source/rpc_server/srv_spoolss_nt.c @@ -479,29 +479,30 @@ 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 */ + the printer_info_2 off of disk. Don't use find_service() since + that calls out to map_username() */ - snum = find_service(aprinter); - - if ( lp_snum_ok(snum) && lp_print_ok(snum) ) { - found = True; - fstrcpy( sname, aprinter ); - } - /* do another loop to look for printernames */ for (snum=0; !found && snum