The branch, master has been updated
       via  9ddeac1... pyxattr: Factor out helper functions.
       via  17d6f56... selftest: Cope with 'multipart' support in subunit.
       via  8b0f319... pyxattr: Simplify tests.
       via  05b4e29... pyxattr: Fix tests by not opening tdb files multiple 
times.
       via  14b0fed... pyxattr: Fix tests by avoiding opening tdb files 
multiple times.
       via  253a232... pyxattr: Fix memory leaks.
       via  9a25380... pyxattr: Simplify tests.
       via  7092e22... pyxattr: Fix return value, raise exception, fix memory 
leak.
       via  342aff7... pyxattr: Use standard functions for error handling.
       via  6afb162... pyxattr: Remove unnecessary hacks.
       via  f679def... s4: Fix a few warnings.
       via  4b11e0c... pidl: Include Python.h first, to avoid warnings.
       via  c42242d... s4: Include Python.h early to avoid double definition 
errors.
      from  e8a99ac... s3: fix dnsupdate configure check

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


- Log -----------------------------------------------------------------
commit 9ddeac17f58273730be605a1f08097a15a3204d1
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Thu Jan 21 17:17:02 2010 +1300

    pyxattr: Factor out helper functions.

commit 17d6f56646b79ba1acecab6eb661cb6205c9b408
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Thu Jan 21 17:16:19 2010 +1300

    selftest: Cope with 'multipart' support in subunit.

commit 8b0f31994c38b9f349fdda88a74e95a961582902
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Thu Jan 21 16:56:23 2010 +1300

    pyxattr: Simplify tests.

commit 05b4e29f7f35108a7a17f072dc1329fc14d6b9ea
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Thu Jan 21 16:45:06 2010 +1300

    pyxattr: Fix tests by not opening tdb files multiple times.

commit 14b0fed96c5d5acf9118156d29e469aed584c33d
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Thu Jan 21 16:44:20 2010 +1300

    pyxattr: Fix tests by avoiding opening tdb files multiple times.

commit 253a232d300ac6a508983bbbb6eb6d0235d48722
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Thu Jan 21 16:44:12 2010 +1300

    pyxattr: Fix memory leaks.

commit 9a253808383e1a2777c3c05a25be88ed25c51a13
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Thu Jan 21 16:41:30 2010 +1300

    pyxattr: Simplify tests.

commit 7092e220b57867c35425f17d09c4cc1031932eda
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Thu Jan 21 16:29:15 2010 +1300

    pyxattr: Fix return value, raise exception, fix memory leak.

commit 342aff75c5400ef6be855094e2fe42f444cc40de
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Thu Jan 21 16:28:24 2010 +1300

    pyxattr: Use standard functions for error handling.

commit 6afb16253399a58ac06b0061cd7ceb112bcd172b
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Thu Jan 21 16:18:19 2010 +1300

    pyxattr: Remove unnecessary hacks.

commit f679def4f2c4d878c8fac49ea248cfadb665168c
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Wed Jan 20 16:27:38 2010 +1300

    s4: Fix a few warnings.

commit 4b11e0c67cbd611b7f295256f0aa6c55a8b88699
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Wed Jan 20 16:27:15 2010 +1300

    pidl: Include Python.h first, to avoid warnings.

commit c42242d132144fbbdce97bd95f0e24bdf58a2c84
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Wed Jan 20 15:07:09 2010 +1300

    s4: Include Python.h early to avoid double definition errors.

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

Summary of changes:
 lib/talloc/pytalloc.c                         |    1 +
 pidl/lib/Parse/Pidl/Samba4/Python.pm          |    2 +-
 selftest/Subunit.pm                           |    2 +-
 source4/auth/pyauth.c                         |    1 +
 source4/lib/ldb/tools/cmdline.c               |    2 +
 source4/lib/stream/packet.h                   |    1 +
 source4/librpc/ndr/py_xattr.c                 |    9 +-
 source4/param/provision.c                     |    2 +-
 source4/scripting/python/pyxattr_native.c     |   48 +++-----
 source4/scripting/python/pyxattr_tdb.c        |   54 ++++-----
 source4/scripting/python/samba/tests/xattr.py |  160 +++++++++++--------------
 source4/torture/rpc/samba3rpc.c               |    1 -
 source4/torture/smb2/acls.c                   |    4 +-
 source4/utils/net/net.c                       |    2 +-
 14 files changed, 130 insertions(+), 159 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/talloc/pytalloc.c b/lib/talloc/pytalloc.c
index c6decf3..ad595a1 100644
--- a/lib/talloc/pytalloc.c
+++ b/lib/talloc/pytalloc.c
@@ -17,6 +17,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <Python.h>
 #include "replace.h"
 #include <talloc.h>
 #include <pytalloc.h>
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm 
b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 79c72d7..015c54d 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -1124,8 +1124,8 @@ sub Parse($$$$$)
 
     $self->pidl_hdr("
 /* Python wrapper functions auto-generated by pidl */
-#include \"includes.h\"
 #include <Python.h>
+#include \"includes.h\"
 #include \"librpc/rpc/dcerpc.h\"
 #include \"lib/talloc/pytalloc.h\"
 #include \"librpc/rpc/pyrpc.h\"
diff --git a/selftest/Subunit.pm b/selftest/Subunit.pm
index 9d67c81..718b8ce 100644
--- a/selftest/Subunit.pm
+++ b/selftest/Subunit.pm
@@ -38,7 +38,7 @@ sub parse_results($$$)
                        push (@$open_tests, $1);
                } elsif (/^time: (\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)\n/) {
                        $msg_ops->report_time(mktime($6, $5, $4, $3, $2-1, 
$1-1900));
-               } elsif 
(/^(success|successful|failure|fail|skip|knownfail|error|xfail|skip-testsuite|testsuite-failure|testsuite-xfail|testsuite-success|testsuite-error):
 (.*?)( \[)?([ \t]*)\n/) {
+               } elsif 
(/^(success|successful|failure|fail|skip|knownfail|error|xfail|skip-testsuite|testsuite-failure|testsuite-xfail|testsuite-success|testsuite-error):
 (.*?)( \[)?([ \t]*)( multipart)?\n/) {
                        $msg_ops->control_msg($_);
                        my $result = $1;
                        my $testname = $2;
diff --git a/source4/auth/pyauth.c b/source4/auth/pyauth.c
index 7ec7f3e..865609e 100644
--- a/source4/auth/pyauth.c
+++ b/source4/auth/pyauth.c
@@ -16,6 +16,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <Python.h>
 #include "includes.h"
 #include "param/param.h"
 #include "pyauth.h"
diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c
index 44ae23b..f2becb1 100644
--- a/source4/lib/ldb/tools/cmdline.c
+++ b/source4/lib/ldb/tools/cmdline.c
@@ -33,6 +33,8 @@
 #include "auth/auth.h"
 #include "ldb_wrap.h"
 #include "param/param.h"
+#include "librpc/gen_ndr/drsblobs.h"
+#include "dsdb/schema/schema.h"
 #include "dsdb/common/proto.h"
 #endif
 
diff --git a/source4/lib/stream/packet.h b/source4/lib/stream/packet.h
index 85f0f26..a274bd3 100644
--- a/source4/lib/stream/packet.h
+++ b/source4/lib/stream/packet.h
@@ -23,6 +23,7 @@
 struct packet_context;
 struct tevent_context;
 struct tevent_fd;
+struct socket_context;
 
 typedef NTSTATUS (*packet_full_request_fn_t)(void *private_data,
                                             DATA_BLOB blob, size_t 
*packet_size);
diff --git a/source4/librpc/ndr/py_xattr.c b/source4/librpc/ndr/py_xattr.c
index 15f2b9c..19c5f26 100644
--- a/source4/librpc/ndr/py_xattr.c
+++ b/source4/librpc/ndr/py_xattr.c
@@ -22,6 +22,7 @@
 #ifndef Py_RETURN_NONE
 #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
 #endif
+
 static void PyType_AddMethods(PyTypeObject *type, PyMethodDef *methods)
 {
         PyObject *dict;
@@ -69,11 +70,15 @@ static PyObject *py_ntacl_print(PyObject *self, PyObject 
*args)
        mem_ctx = talloc_new(NULL);
 
        pr = talloc_zero(mem_ctx, struct ndr_print);
-       if (!pr) return;
+       if (!pr) {
+               PyErr_NoMemory();
+               talloc_free(mem_ctx);
+               return NULL;
+       }
        pr->print = ntacl_print_debug_helper;
        ndr_print_xattr_NTACL(pr, "file", ntacl);
 
-       talloc_free(pr);
+       talloc_free(mem_ctx);
 
        Py_RETURN_NONE;
 }
diff --git a/source4/param/provision.c b/source4/param/provision.c
index 7bd10ca..920a5d8 100644
--- a/source4/param/provision.c
+++ b/source4/param/provision.c
@@ -68,7 +68,7 @@ static PyObject *PyLdb_FromLdbContext(struct ldb_context 
*ldb_ctx)
        if (ldb_mod == NULL)
                return NULL;
 
-       ldb_ctx_type = PyObject_GetAttrString(ldb_mod, "Ldb");
+       ldb_ctx_type = (PyTypeObject *)PyObject_GetAttrString(ldb_mod, "Ldb");
 
        ret = (PyLdbObject *)ldb_ctx_type->tp_alloc(ldb_ctx_type, 0);
        if (ret == NULL) {
diff --git a/source4/scripting/python/pyxattr_native.c 
b/source4/scripting/python/pyxattr_native.c
index 7cff42c..9b60039 100644
--- a/source4/scripting/python/pyxattr_native.c
+++ b/source4/scripting/python/pyxattr_native.c
@@ -19,7 +19,6 @@
 */
 
 #include <Python.h>
-#include "version.h"
 #include "includes.h"
 #include "librpc/ndr/libndr.h"
 #include "lib/util/wrap_xattr.h"
@@ -28,7 +27,7 @@
 #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
 #endif
 
-static PyObject  *py_is_xattr_supported(PyObject *self)
+static PyObject *py_is_xattr_supported(PyObject *self)
 {
 #if !defined(HAVE_XATTR_SUPPORT)
        return Py_False;
@@ -36,6 +35,7 @@ static PyObject  *py_is_xattr_supported(PyObject *self)
        return Py_True;
 #endif
 }
+
 static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args)
 {
        char *filename, *attribute;
@@ -43,16 +43,17 @@ static PyObject *py_wrap_setxattr(PyObject *self, PyObject 
*args)
        int blobsize;
        DATA_BLOB blob;
 
-       if (!PyArg_ParseTuple(args, "sss#", 
&filename,&attribute,&blob.data,&blobsize))
+       if (!PyArg_ParseTuple(args, "sss#", &filename, &attribute, &blob.data, 
+        &blobsize))
                return NULL;
 
        blob.length = blobsize;
-       ret = wrap_setxattr(filename,attribute,blob.data,blob.length,0);
+       ret = wrap_setxattr(filename, attribute, blob.data, blob.length, 0);
        if( ret < 0 ) {
                if (errno == ENOTSUP) {
-                       PyErr_SetString(PyExc_IOError, strerror(errno));
+                       PyErr_SetFromErrno(PyExc_IOError);
                } else {
-                       PyErr_SetString(PyExc_TypeError, strerror(errno));
+                       PyErr_SetFromErrno(PyExc_TypeError);
                }
                return NULL;
        }
@@ -64,33 +65,35 @@ static PyObject *py_wrap_getxattr(PyObject *self, PyObject 
*args)
        char *filename, *attribute;
        int len;
        TALLOC_CTX *mem_ctx;
-       uint8_t *buf;
+       char *buf;
        PyObject *ret;
-       if (!PyArg_ParseTuple(args, "ss", &filename,&attribute))
+       if (!PyArg_ParseTuple(args, "ss", &filename, &attribute))
                return NULL;
        mem_ctx = talloc_new(NULL);
        len = wrap_getxattr(filename,attribute,NULL,0);
        if( len < 0 ) {
                if (errno == ENOTSUP) {
-                       PyErr_SetString(PyExc_IOError, strerror(errno));
+                       PyErr_SetFromErrno(PyExc_IOError);
                } else {
-                       PyErr_SetString(PyExc_TypeError, strerror(errno));
+                       PyErr_SetFromErrno(PyExc_TypeError);
                }
+               talloc_free(mem_ctx);
                return NULL;
        }
        /* check length ... */
-       buf = talloc_zero_array(mem_ctx, uint8_t, len);
-       len = wrap_getxattr(filename,attribute,buf,len);
+       buf = talloc_zero_array(mem_ctx, char, len);
+       len = wrap_getxattr(filename, attribute, buf, len);
        if( len < 0 ) {
                if (errno == ENOTSUP) {
-                       PyErr_SetString(PyExc_IOError, strerror(errno));
+                       PyErr_SetFromErrno(PyExc_IOError);
                } else {
-                       PyErr_SetString(PyExc_TypeError, strerror(errno));
+                       PyErr_SetFromErrno(PyExc_TypeError);
                }
+               talloc_free(mem_ctx);
                return NULL;
        }
-       ret = PyString_FromStringAndSize(buf,len);
-       talloc_free(buf);
+       ret = PyString_FromStringAndSize(buf, len);
+       talloc_free(mem_ctx);
        return ret;
 }
 
@@ -112,19 +115,8 @@ void initxattr_native(void)
 
        m = Py_InitModule3("xattr_native", py_xattr_methods,
                           "Python bindings for xattr manipulation.");
+
        if (m == NULL)
                return;
-
-       PyModule_AddObject(m, "version", 
PyString_FromString(SAMBA_VERSION_STRING));
-
-       /* one of the most annoying things about python scripts is
-          that they don't die when you hit control-C. This fixes that
-          sillyness. As we do all database operations using
-          transactions, this is also safe. In fact, not dying
-          immediately is unsafe as we could end up treating the
-          control-C exception as a different error and try to modify
-          as database incorrectly
-       */
-       signal(SIGINT, SIG_DFL);
 }
 
diff --git a/source4/scripting/python/pyxattr_tdb.c 
b/source4/scripting/python/pyxattr_tdb.c
index aa511fa..e49cd88 100644
--- a/source4/scripting/python/pyxattr_tdb.c
+++ b/source4/scripting/python/pyxattr_tdb.c
@@ -19,36 +19,34 @@
 */
 
 #include <Python.h>
-#include "version.h"
 #include "includes.h"
-#include "../tdb/include/tdb.h"
+#include <tdb.h>
 #include "tdb_wrap.h"
 #include "librpc/ndr/libndr.h"
 #include "lib/util/wrap_xattr.h"
 #include "ntvfs/posix/vfs_posix.h"
+#include "libcli/util/pyerrors.h"
 
 #ifndef Py_RETURN_NONE
 #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
 #endif
 
-static PyObject  *py_is_xattr_supported(PyObject *self)
+static PyObject *py_is_xattr_supported(PyObject *self)
 {
-#if !defined(HAVE_XATTR_SUPPORT)
-       return Py_False;
-#else
        return Py_True;
-#endif
 }
+
 static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args)
 {
        char *filename, *attribute, *tdbname;
        DATA_BLOB blob;
        int blobsize;
-        NTSTATUS status;
+       NTSTATUS status;
        TALLOC_CTX *mem_ctx;
        struct tdb_wrap *eadb;
 
-       if (!PyArg_ParseTuple(args, "ssss#", 
&tdbname,&filename,&attribute,&blob.data,&blobsize))
+       if (!PyArg_ParseTuple(args, "ssss#", &tdbname, &filename, &attribute, 
+                                                 &blob.data, &blobsize))
                return NULL;
 
        blob.length = blobsize;
@@ -58,12 +56,17 @@ static PyObject *py_wrap_setxattr(PyObject *self, PyObject 
*args)
 
        if (eadb == NULL) {
                PyErr_SetFromErrno(PyExc_IOError);
+               talloc_free(mem_ctx);
                return NULL;
-       }       status = 
push_xattr_blob_tdb_raw(eadb,mem_ctx,attribute,filename,-1,&blob);
-       if( !NT_STATUS_IS_OK(status) ) {
-               PyErr_SetString(PyExc_TypeError, strerror(errno));
+       }
+       status = push_xattr_blob_tdb_raw(eadb, mem_ctx, attribute, filename, -1,
+                                                                        &blob);
+       if (!NT_STATUS_IS_OK(status)) {
+               PyErr_FromNTSTATUS(status);
+               talloc_free(mem_ctx);
                return NULL;
        }
+       talloc_free(mem_ctx);
        Py_RETURN_NONE;
 }
 
@@ -76,23 +79,26 @@ static PyObject *py_wrap_getxattr(PyObject *self, PyObject 
*args)
        NTSTATUS status;
        struct tdb_wrap *eadb = NULL;
 
-       if (!PyArg_ParseTuple(args, "sss", &tdbname,&filename,&attribute))
+       if (!PyArg_ParseTuple(args, "sss", &tdbname, &filename, &attribute))
                return NULL;
 
        mem_ctx = talloc_new(NULL);
        eadb = tdb_wrap_open(mem_ctx, tdbname, 50000,
                                TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
        if (eadb == NULL) {
-
                PyErr_SetFromErrno(PyExc_IOError);
+               talloc_free(mem_ctx);
                return NULL;
        }
-       status = 
pull_xattr_blob_tdb_raw(eadb,mem_ctx,attribute,filename,-1,100,&blob);
-       if( !NT_STATUS_IS_OK(status) || blob.length < 0 ) {
-               PyErr_SetString(PyExc_TypeError, 
get_friendly_nt_error_msg(status));
+       status = pull_xattr_blob_tdb_raw(eadb, mem_ctx, attribute, filename, 
+                                                                        -1, 
100, &blob);
+       if (!NT_STATUS_IS_OK(status) || blob.length < 0) {
+               PyErr_FromNTSTATUS(status);
+               talloc_free(mem_ctx);
                return NULL;
        }
-       ret = PyString_FromStringAndSize(blob.data,blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       talloc_free(mem_ctx);
        return ret;
 }
 
@@ -116,17 +122,5 @@ void initxattr_tdb(void)
                           "Python bindings for xattr manipulation.");
        if (m == NULL)
                return;
-
-       PyModule_AddObject(m, "version", 
PyString_FromString(SAMBA_VERSION_STRING));
-
-       /* one of the most annoying things about python scripts is
-          that they don't die when you hit control-C. This fixes that
-          sillyness. As we do all database operations using
-          transactions, this is also safe. In fact, not dying
-          immediately is unsafe as we could end up treating the
-          control-C exception as a different error and try to modify
-          as database incorrectly
-       */
-       signal(SIGINT, SIG_DFL);
 }
 
diff --git a/source4/scripting/python/samba/tests/xattr.py 
b/source4/scripting/python/samba/tests/xattr.py
index fcc2a3a..9bfe52c 100644
--- a/source4/scripting/python/samba/tests/xattr.py
+++ b/source4/scripting/python/samba/tests/xattr.py
@@ -19,109 +19,85 @@
 
 import samba.xattr_native, samba.xattr_tdb
 from samba.dcerpc import xattr
-from samba.ndr import ndr_pack, ndr_unpack
-from unittest import TestCase
+from samba.ndr import ndr_pack
+from testtools.testcase import TestCase, TestSkipped
 import random
 import os
-import tdb
-import sys
 
 class XattrTests(TestCase):
 
-    def test_set_xattr_native(self):
-               if samba.xattr_native.is_xattr_supported():
-                       random.seed()
-                       path=None
-                       try:
-                               path=os.environ['SELFTEST_PREFIX']
-                       except:
-                               self.assertTrue(path!=None, "SELFTEST_PREFIX 
env not set")
-                       if path:
-                               path=os.environ['SELFTEST_PREFIX']
-                               
tempf=os.path.join(path,"pytests"+str(int(100000*random.random())))
-                               ntacl=xattr.NTACL()
-                               ntacl.version = 1
-                               open(tempf, 'w').write("empty")
-                               try:
-                                       
samba.xattr_native.wrap_setxattr(tempf,"user.unittests",ndr_pack(ntacl))
-                               except IOError:
-                                       print >>sys.stderr, "WARNING: the 
filesystem where the tests are runned do not support XATTR, tests SKIPED"
-                               os.unlink(tempf)
-               else:
-                       print >>sys.stderr, "WARNING: the filesystem where the 
tests are runned do not support XATTR, tests SKIPED"
+    def _tmpfilename(self):
+        random.seed()
+        path = os.environ['SELFTEST_PREFIX']
+        return os.path.join(path, "pytests"+str(int(100000*random.random())))
+
+    def _eadbpath(self):
+        return os.path.join(os.environ['SELFTEST_PREFIX'], "eadb.tdb")
 
+    def test_set_xattr_native(self):
+        if not samba.xattr_native.is_xattr_supported():
+            raise TestSkipped()
+        ntacl = xattr.NTACL()
+        ntacl.version = 1
+        tempf = self._tmpfilename()
+        open(tempf, 'w').write("empty")
+        try:
+            samba.xattr_native.wrap_setxattr(tempf, "user.unittests", 
+                ndr_pack(ntacl))
+        except IOError:
+            raise TestSkipped("the filesystem where the tests are runned do 
not support XATTR")
+        os.unlink(tempf)
 
     def test_set_and_get_native(self):
-               if samba.xattr_native.is_xattr_supported():
-                       random.seed()
-                       path=None
-                       try:
-                               path=os.environ['SELFTEST_PREFIX']
-                       except:
-                               self.assertTrue(path!=None, "SELFTEST_PREFIX 
env not set")
-                       if path:
-                               path=os.environ['SELFTEST_PREFIX']
-                               
tempf=os.path.join(path,"pytests"+str(int(100000*random.random())))
-                               reftxt="this is a test"
-                               open(tempf, 'w').write("empty")
-                               try:
-                                       
samba.xattr_native.wrap_setxattr(tempf,"user.unittests",reftxt)
-                                       text = 
samba.xattr_native.wrap_getxattr(tempf,"user.unittests")
-                                       self.assertEquals(text,reftxt)
-                               except IOError:
-                                       print >>sys.stderr,"WARNING: the 
filesystem where the tests are runned do not support XATTR, tests SKIPED"
-                               os.unlink(tempf)
-               else:
-                       print >>sys.stderr,"WARNING: the filesystem where the 
tests are runned do not support XATTR, tests SKIPED"
+        if not samba.xattr_native.is_xattr_supported():
+            raise TestSkipped()
+        tempf = self._tmpfilename()
+        reftxt = "this is a test"
+        open(tempf, 'w').write("empty")
+        try:
+            samba.xattr_native.wrap_setxattr(tempf, "user.unittests", reftxt)
+            text = samba.xattr_native.wrap_getxattr(tempf, "user.unittests")
+            self.assertEquals(text, reftxt)
+        except IOError:
+            raise TestSkipped("the filesystem where the tests are runned do 
not support XATTR")
+        os.unlink(tempf)
 
     def test_set_xattr_tdb(self):
-               path=None
-               try:
-                       path=os.environ['SELFTEST_PREFIX']
-               except:
-                       self.assertTrue(path!=None, "SELFTEST_PREFIX env not 
set")
-               if path:
-                       eadb=tdb.Tdb(os.path.join(path,"eadb.tdb"), 50000, 
tdb.DEFAULT, os.O_CREAT|os.O_RDWR)
-                       random.seed()
-                       
tempf=os.path.join(path,"pytests"+str(int(100000*random.random())))
-                       ntacl=xattr.NTACL()
-                       ntacl.version = 1
-                       open(tempf, 'w').write("empty")
-                       
samba.xattr_tdb.wrap_setxattr(os.path.join(path,"eadb.tdb"),tempf,"user.unittests",ndr_pack(ntacl))
-                       os.unlink(tempf)
-                       os.unlink(os.path.join(path,"eadb.tdb"))
+        tempf = self._tmpfilename()
+        eadb_path = self._eadbpath()
+        ntacl = xattr.NTACL()
+        ntacl.version = 1
+        open(tempf, 'w').write("empty")
+        try:
+            samba.xattr_tdb.wrap_setxattr(eadb_path,
+                tempf, "user.unittests", ndr_pack(ntacl))
+        finally:
+            os.unlink(tempf)
+        os.unlink(eadb_path)
 
     def test_set_tdb_not_open(self):
-               path=None
-               try:
-                       path=os.environ['SELFTEST_PREFIX']
-               except:
-                       self.assertTrue(path!=None, "SELFTEST_PREFIX env not 
set")
-               if path:
-                       eadb=tdb.Tdb(os.path.join(path,"eadb.tdb"), 50000, 
tdb.DEFAULT, os.O_CREAT|os.O_RDWR)
-                       random.seed()
-                       
tempf=os.path.join(path,"pytests"+str(int(100000*random.random())))
-                       ntacl=xattr.NTACL()
-                       ntacl.version = 1
-                       open(tempf, 'w').write("empty")
-                       
self.assertRaises(IOError,samba.xattr_tdb.wrap_setxattr,os.path.join(path,os.path.join("nonexistent","eadb.tdb")),tempf,"user.unittests",ndr_pack(ntacl))
-                       os.unlink(tempf)
+        tempf = self._tmpfilename()
+        ntacl = xattr.NTACL()
+        ntacl.version = 1


-- 
Samba Shared Repository

Reply via email to