summaryrefslogtreecommitdiffstats
path: root/source/printing
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2004-06-02 14:58:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:51:52 -0500
commit148dc71ea5c1ec619ba6f4873fa7c69a608e58cc (patch)
tree5fda9d0390596efe80b623a7e84876ec044104b9 /source/printing
parent9ceff803278bdbc09cb5ab678a108cea24ab49a9 (diff)
downloadsamba-148dc71ea5c1ec619ba6f4873fa7c69a608e58cc.tar.gz
samba-148dc71ea5c1ec619ba6f4873fa7c69a608e58cc.tar.xz
samba-148dc71ea5c1ec619ba6f4873fa7c69a608e58cc.zip
r979: Implement the 'cups server' option. This makes it possible to have virtual
smbd's connect to different cups daemons. Volker
Diffstat (limited to 'source/printing')
-rw-r--r--source/printing/print_cups.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/source/printing/print_cups.c b/source/printing/print_cups.c
index 9a48296543d..3097811fac2 100644
--- a/source/printing/print_cups.c
+++ b/source/printing/print_cups.c
@@ -65,6 +65,17 @@ cups_passwd_cb(const char *prompt) /* I - Prompt */
return (NULL);
}
+static const char *cups_server(void)
+{
+ if ((lp_cups_server() != NULL) && (strlen(lp_cups_server()) > 0)) {
+ DEBUG(10, ("cups server explicitly set to %s\n",
+ lp_cups_server()));
+ return lp_cups_server();
+ }
+
+ DEBUG(10, ("cups server left to default %s\n", cupsServer()));
+ return cupsServer();
+}
/*
* 'cups_printer_fn()' - Call a function for every printer known to the
@@ -102,10 +113,10 @@ void cups_printer_fn(void (*fn)(char *, char *))
* Try to connect to the server...
*/
- if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
+ if ((http = httpConnect(cups_server(), ippPort())) == NULL)
{
DEBUG(0,("Unable to connect to CUPS server %s - %s\n",
- cupsServer(), strerror(errno)));
+ cups_server(), strerror(errno)));
return;
}
@@ -331,10 +342,10 @@ int cups_printername_ok(const char *name)
* Try to connect to the server...
*/
- if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
+ if ((http = httpConnect(cups_server(), ippPort())) == NULL)
{
DEBUG(3,("Unable to connect to CUPS server %s - %s\n",
- cupsServer(), strerror(errno)));
+ cups_server(), strerror(errno)));
return (0);
}
@@ -425,10 +436,10 @@ cups_job_delete(int snum, struct printjob *pjob)
* Try to connect to the server...
*/
- if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
+ if ((http = httpConnect(cups_server(), ippPort())) == NULL)
{
DEBUG(0,("Unable to connect to CUPS server %s - %s\n",
- cupsServer(), strerror(errno)));
+ cups_server(), strerror(errno)));
return (1);
}
@@ -515,10 +526,10 @@ cups_job_pause(int snum, struct printjob *pjob)
* Try to connect to the server...
*/
- if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
+ if ((http = httpConnect(cups_server(), ippPort())) == NULL)
{
DEBUG(0,("Unable to connect to CUPS server %s - %s\n",
- cupsServer(), strerror(errno)));
+ cups_server(), strerror(errno)));
return (1);
}
@@ -605,10 +616,10 @@ cups_job_resume(int snum, struct printjob *pjob)
* Try to connect to the server...
*/
- if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
+ if ((http = httpConnect(cups_server(), ippPort())) == NULL)
{
DEBUG(0,("Unable to connect to CUPS server %s - %s\n",
- cupsServer(), strerror(errno)));
+ cups_server(), strerror(errno)));
return (1);
}
@@ -698,10 +709,10 @@ cups_job_submit(int snum, struct printjob *pjob)
* Try to connect to the server...
*/
- if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
+ if ((http = httpConnect(cups_server(), ippPort())) == NULL)
{
DEBUG(0,("Unable to connect to CUPS server %s - %s\n",
- cupsServer(), strerror(errno)));
+ cups_server(), strerror(errno)));
return (1);
}
@@ -848,10 +859,10 @@ cups_queue_get(int snum, print_queue_struct **q, print_status_struct *status)
* Try to connect to the server...
*/
- if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
+ if ((http = httpConnect(cups_server(), ippPort())) == NULL)
{
DEBUG(0,("Unable to connect to CUPS server %s - %s\n",
- cupsServer(), strerror(errno)));
+ cups_server(), strerror(errno)));
return (0);
}
@@ -1153,10 +1164,10 @@ cups_queue_pause(int snum)
* Try to connect to the server...
*/
- if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
+ if ((http = httpConnect(cups_server(), ippPort())) == NULL)
{
DEBUG(0,("Unable to connect to CUPS server %s - %s\n",
- cupsServer(), strerror(errno)));
+ cups_server(), strerror(errno)));
return (1);
}
@@ -1245,10 +1256,10 @@ cups_queue_resume(int snum)
* Try to connect to the server...
*/
- if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
+ if ((http = httpConnect(cups_server(), ippPort())) == NULL)
{
DEBUG(0,("Unable to connect to CUPS server %s - %s\n",
- cupsServer(), strerror(errno)));
+ cups_server(), strerror(errno)));
return (1);
}