summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorDavid O'Neill <dmo@samba.org>2001-01-17 18:47:46 +0000
committerDavid O'Neill <dmo@samba.org>2001-01-17 18:47:46 +0000
commit792ca5d98938c3c52ff4e598bcb55056565dc202 (patch)
treebb46ce6cad82833e1db7b15ebb9c1f91838405a4 /source3/printing
parent73ba07b3623022e1bde22721b67dba769cc7a1f2 (diff)
downloadsamba-792ca5d98938c3c52ff4e598bcb55056565dc202.tar.gz
samba-792ca5d98938c3c52ff4e598bcb55056565dc202.tar.bz2
samba-792ca5d98938c3c52ff4e598bcb55056565dc202.zip
Changes from APPLIANCE_HEAD:
source/rpc_server/srv_spoolss_nt.c - Unrolled construct_notify_jobs_info() loop to only fetch printer info_2 structure once rather than num_print_jobs times. - convert command to unix codepage. - remove lp_remove_service() call as it prevents lp_killservice() from working. - Modified some DEBUG and DEBUGADD statements. source/param/loadparm.c source/param/params.c - change printer, preload, auto services to FLAG_DOS_STRING, reverted earlier changes to szPrintername et al, add comments. source/printing/load.c - fix bug with lp_auto_services() and strtok() source/printing/nt_printing.c source/printing/printing.c - remove redundant test that used SERVICE(snum) source/printing/pcap.c - add unix_to_dos() calls, add notes wrt FIXMEs for xxx_printer_fn() functions. source/web/swat.c - added FIXME comment. source/smbd/service.c - added comment re: dos codepage (This used to be commit 7b774b72c2857af9519012106714a9e2cb099da3)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/load.c9
-rw-r--r--source3/printing/nt_printing.c3
-rw-r--r--source3/printing/pcap.c13
-rw-r--r--source3/printing/printing.c1
4 files changed, 18 insertions, 8 deletions
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);