diff options
author | Günther Deschner <gd@samba.org> | 2010-03-26 13:17:49 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-03-26 14:36:46 +0100 |
commit | 3da91b786ef87bd13ae1210a1bf671e2209d9c1f (patch) | |
tree | b6ecdc06ee099325aa3762a3f02bde009ff2a4d6 /source3/printing/print_cups.c | |
parent | 772839640e11664e1b1304d7f95146613d6ac1ac (diff) | |
download | samba-3da91b786ef87bd13ae1210a1bf671e2209d9c1f.tar.gz |
s3-printing: avoid mixing cups backend code with nt_printing code in cups_pull_comment_location.
Guenther
Diffstat (limited to 'source3/printing/print_cups.c')
-rw-r--r-- | source3/printing/print_cups.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index 5c023edf492..6735f14f703 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -1631,7 +1631,10 @@ struct printif cups_printif = cups_job_submit, }; -bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer) +bool cups_pull_comment_location(TALLOC_CTX *mem_ctx, + const char *printername, + char **comment, + char **location) { TALLOC_CTX *frame = talloc_stackframe(); http_t *http = NULL; /* HTTP connection to server */ @@ -1652,7 +1655,7 @@ bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer) bool ret = False; size_t size; - DEBUG(5, ("pulling %s location\n", printer->sharename)); + DEBUG(5, ("pulling %s location\n", printername)); /* * Make sure we don't ask for passwords... @@ -1691,7 +1694,7 @@ bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer) if (server) { goto out; } - if (!push_utf8_talloc(frame, &sharename, printer->sharename, &size)) { + if (!push_utf8_talloc(frame, &sharename, printername, &size)) { goto out; } slprintf(uri, sizeof(uri) - 1, "ipp://%s/printers/%s", @@ -1743,40 +1746,30 @@ bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer) /* Grab the comment if we don't have one */ if ( (strcmp(attr->name, "printer-info") == 0) - && (attr->value_tag == IPP_TAG_TEXT) - && !strlen(printer->comment) ) + && (attr->value_tag == IPP_TAG_TEXT)) { - char *comment = NULL; - if (!pull_utf8_talloc(frame, - &comment, + if (!pull_utf8_talloc(mem_ctx, + comment, attr->values[0].string.text, &size)) { goto out; } DEBUG(5,("cups_pull_comment_location: Using cups comment: %s\n", - comment)); - strlcpy(printer->comment, - comment, - sizeof(printer->comment)); + *comment)); } /* Grab the location if we don't have one */ if ( (strcmp(attr->name, "printer-location") == 0) - && (attr->value_tag == IPP_TAG_TEXT) - && !strlen(printer->location) ) + && (attr->value_tag == IPP_TAG_TEXT)) { - char *location = NULL; - if (!pull_utf8_talloc(frame, - &location, + if (!pull_utf8_talloc(mem_ctx, + location, attr->values[0].string.text, &size)) { goto out; } DEBUG(5,("cups_pull_comment_location: Using cups location: %s\n", - location)); - strlcpy(printer->location, - location, - sizeof(printer->location)); + *location)); } attr = attr->next; |