1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3: Remove the pointless PRINTERNAME macro

This commit is contained in:
Volker Lendecke 2010-06-13 12:11:26 +02:00
parent 1b13755698
commit 3f7e2222f4
7 changed files with 49 additions and 32 deletions

View 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))

View 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;

View 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())));
}

View 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);
}
/****************************************************************************

View 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())));
}

View 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;
}

View 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(