[SCM] Samba Shared Repository - branch v3-3-stable updated - release-3-3-0rc1-157-g6dc46a0

Karolin Seeger kseeger at samba.org
Mon Dec 15 08:12:33 GMT 2008


The branch, v3-3-stable has been updated
       via  6dc46a003865d7f59a32de2c470ad3c21f8ae86c (commit)
       via  2b5958164134bffa74d835b884b8a2e9309e1ae9 (commit)
       via  ce7d58a8a8626300b4b6861e54cf23db526b0e8b (commit)
       via  83961fe48051d1c70c62a6eb72cd048305710cfb (commit)
       via  9725ffc9e60bb598f6d544ebd166ea29d528f5fa (commit)
       via  a27fb2d8d66883762e8e85e573eefbb155ddccd7 (commit)
       via  dca9cd5e06dc3dc3109671f99b22862f4aaa3dad (commit)
       via  45de61f9b3a2713e2e27178cc336e25c1fc1b15a (commit)
       via  91cf9a3cb068b9ccc31e7e7ea659e0d467277398 (commit)
       via  be06858f9174c0b97506ee85c40848a57aeaaca7 (commit)
       via  ca86e6ae361434e9ecc8bff76cf670806886beac (commit)
       via  e0983f0d93b0a6f5c2588609ebfa2e981dce0cfc (commit)
       via  8df2422c7a1654db44c33bd871d13da1a531079d (commit)
      from  807365d2cb15ea468e53449023299d17914b68dc (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-stable


- Log -----------------------------------------------------------------
commit 6dc46a003865d7f59a32de2c470ad3c21f8ae86c
Author: Karolin Seeger <kseeger at samba.org>
Date:   Mon Dec 15 09:10:11 2008 +0100

    WHATSNEW: Update changes since 3.3.0rc1.
    
    Karolin
    (cherry picked from commit 34f96b0cdcee3a8ab6612313e70b682f2aa29538)

commit 2b5958164134bffa74d835b884b8a2e9309e1ae9
Author: Karolin Seeger <kseeger at samba.org>
Date:   Mon Dec 15 08:59:11 2008 +0100

    VERSION: Change version to 3.3.0rc2.
    
    Karolin

commit ce7d58a8a8626300b4b6861e54cf23db526b0e8b
Author: Herb Lewis <herb at samba.org>
Date:   Sat Dec 13 12:18:15 2008 -0800

    don't return 0 on error - bad for scripts
    (cherry picked from commit 79d68083411e9119933dbf5c850cb78f47e6f553)

commit 83961fe48051d1c70c62a6eb72cd048305710cfb
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Nov 21 08:28:13 2008 +0100

    s3:dsgetdcname: retry with the clients site
    
    metze
    (cherry picked from commit 1b7b0e924f3064a9774fd5d46bedc3d342b39ddb)
    (cherry picked from commit f7a811f2ae3572791035014b6e20410b07ea011e)

commit 9725ffc9e60bb598f6d544ebd166ea29d528f5fa
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Nov 21 08:22:38 2008 +0100

    s3:libnet_join: use DS_FORCE_REDISCOVERY
    
    metze
    (cherry picked from commit 2bb91392b46e347fe3b6803d10b10d8b40e4a4a6)
    (cherry picked from commit 134893ef2b12b4b039c717588a8172613f6d1955)

commit a27fb2d8d66883762e8e85e573eefbb155ddccd7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Oct 27 19:40:23 2008 +0100

    s3:libnet_join: call saf_join_store() after a the join.
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Günther Deschner <gd at samba.org>
    (similar to commit feef594d275881466e2c3f59c0ff54609a9cc53b)
    (cherry picked from commit 6a993cb333675f4079d439fa334edee2df604933)
    (cherry picked from commit 8314ce63ff77f0472d4249adcea87123b3b3f5c2)

commit dca9cd5e06dc3dc3109671f99b22862f4aaa3dad
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Oct 27 19:39:30 2008 +0100

    s3:libads/ldap.c: store the dc name in the saf cache as in all other places
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit 543fa85a711337e979c7b631bda5db95d109ef59)
    (cherry picked from commit 17efebde11eafd065c2cac39cdbe55b8d40d40be)
    (cherry picked from commit 9e78bfdbe107519f2ddfa4d532771945a7691b46)

commit 45de61f9b3a2713e2e27178cc336e25c1fc1b15a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Oct 27 19:38:15 2008 +0100

    s3:libads/ldap.c: if the client belongs to no site at all any dc is the closest
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit f86ef9b53a903485deba94febf90dd4e657cc02b)
    (cherry picked from commit a8040d59659e58c5cb92c1107a7ff012eff12729)
    (cherry picked from commit 7baceea20252dec6b64e86ec8b5a73b62b373758)

commit 91cf9a3cb068b9ccc31e7e7ea659e0d467277398
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Oct 27 19:36:25 2008 +0100

    s3:libads/ldap.c: pass the real workgroup name to get_dc_name()
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit c2d4a84abe1b6cbf68d6e9f1bb1f8974d0b628fc)
    (cherry picked from commit 2f27ffc4a2ba745341a5961b8f04e62da3fb089a)
    (cherry picked from commit 132911954715bfa6df8566c0fb382ef07a7da96e)

commit be06858f9174c0b97506ee85c40848a57aeaaca7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Oct 27 19:31:30 2008 +0100

    s3:libsmb/namequery.c: add saf_join_store() function
    
    saf_join_store() should be called after a successful
    domain join, the affinity to the dc used at join time
    has a larger ttl, to avoid problems with delayed replication.
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit 80e74a27c55c01221091e3eec930c2ac4433c22c)
    (cherry picked from commit 895c40d03a07182c054a6fd857e7dd6838e698f4)
    (cherry picked from commit 7b56268b3c9652e3089bd75e4e51dd626fa742a6)

commit ca86e6ae361434e9ecc8bff76cf670806886beac
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Oct 27 09:40:25 2008 +0100

    s3: libsmb/namequery: fallback to returning all dcs, when none is available in the requested site
    
    It could happen that all dcs in a site are unavailable
    (some sites have only one dc) and then we need to fallback
    to get all dcs.
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit c127367b1dd622eeceb1f47de0a047c297dda222)
    (cherry picked from commit 0c43f96330f2935805ba4f0f8f858a027a90bc4c)
    (cherry picked from commit caaf59383ceabdc555f7db098dae0455dea65023)

commit e0983f0d93b0a6f5c2588609ebfa2e981dce0cfc
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Oct 22 11:14:10 2008 +0200

    s3: libads: use get_dc_name() instead of get_sorted_dc_list() in the LDAP case
    
    We use get_dc_name() for LDAP because it generates the selfwritten
    krb5.conf with the correct kdc addresses and sets KRB5_CONFIG.
    
    For CLDAP we need to use get_sorted_dc_list() to avoid recursion.
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit d2f7f81f4d61bae9c4be65cbc1bf962b6c24a31f)
    (cherry picked from commit 7f779450cb0b0d9f36665c56c4acd0950daaeab2)
    (cherry picked from commit 95c9a0272a72c029d75c3ffd1b5fad360b30f139)

commit 8df2422c7a1654db44c33bd871d13da1a531079d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Oct 22 10:36:21 2008 +0200

    s3: correctly detect if the current dc is the closest one
    
    ads->config.tried_closest_dc was never set.
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit dfe5b00db35e1e7c7bb3ba36729fc3f97eb48db3)
    (cherry picked from commit 588f5aae669910fee6da7f807f330163496b4170)
    (cherry picked from commit b609f41baa035a15dafb18b2ec569a2b96968b17)

-----------------------------------------------------------------------

Summary of changes:
 WHATSNEW.txt                |    4 ++
 source/VERSION              |    2 +-
 source/include/ads.h        |    1 -
 source/include/proto.h      |    1 +
 source/libads/ldap.c        |   45 +++++++++++++++++++++++--
 source/libads/ndr.c         |    1 -
 source/libnet/libnet_join.c |    6 +++-
 source/libsmb/dsgetdcname.c |   49 ++++++++++++++++++++++++---
 source/libsmb/namequery.c   |   77 +++++++++++++++++++++++++++++++++++++++++--
 source/utils/net_ads.c      |    2 +-
 source/utils/smbcacls.c     |    2 +
 11 files changed, 172 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 50d62da..b5aac3f 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -201,6 +201,7 @@ o   Steve French <stevef at smf-t60p.smfdom>
 
 o   SATOH Fumiyasu <fumiyas at osstech.co.jp>
     * BUG 5688: LPQ process is orphaned if socket address parameter is invalid.
+    * Vars for signals must be volatile sig_atomic_t.
 
 
 o   Henning Henkel <henning.henkel at fh-furtwangen.de>
@@ -219,6 +220,8 @@ o   Jeff Layton <jlayton at redhat.com>
 o   Volker Lendecke <vl at samba.org>
     * Fix crash bug when freeing a non-malloc'ed buffer if the client sends a
       non-encrypted packet with the crypto state set.
+    * Fix error code when smbclient puts a file over an existing directory.
+    * Pass the get_real_filename operation through the VFS.
 
 
 o   Stefan Metzmacher <metze at samba.org>
@@ -226,6 +229,7 @@ o   Stefan Metzmacher <metze at samba.org>
     * Fix several issues concerning Alternate Data Streams.
     * Fix valgrind bug lp_parm_const_string().
     * Fix setting of trust passwords using 'net rpc trustdom add'.
+    * Correctly detect if the current dc is the closest one.
 
 
 o   Tim Prouty <tprouty at samba.org>
diff --git a/source/VERSION b/source/VERSION
index 16b5de4..01af455 100644
--- a/source/VERSION
+++ b/source/VERSION
@@ -56,7 +56,7 @@ SAMBA_VERSION_PRE_RELEASE=
 # e.g. SAMBA_VERSION_RC_RELEASE=1                      #
 #  ->  "3.0.0rc1"                                      #
 ########################################################
-SAMBA_VERSION_RC_RELEASE=
+SAMBA_VERSION_RC_RELEASE=2
 
 ########################################################
 # To mark SVN snapshots this should be set to 'yes'    #
diff --git a/source/include/ads.h b/source/include/ads.h
index b72d250..abff9ea 100644
--- a/source/include/ads.h
+++ b/source/include/ads.h
@@ -80,7 +80,6 @@ typedef struct ads_struct {
 		char *server_site_name;
 		char *client_site_name;
 		time_t current_time;
-		int tried_closest_dc;
 		char *schema_path;
 		char *config_path;
 	} config;
diff --git a/source/include/proto.h b/source/include/proto.h
index 9d0b190..f6b1906 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -4742,6 +4742,7 @@ bool namecache_status_fetch(const char *keyname,
 /* The following definitions come from libsmb/namequery.c  */
 
 bool saf_store( const char *domain, const char *servername );
+bool saf_join_store( const char *domain, const char *servername );
 bool saf_delete( const char *domain );
 char *saf_fetch( const char *domain );
 NODE_STATUS_STRUCT *node_status_query(int fd,
diff --git a/source/libads/ldap.c b/source/libads/ldap.c
index 38f3ab9..215a310 100644
--- a/source/libads/ldap.c
+++ b/source/libads/ldap.c
@@ -162,6 +162,11 @@ bool ads_closest_dc(ADS_STRUCT *ads)
 		return True;
 	}
 
+	if (ads->config.client_site_name == NULL) {
+		DEBUG(10,("ads_closest_dc: client belongs to no site\n"));
+		return True;
+	}
+
 	DEBUG(10,("ads_closest_dc: %s is not the closest DC\n", 
 		ads->config.ldap_server_name));
 
@@ -267,10 +272,12 @@ static bool ads_try_connect(ADS_STRUCT *ads, const char *server, bool gc)
 
 static NTSTATUS ads_find_dc(ADS_STRUCT *ads)
 {
+	const char *c_domain;
 	const char *c_realm;
 	int count, i=0;
 	struct ip_service *ip_list;
 	const char *realm;
+	const char *domain;
 	bool got_realm = False;
 	bool use_own_domain = False;
 	char *sitename;
@@ -308,13 +315,44 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads)
 		return NT_STATUS_INVALID_PARAMETER; /* rather need MISSING_PARAMETER ... */
 	}
 
+	if ( use_own_domain ) {
+		c_domain = lp_workgroup();
+	} else {
+		c_domain = ads->server.workgroup;
+	}
+
 	realm = c_realm;
+	domain = c_domain;
+
+	/*
+	 * In case of LDAP we use get_dc_name() as that
+	 * creates the custom krb5.conf file
+	 */
+	if (!(ads->auth.flags & ADS_AUTH_NO_BIND)) {
+		fstring srv_name;
+		struct sockaddr_storage ip_out;
+
+		DEBUG(6,("ads_find_dc: (ldap) looking for %s '%s'\n",
+			(got_realm ? "realm" : "domain"), realm));
+
+		if (get_dc_name(domain, realm, srv_name, &ip_out)) {
+			/*
+			 * we call ads_try_connect() to fill in the
+			 * ads->config details
+			 */
+			if (ads_try_connect(ads, srv_name, false)) {
+				return NT_STATUS_OK;
+			}
+		}
+
+		return NT_STATUS_NO_LOGON_SERVERS;
+	}
 
 	sitename = sitename_fetch(realm);
 
  again:
 
-	DEBUG(6,("ads_find_dc: looking for %s '%s'\n",
+	DEBUG(6,("ads_find_dc: (cldap) looking for %s '%s'\n",
 		(got_realm ? "realm" : "domain"), realm));
 
 	status = get_sorted_dc_list(realm, sitename, &ip_list, &count, got_realm);
@@ -613,9 +651,8 @@ got_connection:
 
 	/* cache the successful connection for workgroup and realm */
 	if (ads_closest_dc(ads)) {
-		print_sockaddr(addr, sizeof(addr), &ads->ldap.ss);
-		saf_store( ads->server.workgroup, addr);
-		saf_store( ads->server.realm, addr);
+		saf_store( ads->server.workgroup, ads->config.ldap_server_name);
+		saf_store( ads->server.realm, ads->config.ldap_server_name);
 	}
 
 	ldap_set_option(ads->ldap.ld, LDAP_OPT_PROTOCOL_VERSION, &version);
diff --git a/source/libads/ndr.c b/source/libads/ndr.c
index 6324a22..6ada66c 100644
--- a/source/libads/ndr.c
+++ b/source/libads/ndr.c
@@ -75,7 +75,6 @@ void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct
 	ndr_print_string(ndr, "server_site_name", r->config.server_site_name);
 	ndr_print_string(ndr, "client_site_name", r->config.client_site_name);
 	ndr_print_time_t(ndr, "current_time", r->config.current_time);
-	ndr_print_bool(ndr, "tried_closest_dc", r->config.tried_closest_dc);
 	ndr_print_string(ndr, "schema_path", r->config.schema_path);
 	ndr_print_string(ndr, "config_path", r->config.config_path);
 	ndr->depth--;
diff --git a/source/libnet/libnet_join.c b/source/libnet/libnet_join.c
index d53cb68..8abd317 100644
--- a/source/libnet/libnet_join.c
+++ b/source/libnet/libnet_join.c
@@ -1521,7 +1521,10 @@ static WERROR libnet_join_post_processing(TALLOC_CTX *mem_ctx,
 		return WERR_OK;
 	}
 
-	saf_store(r->in.domain_name, r->in.dc_name);
+	saf_join_store(r->out.netbios_domain_name, r->in.dc_name);
+	if (r->out.dns_domain_name) {
+		saf_join_store(r->out.dns_domain_name, r->in.dc_name);
+	}
 
 #ifdef WITH_ADS
 	if (r->out.domain_is_ad) {
@@ -1752,6 +1755,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
 				     r->in.domain_name,
 				     NULL,
 				     NULL,
+				     DS_FORCE_REDISCOVERY |
 				     DS_DIRECTORY_SERVICE_REQUIRED |
 				     DS_WRITABLE_REQUIRED |
 				     DS_RETURN_DNS_NAME,
diff --git a/source/libsmb/dsgetdcname.c b/source/libsmb/dsgetdcname.c
index 41a26cb..19c8360 100644
--- a/source/libsmb/dsgetdcname.c
+++ b/source/libsmb/dsgetdcname.c
@@ -1119,6 +1119,27 @@ static NTSTATUS dsgetdcname_rediscover(TALLOC_CTX *mem_ctx,
 				  num_dcs, info);
 }
 
+static bool is_closest_site(struct netr_DsRGetDCNameInfo *info)
+{
+	if (info->dc_flags & DS_SERVER_CLOSEST) {
+		return true;
+	}
+
+	if (!info->client_site_name) {
+		return true;
+	}
+
+	if (!info->dc_site_name) {
+		return false;
+	}
+
+	if (strcmp(info->client_site_name, info->dc_site_name) == 0) {
+		return true;
+	}
+
+	return false;
+}
+
 /********************************************************************
  dsgetdcname.
 
@@ -1136,6 +1157,8 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
 	NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
 	struct netr_DsRGetDCNameInfo *myinfo = NULL;
 	char *query_site = NULL;
+	bool first = true;
+	struct netr_DsRGetDCNameInfo *first_info = NULL;
 
 	DEBUG(10,("dsgetdcname: domain_name: %s, "
 		  "domain_guid: %s, site_name: %s, flags: 0x%08x\n",
@@ -1163,7 +1186,6 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
 	status = dsgetdcname_cached(mem_ctx, msg_ctx, domain_name, domain_guid,
 				    flags, query_site, &myinfo);
 	if (NT_STATUS_IS_OK(status)) {
-		*info = myinfo;
 		goto done;
 	}
 
@@ -1176,12 +1198,27 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
 					domain_guid, flags, query_site,
 					&myinfo);
 
- 	if (NT_STATUS_IS_OK(status)) {
-		*info = myinfo;
-	}
-
  done:
 	SAFE_FREE(query_site);
 
-	return status;
+	if (!NT_STATUS_IS_OK(status)) {
+		if (!first) {
+			*info = first_info;
+			return NT_STATUS_OK;
+		}
+		return status;
+	}
+
+	if (!first) {
+		TALLOC_FREE(first_info);
+	} else if (!is_closest_site(myinfo)) {
+		first = false;
+		first_info = myinfo;
+		/* TODO: may use the next_closest_site here */
+		query_site = SMB_STRDUP(myinfo->client_site_name);
+		goto rediscover;
+	}
+
+	*info = myinfo;
+	return NT_STATUS_OK;
 }
diff --git a/source/libsmb/namequery.c b/source/libsmb/namequery.c
index 5945683..112df1b 100644
--- a/source/libsmb/namequery.c
+++ b/source/libsmb/namequery.c
@@ -34,6 +34,8 @@ bool global_in_nmbd = False;
 ****************************************************************************/
 #define SAFKEY_FMT	"SAF/DOMAIN/%s"
 #define SAF_TTL		900
+#define SAFJOINKEY_FMT	"SAFJOIN/DOMAIN/%s"
+#define SAFJOIN_TTL	3600
 
 static char *saf_key(const char *domain)
 {
@@ -44,6 +46,15 @@ static char *saf_key(const char *domain)
 	return keystr;
 }
 
+static char *saf_join_key(const char *domain)
+{
+	char *keystr;
+
+	asprintf_strupper_m(&keystr, SAFJOINKEY_FMT, domain);
+
+	return keystr;
+}
+
 /****************************************************************************
 ****************************************************************************/
 
@@ -69,7 +80,7 @@ bool saf_store( const char *domain, const char *servername )
 		return False;
 
 	key = saf_key( domain );
-	expire = time( NULL ) + SAF_TTL;
+	expire = time( NULL ) + lp_parm_int(-1, "saf","ttl", SAF_TTL);
 
 	DEBUG(10,("saf_store: domain = [%s], server = [%s], expire = [%u]\n",
 		domain, servername, (unsigned int)expire ));
@@ -81,6 +92,38 @@ bool saf_store( const char *domain, const char *servername )
 	return ret;
 }
 
+bool saf_join_store( const char *domain, const char *servername )
+{
+	char *key;
+	time_t expire;
+	bool ret = False;
+
+	if ( !domain || !servername ) {
+		DEBUG(2,("saf_join_store: Refusing to store empty domain or servername!\n"));
+		return False;
+	}
+
+	if ( (strlen(domain) == 0) || (strlen(servername) == 0) ) {
+		DEBUG(0,("saf_join_store: refusing to store 0 length domain or servername!\n"));
+		return False;
+	}
+
+	if ( !gencache_init() )
+		return False;
+
+	key = saf_join_key( domain );
+	expire = time( NULL ) + lp_parm_int(-1, "saf","join ttl", SAFJOIN_TTL);
+
+	DEBUG(10,("saf_join_store: domain = [%s], server = [%s], expire = [%u]\n",
+		domain, servername, (unsigned int)expire ));
+
+	ret = gencache_set( key, servername, expire );
+
+	SAFE_FREE( key );
+
+	return ret;
+}
+
 bool saf_delete( const char *domain )
 {
 	char *key;
@@ -94,15 +137,22 @@ bool saf_delete( const char *domain )
 	if ( !gencache_init() )
 		return False;
 
+	key = saf_join_key(domain);
+	ret = gencache_del(key);
+	SAFE_FREE(key);
+
+	if (ret) {
+		DEBUG(10,("saf_delete[join]: domain = [%s]\n", domain ));
+	}
+
 	key = saf_key(domain);
 	ret = gencache_del(key);
+	SAFE_FREE(key);
 
 	if (ret) {
 		DEBUG(10,("saf_delete: domain = [%s]\n", domain ));
 	}
 
-	SAFE_FREE( key );
-
 	return ret;
 }
 
@@ -124,6 +174,18 @@ char *saf_fetch( const char *domain )
 	if ( !gencache_init() )
 		return False;
 
+	key = saf_join_key( domain );
+
+	ret = gencache_get( key, &server, &timeout );
+
+	SAFE_FREE( key );
+
+	if ( ret ) {
+		DEBUG(5,("saf_fetch[join]: Returning \"%s\" for \"%s\" domain\n",
+			server, domain ));
+		return server;
+	}
+
 	key = saf_key( domain );
 
 	ret = gencache_get( key, &server, &timeout );
@@ -2098,6 +2160,15 @@ NTSTATUS get_sorted_dc_list( const char *domain,
 
 	status = get_dc_list(domain, sitename, ip_list,
 			count, lookup_type, &ordered);
+	if (NT_STATUS_EQUAL(status, NT_STATUS_NO_LOGON_SERVERS)
+	    && sitename) {
+		DEBUG(3,("get_sorted_dc_list: no server for name %s available"
+			 " in site %s, fallback to all servers\n",
+			 domain, sitename));
+		status = get_dc_list(domain, NULL, ip_list,
+				     count, lookup_type, &ordered);
+	}
+
 	if (!NT_STATUS_IS_OK(status)) {
 		SAFE_FREE(*ip_list);
 		*count = 0;
diff --git a/source/utils/net_ads.c b/source/utils/net_ads.c
index 627374c..95a6807 100644
--- a/source/utils/net_ads.c
+++ b/source/utils/net_ads.c
@@ -291,7 +291,7 @@ retry:
 
 		tried_closest_dc = true; /* avoid loop */
 
-		if (!ads->config.tried_closest_dc) {
+		if (!ads_closest_dc(ads)) {
 
 			namecache_delete(ads->server.realm, 0x1C);
 			namecache_delete(ads->server.workgroup, 0x1C);
diff --git a/source/utils/smbcacls.c b/source/utils/smbcacls.c
index 1bfc475..f7f1272 100644
--- a/source/utils/smbcacls.c
+++ b/source/utils/smbcacls.c
@@ -735,6 +735,8 @@ static int owner_set(struct cli_state *cli, enum chown_mode change_mode,
 
 	if (!cli_set_secdesc(cli, fnum, sd)) {
 		printf("ERROR: secdesc set failed: %s\n", cli_errstr(cli));
+		cli_close(cli, fnum);
+		return EXIT_FAILED;
 	}
 
 	cli_close(cli, fnum);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list