]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python: Use constants from hresult.h for python constants
authorAndrew Bartlett <abartlet@samba.org>
Wed, 29 Nov 2023 21:37:13 +0000 (10:37 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 30 Nov 2023 01:05:32 +0000 (01:05 +0000)
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 <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/pyglue.c
python/samba/__init__.py

index 8fb5f7a1f9f71490fb5c1f948ecc8a1b8a3ccca9..47e162a8631a0894945057c6d8cce3e679259e1a 100644 (file)
@@ -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;
 }
index f11164a29ba6ed125f18bf0d5043b93dd9e8fd83..13b646b65ae19b342b3a2e4ea755d92c4269ecee 100644 (file)
@@ -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