diff options
author | Jean-François Micouleau <jfm@samba.org> | 2000-04-10 21:47:46 +0000 |
---|---|---|
committer | Jean-François Micouleau <jfm@samba.org> | 2000-04-10 21:47:46 +0000 |
commit | a7b09e3e11dc66779ee50524ebe1f6687ec744c6 (patch) | |
tree | ec8d1126f314c707e4d8fcee2860adbf50627968 | |
parent | 5480ecf24bc7c97f25a5a6aee7e24eba7e87a458 (diff) | |
download | samba-a7b09e3e11dc66779ee50524ebe1f6687ec744c6.tar.gz samba-a7b09e3e11dc66779ee50524ebe1f6687ec744c6.tar.xz samba-a7b09e3e11dc66779ee50524ebe1f6687ec744c6.zip |
added checks to open both \\server\printer and \\server\share.
it doesn't work, the getprinter level 0 reply is wrong...
J.F.
-rw-r--r-- | source/rpc_server/srv_spoolss_nt.c | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/source/rpc_server/srv_spoolss_nt.c b/source/rpc_server/srv_spoolss_nt.c index 1d33b1b8bb3..3f9e98caa38 100644 --- a/source/rpc_server/srv_spoolss_nt.c +++ b/source/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;snum<n_services && found==False;snum++) { + + if ( !(lp_browseable(snum) && lp_snum_ok(snum) && lp_print_ok(snum) ) ) + continue; + + DEBUGADD(5,("share:%s\n",lp_servicename(snum))); + + if (get_a_printer(&printer, 2, lp_servicename(snum))!=0) + continue; + + DEBUG(10,("set_printer_hnd_printername: printername [%s], aprinter [%s]\n", + printer.info_2->printername, 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); |