The branch, master has been updated via efe28b1 s4:libcli/pyerrors: add PyErr_NTSTATUS_NOT_OK_RAISE() via a370792 s4:libcli/pyerrors: s/PyErr_WERROR_IS_ERR_RAISE/PyErr_WERROR_NOT_OK_RAISE/ from 4e0fb8b Revert "ldb: Add parameter to avoid NULL format string flagged by -Werror=format"
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit efe28b124770eaa66e39b1e9c717358d53547bd5 Author: Stefan Metzmacher <me...@samba.org> Date: Mon Aug 6 10:41:31 2012 +0200 s4:libcli/pyerrors: add PyErr_NTSTATUS_NOT_OK_RAISE() metze Autobuild-User(master): Stefan Metzmacher <me...@samba.org> Autobuild-Date(master): Mon Aug 6 18:06:50 CEST 2012 on sn-devel-104 commit a370792cbc7285da90ef261d03efe781075ff71b Author: Stefan Metzmacher <me...@samba.org> Date: Mon Aug 6 10:39:19 2012 +0200 s4:libcli/pyerrors: s/PyErr_WERROR_IS_ERR_RAISE/PyErr_WERROR_NOT_OK_RAISE/ metze ----------------------------------------------------------------------- Summary of changes: source4/dsdb/pydsdb.c | 10 +++++----- source4/lib/registry/pyregistry.c | 24 ++++++++++++------------ source4/libcli/util/pyerrors.h | 8 +++++++- 3 files changed, 24 insertions(+), 18 deletions(-) Changeset truncated at 500 lines: diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c index b9e1dd7..3558049 100644 --- a/source4/dsdb/pydsdb.c +++ b/source4/dsdb/pydsdb.c @@ -591,7 +591,7 @@ static PyObject *py_dsdb_DsReplicaAttribute(PyObject *self, PyObject *args) } werr = a->syntax->ldb_to_drsuapi(&syntax_ctx, a, el, attr, attr); - PyErr_WERROR_IS_ERR_RAISE(werr); + PyErr_WERROR_NOT_OK_RAISE(werr); ret = py_return_ndr_struct("samba.dcerpc.drsuapi", "DsReplicaAttribute", attr, attr); @@ -702,11 +702,11 @@ static PyObject *py_dsdb_normalise_attributes(PyObject *self, PyObject *args) } werr = a->syntax->ldb_to_drsuapi(&syntax_ctx, a, el, attr, attr); - PyErr_WERROR_IS_ERR_RAISE(werr); + PyErr_WERROR_NOT_OK_RAISE(werr); /* now convert back again */ werr = a->syntax->drsuapi_to_ldb(&syntax_ctx, a, attr, el, el); - PyErr_WERROR_IS_ERR_RAISE(werr); + PyErr_WERROR_NOT_OK_RAISE(werr); ret = py_return_ndr_struct("ldb", "MessageElement", el, el); @@ -860,7 +860,7 @@ static PyObject *py_dsdb_set_schema_from_ldif(PyObject *self, PyObject *args) PyErr_LDB_OR_RAISE(py_ldb, ldb); result = dsdb_set_schema_from_ldif(ldb, pf, df, dn); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); Py_RETURN_NONE; } @@ -911,7 +911,7 @@ static PyObject *py_dsdb_write_prefixes_from_schema_to_ldb(PyObject *self, PyObj } result = dsdb_write_prefixes_from_schema_to_ldb(NULL, ldb, schema); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); Py_RETURN_NONE; } diff --git a/source4/lib/registry/pyregistry.c b/source4/lib/registry/pyregistry.c index 2e8b95f..ad411e8 100644 --- a/source4/lib/registry/pyregistry.c +++ b/source4/lib/registry/pyregistry.c @@ -49,7 +49,7 @@ static PyObject *py_get_predefined_key_by_name(PyObject *self, PyObject *args) return NULL; result = reg_get_predefined_key_by_name(ctx, name, &key); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); return pytalloc_steal(&PyRegistryKey, key); } @@ -64,7 +64,7 @@ static PyObject *py_key_del_abs(PyObject *self, PyObject *args) return NULL; result = reg_key_del_abs(ctx, path); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); Py_RETURN_NONE; } @@ -80,7 +80,7 @@ static PyObject *py_get_predefined_key(PyObject *self, PyObject *args) return NULL; result = reg_get_predefined_key(ctx, hkey, &key); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); return pytalloc_steal(&PyRegistryKey, key); } @@ -94,7 +94,7 @@ static PyObject *py_diff_apply(PyObject *self, PyObject *args) return NULL; result = reg_diff_apply(ctx, filename); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); Py_RETURN_NONE; } @@ -127,7 +127,7 @@ static PyObject *py_mount_hive(PyObject *self, PyObject *args) SMB_ASSERT(ctx != NULL); result = reg_mount_hive(ctx, PyHiveKey_AsHiveKey(py_hivekey), hkey, elements); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); Py_RETURN_NONE; } @@ -137,7 +137,7 @@ static PyObject *registry_new(PyTypeObject *type, PyObject *args, PyObject *kwar WERROR result; struct registry_context *ctx; result = reg_open_local(NULL, &ctx); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); return pytalloc_steal(&PyRegistry, ctx); } @@ -175,7 +175,7 @@ static PyObject *py_hive_key_del(PyObject *self, PyObject *args) result = hive_key_del(NULL, key, name); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); Py_RETURN_NONE; } @@ -186,7 +186,7 @@ static PyObject *py_hive_key_flush(PyObject *self) struct hive_key *key = PyHiveKey_AsHiveKey(self); result = hive_key_flush(key); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); Py_RETURN_NONE; } @@ -202,7 +202,7 @@ static PyObject *py_hive_key_del_value(PyObject *self, PyObject *args) result = hive_key_del_value(NULL, key, name); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); Py_RETURN_NONE; } @@ -226,7 +226,7 @@ static PyObject *py_hive_key_set_value(PyObject *self, PyObject *args) else result = hive_key_del_value(NULL, key, name); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); Py_RETURN_NONE; } @@ -291,7 +291,7 @@ static PyObject *py_open_hive(PyTypeObject *type, PyObject *args, PyObject *kwar tevent_context_init(NULL), lp_ctx, &hive_key); talloc_free(mem_ctx); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); return pytalloc_steal(&PyHiveKey, hive_key); } @@ -403,7 +403,7 @@ static PyObject *py_open_ldb_file(PyObject *self, PyObject *args, PyObject *kwar result = reg_open_ldb_file(NULL, location, session_info, credentials, s4_event_context_init(NULL), lp_ctx, &key); talloc_free(mem_ctx); - PyErr_WERROR_IS_ERR_RAISE(result); + PyErr_WERROR_NOT_OK_RAISE(result); return pytalloc_steal(&PyHiveKey, key); } diff --git a/source4/libcli/util/pyerrors.h b/source4/libcli/util/pyerrors.h index 4c526c6..0241e96 100644 --- a/source4/libcli/util/pyerrors.h +++ b/source4/libcli/util/pyerrors.h @@ -38,7 +38,13 @@ return NULL; \ } -#define PyErr_WERROR_IS_ERR_RAISE(status) \ +#define PyErr_NTSTATUS_NOT_OK_RAISE(status) \ + if (!NT_STATUS_IS_OK(status)) { \ + PyErr_SetNTSTATUS(status); \ + return NULL; \ + } + +#define PyErr_WERROR_NOT_OK_RAISE(status) \ if (!W_ERROR_IS_OK(status)) { \ PyErr_SetWERROR(status); \ return NULL; \ -- Samba Shared Repository