The branch, master has been updated
       via  7600fd8 s3: Factor out calculate_open_access_flags
       via  e0de443 s3: Slightly simplify smbd_smb2_request_process_negprot
       via  1b403d4 s3: Fix some blank line endings
       via  11af163 s3: Fix a typo
       via  0feb341 pysmbd: Fix cut&paste errors
      from  8090046 pyntdb: Fix init function for ntdb python module.

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


- Log -----------------------------------------------------------------
commit 7600fd8b0cef3f1de99204ebdd14115a5f36c958
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Sep 4 09:22:49 2012 +0200

    s3: Factor out calculate_open_access_flags
    
    Autobuild-User(master): Volker Lendecke <v...@samba.org>
    Autobuild-Date(master): Wed Sep 26 00:22:56 CEST 2012 on sn-devel-104

commit e0de443af80ee6231f4deddc5c7b4534d8c11f83
Author: Volker Lendecke <v...@samba.org>
Date:   Wed Sep 12 16:43:36 2012 +0200

    s3: Slightly simplify smbd_smb2_request_process_negprot
    
    Remove a nested if-statement

commit 1b403d46c7a94645c72fead6758d81f5b20298cc
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Sep 24 14:11:05 2012 -0700

    s3: Fix some blank line endings

commit 11af163df89f504da6d9b0878fe99e2941a1d6d6
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Sep 25 10:34:49 2012 -0700

    s3: Fix a typo

commit 0feb341502ee5ff1f7d6cff41496a99ba47280d2
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Sep 24 14:18:42 2012 -0700

    pysmbd: Fix cut&paste errors

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

Summary of changes:
 source3/smbd/open.c         |   48 ++++++++++++++++++++++++++++--------------
 source3/smbd/pysmbd.c       |   17 ++++++++-------
 source3/smbd/smb2_negprot.c |    8 ++----
 3 files changed, 44 insertions(+), 29 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 34d5526..2785d6f 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1869,6 +1869,35 @@ static int disposition_to_open_flags(uint32_t 
create_disposition)
        return ret;
 }
 
+static int calculate_open_access_flags(uint32_t access_mask,
+                                      int oplock_request,
+                                      uint32_t private_flags)
+{
+       int flags;
+
+       /*
+        * Note that we ignore the append flag as append does not
+        * mean the same thing under DOS and Unix.
+        */
+
+       if ((access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) ||
+           (oplock_request & FORCE_OPLOCK_BREAK_TO_NONE)) {
+               /* DENY_DOS opens are always underlying read-write on the
+                  file handle, no matter what the requested access mask
+                   says. */
+               if ((private_flags & NTCREATEX_OPTIONS_PRIVATE_DENY_DOS) ||
+                   access_mask & (FILE_READ_ATTRIBUTES|FILE_READ_DATA|
+                                  FILE_READ_EA|FILE_EXECUTE)) {
+                       flags = O_RDWR;
+               } else {
+                       flags = O_WRONLY;
+               }
+       } else {
+               flags = O_RDONLY;
+       }
+       return flags;
+}
+
 /****************************************************************************
  Open a file with a share mode. Passed in an already created files_struct *.
 ****************************************************************************/
@@ -2123,21 +2152,8 @@ static NTSTATUS open_file_ntcreate(connection_struct 
*conn,
         * mean the same thing under DOS and Unix.
         */
 
-       if ((access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) ||
-           (oplock_request & FORCE_OPLOCK_BREAK_TO_NONE)) {
-               /* DENY_DOS opens are always underlying read-write on the
-                  file handle, no matter what the requested access mask
-                   says. */
-               if ((private_flags & NTCREATEX_OPTIONS_PRIVATE_DENY_DOS) ||
-                   access_mask & (FILE_READ_ATTRIBUTES|FILE_READ_DATA|
-                                  FILE_READ_EA|FILE_EXECUTE)) {
-                       flags = O_RDWR;
-               } else {
-                       flags = O_WRONLY;
-               }
-       } else {
-               flags = O_RDONLY;
-       }
+       flags = calculate_open_access_flags(access_mask, oplock_request,
+                                           private_flags);
 
        /*
         * Currently we only look at FILE_WRITE_THROUGH for create options.
@@ -2592,7 +2608,7 @@ static NTSTATUS open_file_ntcreate(connection_struct 
*conn,
        }
 
        /*
-        * At this point onwards, we can guarentee that the share entry
+        * At this point onwards, we can guarantee that the share entry
         * is locked, whether we created the file or not, and that the
         * deny mode is compatible with all current opens.
         */
diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c
index 9b9b358..4012e6e 100644
--- a/source3/smbd/pysmbd.c
+++ b/source3/smbd/pysmbd.c
@@ -1,7 +1,7 @@
 /*
    Unix SMB/CIFS implementation.
-   Set NT and POSIX ACLs and other VFS operations from Python 
-   
+   Set NT and POSIX ACLs and other VFS operations from Python
+
    Copyrigyt (C) Andrew Bartlett 2012
    Copyright (C) Jeremy Allison 1994-2009.
    Copyright (C) Andreas Gruenbacher 2002.
@@ -51,7 +51,7 @@ static NTSTATUS set_sys_acl_no_snum(const char *fname,
        }
 
        if (!(conn->params = talloc(conn, struct share_params))) {
-               DEBUG(0,("get_nt_acl_no_snum: talloc() failed!\n"));
+               DEBUG(0,("set_sys_acl_no_snum: talloc() failed!\n"));
                TALLOC_FREE(conn);
                return NT_STATUS_NO_MEMORY;
        }
@@ -65,7 +65,8 @@ static NTSTATUS set_sys_acl_no_snum(const char *fname,
        ret = SMB_VFS_SYS_ACL_SET_FILE( conn, fname, acltype, theacl);
        if (ret != 0) {
                status = map_nt_error_from_unix_common(ret);
-               DEBUG(0,("set_nt_acl_no_snum: fset_nt_acl returned zero.\n"));
+               DEBUG(0,("set_sys_acl_no_snum: SMB_VFS_SYS_ACL_SET_FILE "
+                        "returned zero.\n"));
        }
 
        conn_free(conn);
@@ -216,17 +217,17 @@ static SMB_ACL_T make_simple_acl(gid_t gid, mode_t 
chmod_mode)
                        TALLOC_FREE(acl);
                        return NULL;
                }
-               
+
                if (sys_acl_set_tag_type(entry, SMB_ACL_GROUP) != 0) {
                        TALLOC_FREE(acl);
                        return NULL;
                }
-               
+
                if (sys_acl_set_qualifier(entry, &gid) != 0) {
                        TALLOC_FREE(acl);
                        return NULL;
                }
-               
+
                if (sys_acl_set_permset(entry, &mode_group) != 0) {
                        TALLOC_FREE(acl);
                        return NULL;
@@ -379,7 +380,7 @@ static PyObject *py_smbd_get_nt_acl(PyObject *self, 
PyObject *args)
 
        if (!PyArg_ParseTuple(args, "si", &fname, &security_info_wanted))
                return NULL;
-       
+
        sd = get_nt_acl_no_snum(tmp_ctx, fname, security_info_wanted);
 
        py_sd = py_return_ndr_struct("samba.dcerpc.security", "descriptor", sd, 
sd);
diff --git a/source3/smbd/smb2_negprot.c b/source3/smbd/smb2_negprot.c
index 11ec2a5..6adc581 100644
--- a/source3/smbd/smb2_negprot.c
+++ b/source3/smbd/smb2_negprot.c
@@ -255,11 +255,9 @@ NTSTATUS smbd_smb2_request_process_negprot(struct 
smbd_smb2_request *req)
        }
 
        if ((protocol >= PROTOCOL_SMB2_24) &&
-           (lp_smb_encrypt(-1) != SMB_SIGNING_OFF))
-       {
-               if (in_capabilities & SMB2_CAP_ENCRYPTION) {
-                       capabilities |= SMB2_CAP_ENCRYPTION;
-               }
+           (lp_smb_encrypt(-1) != SMB_SIGNING_OFF) &&
+           (in_capabilities & SMB2_CAP_ENCRYPTION)) {
+               capabilities |= SMB2_CAP_ENCRYPTION;
        }
 
        /*


-- 
Samba Shared Repository

Reply via email to