summaryrefslogtreecommitdiff
path: root/source3/libads/ldap.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2016-03-02 14:36:14 +0100
committerStefan Metzmacher <metze@samba.org>2016-03-10 06:52:26 +0100
commitcd8af25d4bf87a9156cb2afb3dd206c68b1bedd7 (patch)
tree19fc1bf23f8cf48062cde98ae76cb7c8599dbbd5 /source3/libads/ldap.c
parent960b0adfb398eeabd48213393bc560654baeed5b (diff)
downloadsamba-cd8af25d4bf87a9156cb2afb3dd206c68b1bedd7.tar.gz
s3:libads: remove unused ads_connect_gc()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Günther Deschner <gd@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/libads/ldap.c')
-rw-r--r--source3/libads/ldap.c134
1 files changed, 0 insertions, 134 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 322e7ab119f..028046be4ba 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -553,140 +553,6 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads)
c_realm, c_domain, nt_errstr(status)));
return status;
}
-
-/*********************************************************************
- *********************************************************************/
-
-static NTSTATUS ads_lookup_site(void)
-{
- ADS_STRUCT *ads = NULL;
- ADS_STATUS ads_status;
- NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
-
- ads = ads_init(lp_realm(), NULL, NULL);
- if (!ads) {
- return NT_STATUS_NO_MEMORY;
- }
-
- /* The NO_BIND here will find a DC and set the client site
- but not establish the TCP connection */
-
- ads->auth.flags = ADS_AUTH_NO_BIND;
- ads_status = ads_connect(ads);
- if (!ADS_ERR_OK(ads_status)) {
- DEBUG(4, ("ads_lookup_site: ads_connect to our realm failed! (%s)\n",
- ads_errstr(ads_status)));
- }
- nt_status = ads_ntstatus(ads_status);
-
- if (ads) {
- ads_destroy(&ads);
- }
-
- return nt_status;
-}
-
-/*********************************************************************
- *********************************************************************/
-
-static const char* host_dns_domain(const char *fqdn)
-{
- const char *p = fqdn;
-
- /* go to next char following '.' */
-
- if ((p = strchr_m(fqdn, '.')) != NULL) {
- p++;
- }
-
- return p;
-}
-
-
-/**
- * Connect to the Global Catalog server
- * @param ads Pointer to an existing ADS_STRUCT
- * @return status of connection
- *
- * Simple wrapper around ads_connect() that fills in the
- * GC ldap server information
- **/
-
-ADS_STATUS ads_connect_gc(ADS_STRUCT *ads)
-{
- TALLOC_CTX *frame = talloc_stackframe();
- struct dns_rr_srv *gcs_list;
- int num_gcs;
- const char *realm = ads->server.realm;
- NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
- ADS_STATUS ads_status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
- int i;
- bool done = false;
- char *sitename = NULL;
-
- if (!realm)
- realm = lp_realm();
-
- if ((sitename = sitename_fetch(frame, realm)) == NULL) {
- ads_lookup_site();
- sitename = sitename_fetch(frame, realm);
- }
-
- do {
- /* We try once with a sitename and once without
- (unless we don't have a sitename and then we're
- done */
-
- if (sitename == NULL)
- done = true;
-
- nt_status = ads_dns_query_gcs(frame,
- realm,
- sitename,
- &gcs_list,
- &num_gcs);
-
- if (!NT_STATUS_IS_OK(nt_status)) {
- ads_status = ADS_ERROR_NT(nt_status);
- goto done;
- }
-
- /* Loop until we get a successful connection or have gone
- through them all. When connecting a GC server, make sure that
- the realm is the server's DNS name and not the forest root */
-
- for (i=0; i<num_gcs; i++) {
- ads->server.gc = true;
- ads->server.ldap_server = SMB_STRDUP(gcs_list[i].hostname);
- ads->server.realm = SMB_STRDUP(host_dns_domain(ads->server.ldap_server));
- ads_status = ads_connect(ads);
- if (ADS_ERR_OK(ads_status)) {
- /* Reset the bind_dn to "". A Global Catalog server
- may host multiple domain trees in a forest.
- Windows 2003 GC server will accept "" as the search
- path to imply search all domain trees in the forest */
-
- SAFE_FREE(ads->config.bind_path);
- ads->config.bind_path = SMB_STRDUP("");
-
-
- goto done;
- }
- SAFE_FREE(ads->server.ldap_server);
- SAFE_FREE(ads->server.realm);
- }
-
- TALLOC_FREE(gcs_list);
- num_gcs = 0;
- } while (!done);
-
-done:
- talloc_destroy(frame);
-
- return ads_status;
-}
-
-
/**
* Connect to the LDAP server
* @param ads Pointer to an existing ADS_STRUCT