[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Wed Dec 12 06:59:03 MST 2012


The branch, master has been updated
       via  c905379 tdb: Improve the documentation of tdb_reopen() and tdb_close().
       via  7f08365 tdb: Fix possible crash bugs in the python tdb code.
       via  d07a964 misc: Add a config for clang complete.
      from  34ac9d8 s4-selftest: make sure to test rpc.samr.passwords.validate over ncacn_ip_tcp.

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


- Log -----------------------------------------------------------------
commit c9053796b389758e8bacff4cd37d633fd65171f9
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Dec 11 17:11:58 2012 +0100

    tdb: Improve the documentation of tdb_reopen() and tdb_close().
    
    Reviewed-by: Simo Sorce <idra at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Wed Dec 12 14:58:50 CET 2012 on sn-devel-104

commit 7f08365a28770fdcc1bb625d8a16d11d8f15c29a
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Dec 11 16:51:01 2012 +0100

    tdb: Fix possible crash bugs in the python tdb code.
    
    You can't call tdb_error() for tdb_reopen() or tdb_close(), both return
    the error code of close(2) and not a TDB_ERROR!
    
    Reviewed-by: Simo Sorce <idra at samba.org>
    Reviewed-by: Jelmer Vernooij <jelmer at samba.org>

commit d07a964fe25caaf796449fda9beda600990be650
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 6 15:06:57 2012 +0100

    misc: Add a config for clang complete.
    
    See https://github.com/Rip-Rip/clang_complete

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

Summary of changes:
 .clang_complete       |   99 +++++++++++++++++++++++++++++++++++++++++++++++++
 lib/tdb/include/tdb.h |   10 ++++-
 lib/tdb/pytdb.c       |   17 +++++++-
 3 files changed, 122 insertions(+), 4 deletions(-)
 create mode 100644 .clang_complete


Changeset truncated at 500 lines:

diff --git a/.clang_complete b/.clang_complete
new file mode 100644
index 0000000..cd3a44b
--- /dev/null
+++ b/.clang_complete
@@ -0,0 +1,99 @@
+-DHAVE_CONFIG_H=1
+-D_GNU_SOURCE=1
+-D_XOPEN_SOURCE_EXTENDED=1
+-Ibin/default/auth -Iauth
+-Ibin/default/auth/credentials -Iauth/credentials
+-Ibin/default/auth/gensec -Iauth/gensec
+-Ibin/default/auth/kerberos -I/auth/kerberos
+-Ibin/default/auth/ntlmssp -Iauth/ntlmssp
+-Ibin/default/bin/default/source4/heimdal/lib/asn1
+-Ibin/default/dfs_server -Idfs_server
+-Ibin/default/dynconfig -Idynconfig
+-Ibin/default/include -Iinclude
+-Ibin/default/include/public
+-Ibin/default/lib
+-Ibin/default/lib/addns -Ilib/addns
+-Ibin/default/lib/async_req -Ilib/async_req
+-Ibin/default/lib/ccan -Ilib/ccan
+-Ibin/default/lib/compression -Ilib/compression
+-Ibin/default/lib/crypto -Ilib/crypto
+-Ibin/default/lib/dbwrap -Ilib/dbwrap
+-Ibin/default/lib/krb5_wrap -Ilib/krb5_wrap
+-Ibin/default/lib/ldb -Ilib/ldb
+-Ibin/default/lib/ldb-samba -Ilib/ldb-samba
+-Ibin/default/lib/ldb/include -Ilib/ldb/include
+-Ibin/default/lib/nss_wrapper -Ilib/nss_wrapper
+-Ibin/default/lib/param -Ilib/param
+-Ibin/default/lib/replace -Ilib/replace
+-Ibin/default/lib/smbconf -Ilib/smbconf
+-Ibin/default/lib/socket -Ilib/socket
+-Ibin/default/lib/socket_wrapper -Ilib/socket_wrapper
+-Ibin/default/lib/talloc -Ilib/talloc
+-Ibin/default/lib/tdb -Ilib/tdb
+-Ibin/default/lib/tdb/include -Ilib/tdb/include
+-Ibin/default/lib/tdb_compat -Ilib/tdb_compat
+-Ibin/default/lib/tevent -Ilib/tevent
+-Ibin/default/lib/tsocket -Ilib/tsocket
+-Ibin/default/lib/uid_wrapper -Ilib/uid_wrapper
+-Ibin/default/lib/util/charset -Ilib/util/charset
+-Ibin/default/libcli/auth -Ilibcli/auth
+-Ibin/default/libcli/cldap -Ilibcli/cldap
+-Ibin/default/libcli/dns -Ilibcli/dns
+-Ibin/default/libcli/drsuapi -Ilibcli/drsuapi
+-Ibin/default/libcli/ldap -Ilibcli/ldap
+-Ibin/default/libcli/lsarpc -Ilibcli/lsarpc
+-Ibin/default/libcli/named_pipe_auth -Ilibcli/named_pipe_auth
+-Ibin/default/libcli/nbt -Ilibcli/nbt
+-Ibin/default/libcli/netlogon -Ilibcli/netlogon
+-Ibin/default/libcli/registry -Ilibcli/registry
+-Ibin/default/libcli/security -Ilibcli/security
+-Ibin/default/libcli/smb -Ilibcli/smb
+-Ibin/default/libcli/util -Ilibcli/util
+-Ibin/default/libds/common -Ilibds/common
+-Ibin/default/librpc -Ilibrpc
+-Ibin/default/nsswitch -Insswitch
+-Ibin/default/nsswitch/libwbclient -Insswitch/libwbclient
+-Ibin/default/source3 -Isource3
+-Ibin/default/source3/auth -Isource3/auth
+-Ibin/default/source3/include -Isource3/include
+-Ibin/default/source3/lib -Isource3/lib
+-Ibin/default/source3/lib/asys -Isource3/lib/asys
+-Ibin/default/source3/lib/pthreadpool -Isource3/lib/pthreadpool
+-Ibin/default/source3/librpc -Isource3/librpc
+-Ibin/default/source3/modules -Isource3/modules
+-Ibin/default/source3/passdb -Isource3/passdb
+-Ibin/default/source3/rpc_server -Isource3/rpc_server
+-Ibin/default/source4 -Isource4
+-Ibin/default/source4/auth -Isource4/auth
+-Ibin/default/source4/auth/gensec -Isource4/auth/gensec
+-Ibin/default/source4/auth/kerberos -Isource4/auth/kerberos
+-Ibin/default/source4/dsdb -Isource4/dsdb
+-Ibin/default/source4/heimdal/base -Isource4/heimdal/base
+-Ibin/default/source4/heimdal/include -Isource4/heimdal/include
+-Ibin/default/source4/heimdal/lib -Isource4/heimdal/lib
+-Ibin/default/source4/heimdal/lib/asn1
+-Ibin/default/source4/heimdal/lib/asn1 -Isource4/heimdal/lib/asn1
+-Ibin/default/source4/heimdal/lib/com_err -Isource4/heimdal/lib/com_err
+-Ibin/default/source4/heimdal/lib/gssapi -Isource4/heimdal/lib/gssapi
+-Ibin/default/source4/heimdal/lib/gssapi/gssapi -Isource4/heimdal/lib/gssapi/gssapi
+-Ibin/default/source4/heimdal/lib/gssapi/krb5 -Isource4/heimdal/lib/gssapi/krb5
+-Ibin/default/source4/heimdal/lib/gssapi/mech -Isource4/heimdal/lib/gssapi/mech
+-Ibin/default/source4/heimdal/lib/gssapi/spnego -Isource4/heimdal/lib/gssapi/spnego
+-Ibin/default/source4/heimdal/lib/hcrypto -Isource4/heimdal/lib/hcrypto
+-Ibin/default/source4/heimdal/lib/hcrypto/libtommath -Isource4/heimdal/lib/hcrypto/libtommath
+-Ibin/default/source4/heimdal/lib/hx509 -Isource4/heimdal/lib/hx509
+-Ibin/default/source4/heimdal/lib/krb5 -Isource4/heimdal/lib/krb5
+-Ibin/default/source4/heimdal/lib/roken -Isource4/heimdal/lib/roken
+-Ibin/default/source4/heimdal/lib/wind -Isource4/heimdal/lib/wind
+-Ibin/default/source4/heimdal_build -Isource4/heimdal_build
+-Ibin/default/source4/include -Isource4/include
+-Ibin/default/source4/lib -Isource4/lib
+-Ibin/default/source4/lib/events -Isource4/lib/events
+-Ibin/default/source4/lib/socket -Isource4/lib/socket
+-Ibin/default/source4/lib/stream -Isource4/lib/stream
+-Ibin/default/source4/lib/tls -Isource4/lib/tls
+-Ibin/default/source4/libcli -Isource4/libcli
+-Ibin/default/source4/libcli/ldap -Isource4/libcli/ldap
+-Ibin/default/source4/param -Isource4/param
+-Ibin/default/source4/winbind -Isource4/winbind
+-Iinclude/public
diff --git a/lib/tdb/include/tdb.h b/lib/tdb/include/tdb.h
index d19439e..e371e33 100644
--- a/lib/tdb/include/tdb.h
+++ b/lib/tdb/include/tdb.h
@@ -212,9 +212,12 @@ void tdb_set_max_dead(struct tdb_context *tdb, int max_dead);
  * This can be used after a fork to ensure that we have an independent seek
  * pointer from our parent and to re-establish locks.
  *
- * @param[in]  tdb      The database to reopen.
+ * @param[in]  tdb      The database to reopen. It will be free'd on error!
  *
  * @return              0 on success, -1 on error.
+ *
+ * @note Don't call tdb_error() after this function cause the tdb context will
+ *       be freed on error.
  */
 int tdb_reopen(struct tdb_context *tdb);
 
@@ -361,9 +364,12 @@ int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf);
 /**
  * @brief Close a database.
  *
- * @param[in]  tdb      The database to close.
+ * @param[in]  tdb      The database to close. The context will be free'd.
  *
  * @return              0 for success, -1 on error.
+ *
+ * @note Don't call tdb_error() after this function cause the tdb context will
+ *       be freed on error.
  */
 int tdb_close(struct tdb_context *tdb);
 
diff --git a/lib/tdb/pytdb.c b/lib/tdb/pytdb.c
index ae0e6f8..cf77a25 100644
--- a/lib/tdb/pytdb.c
+++ b/lib/tdb/pytdb.c
@@ -164,7 +164,14 @@ static PyObject *obj_reopen(PyTdbObject *self)
 	int ret;
 	PyErr_TDB_RAISE_IF_CLOSED(self);
 	ret = tdb_reopen(self->ctx);
-	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
+	if (ret != 0) {
+		self->closed = true;
+		PyErr_SetObject(PyExc_RuntimeError,
+				Py_BuildValue("(i,s)",
+					      TDB_ERR_IO,
+					      "Failed to reopen database"));
+		return NULL;
+	}
 	Py_RETURN_NONE;
 }
 
@@ -209,7 +216,13 @@ static PyObject *obj_close(PyTdbObject *self)
 		Py_RETURN_NONE;
 	ret = tdb_close(self->ctx);
 	self->closed = true;
-	PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx);
+	if (ret != 0) {
+		PyErr_SetObject(PyExc_RuntimeError,
+				Py_BuildValue("(i,s)",
+					      TDB_ERR_IO,
+					      "Failed to close database"));
+		return NULL;
+	}
 	Py_RETURN_NONE;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list