summaryrefslogtreecommitdiff
path: root/source3/winbindd/idmap_ad.c
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@us.ibm.com>2013-02-21 12:31:41 -0700
committerAndrew Bartlett <abartlet@samba.org>2013-03-09 06:30:22 +0100
commitad1fbe29fbeea48381c7bedd78f7a45d07ad14d5 (patch)
treeb4a9fa08285d908857c8807260627e68f4995bd0 /source3/winbindd/idmap_ad.c
parentbaf9b78d47079b81cf33682ee481cf6e30ed89e9 (diff)
downloadsamba-ad1fbe29fbeea48381c7bedd78f7a45d07ad14d5.tar.gz
samba-ad1fbe29fbeea48381c7bedd78f7a45d07ad14d5.tar.bz2
samba-ad1fbe29fbeea48381c7bedd78f7a45d07ad14d5.zip
s3-winbindd: Move connection to AD server from idmap_ad
Having this in a common place allows reuse by other idmap modules. Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/winbindd/idmap_ad.c')
-rw-r--r--source3/winbindd/idmap_ad.c49
1 files changed, 4 insertions, 45 deletions
diff --git a/source3/winbindd/idmap_ad.c b/source3/winbindd/idmap_ad.c
index 5b9c3774f6..5bafa90299 100644
--- a/source3/winbindd/idmap_ad.c
+++ b/source3/winbindd/idmap_ad.c
@@ -56,58 +56,17 @@ struct idmap_ad_context {
/************************************************************************
***********************************************************************/
-static ADS_STATUS ad_idmap_cached_connection_internal(struct idmap_domain *dom)
+static ADS_STATUS ad_idmap_cached_connection(struct idmap_domain *dom)
{
- struct idmap_ad_context *ctx;
- char *ldap_server, *realm, *password;
- struct winbindd_domain *wb_dom;
+ ADS_STATUS status;
+ struct idmap_ad_context * ctx;
DEBUG(10, ("ad_idmap_cached_connection: called for domain '%s'\n",
dom->name));
ctx = talloc_get_type(dom->private_data, struct idmap_ad_context);
- ads_cached_connection_reuse(&ctx->ads);
- if (ctx->ads != NULL) {
- return ADS_SUCCESS;
- }
-
- /*
- * At this point we only have the NetBIOS domain name.
- * Check if we can get server nam and realm from SAF cache
- * and the domain list.
- */
- ldap_server = saf_fetch(dom->name);
- DEBUG(10, ("ldap_server from saf cache: '%s'\n", ldap_server?ldap_server:""));
-
- wb_dom = find_domain_from_name_noinit(dom->name);
- if (wb_dom == NULL) {
- DEBUG(10, ("find_domain_from_name_noinit did not find domain '%s'\n",
- dom->name));
- realm = NULL;
- } else {
- DEBUG(10, ("find_domain_from_name_noinit found realm '%s' for "
- " domain '%s'\n", wb_dom->alt_name, dom->name));
- realm = wb_dom->alt_name;
- }
-
- /* the machine acct password might have change - fetch it every time */
- password = secrets_fetch_machine_password(lp_workgroup(), NULL, NULL);
- realm = SMB_STRDUP(lp_realm());
-
- return ads_cached_connection_connect(&ctx->ads, realm, dom->name,
- ldap_server, password, realm, 0);
-}
-
-/************************************************************************
- ***********************************************************************/
-
-static ADS_STATUS ad_idmap_cached_connection(struct idmap_domain *dom)
-{
- ADS_STATUS status;
- struct idmap_ad_context * ctx;
-
- status = ad_idmap_cached_connection_internal(dom);
+ status = ads_idmap_cached_connection(&ctx->ads, dom->name);
if (!ADS_ERR_OK(status)) {
return status;
}