[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Mon Aug 12 01:18:02 MDT 2013


The branch, master has been updated
       via  6a081e9 tevent: Fix tutorial reference
       via  d672535 libcli: Fix improper use of tevent_req_simple_recv_ntstatus
       via  2e59d6c libsmb: Remove an unnecessary variable assignment
       via  f584474 libsmb: Avoid an unnecessary "else"
       via  adc3ac9 smbd: Fix CID 1035550 Structurally dead code
       via  8420d1c smbd: Fix nonblank line endings
       via  68e6e7e lib: Remove unused "get_peer_name"
       via  52c5175 lib: Remove unused "client_name"
       via  2175024 lsa4: Fix an set but unused variable warning
       via  55c3f8e lsa4: Remove an unused variable
       via  c17e5bd s3:rpcclient: fix compiler warnings
       via  a560d1d s3:pylibsmb: remove compiler warnings
       via  82e969b s4:wrepl_out_helpers.c: avoid talloc_reference() in most cases
       via  6b99779 s4:torture/rpc: s/getgroups/getgr to avoid compiler warnings
       via  72dec3c s4:nbt_server: avoid talloc_reference()
       via  270aee5 s4:torture/rpc/samsync: avoid talloc_reference()
       via  fd54ffa s4:libcli: avoid talloc_reference() in finddcs_nbt_send()
       via  ae6166a s4:librpc: avoid talloc_reference() in dcerpc_epm_map_binding_send()
       via  b055b31 auth/credentials: make sure cli_credentials_get_nt_hash() always returns a talloc object
      from  20b64ea waf: replace dependency to libintl with samba_intl

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


- Log -----------------------------------------------------------------
commit 6a081e991923b7d089be4a5cdb1a351c2e863db1
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jul 30 14:37:16 2013 +0200

    tevent: Fix tutorial reference
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Mon Aug 12 09:17:10 CEST 2013 on sn-devel-104

commit d672535551e794574d25a3f553011af5fbb7a0a9
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jun 15 20:39:53 2013 +0200

    libcli: Fix improper use of tevent_req_simple_recv_ntstatus
    
    tevent_req_simple_recv_ntstatus is just for the simple return without
    anything to do after it.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 2e59d6c37002734887f9d26be2ea078775dc0c1e
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jun 9 18:02:27 2013 +0200

    libsmb: Remove an unnecessary variable assignment
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit f584474d7dc1fdb4a778eb1ede8c5321e606341b
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jun 9 11:41:32 2013 +0200

    libsmb: Avoid an unnecessary "else"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit adc3ac9ecdd7000c629b74d6477bbd59124cc7d2
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jun 22 18:43:00 2013 +0200

    smbd: Fix CID 1035550 Structurally dead code
    
    Just a single ctl_code from my point of view is okay with an if(). All
    other cases are handled behind the VFS these days.
    
    The dead code was the last tevent_req_nterror and post routines.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 8420d1c8ee031bb48d3bd845515355251a799633
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jun 22 18:40:31 2013 +0200

    smbd: Fix nonblank line endings
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 68e6e7e8e894312efb6d550d57fcafcd09b5fe4d
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jun 21 18:33:56 2013 +0200

    lib: Remove unused "get_peer_name"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 52c51752e8e8d64f4332cae990688b5b11f1b422
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jun 20 13:49:45 2013 +0200

    lib: Remove unused "client_name"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 2175024f9750d858847c2c0ad1c84ea9a14e0e02
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jun 21 18:11:30 2013 +0200

    lsa4: Fix an set but unused variable warning
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 55c3f8efc3982a49ba154bcb9b797aede0152227
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jun 21 18:11:07 2013 +0200

    lsa4: Remove an unused variable
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c17e5bd43ca54fdf34563b275a75937079e7adb8
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 9 10:23:12 2013 +0200

    s3:rpcclient: fix compiler warnings
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a560d1d485b0958e2ad49e5dcc50692f474ef757
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 9 10:15:48 2013 +0200

    s3:pylibsmb: remove compiler warnings
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 82e969b3c77fa62561c3ecbae2e3d0183e94b3e4
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 8 19:16:26 2013 +0200

    s4:wrepl_out_helpers.c: avoid talloc_reference() in most cases
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6b9977916ec6de2ae4b224e3dcbc6c1f3e7b207e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 8 19:10:29 2013 +0200

    s4:torture/rpc: s/getgroups/getgr to avoid compiler warnings
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 72dec3c1f169d77a0456000d4fa512e8bd2d9007
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 8 18:38:12 2013 +0200

    s4:nbt_server: avoid talloc_reference()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 270aee56f11a2bf6c1d1e2c3c96767278fd22743
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 8 18:33:54 2013 +0200

    s4:torture/rpc/samsync: avoid talloc_reference()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fd54ffa66c194bab5cb2c1343ef063bf9e4eedc6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 8 18:21:13 2013 +0200

    s4:libcli: avoid talloc_reference() in finddcs_nbt_send()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ae6166a3c10d3ce9f9a0d08dcbfcc8afd72ca461
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Aug 8 13:56:51 2013 +0200

    s4:librpc: avoid talloc_reference() in dcerpc_epm_map_binding_send()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b055b3118d9c2159e9d5a42830328cfc103f9555
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Aug 9 10:15:05 2013 +0200

    auth/credentials: make sure cli_credentials_get_nt_hash() always returns a talloc object
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 auth/credentials/credentials.c           |   19 +++++--
 auth/credentials/credentials.h           |    4 +-
 lib/tevent/doc/tevent_request.dox        |    8 +--
 lib/util/util_net.h                      |    1 -
 libcli/smb/smbXcli_base.c                |    7 ++-
 source3/include/proto.h                  |    2 -
 source3/lib/util_sock.c                  |   84 ------------------------------
 source3/libsmb/pylibsmb.c                |    9 ++--
 source3/modules/vfs_default.c            |   12 ++--
 source3/rpcclient/rpcclient.c            |   13 +++--
 source3/smbd/smb2_ioctl_named_pipe.c     |   67 ++++++++++-------------
 source4/libcli/finddcs_cldap.c           |   16 ++++--
 source4/libcli/finddcs_nbt.c             |    2 +-
 source4/librpc/rpc/dcerpc_connect.c      |   15 ++++-
 source4/librpc/rpc/dcerpc_sock.c         |   14 ++++--
 source4/librpc/rpc/dcerpc_util.c         |   18 +++++--
 source4/nbt_server/wins/wins_dns_proxy.c |    5 +-
 source4/nbt_server/wins/winsdb.c         |    2 +-
 source4/nbt_server/wins/winsserver.c     |    4 +-
 source4/rpc_server/lsa/dcesrv_lsa.c      |   11 ++---
 source4/torture/rpc/samsync.c            |   37 ++++++-------
 source4/wrepl_server/wrepl_out_helpers.c |   21 ++++++-
 22 files changed, 162 insertions(+), 209 deletions(-)


Changeset truncated at 500 lines:

diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c
index be497bc..57a7c0b 100644
--- a/auth/credentials/credentials.c
+++ b/auth/credentials/credentials.c
@@ -471,8 +471,8 @@ _PUBLIC_ bool cli_credentials_set_old_password(struct cli_credentials *cred,
  * @param cred credentials context
  * @retval If set, the cleartext password, otherwise NULL
  */
-_PUBLIC_ const struct samr_Password *cli_credentials_get_nt_hash(struct cli_credentials *cred, 
-							TALLOC_CTX *mem_ctx)
+_PUBLIC_ struct samr_Password *cli_credentials_get_nt_hash(struct cli_credentials *cred,
+							   TALLOC_CTX *mem_ctx)
 {
 	const char *password = cli_credentials_get_password(cred);
 
@@ -481,13 +481,22 @@ _PUBLIC_ const struct samr_Password *cli_credentials_get_nt_hash(struct cli_cred
 		if (!nt_hash) {
 			return NULL;
 		}
-		
+
 		E_md4hash(password, nt_hash->hash);    
 
 		return nt_hash;
-	} else {
-		return cred->nt_hash;
+	} else if (cred->nt_hash != NULL) {
+		struct samr_Password *nt_hash = talloc(mem_ctx, struct samr_Password);
+		if (!nt_hash) {
+			return NULL;
+		}
+
+		*nt_hash = *cred->nt_hash;
+
+		return nt_hash;
 	}
+
+	return NULL;
 }
 
 /**
diff --git a/auth/credentials/credentials.h b/auth/credentials/credentials.h
index cb09dc3..766a513 100644
--- a/auth/credentials/credentials.h
+++ b/auth/credentials/credentials.h
@@ -141,8 +141,8 @@ bool cli_credentials_set_password(struct cli_credentials *cred,
 				  enum credentials_obtained obtained);
 struct cli_credentials *cli_credentials_init_anon(TALLOC_CTX *mem_ctx);
 void cli_credentials_parse_string(struct cli_credentials *credentials, const char *data, enum credentials_obtained obtained);
-const struct samr_Password *cli_credentials_get_nt_hash(struct cli_credentials *cred, 
-							TALLOC_CTX *mem_ctx);
+struct samr_Password *cli_credentials_get_nt_hash(struct cli_credentials *cred,
+						  TALLOC_CTX *mem_ctx);
 bool cli_credentials_set_realm(struct cli_credentials *cred, 
 			       const char *val, 
 			       enum credentials_obtained obtained);
diff --git a/lib/tevent/doc/tevent_request.dox b/lib/tevent/doc/tevent_request.dox
index 3358cfb..7fcfb55 100644
--- a/lib/tevent/doc/tevent_request.dox
+++ b/lib/tevent/doc/tevent_request.dox
@@ -182,10 +182,8 @@ tevent_wakeup_recv() )
 
 @image html tevent_subrequest.png
 
-Comprehensive example containing features from this chapter is especially by
-reason of nested subrequests very long and therefore it is located as an
-example on the attached CD. Description and explanation is placed within the
-source code itself (subrequest.c) and enclosed file README. The example is
-available <a href="subrequest_example.zip">here</a>.
+A comprehensive example of nested subrequests can be found in the file
+echo_server.c. It implements a complete, self-contained echo server with no
+dependencies but libevent and libtalloc.
 
 */
diff --git a/lib/util/util_net.h b/lib/util/util_net.h
index 215a657..2f1beff 100644
--- a/lib/util/util_net.h
+++ b/lib/util/util_net.h
@@ -106,7 +106,6 @@ char *print_sockaddr(char *dest,
 			const struct sockaddr_storage *psa);
 char *print_canonical_sockaddr(TALLOC_CTX *ctx,
 			const struct sockaddr_storage *pss);
-const char *client_name(int fd);
 int get_socket_port(int fd);
 const char *client_socket_addr(int fd, char *addr, size_t addr_len);
 
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 5a5828a..7397f83 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -1562,8 +1562,7 @@ static void smbXcli_conn_received(struct tevent_req *subreq)
 	if (subreq != conn->read_smb_req) {
 		DEBUG(1, ("Internal error: cli_smb_received called with "
 			  "unexpected subreq\n"));
-		status = NT_STATUS_INTERNAL_ERROR;
-		smbXcli_conn_disconnect(conn, status);
+		smbXcli_conn_disconnect(conn, NT_STATUS_INTERNAL_ERROR);
 		TALLOC_FREE(frame);
 		return;
 	}
@@ -1587,7 +1586,9 @@ static void smbXcli_conn_received(struct tevent_req *subreq)
 		 * tevent_req_done().
 		 */
 		return;
-	} else if (!NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) {
+	}
+
+	if (!NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) {
 		/*
 		 * We got an error, so notify all pending requests
 		 */
diff --git a/source3/include/proto.h b/source3/include/proto.h
index a9270fc..13b1350 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -571,7 +571,6 @@ char *print_sockaddr(char *dest,
 			const struct sockaddr_storage *psa);
 char *print_canonical_sockaddr(TALLOC_CTX *ctx,
 			const struct sockaddr_storage *pss);
-const char *client_name(int fd);
 int get_socket_port(int fd);
 const char *client_addr(int fd, char *addr, size_t addrlen);
 const char *client_socket_addr(int fd, char *addr, size_t addr_len);
@@ -620,7 +619,6 @@ struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
 					      int timeout);
 NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
 int open_udp_socket(const char *host, int port);
-const char *get_peer_name(int fd, bool force_lookup);
 const char *get_peer_addr(int fd, char *addr, size_t addr_len);
 
 struct tsocket_address;
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 54286b3..a35ae97 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -29,11 +29,6 @@
 #include "../lib/util/tevent_ntstatus.h"
 #include "../lib/tsocket/tsocket.h"
 
-const char *client_name(int fd)
-{
-	return get_peer_name(fd,false);
-}
-
 const char *client_addr(int fd, char *addr, size_t addrlen)
 {
 	return get_peer_addr(fd,addr,addrlen);
@@ -1028,85 +1023,6 @@ static void store_nc(const struct name_addr_pair *nc)
 }
 
 /*******************************************************************
- Return the DNS name of the remote end of a socket.
-******************************************************************/
-
-const char *get_peer_name(int fd, bool force_lookup)
-{
-	struct name_addr_pair nc;
-	char addr_buf[INET6_ADDRSTRLEN];
-	struct sockaddr_storage ss;
-	socklen_t length = sizeof(ss);
-	const char *p;
-	int ret;
-	char name_buf[MAX_DNS_NAME_LENGTH];
-	char tmp_name[MAX_DNS_NAME_LENGTH];
-
-	/* reverse lookups can be *very* expensive, and in many
-	   situations won't work because many networks don't link dhcp
-	   with dns. To avoid the delay we avoid the lookup if
-	   possible */
-	if (!lp_hostname_lookups() && (force_lookup == false)) {
-		length = sizeof(nc.ss);
-		nc.name = get_peer_addr_internal(fd, addr_buf, sizeof(addr_buf),
-			(struct sockaddr *)&nc.ss, &length);
-		store_nc(&nc);
-		lookup_nc(&nc);
-		return nc.name ? nc.name : "UNKNOWN";
-	}
-
-	lookup_nc(&nc);
-
-	memset(&ss, '\0', sizeof(ss));
-	p = get_peer_addr_internal(fd, addr_buf, sizeof(addr_buf), (struct sockaddr *)&ss, &length);
-
-	/* it might be the same as the last one - save some DNS work */
-	if (sockaddr_equal((struct sockaddr *)&ss, (struct sockaddr *)&nc.ss)) {
-		return nc.name ? nc.name : "UNKNOWN";
-	}
-
-	/* Not the same. We need to lookup. */
-	if (fd == -1) {
-		return "UNKNOWN";
-	}
-
-	/* Look up the remote host name. */
-	ret = sys_getnameinfo((struct sockaddr *)&ss,
-			length,
-			name_buf,
-			sizeof(name_buf),
-			NULL,
-			0,
-			0);
-
-	if (ret) {
-		DEBUG(1,("get_peer_name: getnameinfo failed "
-			"for %s with error %s\n",
-			p,
-			gai_strerror(ret)));
-		strlcpy(name_buf, p, sizeof(name_buf));
-	} else {
-		if (!matchname(name_buf, (struct sockaddr *)&ss, length)) {
-			DEBUG(0,("Matchname failed on %s %s\n",name_buf,p));
-			strlcpy(name_buf,"UNKNOWN",sizeof(name_buf));
-		}
-	}
-
-	strlcpy(tmp_name, name_buf, sizeof(tmp_name));
-	alpha_strcpy(name_buf, tmp_name, "_-.", sizeof(name_buf));
-	if (strstr(name_buf,"..")) {
-		strlcpy(name_buf, "UNKNOWN", sizeof(name_buf));
-	}
-
-	nc.name = name_buf;
-	nc.ss = ss;
-
-	store_nc(&nc);
-	lookup_nc(&nc);
-	return nc.name ? nc.name : "UNKNOWN";
-}
-
-/*******************************************************************
  Return the IP addr of the remote end of a socket as a string.
  ******************************************************************/
 
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index ae0d694..533df67 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -51,19 +51,20 @@ static PyTypeObject *get_pytype(const char *module, const char *type)
 }
 
 /*
- * We're using "const char **" for keywords,
+ * We're using "const char * const *" for keywords,
  * PyArg_ParseTupleAndKeywords expects a "char **". Confine the
  * inevitable warnings to just one place.
  */
 static int ParseTupleAndKeywords(PyObject *args, PyObject *kw,
-				 const char *format, const char **keywords,
+				 const char *format, const char * const *keywords,
 				 ...)
 {
+	char **_keywords = discard_const_p(char *, keywords);
 	va_list a;
 	int ret;
 	va_start(a, keywords);
 	ret = PyArg_VaParseTupleAndKeywords(args, kw, format,
-					    (char **)keywords, a);
+					    _keywords, a);
 	va_end(a);
 	return ret;
 }
@@ -448,7 +449,7 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
 		cli_credentials_get_password(cli_creds),
 		0, 0);
 	if (!py_tevent_req_wait_exc(self->ev, req)) {
-		return NULL;
+		return -1;
 	}
 	status = cli_full_connection_recv(req, &self->cli);
 	TALLOC_FREE(req);
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 304ef37..edac0de 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1033,10 +1033,10 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
 		}
 
 		status = file_set_sparse(handle->conn, fsp, set_sparse);
-		
+
 		DEBUG(NT_STATUS_IS_OK(status) ? 10 : 9,
 		      ("FSCTL_SET_SPARSE: fname[%s] set[%u] - %s\n",
-		       smb_fname_str_dbg(fsp->fsp_name), set_sparse, 
+		       smb_fname_str_dbg(fsp->fsp_name), set_sparse,
 		       nt_errstr(status)));
 
 		return status;
@@ -1125,17 +1125,17 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
 		if (SMB_VFS_GET_SHADOW_COPY_DATA(fsp, shadow_data, labels)!=0) {
 			TALLOC_FREE(shadow_data);
 			if (errno == ENOSYS) {
-				DEBUG(5,("FSCTL_GET_SHADOW_COPY_DATA: connectpath %s, not supported.\n", 
+				DEBUG(5,("FSCTL_GET_SHADOW_COPY_DATA: connectpath %s, not supported.\n",
 					fsp->conn->connectpath));
 				return NT_STATUS_NOT_SUPPORTED;
 			} else {
-				DEBUG(0,("FSCTL_GET_SHADOW_COPY_DATA: connectpath %s, failed.\n", 
+				DEBUG(0,("FSCTL_GET_SHADOW_COPY_DATA: connectpath %s, failed.\n",
 					fsp->conn->connectpath));
 				return NT_STATUS_UNSUCCESSFUL;
 			}
 		}
 
-		labels_data_count = (shadow_data->num_volumes * 2 * 
+		labels_data_count = (shadow_data->num_volumes * 2 *
 					sizeof(SHADOW_COPY_LABEL)) + 2;
 
 		if (!labels) {
@@ -1325,7 +1325,7 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
 	}
 
 	default:
-		/* 
+		/*
 		 * Only print once ... unfortunately there could be lots of
 		 * different FSCTLs that are called.
 		 */
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index cb7b70f..42c565d 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -669,7 +669,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
 		       struct user_auth_info *auth_info,
 		       struct cmd_set *cmd_entry,
 		       struct dcerpc_binding *binding,
-		       int argc, char **argv)
+		       int argc, const char **argv)
 {
 	NTSTATUS ntresult;
 	WERROR wresult;
@@ -793,12 +793,12 @@ static NTSTATUS do_cmd(struct cli_state *cli,
 	/* Run command */
 
 	if ( cmd_entry->returntype == RPC_RTYPE_NTSTATUS ) {
-		ntresult = cmd_entry->ntfn(cmd_entry->rpc_pipe, mem_ctx, argc, (const char **) argv);
+		ntresult = cmd_entry->ntfn(cmd_entry->rpc_pipe, mem_ctx, argc, argv);
 		if (!NT_STATUS_IS_OK(ntresult)) {
 			printf("result was %s\n", nt_errstr(ntresult));
 		}
 	} else {
-		wresult = cmd_entry->wfn(cmd_entry->rpc_pipe, mem_ctx, argc, (const char **) argv);
+		wresult = cmd_entry->wfn(cmd_entry->rpc_pipe, mem_ctx, argc, argv);
 		/* print out the DOS error */
 		if (!W_ERROR_IS_OK(wresult)) {
 			printf( "result was %s\n", win_errstr(wresult));
@@ -828,9 +828,9 @@ static NTSTATUS process_cmd(struct user_auth_info *auth_info,
 	NTSTATUS result = NT_STATUS_OK;
 	int ret;
 	int argc;
-	char **argv = NULL;
+	const char **argv = NULL;
 
-	if ((ret = poptParseArgvString(cmd, &argc, (const char ***) &argv)) != 0) {
+	if ((ret = poptParseArgvString(cmd, &argc, &argv)) != 0) {
 		fprintf(stderr, "rpcclient: %s\n", poptStrerror(ret));
 		return NT_STATUS_UNSUCCESSFUL;
 	}
@@ -882,6 +882,7 @@ out_free:
 
  int main(int argc, char *argv[])
 {
+	const char **const_argv = discard_const_p(const char *, argv);
 	int 			opt;
 	static char		*cmdstr = NULL;
 	const char *server;
@@ -930,7 +931,7 @@ out_free:
 
 	/* Parse options */
 
-	pc = poptGetContext("rpcclient", argc, (const char **) argv,
+	pc = poptGetContext("rpcclient", argc, const_argv,
 			    long_options, 0);
 
 	if (argc == 1) {
diff --git a/source3/smbd/smb2_ioctl_named_pipe.c b/source3/smbd/smb2_ioctl_named_pipe.c
index 601e1c3..13c4982 100644
--- a/source3/smbd/smb2_ioctl_named_pipe.c
+++ b/source3/smbd/smb2_ioctl_named_pipe.c
@@ -35,11 +35,13 @@ struct tevent_req *smb2_ioctl_named_pipe(uint32_t ctl_code,
 					 struct tevent_req *req,
 					 struct smbd_smb2_ioctl_state *state)
 {
-	struct tevent_req *subreq;
+	NTSTATUS status;
+	uint8_t *out_data = NULL;
+	uint32_t out_data_len = 0;
+
+	if (ctl_code == FSCTL_PIPE_TRANSCEIVE) {
+		struct tevent_req *subreq;
 
-	switch (ctl_code) {
-	case FSCTL_PIPE_TRANSCEIVE:
-	{
 		if (!IS_IPC(state->smbreq->conn)) {
 			tevent_req_nterror(req, NT_STATUS_NOT_SUPPORTED);
 			return tevent_req_post(req, ev);
@@ -69,47 +71,36 @@ struct tevent_req *smb2_ioctl_named_pipe(uint32_t ctl_code,
 					smbd_smb2_ioctl_pipe_write_done,
 					req);
 		return req;
-		break;
 	}
-	default: {
-		NTSTATUS status;
-		uint8_t *out_data = NULL;
-		uint32_t out_data_len = 0;
 
-		if (state->fsp == NULL) {
-			status = NT_STATUS_NOT_SUPPORTED;
-		} else {
-			status = SMB_VFS_FSCTL(state->fsp,
-					       state,
-					       ctl_code,
-					       state->smbreq->flags2,
-					       state->in_input.data,
-					       state->in_input.length,
-					       &out_data,
-					       state->in_max_output,
-					       &out_data_len);
-			state->out_output = data_blob_const(out_data, out_data_len);
-			if (NT_STATUS_IS_OK(status)) {
-				tevent_req_done(req);
-				return tevent_req_post(req, ev);
-			}
+	if (state->fsp == NULL) {
+		status = NT_STATUS_NOT_SUPPORTED;
+	} else {
+		status = SMB_VFS_FSCTL(state->fsp,
+				       state,
+				       ctl_code,
+				       state->smbreq->flags2,
+				       state->in_input.data,
+				       state->in_input.length,
+				       &out_data,
+				       state->in_max_output,
+				       &out_data_len);
+		state->out_output = data_blob_const(out_data, out_data_len);
+		if (NT_STATUS_IS_OK(status)) {
+			tevent_req_done(req);
+			return tevent_req_post(req, ev);
 		}
+	}
 
-		if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
-			if (IS_IPC(state->smbreq->conn)) {
-				status = NT_STATUS_FS_DRIVER_REQUIRED;
-			} else {
-				status = NT_STATUS_INVALID_DEVICE_REQUEST;
-			}
+	if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
+		if (IS_IPC(state->smbreq->conn)) {
+			status = NT_STATUS_FS_DRIVER_REQUIRED;
+		} else {
+			status = NT_STATUS_INVALID_DEVICE_REQUEST;
 		}
-
-		tevent_req_nterror(req, status);
-		return tevent_req_post(req, ev);
-		break;
-	}
 	}
 
-	tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
+	tevent_req_nterror(req, status);
 	return tevent_req_post(req, ev);
 }
 
diff --git a/source4/libcli/finddcs_cldap.c b/source4/libcli/finddcs_cldap.c
index bf8da4e..ce0e1c7 100644
--- a/source4/libcli/finddcs_cldap.c
+++ b/source4/libcli/finddcs_cldap.c
@@ -431,14 +431,18 @@ NTSTATUS finddcs_cldap_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, struct
 		talloc_free(req);
 		return NT_STATUS_INTERNAL_ERROR;
 	}
-	status = tevent_req_simple_recv_ntstatus(req);
-	if (NT_STATUS_IS_OK(status)) {
-		talloc_steal(mem_ctx, state->netlogon);
-		io->out.netlogon = state->netlogon->out.netlogon;
-		io->out.address = talloc_steal(mem_ctx, state->srv_addresses[state->srv_address_index]);
+	if (tevent_req_is_nterror(req, &status)) {
+		tevent_req_received(req);
+		return status;
 	}
+
+	talloc_steal(mem_ctx, state->netlogon);
+	io->out.netlogon = state->netlogon->out.netlogon;
+	io->out.address = talloc_steal(
+		mem_ctx, state->srv_addresses[state->srv_address_index]);
+
 	tevent_req_received(req);
-	return status;
+	return NT_STATUS_OK;
 }
 
 NTSTATUS finddcs_cldap(TALLOC_CTX *mem_ctx,
diff --git a/source4/libcli/finddcs_nbt.c b/source4/libcli/finddcs_nbt.c
index 6a5d1fd..147efde 100644
--- a/source4/libcli/finddcs_nbt.c
+++ b/source4/libcli/finddcs_nbt.c


-- 
Samba Shared Repository


More information about the samba-cvs mailing list