summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2010-04-26 17:34:24 -0400
committerSimo Sorce <idra@samba.org>2010-07-27 10:27:10 -0400
commit44bc6714b0c5f40eb73def532b3074a4b19f6df4 (patch)
tree60020c8ad107e97be406c26be6fc9948e94c76be /source3/rpc_server
parentd17d73f4be6938b942f1eed875c6dd629d8bec88 (diff)
downloadsamba-44bc6714b0c5f40eb73def532b3074a4b19f6df4.tar.gz
samba-44bc6714b0c5f40eb73def532b3074a4b19f6df4.tar.bz2
samba-44bc6714b0c5f40eb73def532b3074a4b19f6df4.zip
s3-printing: Converted printer publishing functions.
Use spoolss_PrintInfo2 and winreg calls. Signed-off-by: Jim McDonough <jmcd@samba.org>
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index ab1678ffef..6c1eab4168 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -3706,9 +3706,19 @@ static WERROR construct_printer_info7(TALLOC_CTX *mem_ctx,
struct spoolss_PrinterInfo7 *r,
int snum)
{
+ struct auth_serversupplied_info *server_info;
struct GUID guid;
+ NTSTATUS status;
+
+ status = make_server_info_system(mem_ctx, &server_info);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("construct_printer_info7: "
+ "Could not create system server_info\n"));
+ return WERR_NOMEM;
+ }
- if (is_printer_published(print_hnd, snum, &guid)) {
+ if (is_printer_published(mem_ctx, server_info, print_hnd->servername,
+ lp_servicename(snum), &guid, NULL)) {
r->guid = talloc_strdup_upper(mem_ctx, GUID_string2(mem_ctx, &guid));
r->action = DSPRINT_PUBLISH;
} else {
@@ -3717,6 +3727,7 @@ static WERROR construct_printer_info7(TALLOC_CTX *mem_ctx,
}
W_ERROR_HAVE_NO_MEMORY(r->guid);
+ TALLOC_FREE(server_info);
return WERR_OK;
}
@@ -5746,6 +5757,8 @@ static WERROR publish_or_unpublish_printer(pipes_struct *p,
struct spoolss_SetPrinterInfo7 *info7)
{
#ifdef HAVE_ADS
+ struct spoolss_PrinterInfo2 *pinfo2 = NULL;
+ WERROR result;
int snum;
Printer_entry *Printer;
@@ -5763,8 +5776,16 @@ static WERROR publish_or_unpublish_printer(pipes_struct *p,
if (!get_printer_snum(p, handle, &snum, NULL))
return WERR_BADFID;
- nt_printer_publish(Printer, snum, info7->action);
+ result = winreg_get_printer(p->mem_ctx, p->server_info,
+ Printer->servername,
+ lp_servicename(snum), &pinfo2);
+ if (!W_ERROR_IS_OK(result)) {
+ return WERR_BADFID;
+ }
+
+ nt_printer_publish(pinfo2, p->server_info, pinfo2, info7->action);
+ TALLOC_FREE(pinfo2);
return WERR_OK;
#else
return WERR_UNKNOWN_LEVEL;