From 416fa5377bfca53f21b1fe9c1a71c7ca255abeb2 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 10 Apr 2000 21:47:46 +0000 Subject: added checks to open both \\server\printer and \\server\share. it doesn't work, the getprinter level 0 reply is wrong... J.F. (This used to be commit a7b09e3e11dc66779ee50524ebe1f6687ec744c6) --- source3/rpc_server/srv_spoolss_nt.c | 47 ++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 1d33b1b8bb..3f9e98caa3 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -327,6 +327,7 @@ static BOOL set_printer_hnd_printername(POLICY_HND *hnd, char *printername) aprinter++; DEBUGADD(5,("searching for [%s] (len=%d)\n", aprinter, strlen(aprinter))); + /* * store the Samba share name in it * in back we have the long printer name @@ -361,14 +362,54 @@ static BOOL set_printer_hnd_printername(POLICY_HND *hnd, char *printername) found=True; } - if (found==False) - { + /* + * if we haven't found a printer with the given printername + * then it can be a share name as you can open both \\server\printer and + * \\server\share + */ + + /* + * we still check if the printer description file exists as NT won't be happy + * if we reply OK in the openprinter call and can't reply in the subsequent RPC calls + */ + + if (found==False) { + DEBUGADD(5,("Printer not found, checking for share now\n")); + + for (snum=0;snumprintername, aprinter )); + + if ( strlen(lp_servicename(snum)) != strlen(aprinter) ) { + free_a_printer(printer, 2); + continue; + } + + if ( strncasecmp(lp_servicename(snum), aprinter, strlen(aprinter))) { + free_a_printer(printer, 2); + continue; + } + + found=True; + } + } + + if (found==False) { DEBUGADD(4,("Printer not found\n")); return False; } snum--; - DEBUGADD(4,("Printer found: %s[%x]\n",lp_servicename(snum),snum)); + DEBUGADD(4,("Printer found: %s -> %s[%x]\n",printer.info_2->printername, lp_servicename(snum),snum)); ZERO_STRUCT(Printer->dev.printername); strncpy(Printer->dev.printername, lp_servicename(snum), strlen(lp_servicename(snum))); free_a_printer(printer, 2); -- cgit