s3: Remove the pointless PRINTERNAME macro
authorVolker Lendecke <vl@samba.org>
Sun, 13 Jun 2010 10:11:26 +0000 (12:11 +0200)
committerVolker Lendecke <vl@samba.org>
Sun, 13 Jun 2010 10:40:27 +0000 (12:40 +0200)
source3/include/smb_macros.h
source3/printing/nt_printing.c
source3/printing/print_cups.c
source3/printing/print_generic.c
source3/printing/print_iprint.c
source3/printing/printing.c
source3/rpc_server/srv_spoolss_nt.c

index f9a58f33be1224de3c894586bf9182aff7d1d75c..20283e7177f8d92b24ed009ac6d6adde8036fd16 100644 (file)
@@ -68,7 +68,6 @@
 
 
 /* access various service details */
-#define PRINTERNAME(snum)  (lp_printername(snum))
 #define CAN_WRITE(conn)    (!conn->read_only)
 #define VALID_SNUM(snum)   (lp_snum_ok(snum))
 #define GUEST_OK(snum)     (VALID_SNUM(snum) && lp_guest_ok(snum))
index 78f43756c24462f3b544dc2455195dbeb8d0e7b6..c87cfc1fe39a7391f23a5f25fb9529dccb4a34bf 100644 (file)
@@ -5607,7 +5607,7 @@ bool print_access_check(struct auth_serversupplied_info *server_info, int snum,
 
        /* Get printer name */
 
-       pname = PRINTERNAME(snum);
+       pname = lp_printername(snum);
 
        if (!pname || !*pname) {
                errno = EACCES;
index 76a13cf3b42373cb18a76092704d8856897439e3..043cc96930ea00c78076fa0708a66ee54602d823 100644 (file)
@@ -962,7 +962,8 @@ static int cups_job_submit(int snum, struct printjob *pjob)
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
                     "attributes-natural-language", NULL, language->language);
 
-       if (!push_utf8_talloc(frame, &printername, PRINTERNAME(snum), &size)) {
+       if (!push_utf8_talloc(frame, &printername, lp_printername(snum),
+                             &size)) {
                goto out;
        }
        slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s",
@@ -1033,7 +1034,8 @@ static int cups_job_submit(int snum, struct printjob *pjob)
        }
        if ((response = cupsDoFileRequest(http, request, uri, pjob->filename)) != NULL) {
                if (response->request.status.status_code >= IPP_OK_CONFLICT) {
-                       DEBUG(0,("Unable to print file to %s - %s\n", PRINTERNAME(snum),
+                       DEBUG(0,("Unable to print file to %s - %s\n",
+                                lp_printername(snum),
                                 ippErrorString(cupsLastError())));
                } else {
                        ret = 0;
@@ -1046,7 +1048,8 @@ static int cups_job_submit(int snum, struct printjob *pjob)
                        }
                }
        } else {
-               DEBUG(0,("Unable to print file to `%s' - %s\n", PRINTERNAME(snum),
+               DEBUG(0,("Unable to print file to `%s' - %s\n",
+                        lp_printername(snum),
                         ippErrorString(cupsLastError())));
        }
 
@@ -1471,7 +1474,8 @@ static int cups_queue_pause(int snum)
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
                     "attributes-natural-language", NULL, language->language);
 
-       if (!push_utf8_talloc(frame, &printername, PRINTERNAME(snum), &size)) {
+       if (!push_utf8_talloc(frame, &printername, lp_printername(snum),
+                             &size)) {
                goto out;
        }
        slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s",
@@ -1491,13 +1495,15 @@ static int cups_queue_pause(int snum)
 
        if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) {
                if (response->request.status.status_code >= IPP_OK_CONFLICT) {
-                       DEBUG(0,("Unable to pause printer %s - %s\n", PRINTERNAME(snum),
+                       DEBUG(0,("Unable to pause printer %s - %s\n",
+                                lp_printername(snum),
                                ippErrorString(cupsLastError())));
                } else {
                        ret = 0;
                }
        } else {
-               DEBUG(0,("Unable to pause printer %s - %s\n", PRINTERNAME(snum),
+               DEBUG(0,("Unable to pause printer %s - %s\n",
+                        lp_printername(snum),
                        ippErrorString(cupsLastError())));
        }
 
@@ -1572,7 +1578,8 @@ static int cups_queue_resume(int snum)
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
                     "attributes-natural-language", NULL, language->language);
 
-       if (!push_utf8_talloc(frame, &printername, PRINTERNAME(snum), &size)) {
+       if (!push_utf8_talloc(frame, &printername, lp_printername(snum),
+                             &size)) {
                goto out;
        }
        slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s",
@@ -1592,13 +1599,15 @@ static int cups_queue_resume(int snum)
 
        if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) {
                if (response->request.status.status_code >= IPP_OK_CONFLICT) {
-                       DEBUG(0,("Unable to resume printer %s - %s\n", PRINTERNAME(snum),
+                       DEBUG(0,("Unable to resume printer %s - %s\n",
+                                lp_printername(snum),
                                ippErrorString(cupsLastError())));
                } else {
                        ret = 0;
                }
        } else {
-               DEBUG(0,("Unable to resume printer %s - %s\n", PRINTERNAME(snum),
+               DEBUG(0,("Unable to resume printer %s - %s\n",
+                        lp_printername(snum),
                        ippErrorString(cupsLastError())));
        }
 
index b789354999d2ae7391acabe8f6471f1b8bef98d4..b925bedaceb6e99e4e435a69fc24615e87a25687 100644 (file)
@@ -117,7 +117,7 @@ static int generic_job_pause(int snum, struct printjob *pjob)
        
        /* need to pause the spooled entry */
        slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob);
-       return print_run_command(snum, PRINTERNAME(snum), True,
+       return print_run_command(snum, lp_printername(snum), True,
                                 lp_lppausecommand(snum), NULL,
                                 "%j", jobstr,
                                 NULL);
@@ -132,7 +132,7 @@ static int generic_job_resume(int snum, struct printjob *pjob)
 
        /* need to pause the spooled entry */
        slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob);
-       return print_run_command(snum, PRINTERNAME(snum), True,
+       return print_run_command(snum, lp_printername(snum), True,
                                 lp_lpresumecommand(snum), NULL,
                                 "%j", jobstr,
                                 NULL);
@@ -194,7 +194,7 @@ static int generic_job_submit(int snum, struct printjob *pjob)
        slprintf(job_size, sizeof(job_size)-1, "%lu", (unsigned long)pjob->size);
 
        /* send it to the system spooler */
-       ret = print_run_command(snum, PRINTERNAME(snum), True,
+       ret = print_run_command(snum, lp_printername(snum), True,
                        lp_printcommand(snum), NULL,
                        "%s", p,
                        "%J", jobname,
@@ -274,7 +274,8 @@ static int generic_queue_get(const char *printer_name,
 ****************************************************************************/
 static int generic_queue_pause(int snum)
 {
-       return print_run_command(snum, PRINTERNAME(snum), True, lp_queuepausecommand(snum), NULL, NULL);
+       return print_run_command(snum, lp_printername(snum), True,
+                                lp_queuepausecommand(snum), NULL, NULL);
 }
 
 /****************************************************************************
@@ -282,7 +283,8 @@ static int generic_queue_pause(int snum)
 ****************************************************************************/
 static int generic_queue_resume(int snum)
 {
-       return print_run_command(snum, PRINTERNAME(snum), True, lp_queueresumecommand(snum), NULL, NULL);
+       return print_run_command(snum, lp_printername(snum), True,
+                                lp_queueresumecommand(snum), NULL, NULL);
 }
 
 /****************************************************************************
index f7a86dd453b3e2674f3f0d5e337b04869bc69986..2f6e5b2667549ec90995cc418e59e929d6943ce4 100644 (file)
@@ -575,7 +575,8 @@ static int iprint_job_pause(int snum, struct printjob *pjob)
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
                     "attributes-natural-language", NULL, language->language);
 
-       slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(), PRINTERNAME(snum));
+       slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(),
+                lp_printername(snum));
 
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
 
@@ -588,7 +589,8 @@ static int iprint_job_pause(int snum, struct printjob *pjob)
        * Do the request and get back a response...
        */
 
-       slprintf(httpPath, sizeof(httpPath) - 1, "/ipp/%s", PRINTERNAME(snum));
+       slprintf(httpPath, sizeof(httpPath) - 1, "/ipp/%s",
+                lp_printername(snum));
 
        if ((response = cupsDoRequest(http, request, httpPath)) != NULL) {
                if (response->request.status.status_code >= IPP_OK_CONFLICT) {
@@ -673,7 +675,8 @@ static int iprint_job_resume(int snum, struct printjob *pjob)
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
                     "attributes-natural-language", NULL, language->language);
 
-       slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(), PRINTERNAME(snum));
+       slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(),
+                lp_printername(snum));
 
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
 
@@ -686,7 +689,8 @@ static int iprint_job_resume(int snum, struct printjob *pjob)
        * Do the request and get back a response...
        */
 
-       slprintf(httpPath, sizeof(httpPath) - 1, "/ipp/%s", PRINTERNAME(snum));
+       slprintf(httpPath, sizeof(httpPath) - 1, "/ipp/%s",
+                lp_printername(snum));
 
        if ((response = cupsDoRequest(http, request, httpPath)) != NULL) {
                if (response->request.status.status_code >= IPP_OK_CONFLICT) {
@@ -772,7 +776,8 @@ static int iprint_job_submit(int snum, struct printjob *pjob)
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
                     "attributes-natural-language", NULL, language->language);
 
-       slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(), PRINTERNAME(snum));
+       slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(),
+                lp_printername(snum));
 
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
                     "printer-uri", NULL, uri);
@@ -796,17 +801,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", PRINTERNAME(snum));
+       slprintf(uri, sizeof(uri) - 1, "/ipp/%s", lp_printername(snum));
 
        if ((response = cupsDoFileRequest(http, request, uri, pjob->filename)) != NULL) {
                if (response->request.status.status_code >= IPP_OK_CONFLICT) {
-                       DEBUG(0,("Unable to print file to %s - %s\n", PRINTERNAME(snum),
+                       DEBUG(0,("Unable to print file to %s - %s\n",
+                                lp_printername(snum),
                                 ippErrorString(cupsLastError())));
                } else {
                        ret = 0;
                }
        } else {
-               DEBUG(0,("Unable to print file to `%s' - %s\n", PRINTERNAME(snum),
+               DEBUG(0,("Unable to print file to `%s' - %s\n",
+                        lp_printername(snum),
                         ippErrorString(cupsLastError())));
        }
 
index 74edb25eb5ee9c85aef53e8d91917dbe239a851d..6bf037a81705be3218641496aefb2d5f9085b81e 100644 (file)
@@ -1504,7 +1504,7 @@ static void print_queue_update(int snum, bool force)
        lpqcommand = talloc_string_sub2(ctx,
                        lp_lpqcommand(snum),
                        "%p",
-                       PRINTERNAME(snum),
+                       lp_printername(snum),
                        false, false, false);
        if (!lpqcommand) {
                return;
@@ -1524,7 +1524,7 @@ static void print_queue_update(int snum, bool force)
        lprmcommand = talloc_string_sub2(ctx,
                        lp_lprmcommand(snum),
                        "%p",
-                       PRINTERNAME(snum),
+                       lp_printername(snum),
                        false, false, false);
        if (!lprmcommand) {
                return;
@@ -1990,7 +1990,7 @@ static bool print_job_delete1(int snum, uint32 jobid)
        if (pjob->spooled && pjob->sysjob != -1)
        {
                result = (*(current_printif->job_delete))(
-                       PRINTERNAME(snum),
+                       lp_printername(snum),
                        lp_lprmcommand(snum),
                        pjob);
 
@@ -2060,7 +2060,7 @@ bool print_job_delete(struct auth_serversupplied_info *server_info, int snum,
                              "Permission denied-- user not allowed to delete, \
 pause, or resume print job. User name: %s. Printer name: %s.",
                              uidtoname(server_info->utok.uid),
-                             PRINTERNAME(snum) );
+                             lp_printername(snum) );
                /* END_ADMIN_LOG */
 
                return False;
@@ -2135,7 +2135,7 @@ bool print_job_pause(struct auth_serversupplied_info *server_info, int snum,
                        "Permission denied-- user not allowed to delete, \
 pause, or resume print job. User name: %s. Printer name: %s.",
                              uidtoname(server_info->utok.uid),
-                             PRINTERNAME(snum) );
+                             lp_printername(snum) );
                /* END_ADMIN_LOG */
 
                *errcode = WERR_ACCESS_DENIED;
@@ -2198,7 +2198,7 @@ bool print_job_resume(struct auth_serversupplied_info *server_info, int snum,
                         "Permission denied-- user not allowed to delete, \
 pause, or resume print job. User name: %s. Printer name: %s.",
                              uidtoname(server_info->utok.uid),
-                             PRINTERNAME(snum) );
+                             lp_printername(snum) );
                /* END_ADMIN_LOG */
                return False;
        }
index 8ebc7fa64f4bde18e216ee03ead6151760c9bdd1..e03bb348ea8db5334f7d257b00b81b2bb1ceff0e 100644 (file)
@@ -5363,7 +5363,7 @@ static WERROR update_printer_sec(struct policy_handle *handle,
 
                the_acl = old_secdesc_ctr->sd->dacl;
                DEBUG(10, ("old_secdesc_ctr for %s has %d aces:\n",
-                          PRINTERNAME(snum), the_acl->num_aces));
+                          lp_printername(snum), the_acl->num_aces));
 
                for (i = 0; i < the_acl->num_aces; i++) {
                        DEBUG(10, ("%s 0x%08x\n", sid_string_dbg(
@@ -5375,7 +5375,7 @@ static WERROR update_printer_sec(struct policy_handle *handle,
 
                if (the_acl) {
                        DEBUG(10, ("secdesc_ctr for %s has %d aces:\n",
-                                  PRINTERNAME(snum), the_acl->num_aces));
+                                  lp_printername(snum), the_acl->num_aces));
 
                        for (i = 0; i < the_acl->num_aces; i++) {
                                DEBUG(10, ("%s 0x%08x\n", sid_string_dbg(