From 983f222e382dfd2cf9df202f0645bdb1ec8a62ed Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 30 Nov 2023 10:37:13 +1300 Subject: [PATCH] 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 --- python/pyglue.c | 5 +++++ python/samba/__init__.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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 -- 2.47.3