{"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},
{"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
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
doesn't provide WINS server service by default (wsupp = False),
and doesn't provide domain master browser services by default, either.
+
*/
Globals.bMsAddPrinterWizard = True;
/***************************************************************************
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)
{
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)
{
}
/***************************************************************************
-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)
{
/***************************************************************************
-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)
{
/* 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;
/***************************************************************************
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)
{
if ((i = lp_servicenumber(name)) >= 0)
{
string_set(&iSERVICE(i).comment, comment);
+ unix_to_dos(iSERVICE(i).comment, True);
iSERVICE(i).autoloaded = True;
}
}
}
/*******************************************************************
-copy a service
+copy a service. new_name must be in dos codepage
********************************************************************/
void lp_copy_service(int snum, char *new_name)
{
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 );
{
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;
lp_add_printer(p,printers);
}
}
+
+ free(str);
}
/***************************************************************************
pname = PRINTERNAME(snum);
- if (!pname || !*pname)
- pname = SERVICE(snum);
-
if (!pname || !*pname) {
errno = EACCES;
return False;
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)
{
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;
/***************************************************************************
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 *))
{
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;
va_end(ap);
p = PRINTERNAME(snum);
- if (!p || !*p) p = SERVICE(snum);
pstring_sub(syscmd, "%p", p);
standard_sub_snum(snum,syscmd);
/* 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);
kill(0, SIGHUP);
if ( ( i = lp_servicenumber( Printer->dev.handlename ) ) >= 0 ) {
- lp_remove_service( i );
lp_killservice( i );
return True;
} else
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;
}
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)));
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;
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);
* 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"));
(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];
info->count++;
}
- free_a_printer(&printer, 2);
return True;
}
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;
}
+ }
}
/*
/****************************************************************************
- find a service entry
+ find a service entry. service is always in dos codepage
****************************************************************************/
int find_service(char *service)
{
}
/****************************************************************************
- 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)
{
}
if(!initialize_password_db(True)) {
- printf("Can't initialize passdb!\n<p>");
+ printf("Can't setup password database vectors.\n<p>");
return False;
}