context="S"
type="string"
function="_printername"
+ substitution="1"
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
<synonym>printer</synonym>
<description>
void lp_remove_service(int snum);
void lp_copy_service(int snum, const char *new_name);
int lp_default_server_announce(void);
-const char *lp_printername(TALLOC_CTX *ctx, int snum);
+const char *lp_printername(TALLOC_CTX *ctx,
+ const struct loadparm_substitution *lp_sub,
+ int snum);
void lp_set_logfile(const char *name);
int lp_maxprintjobs(int snum);
const char *lp_printcapname(void);
ServicePtrs[snum]->valid = false;
}
-const char *lp_printername(TALLOC_CTX *ctx, int snum)
+const char *lp_printername(TALLOC_CTX *ctx,
+ const struct loadparm_substitution *lp_sub,
+ int snum)
{
- const char *ret = lp__printername(ctx, snum);
+ const char *ret = lp__printername(ctx, lp_sub, snum);
+
if (ret == NULL || *ret == '\0') {
ret = lp_const_servicename(snum);
}
int access_type)
{
struct spoolss_security_descriptor *secdesc = NULL;
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
uint32_t access_granted;
size_t sd_size;
NTSTATUS status;
/* Get printer name */
- pname = lp_printername(talloc_tos(), snum);
+ pname = lp_printername(talloc_tos(), lp_sub, snum);
if (!pname || !*pname) {
return WERR_ACCESS_DENIED;
"attributes-natural-language", NULL, language->language);
if (!push_utf8_talloc(frame, &printername,
- lp_printername(talloc_tos(), snum),
+ lp_printername(talloc_tos(), lp_sub, snum),
&size)) {
goto out;
}
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(talloc_tos(), snum),
+ lp_printername(talloc_tos(), lp_sub, snum),
ippErrorString(cupsLastError())));
} else {
ret = 0;
}
} else {
DEBUG(0,("Unable to print file to `%s' - %s\n",
- lp_printername(talloc_tos(), snum),
+ lp_printername(talloc_tos(), lp_sub, snum),
ippErrorString(cupsLastError())));
}
static int cups_queue_pause(int snum)
{
TALLOC_CTX *frame = talloc_stackframe();
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
int ret = 1; /* Return value */
http_t *http = NULL; /* HTTP connection to server */
ipp_t *request = NULL, /* IPP Request */
"attributes-natural-language", NULL, language->language);
if (!push_utf8_talloc(frame, &printername,
- lp_printername(talloc_tos(), snum), &size)) {
+ lp_printername(talloc_tos(), lp_sub, snum), &size)) {
goto out;
}
ustatus = httpAssembleURIf(HTTP_URI_CODING_ALL,
if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) {
if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) {
DEBUG(0,("Unable to pause printer %s - %s\n",
- lp_printername(talloc_tos(), snum),
+ lp_printername(talloc_tos(), lp_sub, snum),
ippErrorString(cupsLastError())));
} else {
ret = 0;
}
} else {
DEBUG(0,("Unable to pause printer %s - %s\n",
- lp_printername(talloc_tos(), snum),
+ lp_printername(talloc_tos(), lp_sub, snum),
ippErrorString(cupsLastError())));
}
static int cups_queue_resume(int snum)
{
TALLOC_CTX *frame = talloc_stackframe();
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
int ret = 1; /* Return value */
http_t *http = NULL; /* HTTP connection to server */
ipp_t *request = NULL, /* IPP Request */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
- if (!push_utf8_talloc(frame, &printername, lp_printername(talloc_tos(), snum),
+ if (!push_utf8_talloc(frame, &printername, lp_printername(talloc_tos(), lp_sub, snum),
&size)) {
goto out;
}
if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) {
if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) {
DEBUG(0,("Unable to resume printer %s - %s\n",
- lp_printername(talloc_tos(), snum),
+ lp_printername(talloc_tos(), lp_sub, snum),
ippErrorString(cupsLastError())));
} else {
ret = 0;
}
} else {
DEBUG(0,("Unable to resume printer %s - %s\n",
- lp_printername(talloc_tos(), snum),
+ lp_printername(talloc_tos(), lp_sub, snum),
ippErrorString(cupsLastError())));
}
****************************************************************************/
static int generic_job_pause(int snum, struct printjob *pjob)
{
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
fstring jobstr;
/* need to pause the spooled entry */
slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob);
- return print_run_command(snum, lp_printername(talloc_tos(), snum), True,
+ return print_run_command(snum, lp_printername(talloc_tos(), lp_sub, snum), True,
lp_lppause_command(snum), NULL,
"%j", jobstr,
NULL);
****************************************************************************/
static int generic_job_resume(int snum, struct printjob *pjob)
{
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
fstring jobstr;
/* need to pause the spooled entry */
slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob);
- return print_run_command(snum, lp_printername(talloc_tos(), snum), True,
+ return print_run_command(snum, lp_printername(talloc_tos(), lp_sub, snum), True,
lp_lpresume_command(snum), NULL,
"%j", jobstr,
NULL);
char *lpq_cmd)
{
int ret = -1;
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
char *current_directory = NULL;
char *print_directory = NULL;
char *wd = NULL;
slprintf(job_size, sizeof(job_size)-1, "%lu", (unsigned long)pjob->size);
/* send it to the system spooler */
- ret = print_run_command(snum, lp_printername(talloc_tos(), snum), True,
+ ret = print_run_command(snum, lp_printername(talloc_tos(), lp_sub, snum), True,
lp_print_command(snum), NULL,
"%s", p,
"%J", jobname,
* determine the backend job identifier (sysjob).
*/
pjob->sysjob = -1;
- ret = generic_queue_get(lp_printername(talloc_tos(), snum),
+ ret = generic_queue_get(lp_printername(talloc_tos(), lp_sub, snum),
printing_type, lpq_cmd, &q, &status);
if (ret > 0) {
int i;
****************************************************************************/
static int generic_queue_pause(int snum)
{
- return print_run_command(snum, lp_printername(talloc_tos(), snum), True,
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
+
+ return print_run_command(snum, lp_printername(talloc_tos(), lp_sub, snum), True,
lp_queuepause_command(snum), NULL, NULL);
}
****************************************************************************/
static int generic_queue_resume(int snum)
{
- return print_run_command(snum, lp_printername(talloc_tos(), snum), True,
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
+
+ return print_run_command(snum, lp_printername(talloc_tos(), lp_sub, snum), True,
lp_queueresume_command(snum), NULL, NULL);
}
cups_lang_t *language = NULL; /* Default language */
char uri[HTTP_MAX_URI]; /* printer-uri attribute */
char httpPath[HTTP_MAX_URI]; /* path portion of the printer-uri */
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
DEBUG(5,("iprint_job_pause(%d, %p (%d))\n", snum, pjob, pjob->sysjob));
"attributes-natural-language", NULL, language->language);
slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(),
- lp_printername(talloc_tos(), snum));
+ lp_printername(talloc_tos(), lp_sub, snum));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
*/
slprintf(httpPath, sizeof(httpPath) - 1, "/ipp/%s",
- lp_printername(talloc_tos(), snum));
+ lp_printername(talloc_tos(), lp_sub, snum));
if ((response = cupsDoRequest(http, request, httpPath)) != NULL) {
if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) {
cups_lang_t *language = NULL; /* Default language */
char uri[HTTP_MAX_URI]; /* printer-uri attribute */
char httpPath[HTTP_MAX_URI]; /* path portion of the printer-uri */
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
DEBUG(5,("iprint_job_resume(%d, %p (%d))\n", snum, pjob, pjob->sysjob));
"attributes-natural-language", NULL, language->language);
slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(),
- lp_printername(talloc_tos(), snum));
+ lp_printername(talloc_tos(), lp_sub, snum));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
*/
slprintf(httpPath, sizeof(httpPath) - 1, "/ipp/%s",
- lp_printername(talloc_tos(), snum));
+ lp_printername(talloc_tos(), lp_sub, snum));
if ((response = cupsDoRequest(http, request, httpPath)) != NULL) {
if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) {
ipp_attribute_t *attr; /* Current attribute */
cups_lang_t *language = NULL; /* Default language */
char uri[HTTP_MAX_URI]; /* printer-uri attribute */
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
DEBUG(5,("iprint_job_submit(%d, %p (%d))\n", snum, pjob, pjob->sysjob));
"attributes-natural-language", NULL, language->language);
slprintf(uri, sizeof(uri) - 1, "ipp://%s/ipp/%s", iprint_server(),
- lp_printername(talloc_tos(), snum));
+ lp_printername(talloc_tos(), lp_sub, snum));
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
* Do the request and get back a response...
*/
- slprintf(uri, sizeof(uri) - 1, "/ipp/%s", lp_printername(talloc_tos(), snum));
+ slprintf(uri, sizeof(uri) - 1, "/ipp/%s", lp_printername(talloc_tos(), lp_sub, 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(talloc_tos(), snum),
+ lp_printername(talloc_tos(), lp_sub, snum),
ippErrorString(cupsLastError())));
} else {
ret = 0;
}
} else {
DEBUG(0,("Unable to print file to `%s' - %s\n",
- lp_printername(talloc_tos(), snum),
+ lp_printername(talloc_tos(), lp_sub, snum),
ippErrorString(cupsLastError())));
}
int type;
struct printif *current_printif;
TALLOC_CTX *ctx = talloc_tos();
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
fstrcpy( sharename, lp_const_servicename(snum));
lpqcommand = talloc_string_sub2(ctx,
lp_lpq_command(snum),
"%p",
- lp_printername(talloc_tos(), snum),
+ lp_printername(talloc_tos(), lp_sub, snum),
false, false, false);
if (!lpqcommand) {
return;
lprmcommand = talloc_string_sub2(ctx,
lp_lprm_command(snum),
"%p",
- lp_printername(talloc_tos(), snum),
+ lp_printername(talloc_tos(), lp_sub, snum),
false, false, false);
if (!lprmcommand) {
return;
int snum, uint32_t jobid)
{
const char* sharename = lp_const_servicename(snum);
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
struct printjob *pjob;
int result = 0;
struct printif *current_printif = get_printer_fns( snum );
if (pjob->spooled && pjob->sysjob != -1)
{
result = (*(current_printif->job_delete))(
- lp_printername(talloc_tos(), snum),
+ lp_printername(talloc_tos(), lp_sub, snum),
lp_lprm_command(snum),
pjob);
int snum, uint32_t jobid)
{
const char* sharename = lp_const_servicename(snum);
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
struct printjob *pjob;
bool owner;
WERROR werr;
DEBUG(0, ("print job delete denied."
"User name: %s, Printer name: %s.",
uidtoname(server_info->unix_token->uid),
- lp_printername(tmp_ctx, snum)));
+ lp_printername(tmp_ctx, lp_sub, snum)));
werr = WERR_ACCESS_DENIED;
goto err_out;
int snum, uint32_t jobid)
{
const char* sharename = lp_const_servicename(snum);
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
struct printjob *pjob;
int ret = -1;
struct printif *current_printif = get_printer_fns( snum );
DEBUG(0, ("print job pause denied."
"User name: %s, Printer name: %s.",
uidtoname(server_info->unix_token->uid),
- lp_printername(tmp_ctx, snum)));
+ lp_printername(tmp_ctx, lp_sub, snum)));
werr = WERR_ACCESS_DENIED;
goto err_out;
int snum, uint32_t jobid)
{
const char *sharename = lp_const_servicename(snum);
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
struct printjob *pjob;
int ret;
struct printif *current_printif = get_printer_fns( snum );
DEBUG(0, ("print job resume denied."
"User name: %s, Printer name: %s.",
uidtoname(server_info->unix_token->uid),
- lp_printername(tmp_ctx, snum)));
+ lp_printername(tmp_ctx, lp_sub, snum)));
werr = WERR_ACCESS_DENIED;
goto err_out;
uint32_t jobid, enum file_close_type close_type)
{
const char* sharename = lp_const_servicename(snum);
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
struct printjob *pjob;
int ret;
SMB_STRUCT_STAT sbuf;
lpq_cmd = talloc_string_sub2(tmp_ctx,
lp_lpq_command(snum),
"%p",
- lp_printername(talloc_tos(), snum),
+ lp_printername(talloc_tos(), lp_sub, snum),
false, false, false);
if (lpq_cmd == NULL) {
status = NT_STATUS_PRINT_CANCELLED;
{
struct auth_session_info *session_info = NULL;
struct spoolss_PrinterInfo2 *pinfo2 = NULL;
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
int n_services;
int pnum;
int snum;
}
sname = lp_const_servicename(snum);
- pname = lp_printername(session_info, snum);
+ pname = lp_printername(session_info, lp_sub, snum);
/* check printer, but avoid removing non-autoloaded printers */
if (lp_autoloaded(snum) && !pcap_printername_ok(pname)) {
bool ok;
time_t pcap_last_update;
TALLOC_CTX *frame = talloc_stackframe();
+ const struct loadparm_substitution *lp_sub =
+ loadparm_s3_global_substitution();
ok = pcap_cache_loaded(&pcap_last_update);
if (!ok) {
continue;
}
- pname = lp_printername(frame, snum);
+ pname = lp_printername(frame, lp_sub, snum);
/* check printer, but avoid removing non-autoloaded printers */
if (lp_autoloaded(snum) && !pcap_printername_ok(pname)) {