From: Andrew Bartlett Date: Wed, 29 Nov 2023 21:37:13 +0000 (+1300) Subject: python: Use constants from hresult.h for python constants X-Git-Tag: talloc-2.4.2~440 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=983f222e382dfd2cf9df202f0645bdb1ec8a62ed;p=thirdparty%2Fsamba.git python: Use constants from hresult.h for python constants This encourages us to keep a single source for constants. In the future this should be a generated python file like for ntstatus. Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/python/pyglue.c b/python/pyglue.c index 8fb5f7a1f9f..47e162a8631 100644 --- a/python/pyglue.c +++ b/python/pyglue.c @@ -27,6 +27,7 @@ #include "lib/util/debug.h" #include "librpc/ndr/ndr_private.h" #include "lib/cmdline/cmdline.h" +#include "libcli/util/hresult.h" void init_glue(void); static PyObject *PyExc_NTSTATUSError; @@ -632,5 +633,9 @@ MODULE_INIT_FUNC(_glue) PyModule_AddObject(m, "DsExtendedError", PyExc_DsExtendedError); } + PyModule_AddObject(m, "HRES_SEC_E_INVALID_TOKEN", + PyLong_FromUnsignedLongLong(HRES_ERROR_V(HRES_SEC_E_INVALID_TOKEN))); + PyModule_AddObject(m, "HRES_SEC_E_LOGON_DENIED", + PyLong_FromUnsignedLongLong(HRES_ERROR_V(HRES_SEC_E_LOGON_DENIED))); return m; } diff --git a/python/samba/__init__.py b/python/samba/__init__.py index f11164a29ba..13b646b65ae 100644 --- a/python/samba/__init__.py +++ b/python/samba/__init__.py @@ -399,5 +399,5 @@ HRESULTError = _glue.HRESULTError WERRORError = _glue.WERRORError DsExtendedError = _glue.DsExtendedError -HRES_SEC_E_LOGON_DENIED = 0x8009030C -HRES_SEC_E_INVALID_TOKEN = 0x80090308 +HRES_SEC_E_LOGON_DENIED = _glue.HRES_SEC_E_LOGON_DENIED +HRES_SEC_E_INVALID_TOKEN = _glue.HRES_SEC_E_INVALID_TOKEN