[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Dec 9 01:06:05 UTC 2015


The branch, master has been updated
       via  3c6ea32 lib/param: handle (ignore) substitution variable in smb.conf
       via  ea6de66 libdns: Small cleanup
       via  dfceb51 libdns: Convert dns_udp_request to 0/errno
       via  190e2c0 libdns: Properly set ENOMEM
       via  a0fcb7b libdns: tsocket returns -1 and sets errno
       via  557169d lib: Use GUID_buf_string in discover_dc_dns
       via  9bc3f48 lib: Lift lp_disable_netbios one level
       via  7e5b4cd lib: make debug_dsdcinfo_flags static
       via  2bb0b47 lib: Avoid a includes.h
      from  17bc0fa Revert "s3: smbd: Tear down global_smbXsrv_client in the correct order."

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3c6ea3293c6aac67bc442f47185fd494714e4806
Author: Quentin Gibeaux <qgibeaux at iris-tech.fr>
Date:   Thu Oct 29 13:48:27 2015 +0100

    lib/param: handle (ignore) substitution variable in smb.conf
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=10722
    
    The function handle_include returns false when trying to include
    files that have a substitution variable in filename (like %U),
    this patch makes handle_include to ignore this case, to make
    samba-tool work when there is such include in samba's configuration.
    
    Error was :
    	root at ubuntu:/usr/local/samba# grep 'include.*%U' etc/smb.conf
    	include = %U.conf
    	root at ubuntu:/usr/local/samba# ./bin/samba-tool user list
    	Can't find include file %U.conf
    	ERROR(runtime): uncaught exception - Unable to load default file
    
    Signed-off-by: Quentin Gibeaux <qgibeaux at iris-tech.fr>
    Reviewed-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Dec  9 02:05:30 CET 2015 on sn-devel-104

commit ea6de66b9c6c8f5d7e90c24ff02fe4626801a57c
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 6 11:32:46 2015 +0100

    libdns: Small cleanup
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit dfceb51da87f1ebc2b75aaa714729bfbafcb1a2f
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 6 11:31:23 2015 +0100

    libdns: Convert dns_udp_request to 0/errno
    
    Replaces 5 calls to unix_to_werror with just one
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 190e2c013b9b478b9e8686afe1c54a81d80130e6
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 6 11:20:24 2015 +0100

    libdns: Properly set ENOMEM
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a0fcb7bd80f176319e1c6a3cfc447dd6ce88092f
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 6 11:19:46 2015 +0100

    libdns: tsocket returns -1 and sets errno
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 557169d1a0607d606284bdbaab6de930d661a058
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 5 18:46:34 2015 +0100

    lib: Use GUID_buf_string in discover_dc_dns
    
    One talloc call less..
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9bc3f482981c30c62ba8ceb1c66f25685fcfefd9
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 5 13:49:55 2015 +0100

    lib: Lift lp_disable_netbios one level
    
    This should fix an error code when neither DS_IS_FLAT_NAME nor
    DS_IS_DNS_NAME are specified. If netbios is disabled and the DC
    can't be found via DNS we should not return NOT_SUPPORTED but
    DOMAIN_CONTROLLER_NOT_FOUND.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7e5b4cd0974fd075bc8cbb408d73336ea7031c7d
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 5 13:00:07 2015 +0100

    lib: make debug_dsdcinfo_flags static
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2bb0b473c1255152291c3c43f82b1cc45fa83b00
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 5 12:59:49 2015 +0100

    lib: Avoid a includes.h
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 lib/param/loadparm.c           | 18 ++++++++++++++++++
 libcli/dns/dns.c               | 34 ++++++++++++++++------------------
 libcli/dns/libdns.h            | 10 +++++-----
 librpc/ndr/ndr_basic.c         |  3 ++-
 source3/include/proto.h        |  1 -
 source3/libsmb/dsgetdcname.c   | 24 ++++++++++++------------
 source4/dns_server/dns_query.c |  6 ++++--
 7 files changed, 57 insertions(+), 39 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index 612bf78..6a27dcb 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -1113,6 +1113,8 @@ bool handle_include(struct loadparm_context *lp_ctx, struct loadparm_service *se
 			   const char *pszParmValue, char **ptr)
 {
 	char *fname;
+	const char *substitution_variable_substring;
+	char next_char;
 
 	if (lp_ctx->s3_fns) {
 		return lp_ctx->s3_fns->lp_include(lp_ctx, service, pszParmValue, ptr);
@@ -1127,6 +1129,22 @@ bool handle_include(struct loadparm_context *lp_ctx, struct loadparm_service *se
 	if (file_exist(fname))
 		return pm_process(fname, do_section, lpcfg_do_parameter, lp_ctx);
 
+       /*
+        * If the file doesn't exist, we check that it isn't due to variable
+        * substitution
+        */
+	substitution_variable_substring = strchr(fname, '%');
+
+	if (substitution_variable_substring != NULL) {
+		next_char = substitution_variable_substring[1];
+		if ((next_char >= 'a' && next_char <= 'z')
+		    || (next_char >= 'A' && next_char <= 'Z')) {
+			DEBUG(2, ("Tried to load %s but variable substitution in "
+				 "filename, ignoring file.\n", fname));
+			return true;
+		}
+	}
+
 	DEBUG(2, ("Can't find include file %s\n", fname));
 
 	return false;
diff --git a/libcli/dns/dns.c b/libcli/dns/dns.c
index 43e1c4e..7d066d8 100644
--- a/libcli/dns/dns.c
+++ b/libcli/dns/dns.c
@@ -23,9 +23,8 @@
 #include "system/network.h"
 #include <tevent.h>
 #include "lib/tsocket/tsocket.h"
-#include "libcli/util/werror.h"
 #include "libcli/dns/libdns.h"
-#include "lib/util/tevent_werror.h"
+#include "lib/util/tevent_unix.h"
 #include "lib/util/samba_util.h"
 #include "libcli/util/error.h"
 #include "librpc/gen_ndr/dns.h"
@@ -67,20 +66,20 @@ struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
 	ret = tsocket_address_inet_from_strings(state, "ip", NULL, 0,
 						&local_addr);
 	if (ret != 0) {
-		tevent_req_werror(req, unix_to_werror(ret));
+		tevent_req_error(req, errno);
 		return tevent_req_post(req, ev);
 	}
 
 	ret = tsocket_address_inet_from_strings(state, "ip", server_addr_string,
 						DNS_SERVICE_PORT, &server_addr);
 	if (ret != 0) {
-		tevent_req_werror(req, unix_to_werror(ret));
+		tevent_req_error(req, errno);
 		return tevent_req_post(req, ev);
 	}
 
 	ret = tdgram_inet_udp_socket(local_addr, server_addr, state, &dgram);
 	if (ret != 0) {
-		tevent_req_werror(req, unix_to_werror(ret));
+		tevent_req_error(req, errno);
 		return tevent_req_post(req, ev);
 	}
 
@@ -96,10 +95,10 @@ struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
 
 	if (!tevent_req_set_endtime(req, ev,
 				timeval_current_ofs(DNS_REQUEST_TIMEOUT, 0))) {
+		tevent_req_oom(req);
 		return tevent_req_post(req, ev);
 	}
 
-
 	tevent_req_set_callback(subreq, dns_udp_request_get_reply, req);
 	return req;
 }
@@ -117,12 +116,12 @@ static void dns_udp_request_get_reply(struct tevent_req *subreq)
 	TALLOC_FREE(subreq);
 
 	if (len == -1 && err != 0) {
-		tevent_req_werror(req, unix_to_werror(err));
+		tevent_req_error(req, err);
 		return;
 	}
 
 	if (len != state->query_len) {
-		tevent_req_werror(req, WERR_NET_WRITE_FAULT);
+		tevent_req_error(req, EIO);
 		return;
 	}
 
@@ -132,7 +131,6 @@ static void dns_udp_request_get_reply(struct tevent_req *subreq)
 	}
 
 	tevent_req_set_callback(subreq, dns_udp_request_done, req);
-	return;
 }
 
 static void dns_udp_request_done(struct tevent_req *subreq)
@@ -149,7 +147,7 @@ static void dns_udp_request_done(struct tevent_req *subreq)
 	TALLOC_FREE(subreq);
 
 	if (len == -1 && err != 0) {
-		tevent_req_werror(req, unix_to_werror(err));
+		tevent_req_error(req, err);
 		return;
 	}
 
@@ -158,23 +156,23 @@ static void dns_udp_request_done(struct tevent_req *subreq)
 	tevent_req_done(req);
 }
 
-WERROR dns_udp_request_recv(struct tevent_req *req,
-			    TALLOC_CTX *mem_ctx,
-			    uint8_t **reply,
-			    size_t *reply_len)
+int dns_udp_request_recv(struct tevent_req *req,
+			 TALLOC_CTX *mem_ctx,
+			 uint8_t **reply,
+			 size_t *reply_len)
 {
 	struct dns_udp_request_state *state = tevent_req_data(req,
 			struct dns_udp_request_state);
-	WERROR w_error;
+	int err;
 
-	if (tevent_req_is_werror(req, &w_error)) {
+	if (tevent_req_is_unix_error(req, &err)) {
 		tevent_req_received(req);
-		return w_error;
+		return err;
 	}
 
 	*reply = talloc_move(mem_ctx, &state->reply);
 	*reply_len = state->reply_len;
 	tevent_req_received(req);
 
-	return WERR_OK;
+	return 0;
 }
diff --git a/libcli/dns/libdns.h b/libcli/dns/libdns.h
index 31474eb..7ea2eb6 100644
--- a/libcli/dns/libdns.h
+++ b/libcli/dns/libdns.h
@@ -43,11 +43,11 @@ struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
  *@param mem_ctx   talloc memory context to use for the reply string
  *@param reply     buffer that will be allocated and filled with the dns reply
  *@param reply_len length of the reply buffer
- *@return WERROR code depending on the async request result
+ *@return 0/errno
  */
-WERROR dns_udp_request_recv(struct tevent_req *req,
-			    TALLOC_CTX *mem_ctx,
-			    uint8_t **reply,
-			    size_t *reply_len);
+int dns_udp_request_recv(struct tevent_req *req,
+			 TALLOC_CTX *mem_ctx,
+			 uint8_t **reply,
+			 size_t *reply_len);
 
 #endif /*__LIBDNS_H__*/
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
index 12e3942..ecc0f74 100644
--- a/librpc/ndr/ndr_basic.c
+++ b/librpc/ndr/ndr_basic.c
@@ -19,10 +19,11 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "includes.h"
+#include "replace.h"
 #include "system/network.h"
 #include "librpc/ndr/libndr.h"
 #include "lib/util/util_net.h"
+#include "lib/util/debug.h"
 
 #define NDR_SVAL(ndr, ofs) (NDR_BE(ndr)?RSVAL(ndr->data,ofs):SVAL(ndr->data,ofs))
 #define NDR_IVAL(ndr, ofs) (NDR_BE(ndr)?RIVAL(ndr->data,ofs):IVAL(ndr->data,ofs))
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 9dd08fb..7d0ba42 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -764,7 +764,6 @@ void flush_negative_conn_cache_for_domain(const char *domain);
 
 struct netr_DsRGetDCNameInfo;
 
-void debug_dsdcinfo_flags(int lvl, uint32_t flags);
 NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
 		     struct messaging_context *msg_ctx,
 		     const char *domain_name,
diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c
index ac3bfd6..a63ba5a 100644
--- a/source3/libsmb/dsgetdcname.c
+++ b/source3/libsmb/dsgetdcname.c
@@ -44,7 +44,7 @@ static NTSTATUS make_dc_info_from_cldap_reply(TALLOC_CTX *mem_ctx,
 /****************************************************************
 ****************************************************************/
 
-void debug_dsdcinfo_flags(int lvl, uint32_t flags)
+static void debug_dsdcinfo_flags(int lvl, uint32_t flags)
 {
 	DEBUG(lvl,("debug_dsdcinfo_flags: 0x%08x\n\t", flags));
 
@@ -483,10 +483,6 @@ static NTSTATUS discover_dc_netbios(TALLOC_CTX *mem_ctx,
 	*returned_dclist = NULL;
 	*returned_count = 0;
 
-	if (lp_disable_netbios()) {
-		return NT_STATUS_NOT_SUPPORTED;
-	}
-
 	if (flags & DS_PDC_REQUIRED) {
 		name_type = NBT_NAME_PDC;
 	}
@@ -547,7 +543,6 @@ static NTSTATUS discover_dc_dns(TALLOC_CTX *mem_ctx,
 	int numaddrs = 0;
 	struct ip_service_name *dclist = NULL;
 	int count = 0;
-	char *guid_string;
 
 	if (flags & DS_PDC_REQUIRED) {
 		status = ads_dns_query_pdc(mem_ctx,
@@ -573,17 +568,14 @@ static NTSTATUS discover_dc_dns(TALLOC_CTX *mem_ctx,
 					   &dcs,
 					   &numdcs);
 	} else if (domain_guid) {
-		guid_string = GUID_string(mem_ctx, domain_guid);
-		if (!guid_string) {
-			return NT_STATUS_NO_MEMORY;
-		}
+		struct GUID_txt_buf buf;
+		GUID_buf_string(domain_guid, &buf);
 
 		status = ads_dns_query_dcs_guid(mem_ctx,
 						domain_name,
-						guid_string,
+						buf.buf,
 						&dcs,
 						&numdcs);
-		TALLOC_FREE(guid_string);
 	} else {
 		status = ads_dns_query_dcs(mem_ctx,
 					   domain_name,
@@ -1046,6 +1038,10 @@ static NTSTATUS dsgetdcname_rediscover(TALLOC_CTX *mem_ctx,
 
 	if (flags & DS_IS_FLAT_NAME) {
 
+		if (lp_disable_netbios()) {
+			return NT_STATUS_NOT_SUPPORTED;
+		}
+
 		status = discover_dc_netbios(mem_ctx, domain_name, flags,
 					     &dclist, &num_dcs);
 		NT_STATUS_NOT_OK_RETURN(status);
@@ -1076,6 +1072,10 @@ static NTSTATUS dsgetdcname_rediscover(TALLOC_CTX *mem_ctx,
 		}
 	}
 
+	if (lp_disable_netbios()) {
+		return NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
+	}
+
 	status = discover_dc_netbios(mem_ctx, domain_name, flags, &dclist,
 				     &num_dcs);
 	NT_STATUS_NOT_OK_RETURN(status);
diff --git a/source4/dns_server/dns_query.c b/source4/dns_server/dns_query.c
index 89cfd64..956898e 100644
--- a/source4/dns_server/dns_query.c
+++ b/source4/dns_server/dns_query.c
@@ -203,12 +203,14 @@ static void ask_forwarder_done(struct tevent_req *subreq)
 		req, struct ask_forwarder_state);
 	DATA_BLOB in_blob;
 	enum ndr_err_code ndr_err;
-	WERROR ret;
+	int ret;
 
 	ret = dns_udp_request_recv(subreq, state,
 				   &in_blob.data, &in_blob.length);
 	TALLOC_FREE(subreq);
-	if (tevent_req_werror(req, ret)) {
+
+	if (ret != 0) {
+		tevent_req_werror(req, unix_to_werror(ret));
 		return;
 	}
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list