diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-07-01 19:23:50 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:58:10 -0500 |
commit | f88e4babab2b3060c235389a71d2e96925237fd0 (patch) | |
tree | 4926607db6babfb2d157fb4748f6d418666388d9 | |
parent | 8e3445c804c139860d3eda3f4a8a688c06a26252 (diff) | |
download | samba-f88e4babab2b3060c235389a71d2e96925237fd0.tar.gz samba-f88e4babab2b3060c235389a71d2e96925237fd0.tar.bz2 samba-f88e4babab2b3060c235389a71d2e96925237fd0.zip |
r8062: Remove some unused code
(This used to be commit fa6cc0bdefe272ec538a71a2b6ba72a724411764)
-rw-r--r-- | source3/libads/ads_ldap.c | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/source3/libads/ads_ldap.c b/source3/libads/ads_ldap.c index 944cb1599c..ae86ef0b76 100644 --- a/source3/libads/ads_ldap.c +++ b/source3/libads/ads_ldap.c @@ -24,135 +24,6 @@ #include "includes.h" #ifdef HAVE_LDAP -/* convert a single name to a sid in a domain */ -NTSTATUS ads_name_to_sid(ADS_STRUCT *ads, - const char *name, - DOM_SID *sid, - enum SID_NAME_USE *type) -{ - const char *attrs[] = {"objectSid", "sAMAccountType", NULL}; - int count; - ADS_STATUS rc; - void *res = NULL; - char *ldap_exp; - uint32 t; - NTSTATUS status = NT_STATUS_UNSUCCESSFUL; - char *escaped_name = escape_ldap_string_alloc(name); - char *escaped_realm = escape_ldap_string_alloc(ads->config.realm); - - if (!escaped_name || !escaped_realm) { - status = NT_STATUS_NO_MEMORY; - goto done; - } - - if (asprintf(&ldap_exp, "(|(sAMAccountName=%s)(userPrincipalName=%s@%s))", - escaped_name, escaped_name, escaped_realm) == -1) { - DEBUG(1,("ads_name_to_sid: asprintf failed!\n")); - status = NT_STATUS_NO_MEMORY; - goto done; - } - - rc = ads_search_retry(ads, &res, ldap_exp, attrs); - free(ldap_exp); - if (!ADS_ERR_OK(rc)) { - DEBUG(1,("name_to_sid ads_search: %s\n", ads_errstr(rc))); - goto done; - } - - count = ads_count_replies(ads, res); - if (count != 1) { - DEBUG(1,("name_to_sid: %s not found\n", name)); - goto done; - } - - if (!ads_pull_sid(ads, res, "objectSid", sid)) { - DEBUG(1,("No sid for %s !?\n", name)); - goto done; - } - - if (!ads_pull_uint32(ads, res, "sAMAccountType", &t)) { - DEBUG(1,("No sAMAccountType for %s !?\n", name)); - goto done; - } - - *type = ads_atype_map(t); - - status = NT_STATUS_OK; - - DEBUG(3,("ads name_to_sid mapped %s\n", name)); - -done: - if (res) ads_msgfree(ads, res); - - SAFE_FREE(escaped_name); - SAFE_FREE(escaped_realm); - - return status; -} - -/* convert a sid to a user or group name */ -NTSTATUS ads_sid_to_name(ADS_STRUCT *ads, - TALLOC_CTX *mem_ctx, - const DOM_SID *sid, - char **name, - enum SID_NAME_USE *type) -{ - const char *attrs[] = {"userPrincipalName", - "sAMAccountName", - "sAMAccountType", NULL}; - ADS_STATUS rc; - void *msg = NULL; - char *ldap_exp = NULL; - char *sidstr = NULL; - uint32 atype; - NTSTATUS status = NT_STATUS_UNSUCCESSFUL; - - if (!(sidstr = sid_binstring(sid))) { - DEBUG(1,("ads_sid_to_name: sid_binstring failed!\n")); - status = NT_STATUS_NO_MEMORY; - goto done; - } - - if (asprintf(&ldap_exp, "(objectSid=%s)", sidstr) == -1) { - DEBUG(1,("ads_sid_to_name: asprintf failed!\n")); - status = NT_STATUS_NO_MEMORY; - goto done; - } - - rc = ads_search_retry(ads, &msg, ldap_exp, attrs); - if (!ADS_ERR_OK(rc)) { - status = ads_ntstatus(rc); - DEBUG(1,("ads_sid_to_name ads_search: %s\n", ads_errstr(rc))); - goto done; - } - - if (!ads_pull_uint32(ads, msg, "sAMAccountType", &atype)) { - goto done; - } - - *name = ads_pull_username(ads, mem_ctx, msg); - if (!*name) { - DEBUG(1,("ads_sid_to_name: ads_pull_username retuned NULL!\n")); - status = NT_STATUS_NO_MEMORY; - goto done; - } - - *type = ads_atype_map(atype); - - status = NT_STATUS_OK; - - DEBUG(3,("ads sid_to_name mapped %s\n", *name)); - -done: - if (msg) ads_msgfree(ads, msg); - - SAFE_FREE(ldap_exp); - SAFE_FREE(sidstr); - - return status; -} - - /* convert a sid to a DN */ ADS_STATUS ads_sid_to_dn(ADS_STRUCT *ads, |