]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python: move HRES_SEC_* constants to samba module
authorRob van der Linde <rob@catalyst.net.nz>
Tue, 28 Nov 2023 02:13:21 +0000 (15:13 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 30 Nov 2023 01:05:32 +0000 (01:05 +0000)
Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/__init__.py
python/samba/tests/krb5/authn_policy_tests.py
python/samba/tests/krb5/protected_users_tests.py
source4/dsdb/tests/python/passwords.py
source4/dsdb/tests/python/sam.py

index 3e6ea7d18e1bfa7520d91100a8de9a262a7e9fac..f11164a29ba6ed125f18bf0d5043b93dd9e8fd83 100644 (file)
@@ -398,3 +398,6 @@ NTSTATUSError = _glue.NTSTATUSError
 HRESULTError = _glue.HRESULTError
 WERRORError = _glue.WERRORError
 DsExtendedError = _glue.DsExtendedError
+
+HRES_SEC_E_LOGON_DENIED = 0x8009030C
+HRES_SEC_E_INVALID_TOKEN = 0x80090308
index 43a975fac8e2ad1d024b03c0d9ea20c8ae3bc72a..6ce2e41d1c78b3461e31fdddeffdf96092b0993f 100755 (executable)
@@ -38,6 +38,7 @@ from samba.netcmd.domain.models import AuthenticationPolicy, AuthenticationSilo
 
 import samba.tests
 import samba.tests.krb5.kcrypto as kcrypto
+from samba import HRES_SEC_E_INVALID_TOKEN, HRES_SEC_E_LOGON_DENIED
 from samba.tests.krb5.kdc_base_test import GroupType
 from samba.tests.krb5.kdc_tgs_tests import KdcTgsBaseTests
 from samba.tests.auth_log_base import AuthLogTestBase, NoMessageException
@@ -59,9 +60,6 @@ SidType = RawKerberosTest.SidType
 global_asn1_print = False
 global_hexdump = False
 
-HRES_SEC_E_INVALID_TOKEN = 0x80090308
-HRES_SEC_E_LOGON_DENIED = 0x8009030C
-
 
 AUTHN_VERSION = {'major': 1, 'minor': 3}
 AUTHZ_VERSION = {'major': 1, 'minor': 2}
index b592b4a893f6bf46dc2b787a2259497dbcffb510..b2955a874e162a35cac1fac5fde9d754c2adb3a9 100755 (executable)
@@ -26,7 +26,7 @@ from functools import partial
 
 import ldb
 
-from samba import generate_random_password, ntstatus
+from samba import generate_random_password, ntstatus, HRES_SEC_E_LOGON_DENIED
 from samba.dcerpc import netlogon, security
 
 import samba.tests.krb5.kcrypto as kcrypto
@@ -51,8 +51,6 @@ import samba.tests.krb5.rfc4120_pyasn1 as krb5_asn1
 global_asn1_print = False
 global_hexdump = False
 
-HRES_SEC_E_LOGON_DENIED = 0x8009030C
-
 
 class ProtectedUsersTests(KDCBaseTest):
     def setUp(self):
index 2f513df83aef9f14460c982a701a84f7ae5d9caf..73fd0275a6d8509a174d1b68e4873c554db54831 100755 (executable)
@@ -21,6 +21,7 @@ from samba.tests.password_test import PasswordTestCase
 
 import samba.getopt as options
 
+from samba import HRES_SEC_E_INVALID_TOKEN
 from samba.auth import system_session
 from samba.credentials import Credentials
 from samba.dcerpc import security
@@ -267,8 +268,6 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')).
             SamDB(url=host_ldaps,
                   credentials=self.creds, lp=lp)
         except LdbError as err:
-            HRES_SEC_E_INVALID_TOKEN = 0x80090308
-
             num, estr = err.args
             self.assertEqual(ERR_INVALID_CREDENTIALS, num)
             self.assertIn(f"{HRES_SEC_E_INVALID_TOKEN:08X}", estr)
index c413b0813e031a53322014e1e6b994eeef4ce732..bbc6ba8a58f653f02a5529e68462e17c317a47fc 100755 (executable)
@@ -9,6 +9,7 @@ import time
 
 sys.path.insert(0, "bin/python")
 import samba
+from samba import HRES_SEC_E_INVALID_TOKEN, HRES_SEC_E_LOGON_DENIED
 from samba.tests.subunitrun import SubunitOptions, TestProgram
 
 import samba.getopt as options
@@ -1723,9 +1724,6 @@ class SamTests(samba.tests.TestCase):
             return "%08X: LdapErr: DSID-%08X, comment: AcceptSecurityContext error, data %x, v" % (
                     hresult_v, dsid_v, werror_v)
 
-        HRES_SEC_E_LOGON_DENIED = 0x8009030C
-        HRES_SEC_E_INVALID_TOKEN = 0x80090308
-
         sasl_bind_dsid = 0x0C0904DC
         simple_bind_dsid = 0x0C0903A9