[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Wed May 23 13:57:03 MDT 2012


The branch, master has been updated
       via  b211768 s3:rpc_server/dfs: pass allow_broken_path=true to create_junction()
       via  aa7b1e2 s3:smbd/proto.h: remove unused resolve_dfspath() prototype
       via  97f0a36 s3:smbd/files: remove unused VALID_FNUM()
       via  a0c9a29 s3:smb2_server: make use of nt_status_np_pipe()
       via  d595d2e s3:smbd: use nt_status_np_pipe for smb1
       via  d869f02 s3:smbd: add nt_status_np_pipe()
      from  dcfb34f blackbox: fix samba4.blackbox.kinit test

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


- Log -----------------------------------------------------------------
commit b21176875a9cab2302405c7df35a87ae34643e8a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed May 23 12:46:20 2012 +0200

    s3:rpc_server/dfs: pass allow_broken_path=true to create_junction()
    
    DCERPC code can't be smb2 specific!
    
    I'm not sure if 'true' is the correct value here, but at least
    it matches the old behavior and the tcp and smb1 cases.
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Wed May 23 21:56:05 CEST 2012 on sn-devel-104

commit aa7b1e21a8ea7c13aad46ce4510725e3005f4432
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed May 23 13:21:57 2012 +0200

    s3:smbd/proto.h: remove unused resolve_dfspath() prototype
    
    metze

commit 97f0a3675f0abaa1645f3d980f63d2b8f74a34a9
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed May 23 17:04:42 2012 +0200

    s3:smbd/files: remove unused VALID_FNUM()
    
    metze

commit a0c9a291e7cf0084a67cbb3fd017ddbff7d3b758
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed May 23 15:24:01 2012 +0200

    s3:smb2_server: make use of nt_status_np_pipe()
    
    metze

commit d595d2e5af1a6b85d069ce621a85648d1213c360
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed May 23 15:23:23 2012 +0200

    s3:smbd: use nt_status_np_pipe for smb1
    
    metze

commit d869f0260c7f9c30712b7a4d8fb13de4124868c5
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed May 23 15:21:28 2012 +0200

    s3:smbd: add nt_status_np_pipe()
    
    This mapps between NT_STATUS_CONNECTION_* to NT_STATUS_PIPE_*
    
    metze

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

Summary of changes:
 source3/rpc_server/dfs/srv_dfs_nt.c |    6 +++-
 source3/smbd/files.c                |    2 -
 source3/smbd/ipc.c                  |   42 +++++++++++++++++++++++++++++-----
 source3/smbd/pipes.c                |    2 +
 source3/smbd/proto.h                |    6 +----
 source3/smbd/smb2_ioctl.c           |   14 +++++++++--
 source3/smbd/smb2_read.c            |    2 +
 source3/smbd/smb2_write.c           |    2 +
 8 files changed, 57 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c b/source3/rpc_server/dfs/srv_dfs_nt.c
index 0a9a7cc..e765f15 100644
--- a/source3/rpc_server/dfs/srv_dfs_nt.c
+++ b/source3/rpc_server/dfs/srv_dfs_nt.c
@@ -361,8 +361,10 @@ WERROR _dfs_GetInfo(struct pipes_struct *p, struct dfs_GetInfo *r)
 		return WERR_NOMEM;
 	}
 
-	if(!create_junction(ctx, r->in.dfs_entry_path,
-			    !smbd_server_conn->using_smb2, jn)) {
+	ret = create_junction(ctx, r->in.dfs_entry_path,
+			      true, /* allow broken_path */
+			      jn);
+	if (!ret) {
 		return WERR_DFS_NO_SUCH_SERVER;
 	}
 
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 8a9f055..203d0ad 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -25,8 +25,6 @@
 #include <ccan/hash/hash.h>
 #include "lib/util/bitmap.h"
 
-#define VALID_FNUM(fnum)   (((fnum) >= 0) && ((fnum) < real_max_open_files))
-
 #define FILE_HANDLE_OFFSET 0x1000
 
 /****************************************************************************
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 36c2916..3d9b174 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -79,6 +79,17 @@ static void copy_trans_params_and_data(char *outbuf, int align,
 		memcpy(copy_into, &rdata[data_offset], data_len);
 }
 
+NTSTATUS nt_status_np_pipe(NTSTATUS status)
+{
+	if (NT_STATUS_EQUAL(status, NT_STATUS_CONNECTION_DISCONNECTED)) {
+		status = NT_STATUS_PIPE_DISCONNECTED;
+	} else if (NT_STATUS_EQUAL(status, NT_STATUS_CONNECTION_RESET)) {
+		status = NT_STATUS_PIPE_BROKEN;
+	}
+
+	return status;
+}
+
 /****************************************************************************
  Send a trans reply.
  ****************************************************************************/
@@ -290,11 +301,23 @@ static void api_dcerpc_cmd_write_done(struct tevent_req *subreq)
 
 	status = np_write_recv(subreq, &nwritten);
 	TALLOC_FREE(subreq);
-	if (!NT_STATUS_IS_OK(status) || (nwritten != state->num_data)) {
-		DEBUG(10, ("Could not write to pipe: %s (%d/%d)\n",
-			   nt_errstr(status), (int)state->num_data,
-			   (int)nwritten));
-		reply_nterror(req, NT_STATUS_PIPE_NOT_AVAILABLE);
+	if (!NT_STATUS_IS_OK(status)) {
+		NTSTATUS old = status;
+		status = nt_status_np_pipe(old);
+
+		DEBUG(10, ("Could not write to pipe: %s%s%s\n",
+			   nt_errstr(old),
+			   NT_STATUS_EQUAL(old, status)?"":" => ",
+			   NT_STATUS_EQUAL(old, status)?"":nt_errstr(status)));
+		reply_nterror(req, status);
+		goto send;
+	}
+	if (nwritten != state->num_data) {
+		status = NT_STATUS_PIPE_NOT_AVAILABLE;
+		DEBUG(10, ("Could not write to pipe: (%d/%d) => %s\n",
+			   (int)state->num_data,
+			   (int)nwritten, nt_errstr(status)));
+		reply_nterror(req, status);
 		goto send;
 	}
 
@@ -340,8 +363,13 @@ static void api_dcerpc_cmd_read_done(struct tevent_req *subreq)
 	TALLOC_FREE(subreq);
 
 	if (!NT_STATUS_IS_OK(status)) {
-		DEBUG(10, ("Could not read from to pipe: %s\n",
-			   nt_errstr(status)));
+		NTSTATUS old = status;
+		status = nt_status_np_pipe(old);
+
+		DEBUG(10, ("Could not read from to pipe: %s%s%s\n",
+			   nt_errstr(old),
+			   NT_STATUS_EQUAL(old, status)?"":" => ",
+			   NT_STATUS_EQUAL(old, status)?"":nt_errstr(status)));
 		reply_nterror(req, status);
 
 		if (!srv_send_smb(req->sconn, (char *)req->outbuf,
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index c3a5cb3..f9e3618 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -454,6 +454,8 @@ static void pipe_read_andx_done(struct tevent_req *subreq)
 	status = np_read_recv(subreq, &nread, &is_data_outstanding);
 	TALLOC_FREE(subreq);
 	if (!NT_STATUS_IS_OK(status)) {
+		NTSTATUS old = status;
+		status = nt_status_np_pipe(old);
 		reply_nterror(req, status);
 		goto done;
 	}
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 4a3bd2d..4dc63cc 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -396,6 +396,7 @@ NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
 
 /* The following definitions come from smbd/ipc.c  */
 
+NTSTATUS nt_status_np_pipe(NTSTATUS status);
 void send_trans_reply(connection_struct *conn,
 		      struct smb_request *req,
 		      char *rparam, int rparam_len,
@@ -471,11 +472,6 @@ bool create_junction(TALLOC_CTX *ctx,
 bool create_msdfs_link(const struct junction_map *jucn);
 bool remove_msdfs_link(const struct junction_map *jucn);
 struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn);
-NTSTATUS resolve_dfspath(TALLOC_CTX *ctx,
-			connection_struct *conn,
-			bool dfs_pathnames,
-			const char *name_in,
-			char **pp_name_out);
 NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
 				connection_struct *conn,
 				bool dfs_pathnames,
diff --git a/source3/smbd/smb2_ioctl.c b/source3/smbd/smb2_ioctl.c
index 37acf11..cd303ed 100644
--- a/source3/smbd/smb2_ioctl.c
+++ b/source3/smbd/smb2_ioctl.c
@@ -616,6 +616,8 @@ static void smbd_smb2_ioctl_pipe_write_done(struct tevent_req *subreq)
 
 	TALLOC_FREE(subreq);
 	if (!NT_STATUS_IS_OK(status)) {
+		NTSTATUS old = status;
+		status = nt_status_np_pipe(old);
 		tevent_req_nterror(req, status);
 		return;
 	}
@@ -654,18 +656,24 @@ static void smbd_smb2_ioctl_pipe_read_done(struct tevent_req *subreq)
 	struct smbd_smb2_ioctl_state *state = tevent_req_data(req,
 					      struct smbd_smb2_ioctl_state);
 	NTSTATUS status;
+	NTSTATUS old;
 	ssize_t nread = -1;
 	bool is_data_outstanding = false;
 
 	status = np_read_recv(subreq, &nread, &is_data_outstanding);
+	TALLOC_FREE(subreq);
+
+	old = status;
+	status = nt_status_np_pipe(old);
 
 	DEBUG(10,("smbd_smb2_ioctl_pipe_read_done: np_read_recv nread = %d "
-		 "is_data_outstanding = %d, status = %s\n",
+		 "is_data_outstanding = %d, status = %s%s%s\n",
 		(int)nread,
 		(int)is_data_outstanding,
-		nt_errstr(status) ));
+		nt_errstr(old),
+		NT_STATUS_EQUAL(old, status)?"":" => ",
+		NT_STATUS_EQUAL(old, status)?"":nt_errstr(status)));
 
-	TALLOC_FREE(subreq);
 	if (!NT_STATUS_IS_OK(status)) {
 		tevent_req_nterror(req, status);
 		return;
diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c
index 53b0a9d..b36c3cb 100644
--- a/source3/smbd/smb2_read.c
+++ b/source3/smbd/smb2_read.c
@@ -567,6 +567,8 @@ static void smbd_smb2_read_pipe_done(struct tevent_req *subreq)
 	status = np_read_recv(subreq, &nread, &is_data_outstanding);
 	TALLOC_FREE(subreq);
 	if (!NT_STATUS_IS_OK(status)) {
+		NTSTATUS old = status;
+		status = nt_status_np_pipe(old);
 		tevent_req_nterror(req, status);
 		return;
 	}
diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c
index 163672c..0b502a4 100644
--- a/source3/smbd/smb2_write.c
+++ b/source3/smbd/smb2_write.c
@@ -390,6 +390,8 @@ static void smbd_smb2_write_pipe_done(struct tevent_req *subreq)
 	status = np_write_recv(subreq, &nwritten);
 	TALLOC_FREE(subreq);
 	if (!NT_STATUS_IS_OK(status)) {
+		NTSTATUS old = status;
+		status = nt_status_np_pipe(old);
 		tevent_req_nterror(req, status);
 		return;
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list