Merge tag 'upstream/4.0.5+dfsg1' into samba_4.0_ivo
[abartlet/samba-debian.git] / source3 / printing / print_iprint.c
index 529f0dd0d7c007ff213fcc43357824a4c8941300..ad61a0a33800abb9cad0aebce63f9cb1dbfe2c9e 100644 (file)
@@ -93,10 +93,12 @@ iprint_passwd_cb(const char *prompt)        /* I - Prompt */
 
 static const char *iprint_server(void)
 {
-       if ((lp_iprint_server() != NULL) && (strlen(lp_iprint_server()) > 0)) {
+       const char *server = lp_iprint_server(talloc_tos());
+
+       if ((server != NULL) && (strlen(server) > 0)) {
                DEBUG(10, ("iprint server explicitly set to %s\n",
-                          lp_iprint_server()));
-               return lp_iprint_server();
+                          server));
+               return server;
        }
 
        DEBUG(10, ("iprint server left to default %s\n", cupsServer()));
@@ -618,7 +620,7 @@ static int iprint_job_pause(int snum, struct printjob *pjob)
                     "attributes-natural-language", NULL, language->language);
 
        slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(),
-                lp_printername(snum));
+                lp_printername(talloc_tos(), snum));
 
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
 
@@ -632,7 +634,7 @@ static int iprint_job_pause(int snum, struct printjob *pjob)
        */
 
        slprintf(httpPath, sizeof(httpPath) - 1, "/ipp/%s",
-                lp_printername(snum));
+                lp_printername(talloc_tos(), snum));
 
        if ((response = cupsDoRequest(http, request, httpPath)) != NULL) {
                if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) {
@@ -718,7 +720,7 @@ static int iprint_job_resume(int snum, struct printjob *pjob)
                     "attributes-natural-language", NULL, language->language);
 
        slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(),
-                lp_printername(snum));
+                lp_printername(talloc_tos(), snum));
 
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
 
@@ -732,7 +734,7 @@ static int iprint_job_resume(int snum, struct printjob *pjob)
        */
 
        slprintf(httpPath, sizeof(httpPath) - 1, "/ipp/%s",
-                lp_printername(snum));
+                lp_printername(talloc_tos(), snum));
 
        if ((response = cupsDoRequest(http, request, httpPath)) != NULL) {
                if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) {
@@ -819,7 +821,7 @@ static int iprint_job_submit(int snum, struct printjob *pjob,
                     "attributes-natural-language", NULL, language->language);
 
        slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(),
-                lp_printername(snum));
+                lp_printername(talloc_tos(), snum));
 
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
                     "printer-uri", NULL, uri);
@@ -838,19 +840,19 @@ static int iprint_job_submit(int snum, struct printjob *pjob,
        * Do the request and get back a response...
        */
 
-       slprintf(uri, sizeof(uri) - 1, "/ipp/%s", lp_printername(snum));
+       slprintf(uri, sizeof(uri) - 1, "/ipp/%s", lp_printername(talloc_tos(), snum));
 
        if ((response = cupsDoFileRequest(http, request, uri, pjob->filename)) != NULL) {
                if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) {
                        DEBUG(0,("Unable to print file to %s - %s\n",
-                                lp_printername(snum),
+                                lp_printername(talloc_tos(), snum),
                                 ippErrorString(cupsLastError())));
                } else {
                        ret = 0;
                }
        } else {
                DEBUG(0,("Unable to print file to `%s' - %s\n",
-                        lp_printername(snum),
+                        lp_printername(talloc_tos(), snum),
                         ippErrorString(cupsLastError())));
        }