The branch, master has been updated
       via  e3a796f s3:torture: in LOCAL-MESSAGING-FDPASS2, close fds after 
passing them
       via  a4edec4 s3:unix_msg: fix a tab<->space mixup in unix_msg_recv()
       via  d7d70c0 smbd:smb2: improve smbd_smb2_protocol_dialect_match(), 
removing code duplication
      from  043585f WHATSNEW: Update WHATSNEW for new default winbind 
implementation

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


- Log -----------------------------------------------------------------
commit e3a796f3eb9adfe2f68e9b8522fb59923fc47c21
Author: Michael Adam <ob...@samba.org>
Date:   Wed Sep 24 19:11:27 2014 +0200

    s3:torture: in LOCAL-MESSAGING-FDPASS2, close fds after passing them
    
    Signed-off-by: Michael Adam <ob...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>
    
    Autobuild-User(master): Volker Lendecke <v...@samba.org>
    Autobuild-Date(master): Sat Sep 27 12:44:55 CEST 2014 on sn-devel-104

commit a4edec4e8d64f410cd0dd21752d3c27d0915c906
Author: Michael Adam <ob...@samba.org>
Date:   Thu Sep 25 19:56:52 2014 +0200

    s3:unix_msg: fix a tab<->space mixup in unix_msg_recv()
    
    Signed-off-by: Michael Adam <ob...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>

commit d7d70c0d3c2efaa65318b1f91512746a71846341
Author: Michael Adam <ob...@samba.org>
Date:   Fri Sep 26 06:31:58 2014 +0200

    smbd:smb2: improve smbd_smb2_protocol_dialect_match(), removing code 
duplication
    
    Signed-off-by: Michael Adam <ob...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>

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

Summary of changes:
 source3/lib/unix_msg/unix_msg.c             |    2 +-
 source3/smbd/smb2_negprot.c                 |   98 +++++++--------------------
 source3/torture/test_messaging_fd_passing.c |    3 +
 3 files changed, 29 insertions(+), 74 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/unix_msg/unix_msg.c b/source3/lib/unix_msg/unix_msg.c
index 28ea514..01554a2 100644
--- a/source3/lib/unix_msg/unix_msg.c
+++ b/source3/lib/unix_msg/unix_msg.c
@@ -994,7 +994,7 @@ static void unix_msg_recv(struct unix_dgram_ctx *dgram_ctx,
        buflen -= sizeof(cookie);
 
        if (cookie == 0) {
-               ctx->recv_callback(ctx, buf, buflen, fds, num_fds, 
ctx->private_data);
+               ctx->recv_callback(ctx, buf, buflen, fds, num_fds, 
ctx->private_data);
                return;
        }
 
diff --git a/source3/smbd/smb2_negprot.c b/source3/smbd/smb2_negprot.c
index 6524658..d40a17f 100644
--- a/source3/smbd/smb2_negprot.c
+++ b/source3/smbd/smb2_negprot.c
@@ -87,85 +87,37 @@ enum protocol_types smbd_smb2_protocol_dialect_match(const 
uint8_t *indyn,
                                const int dialect_count,
                                uint16_t *dialect)
 {
-       size_t c = 0;
-       enum protocol_types protocol = PROTOCOL_NONE;
-
-       for (c=0; protocol == PROTOCOL_NONE && c < dialect_count; c++) {
-               if (lp_server_max_protocol() < PROTOCOL_SMB3_00) {
-                       break;
-               }
-               if (lp_server_min_protocol() > PROTOCOL_SMB3_00) {
-                       break;
-               }
-
-               *dialect = SVAL(indyn, c*2);
-               if (*dialect == SMB3_DIALECT_REVISION_300) {
-                       protocol = PROTOCOL_SMB3_00;
-                       break;
-               }
-       }
-
-       for (c=0; protocol == PROTOCOL_NONE && c < dialect_count; c++) {
-               if (lp_server_max_protocol() < PROTOCOL_SMB2_24) {
-                       break;
-               }
-               if (lp_server_min_protocol() > PROTOCOL_SMB2_24) {
-                       break;
-               }
-
-               *dialect = SVAL(indyn, c*2);
-               if (*dialect == SMB2_DIALECT_REVISION_224) {
-                       protocol = PROTOCOL_SMB2_24;
-                       break;
-               }
-       }
-
-       for (c=0; protocol == PROTOCOL_NONE && c < dialect_count; c++) {
-               if (lp_server_max_protocol() < PROTOCOL_SMB2_22) {
-                       break;
+       struct {
+               enum protocol_types proto;
+               uint16_t dialect;
+       } pd[] = {
+               { PROTOCOL_SMB3_00, SMB3_DIALECT_REVISION_300 },
+               { PROTOCOL_SMB2_24, SMB2_DIALECT_REVISION_224 },
+               { PROTOCOL_SMB2_22, SMB2_DIALECT_REVISION_222 },
+               { PROTOCOL_SMB2_10, SMB2_DIALECT_REVISION_210 },
+               { PROTOCOL_SMB2_02, SMB2_DIALECT_REVISION_202 },
+       };
+       size_t i;
+
+       for (i = 0; i < ARRAY_SIZE(pd); i ++) {
+               size_t c = 0;
+
+               if (lp_server_max_protocol() < pd[i].proto) {
+                       continue;
                }
-               if (lp_server_min_protocol() > PROTOCOL_SMB2_22) {
-                       break;
-               }
-
-               *dialect = SVAL(indyn, c*2);
-               if (*dialect == SMB2_DIALECT_REVISION_222) {
-                       protocol = PROTOCOL_SMB2_22;
-                       break;
-               }
-       }
-
-       for (c=0; protocol == PROTOCOL_NONE && c < dialect_count; c++) {
-               if (lp_server_max_protocol() < PROTOCOL_SMB2_10) {
-                       break;
-               }
-               if (lp_server_min_protocol() > PROTOCOL_SMB2_10) {
-                       break;
+               if (lp_server_min_protocol() > pd[i].proto) {
+                       continue;
                }
 
-               *dialect = SVAL(indyn, c*2);
-               if (*dialect == SMB2_DIALECT_REVISION_210) {
-                       protocol = PROTOCOL_SMB2_10;
-                       break;
-               }
-       }
-
-       for (c=0; protocol == PROTOCOL_NONE && c < dialect_count; c++) {
-               if (lp_server_max_protocol() < PROTOCOL_SMB2_02) {
-                       break;
-               }
-               if (lp_server_min_protocol() > PROTOCOL_SMB2_02) {
-                       break;
-               }
-
-               *dialect = SVAL(indyn, c*2);
-               if (*dialect == SMB2_DIALECT_REVISION_202) {
-                       protocol = PROTOCOL_SMB2_02;
-                       break;
+               for (c = 0; c < dialect_count; c++) {
+                       *dialect = SVAL(indyn, c*2);
+                       if (*dialect == pd[i].dialect) {
+                               return pd[i].proto;
+                       }
                }
        }
 
-       return protocol;
+       return PROTOCOL_NONE;
 }
 
 NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
diff --git a/source3/torture/test_messaging_fd_passing.c 
b/source3/torture/test_messaging_fd_passing.c
index 1a296e4..5b3099e 100644
--- a/source3/torture/test_messaging_fd_passing.c
+++ b/source3/torture/test_messaging_fd_passing.c
@@ -255,6 +255,9 @@ static bool fdpass2_parent(pid_t child_pid, int ready_fd)
                goto done;
        }
 
+       close(up_pipe[0]);
+       close(down_pipe[1]);
+
        bytes = write(up_pipe[1], &c1, 1);
        if (bytes != 1) {
                perror("parent: write to up pipe failed");


-- 
Samba Shared Repository

Reply via email to