]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libads: remove unused ads_connect_gc()
authorStefan Metzmacher <metze@samba.org>
Wed, 2 Mar 2016 13:36:14 +0000 (14:36 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 10 Mar 2016 05:52:26 +0000 (06:52 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/libads/ads_proto.h
source3/libads/ldap.c

index 224d9927fe01bed1ff7473ada277ceb7b4ebfee6..1399f41fbf7eab1daee76a9640e24974ad6b0b08 100644 (file)
@@ -66,7 +66,6 @@ bool ads_sitename_match(ADS_STRUCT *ads);
 bool ads_closest_dc(ADS_STRUCT *ads);
 ADS_STATUS ads_connect(ADS_STRUCT *ads);
 ADS_STATUS ads_connect_user_creds(ADS_STRUCT *ads);
-ADS_STATUS ads_connect_gc(ADS_STRUCT *ads);
 void ads_disconnect(ADS_STRUCT *ads);
 ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
                                int scope, const char *expr, const char **attrs,
index 322e7ab119f65608bc3556f9bf73aa803589f47a..028046be4ba57939ae01db145d8d0f42ea2459af 100644 (file)
@@ -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