summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_spoolss_nt.c
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-12-13 19:01:27 +0000
committerJim McDonough <jmcd@samba.org>2002-12-13 19:01:27 +0000
commit81a2a307392a12e5ec464e524d2948611e23b943 (patch)
tree5c5ed8973d98d535b5553f2a4f84307a8a3f03c0 /source3/rpc_server/srv_spoolss_nt.c
parent899b6e6d0facd1ef5865ce550fadd292514955d6 (diff)
downloadsamba-81a2a307392a12e5ec464e524d2948611e23b943.tar.gz
samba-81a2a307392a12e5ec464e524d2948611e23b943.tar.bz2
samba-81a2a307392a12e5ec464e524d2948611e23b943.zip
More printer publishing code.
- Add published attribute to info2, needed for win clients to work properly - Return proper info on getprinter 7 This means you can now look at the sharing tab of a printer and get correct info about whether it is published or not, and change it. (This used to be commit d57bddc9b22e809c79294c7eacbd5d0f115fe990)
Diffstat (limited to 'source3/rpc_server/srv_spoolss_nt.c')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c46
1 files changed, 41 insertions, 5 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index fd22330449..0e3d69924b 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -4148,14 +4148,50 @@ static BOOL construct_printer_info_5(PRINTER_INFO_5 *printer, int snum)
}
/********************************************************************
- * construct_printer_info_5
- * fill a printer_info_5 struct
+ * construct_printer_info_7
+ * fill a printer_info_7 struct
********************************************************************/
-static BOOL construct_printer_info_7(PRINTER_INFO_7 *printer)
+static BOOL construct_printer_info_7(PRINTER_INFO_7 *printer, int snum)
{
+#ifdef HAVE_ADS
+ char *guid_str = NULL;
+ GUID guid;
+ ADS_STRUCT *ads;
+ ADS_STATUS ads_rc;
+ void *res = NULL;
+ char *prt_dn;
+ const char *attrs[] = {"objectGUID", NULL};
+
+ printer->action = SPOOL_DS_UNPUBLISH;
+
+ ads = ads_init(NULL, NULL, lp_ads_server());
+ ads_rc = ads_connect(ads);
+ ads_rc = ads_find_printer_on_server(ads, &res, lp_servicename(snum),
+ global_myname());
+ if (ADS_ERR_OK(ads_rc) && ads_count_replies(ads, res)) {
+ prt_dn = ads_get_dn(ads, res);
+ ads_msgfree(ads, res);
+ if (prt_dn &&
+ ADS_ERR_OK(ads_search_dn(ads, &res, prt_dn, attrs))) {
+ ads_rc = ads_search_dn(ads, &res, prt_dn, attrs);
+ ads_memfree(ads, prt_dn);
+ ads_pull_guid(ads, res, &guid);
+ printer->action = SPOOL_DS_PUBLISH;
+ }
+ }
+
+ ads_msgfree(ads, res);
+
+ asprintf(&guid_str, "{%s}", uuid_string_static(guid));
+ strupper(guid_str);
+ init_unistr(&printer->guid, guid_str);
+
+#else
+ printer->action = SPOOL_DS_UNPUBLISH;
init_unistr(&printer->guid, "");
- printer->action = 0;
+#endif
+
return True;
}
@@ -4722,7 +4758,7 @@ static WERROR getprinter_level_7(int snum, NEW_BUFFER *buffer, uint32 offered, u
if((printer=(PRINTER_INFO_7*)malloc(sizeof(PRINTER_INFO_7)))==NULL)
return WERR_NOMEM;
- if (!construct_printer_info_7(printer))
+ if (!construct_printer_info_7(printer, snum))
return WERR_NOMEM;
/* check the required size. */