summaryrefslogtreecommitdiffstats
path: root/source/libads/ldap.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-20 23:35:14 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-20 23:35:14 +0000
commitff002a458afa6ca378f0c6d2ec9fb74233c839a7 (patch)
tree60877d5fa197766f04ef2248430e6d66652acb87 /source/libads/ldap.c
parent0bea6cf79a44f79fa3a4f2c8381e898e79c66509 (diff)
downloadsamba-ff002a458afa6ca378f0c6d2ec9fb74233c839a7.tar.gz
samba-ff002a458afa6ca378f0c6d2ec9fb74233c839a7.tar.xz
samba-ff002a458afa6ca378f0c6d2ec9fb74233c839a7.zip
added ads_domain_sid() function
Diffstat (limited to 'source/libads/ldap.c')
-rw-r--r--source/libads/ldap.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/libads/ldap.c b/source/libads/ldap.c
index d2b9f74c4d6..8966ceb32a9 100644
--- a/source/libads/ldap.c
+++ b/source/libads/ldap.c
@@ -680,4 +680,22 @@ ADS_STATUS ads_trusted_domains(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
return ADS_SUCCESS;
}
+/* find the domain sid for our domain */
+ADS_STATUS ads_domain_sid(ADS_STRUCT *ads, DOM_SID *sid)
+{
+ const char *attrs[] = {"objectSid", NULL};
+ void *res;
+ ADS_STATUS rc;
+
+ rc = ads_do_search(ads, ads->bind_path, LDAP_SCOPE_BASE, "(objectclass=*)",
+ attrs, &res);
+ if (!ADS_ERR_OK(rc)) return rc;
+ if (!ads_pull_sid(ads, res, "objectSid", sid)) {
+ return ADS_ERROR_SYSTEM(ENOENT);
+ }
+ ads_msgfree(ads, res);
+
+ return ADS_SUCCESS;
+}
+
#endif