summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2020-10-28 17:05:36 +0100
committerAndreas Schneider <asn@cryptomilk.org>2020-10-29 14:19:36 +0000
commit7d54e4b49c235dc571f47d15e6b0a6fa63340773 (patch)
tree71650b971c8a0ec2abbf921c79b89d08ecad9ad0 /source4
parent32d4c75d6cbf9153068a0487347097707afb356a (diff)
downloadsamba-7d54e4b49c235dc571f47d15e6b0a6fa63340773.tar.gz
s4:param: Add 'weak crypto' getter to pyparam
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/param/pyparam.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c
index 4023fac4dd6..e15592b5743 100644
--- a/source4/param/pyparam.c
+++ b/source4/param/pyparam.c
@@ -463,6 +463,23 @@ static PyObject *py_lp_ctx_config_file(PyObject *self, void *closure)
return PyUnicode_FromString(configfile);
}
+static PyObject *py_lp_ctx_weak_crypto(PyObject *self, void *closure)
+{
+ enum samba_weak_crypto weak_crypto =
+ lpcfg_weak_crypto(PyLoadparmContext_AsLoadparmContext(self));
+
+ switch(weak_crypto) {
+ case SAMBA_WEAK_CRYPTO_UNKNOWN:
+ Py_RETURN_NONE;
+ case SAMBA_WEAK_CRYPTO_ALLOWED:
+ return PyUnicode_FromString("allowed");
+ case SAMBA_WEAK_CRYPTO_DISALLOWED:
+ return PyUnicode_FromString("disallowed");
+ }
+
+ Py_RETURN_NONE;
+}
+
static PyGetSetDef py_lp_ctx_getset[] = {
{
.name = discard_const_p(char, "default_service"),
@@ -473,6 +490,11 @@ static PyGetSetDef py_lp_ctx_getset[] = {
.get = (getter)py_lp_ctx_config_file,
.doc = discard_const_p(char, "Name of last config file that was loaded.")
},
+ {
+ .name = discard_const_p(char, "weak_crypto"),
+ .get = (getter)py_lp_ctx_weak_crypto,
+ .doc = discard_const_p(char, "If weak crypto is allowed.")
+ },
{ .name = NULL }
};