summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-12-13 21:56:34 +0000
committerJim McDonough <jmcd@samba.org>2002-12-13 21:56:34 +0000
commitf201af19250895b278568df91aad58cea247e543 (patch)
tree3fd6ee06465e5426dc0f816a225e1153b5a85cc8 /source3/rpc_server
parentce2b200add7129eb67da18afc7f44f0cf93c33ec (diff)
downloadsamba-f201af19250895b278568df91aad58cea247e543.tar.gz
samba-f201af19250895b278568df91aad58cea247e543.tar.bz2
samba-f201af19250895b278568df91aad58cea247e543.zip
Store printer guid in the dsspooler registry key so we don't have to
query the directory server every time someone asks (This used to be commit dd81003bddc17522041e1cd2f0484e1760493e4a)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c43
1 files changed, 9 insertions, 34 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 0e3d69924b..6dd4352cbc 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -4154,43 +4154,18 @@ static BOOL construct_printer_info_5(PRINTER_INFO_5 *printer, int snum)
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, "");
-#endif
+ if (is_printer_published(snum, &guid)) {
+ asprintf(&guid_str, "{%s}", uuid_string_static(guid));
+ strupper(guid_str);
+ init_unistr(&printer->guid, guid_str);
+ printer->action = SPOOL_DS_PUBLISH;
+ } else {
+ init_unistr(&printer->guid, "");
+ printer->action = SPOOL_DS_UNPUBLISH;
+ }
return True;
}