diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/param/loadparm.c | 29 | ||||
-rw-r--r-- | source3/param/params.c | 2 | ||||
-rw-r--r-- | source3/printing/load.c | 9 | ||||
-rw-r--r-- | source3/printing/nt_printing.c | 3 | ||||
-rw-r--r-- | source3/printing/pcap.c | 13 | ||||
-rw-r--r-- | source3/printing/printing.c | 1 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 51 | ||||
-rw-r--r-- | source3/smbd/service.c | 2 | ||||
-rw-r--r-- | source3/web/swat.c | 5 |
9 files changed, 70 insertions, 45 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 57e8f17189..7750cb7ac7 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -830,8 +830,8 @@ static struct parm_struct parm_table[] = { {"deleteprinter command", P_STRING, P_GLOBAL, &Globals.szDeletePrinterCommand, NULL, NULL, 0}, {"show add printer wizard", P_BOOL, P_GLOBAL, &Globals.bMsAddPrinterWizard, NULL, NULL, 0}, - {"printer name", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_PRINT}, - {"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, 0}, + {"printer name", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_PRINT|FLAG_DOS_STRING}, + {"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_DOS_STRING}, {"printer driver", P_STRING, P_LOCAL, &sDefault.szPrinterDriver, NULL, NULL, FLAG_PRINT}, {"printer driver file", P_STRING, P_LOCAL, &sDefault.szDriverFile, NULL, NULL, FLAG_PRINT}, {"printer driver location", P_STRING, P_LOCAL, &sDefault.szPrinterDriverLocation, NULL, NULL, FLAG_PRINT | FLAG_GLOBAL}, @@ -938,8 +938,8 @@ static struct parm_struct parm_table[] = { {"smbrun", P_STRING, P_GLOBAL, &Globals.szSmbrun, NULL, NULL, 0}, {"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, FLAG_HIDE}, - {"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, 0}, - {"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, 0}, + {"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_DOS_STRING}, + {"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_DOS_STRING}, {"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, 0}, {"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, 0}, #ifdef WITH_UTMP @@ -1270,8 +1270,7 @@ static void init_globals(void) Globals.sslCompatibility = False; #endif /* WITH_SSL */ -/* - these parameters are set to defaults that are more appropriate +/* these parameters are set to defaults that are more appropriate for the increasing samba install base: as a member of the workgroup, that will possibly become a @@ -1280,6 +1279,7 @@ static void init_globals(void) doesn't provide WINS server service by default (wsupp = False), and doesn't provide domain master browser services by default, either. + */ Globals.bMsAddPrinterWizard = True; @@ -1690,7 +1690,7 @@ static void free_service(service * pservice) /*************************************************************************** add a new service to the services array initialising it with the given -service +service. name must be in DOS codepage. ***************************************************************************/ static int add_a_service(service * pservice, char *name) { @@ -1739,14 +1739,13 @@ static int add_a_service(service * pservice, char *name) if (name) { string_set(&iSERVICE(i).szService, name); - unix_to_dos(iSERVICE(i).szService, True); } return (i); } /*************************************************************************** add a new home service, with the specified home directory, defaults coming -from service ifrom +from service ifrom. homename must be in DOS codepage. ***************************************************************************/ BOOL lp_add_home(char *pszHomename, int iDefaultService, char *pszHomedir) { @@ -1775,7 +1774,7 @@ BOOL lp_add_home(char *pszHomename, int iDefaultService, char *pszHomedir) } /*************************************************************************** -add a new service, based on an old one +add a new service, based on an old one. pszService must be in DOS codepage. ***************************************************************************/ int lp_add_service(char *pszService, int iDefaultService) { @@ -1817,7 +1816,8 @@ static BOOL lp_add_ipc(void) /*************************************************************************** -add a new printer service, with defaults coming from service iFrom +add a new printer service, with defaults coming from service iFrom. +printername must be in DOS codepage. ***************************************************************************/ BOOL lp_add_printer(char *pszPrintername, int iDefaultService) { @@ -1834,9 +1834,7 @@ BOOL lp_add_printer(char *pszPrintername, int iDefaultService) /* the printer name is set to the service name. */ string_set(&iSERVICE(i).szPrintername, pszPrintername); - unix_to_dos(iSERVICE(i).szPrintername, True); string_set(&iSERVICE(i).comment, comment); - unix_to_dos(iSERVICE(i).comment, True); iSERVICE(i).bBrowseable = sDefault.bBrowseable; /* Printers cannot be read_only. */ iSERVICE(i).bRead_only = False; @@ -2734,7 +2732,7 @@ void init_locals(void) /*************************************************************************** Process a new section (service). At this stage all sections are services. Later we'll have special sections that permit server parameters to be set. -Returns True on success, False on failure. +Returns True on success, False on failure. SectionName must be in DOS codepage. ***************************************************************************/ static BOOL do_section(char *pszSectionName) { @@ -3037,6 +3035,7 @@ void lp_add_one_printer(char *name, char *comment) if ((i = lp_servicenumber(name)) >= 0) { string_set(&iSERVICE(i).comment, comment); + unix_to_dos(iSERVICE(i).comment, True); iSERVICE(i).autoloaded = True; } } @@ -3448,7 +3447,7 @@ void lp_remove_service(int snum) } /******************************************************************* -copy a service +copy a service. new_name must be in dos codepage ********************************************************************/ void lp_copy_service(int snum, char *new_name) { diff --git a/source3/param/params.c b/source3/param/params.c index 9cb6412b96..b359b269d4 100644 --- a/source3/param/params.c +++ b/source3/param/params.c @@ -271,7 +271,7 @@ static BOOL Section( myFILE *InFile, BOOL (*sfunc)(char *) ) DEBUG(0, ("%s Empty section name in configuration file.\n", func )); return( False ); } - if( !sfunc( bufr ) ) /* Got a valid name. Deal with it. */ + if( !sfunc( unix_to_dos(bufr,True) ) ) /* Got a valid name. Deal with it. */ return( False ); (void)EatComment( InFile ); /* Finish off the line. */ return( True ); diff --git a/source3/printing/load.c b/source3/printing/load.c index fbf10d22b8..275ffa21ed 100644 --- a/source3/printing/load.c +++ b/source3/printing/load.c @@ -41,13 +41,16 @@ static void add_auto_printers(void) { char *p; int printers; - char *str = lp_auto_services(); + char *str = strdup(lp_auto_services()); if (!str) return; printers = lp_servicenumber(PRINTERS_NAME); - if (printers < 0) return; + if (printers < 0) { + free(str); + return; + } for (p=strtok(str,LIST_SEP);p;p=strtok(NULL,LIST_SEP)) { if (lp_servicenumber(p) >= 0) continue; @@ -56,6 +59,8 @@ static void add_auto_printers(void) lp_add_printer(p,printers); } } + + free(str); } /*************************************************************************** diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 2572a98bde..7b84f95161 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -3043,9 +3043,6 @@ BOOL print_access_check(struct current_user *user, int snum, int access_type) pname = PRINTERNAME(snum); - if (!pname || !*pname) - pname = SERVICE(snum); - if (!pname || !*pname) { errno = EACCES; return False; diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c index fb2409fd38..e9c2e46090 100644 --- a/source3/printing/pcap.c +++ b/source3/printing/pcap.c @@ -244,7 +244,10 @@ static BOOL ScanQconfig(char *psz,char *pszPrintername) Scan printcap file pszPrintcapname for a printer called pszPrintername. Return True if found, else False. Returns False on error, too, after logging the error at level 0. For generality, the printcap name may be passed - if -passed as NULL, the configuration will be queried for the name. +passed as NULL, the configuration will be queried for the name. pszPrintername +must be in DOS codepage. +The xxx_printername_ok functions need fixing to understand they are being +given a DOS codepage. FIXME !! JRA. ***************************************************************************/ BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname) { @@ -293,6 +296,8 @@ BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname) if (*line == '#' || *line == 0) continue; + unix_to_dos(line,True); + /* now we have a real printer line - cut it off at the first : */ p = strchr(line,':'); if (p) *p = 0; @@ -322,7 +327,9 @@ BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname) /*************************************************************************** run a function on each printer name in the printcap file. The function is -passed the primary name and the comment (if possible) +passed the primary name and the comment (if possible). Note the fn() takes +strings in DOS codepage. This means the xxx_printer_fn() calls must be fixed +to return DOS codepage. FIXME !! JRA. ***************************************************************************/ void pcap_printer_fn(void (*fn)(char *, char *)) { @@ -376,6 +383,8 @@ void pcap_printer_fn(void (*fn)(char *, char *)) p = strchr(line,':'); if (p) *p = 0; + unix_to_dos(line,True); + /* now find the most likely printer name and comment this is pure guesswork, but it's better than nothing */ *name = 0; diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 3f8c542ec7..3ce58b5b78 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -164,7 +164,6 @@ static int print_run_command(int snum,char *command, va_end(ap); p = PRINTERNAME(snum); - if (!p || !*p) p = SERVICE(snum); pstring_sub(syscmd, "%p", p); standard_sub_snum(snum,syscmd); diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 4355e2eb59..0654eea6f4 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -272,6 +272,7 @@ static BOOL delete_printer_handle(POLICY_HND *hnd) /* Printer->dev.handlename equals portname equals sharename */ slprintf(command, sizeof(command), "%s \"%s\"", cmd, Printer->dev.handlename); + dos_to_unix(command, True); /* Convert printername to unix-codepage */ slprintf(tmp_file, sizeof(tmp_file), "%s/smbcmd.%d", path, local_pid); unlink(tmp_file); @@ -289,7 +290,6 @@ static BOOL delete_printer_handle(POLICY_HND *hnd) kill(0, SIGHUP); if ( ( i = lp_servicenumber( Printer->dev.handlename ) ) >= 0 ) { - lp_remove_service( i ); lp_killservice( i ); return True; } else @@ -526,7 +526,8 @@ static BOOL open_printer_hnd(POLICY_HND *hnd, char *name) return False; } - DEBUG(5, ("%d printer handles active\n", ubi_dlCount(&Printer_list))); + DEBUG(5, ("%d printer handles active\n", + (int)ubi_dlCount(&Printer_list))); return True; } @@ -1604,11 +1605,9 @@ static BOOL construct_notify_printer_info(SPOOL_NOTIFY_INFO *info, int snum, SPO NT_PRINTER_INFO_LEVEL *printer = NULL; print_queue_struct *queue=NULL; - DEBUG(4,("construct_notify_printer_info\n")); - type=option_type->type; - DEBUGADD(4,("Notify type: [%s], number of notify info: [%d] on printer: [%s]\n", + DEBUG(4,("construct_notify_printer_info: Notify type: [%s], number of notify info: [%d] on printer: [%s]\n", (option_type->type==PRINTER_NOTIFY_TYPE?"PRINTER_NOTIFY_TYPE":"JOB_NOTIFY_TYPE"), option_type->count, lp_servicename(snum))); @@ -1617,7 +1616,7 @@ static BOOL construct_notify_printer_info(SPOOL_NOTIFY_INFO *info, int snum, SPO for(field_num=0; field_num<option_type->count; field_num++) { field = option_type->fields[field_num]; - DEBUGADD(4,("notify [%d]: type [%x], field [%x]\n", field_num, type, field)); + DEBUG(4,("construct_notify_printer_info: notify [%d]: type [%x], field [%x]\n", field_num, type, field)); if (!search_notify(type, field, &j) ) continue; @@ -1629,8 +1628,8 @@ static BOOL construct_notify_printer_info(SPOOL_NOTIFY_INFO *info, int snum, SPO construct_info_data(current_data, type, field, id); - DEBUG(10,("construct_notify_printer_info: calling %s\n", - notify_info_data_table[j].name )); + DEBUG(10,("construct_notify_printer_info: calling [%s] snum=%d printername=[%s])\n", + notify_info_data_table[j].name, snum, printer->info_2->printername )); notify_info_data_table[j].fn(snum, current_data, queue, printer); @@ -1646,14 +1645,17 @@ static BOOL construct_notify_printer_info(SPOOL_NOTIFY_INFO *info, int snum, SPO * fill a notify_info struct with info asked * ********************************************************************/ -static BOOL construct_notify_jobs_info(print_queue_struct *queue, SPOOL_NOTIFY_INFO *info, int snum, SPOOL_NOTIFY_OPTION_TYPE *option_type, uint32 id) +static BOOL construct_notify_jobs_info(print_queue_struct *queue, + SPOOL_NOTIFY_INFO *info, + NT_PRINTER_INFO_LEVEL *printer, + int snum, SPOOL_NOTIFY_OPTION_TYPE + *option_type, uint32 id) { int field_num,j; uint16 type; uint16 field; SPOOL_NOTIFY_INFO_DATA *current_data; - NT_PRINTER_INFO_LEVEL *printer = NULL; DEBUG(4,("construct_notify_jobs_info\n")); @@ -1663,9 +1665,6 @@ static BOOL construct_notify_jobs_info(print_queue_struct *queue, SPOOL_NOTIFY_I (option_type->type==PRINTER_NOTIFY_TYPE?"PRINTER_NOTIFY_TYPE":"JOB_NOTIFY_TYPE"), option_type->count)); - if (get_a_printer(&printer, 2, lp_servicename(snum))!=0) - return False; - for(field_num=0; field_num<option_type->count; field_num++) { field = option_type->fields[field_num]; @@ -1683,7 +1682,6 @@ static BOOL construct_notify_jobs_info(print_queue_struct *queue, SPOOL_NOTIFY_I info->count++; } - free_a_printer(&printer, 2); return True; } @@ -1798,18 +1796,35 @@ static uint32 printer_notify_info(POLICY_HND *hnd, SPOOL_NOTIFY_INFO *info) switch ( option_type->type ) { case PRINTER_NOTIFY_TYPE: - if(construct_notify_printer_info(info, snum, option_type, id)) + if(construct_notify_printer_info(info, snum, + option_type, id)) id--; break; - case JOB_NOTIFY_TYPE: + case JOB_NOTIFY_TYPE: { + NT_PRINTER_INFO_LEVEL *printer = NULL; + memset(&status, 0, sizeof(status)); count = print_queue_status(snum, &queue, &status); - for (j=0; j<count; j++) - construct_notify_jobs_info(&queue[j], info, snum, option_type, queue[j].job); + + if (get_a_printer(&printer, 2, + lp_servicename(snum)) != 0) + goto done; + + for (j=0; j<count; j++) { + construct_notify_jobs_info(&queue[j], info, + printer, snum, + option_type, + queue[j].job); + } + + free_a_printer(&printer, 2); + + done: safe_free(queue); break; } + } } /* diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 4670d601d7..1db5dc4a5f 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -80,7 +80,7 @@ BOOL become_service(connection_struct *conn,BOOL do_chdir) /**************************************************************************** - find a service entry + find a service entry. service is always in dos codepage ****************************************************************************/ int find_service(char *service) { diff --git a/source3/web/swat.c b/source3/web/swat.c index e0936d0741..d0a78fb243 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -520,7 +520,8 @@ static void globals_page(void) } /**************************************************************************** - display a shares editing page + display a shares editing page. share is in unix codepage, and must be in + dos codepage. FIXME !!! JRA. ****************************************************************************/ static void shares_page(void) { @@ -641,7 +642,7 @@ static BOOL change_password(const char *remote_machine, char *user_name, } if(!initialize_password_db(True)) { - printf("Can't initialize passdb!\n<p>"); + printf("Can't setup password database vectors.\n<p>"); return False; } |