[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Tue Apr 9 18:04:02 MDT 2013


The branch, master has been updated
       via  8aae8b5 s3:smbd: do not access data behind req->buf+req->buflen in srvstr_pull_req_talloc()
       via  a70e9db s3:smbd: convert srvstr_pull_req_talloc() into a function
       via  98f9e5e s3:smbd: do not access data behind req->buf+req->buflen in srvstr_get_path_req_wcard()
       via  e7e37b3 python-samba-tool domain classicupgrade: Make failure to connect directly to the LDAP backend fatal
       via  45a596f build: Remove extra space in shebang
       via  58e3c53 build: Replace #!/usr/bin/env python with passed in PYTHON=
      from  69b3d19 vfs_fake_perms: Fix bug 9775, segfault for "artificial" conn_structs

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


- Log -----------------------------------------------------------------
commit 8aae8b5bad167ac732b7f8949dfb40aebb2f26a9
Author: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Date:   Thu Apr 4 13:29:01 2013 +0200

    s3:smbd: do not access data behind req->buf+req->buflen in srvstr_pull_req_talloc()
    
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Wed Apr 10 02:03:13 CEST 2013 on sn-devel-104

commit a70e9db0f325e9be85983c172f0cc68992b0f593
Author: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Date:   Thu Apr 4 13:24:36 2013 +0200

    s3:smbd: convert srvstr_pull_req_talloc() into a function
    
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 98f9e5edd35d6fb54dea74f799b017967b0a13fd
Author: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Date:   Thu Apr 4 12:59:36 2013 +0200

    s3:smbd: do not access data behind req->buf+req->buflen in srvstr_get_path_req_wcard()
    
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit e7e37b3b90100f762a45f2f3c047e14e3619c216
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Apr 5 15:23:20 2013 +1100

    python-samba-tool domain classicupgrade: Make failure to connect directly to the LDAP backend fatal
    
    This is better than failing just a little further down the stack with a useless error
    about use-before-set.
    
    Andrew Bartlett
    
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 45a596fbe9ed2b198956d58784999df780f6dd65
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 8 08:33:55 2013 +1000

    build: Remove extra space in shebang
    
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 58e3c5323e343dcab1c528c6b6a44925b76cb297
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Apr 8 15:57:45 2013 +1000

    build: Replace #!/usr/bin/env python with passed in PYTHON=
    
    This means that if we were forced to use a specific python for the build, we
    will put that binary into the top of samba-tool, so it continues to work
    after the install.
    
    Andrew Bartlett
    
    Reviewed-by: Michael Adam <obnox at samba.org>

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

Summary of changes:
 buildtools/wafsamba/samba_python.py |   10 ++++++++++
 buildtools/wafsamba/wafsamba.py     |   15 ++++++++++++++-
 python/samba/upgrade.py             |    2 +-
 source3/include/srvstr.h            |    9 ---------
 source3/smbd/proto.h                |    2 ++
 source3/smbd/reply.c                |   31 ++++++++++++++++++++++++++++---
 source3/wscript                     |    2 +-
 wscript                             |    7 ++-----
 8 files changed, 58 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py
index b2172f7..847b431 100644
--- a/buildtools/wafsamba/samba_python.py
+++ b/buildtools/wafsamba/samba_python.py
@@ -5,6 +5,16 @@ from samba_utils import *
 from samba_autoconf import *
 
 from Configure import conf
+
+ at conf
+def SAMBA_CHECK_PYTHON(conf, mandatory=True):
+    # enable tool to build python extensions
+    conf.find_program('python', var='PYTHON', mandatory=mandatory)
+    conf.check_tool('python')
+    path_python = conf.find_program('python')
+    conf.env.PYTHON_SPECIFIED = (conf.env.PYTHON != path_python)
+    conf.check_python_version((2,4,2))
+
 @conf
 def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
     if conf.env["python_headers_checked"] == []:
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index f7156ec..3559cc1 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -696,14 +696,25 @@ def copy_and_fix_python_path(task):
         replacement="""sys.path.insert(0, "%s")
 sys.path.insert(1, "%s")""" % (task.env["PYTHONARCHDIR"], task.env["PYTHONDIR"])
 
+    shebang = None
+
+    if task.env["PYTHON"][0] == "/":
+        replacement_shebang = "#!%s" % task.env["PYTHON"]
+    else:
+        replacement_shebang = "#!/usr/bin/env %s" % task.env["PYTHON"]
+
     installed_location=task.outputs[0].bldpath(task.env)
     source_file = open(task.inputs[0].srcpath(task.env))
     installed_file = open(installed_location, 'w')
+    lineno = 0
     for line in source_file:
         newline = line
-        if pattern in line:
+        if lineno == 0 and task.env["PYTHON_SPECIFIED"] == True and line[:2] == "#!":
+            newline = replacement_shebang
+        elif pattern in line:
             newline = line.replace(pattern, replacement)
         installed_file.write(newline)
+        lineno = lineno + 1
     installed_file.close()
     os.chmod(installed_location, 0755)
     return 0
@@ -727,6 +738,8 @@ def install_file(bld, destdir, file, chmod=MODE_644, flat=False,
                             target=inst_file)
         bld.add_manual_dependency(bld.path.find_or_declare(inst_file), bld.env["PYTHONARCHDIR"])
         bld.add_manual_dependency(bld.path.find_or_declare(inst_file), bld.env["PYTHONDIR"])
+        bld.add_manual_dependency(bld.path.find_or_declare(inst_file), str(bld.env["PYTHON_SPECIFIED"]))
+        bld.add_manual_dependency(bld.path.find_or_declare(inst_file), bld.env["PYTHON"])
         file = inst_file
     if base_name:
         file = os.path.join(base_name, file)
diff --git a/python/samba/upgrade.py b/python/samba/upgrade.py
index 8371224..af854ef 100644
--- a/python/samba/upgrade.py
+++ b/python/samba/upgrade.py
@@ -791,7 +791,7 @@ Please fix this account before attempting to upgrade again
             try:
                 ldb_object = Ldb(url, credentials=creds)
             except ldb.LdbError, e:
-                logger.warning("Could not open ldb connection to %s, the error message is: %s", url, e)
+                raise ProvisiongError("Could not open ldb connection to %s, the error message is: %s" % (url, e))
             else:
                 break
     logger.info("Exporting posix attributes")
diff --git a/source3/include/srvstr.h b/source3/include/srvstr.h
index 7e7d8a2..2c6e7ef 100644
--- a/source3/include/srvstr.h
+++ b/source3/include/srvstr.h
@@ -19,12 +19,3 @@
 
 #define srvstr_pull_talloc(ctx, base_ptr, smb_flags2, dest, src, src_len, flags) \
     pull_string_talloc(ctx, base_ptr, smb_flags2, dest, src, src_len, flags)
-
-/* pull a string from the smb_buf part of a packet. In this case the
-   string can either be null terminated or it can be terminated by the
-   end of the smbbuf area 
-*/
-
-#define srvstr_pull_req_talloc(ctx, req_, dest, src, flags) \
-    pull_string_talloc(ctx, req_->inbuf, req_->flags2, dest, src, \
-		       smbreq_bufrem(req_, src), flags)
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 7e13049..2be73a2 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -841,6 +841,8 @@ size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
 size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
 			   char **pp_dest, const char *src, int flags,
 			   NTSTATUS *err);
+size_t srvstr_pull_req_talloc(TALLOC_CTX *ctx, struct smb_request *req,
+			      char **dest, const char *src, int flags);
 bool check_fsp_open(connection_struct *conn, struct smb_request *req,
 		    files_struct *fsp);
 bool check_fsp(connection_struct *conn, struct smb_request *req,
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 0d9f415..79aaf76 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -318,9 +318,16 @@ size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
 				 char **pp_dest, const char *src, int flags,
 				 NTSTATUS *err, bool *contains_wcard)
 {
-	return srvstr_get_path_wcard(mem_ctx, (const char *)req->inbuf, req->flags2,
-				     pp_dest, src, smbreq_bufrem(req, src),
-				     flags, err, contains_wcard);
+	ssize_t bufrem = smbreq_bufrem(req, src);
+
+	if (bufrem < 0) {
+		*err = NT_STATUS_INVALID_PARAMETER;
+		return 0;
+	}
+
+	return srvstr_get_path_wcard(mem_ctx, (const char *)req->inbuf,
+				     req->flags2, pp_dest, src, bufrem, flags,
+				     err, contains_wcard);
 }
 
 size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
@@ -332,6 +339,24 @@ size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
 					 flags, err, &ignore);
 }
 
+/**
+ * pull a string from the smb_buf part of a packet. In this case the
+ * string can either be null terminated or it can be terminated by the
+ * end of the smbbuf area
+ */
+size_t srvstr_pull_req_talloc(TALLOC_CTX *ctx, struct smb_request *req,
+			      char **dest, const char *src, int flags)
+{
+	ssize_t bufrem = smbreq_bufrem(req, src);
+
+	if (bufrem < 0) {
+		return 0;
+	}
+
+	return pull_string_talloc(ctx, req->inbuf, req->flags2, dest, src,
+				  bufrem, flags);
+}
+
 /****************************************************************************
  Check if we have a correct fsp pointing to a file. Basic check for open fsp.
 ****************************************************************************/
diff --git a/source3/wscript b/source3/wscript
index 568f736..d687dae 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#!/usr/bin/env python
 
 srcdir=".."
 
diff --git a/wscript b/wscript
index 4f82310..1ef55ab 100644
--- a/wscript
+++ b/wscript
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#!/usr/bin/env python
 
 srcdir = '.'
 blddir = 'bin'
@@ -82,13 +82,10 @@ def configure(conf):
 
     conf.RECURSE('lib/replace')
 
-    conf.find_program('python', var='PYTHON', mandatory=True)
     conf.find_program('perl', var='PERL', mandatory=True)
     conf.find_program('xsltproc', var='XSLTPROC')
 
-    # enable tool to build python extensions
-    conf.check_tool('python')
-    conf.check_python_version((2,4,2))
+    conf.SAMBA_CHECK_PYTHON(mandatory=True)
     conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True)
 
     if sys.platform == 'darwin' and not conf.env['HAVE_ENVIRON_DECL']:


-- 
Samba Shared Repository


More information about the samba-cvs mailing list