From 401c7495ea0286a46c97a18273419f122d1168a7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 20 Dec 2001 23:35:14 +0000 Subject: added ads_domain_sid() function (This used to be commit ff002a458afa6ca378f0c6d2ec9fb74233c839a7) --- source3/libads/ldap.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source3/libads/ldap.c') diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index d2b9f74c4d..8966ceb32a 100644 --- a/source3/libads/ldap.c +++ b/source3/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 -- cgit