[Samba] BUG: when using 'addprinter command'

J. 'FIK' Brand jurgen.brand at tip.nl
Wed May 29 06:28:02 GMT 2002


When using the 'addprinter command' a Win2K client can add a printer to a samba server.

When de wizards is at it's end it first gives a error of 'Access diened' when executing for the second time it gives 'Printer already existed'.

This has to do with the following pieces of code :

---- srv_spoolss_nt.c - spoolss_addprinterex_level_2 -----

 if ((snum = print_queue_snum(printer->info_2->sharename)) != -1) {
  DEBUG(5, ("_spoolss_addprinterex: Attempted to add a printer named [%s] when one already existed!\n", 
   printer->info_2->sharename));
  free_a_printer(&printer, 2);
  return WERR_PRINTER_ALREADY_EXISTS;
 }

 if (*lp_addprinter_cmd() )
  if ( !add_printer_hook(printer) ) {
   free_a_printer(&printer,2);
   return WERR_ACCESS_DENIED;
 }

 slprintf(name, sizeof(name)-1, "\\\\%s\\%s", get_called_name(),
             printer->info_2->sharename);

 if ((snum = print_queue_snum(printer->info_2->sharename)) == -1) {
  free_a_printer(&printer,2);
  return WERR_ACCESS_DENIED;
 }

1 the function print_queue_snum check is a printer share exitst, if so gives a error, 
2 add the printer to the smb.conf.
3 check again on the share, but print_queue_snum (printing.c) uses the function lp_servicenumber (loadparm.c). This function DOES NOT reload the smb.conf.

The first time a printer share is added the fails on 3 - shares does not exists. The second time the smb.conf is reload (where i don't kown) and then it fails on 1 - share already exists.


I hope someone can check this (i'm no expert) and kown's how to fix it.


Jurgen
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the samba mailing list