diff options
author | Andrew Bartlett <abartlet@samba.org> | 2013-09-16 09:38:09 -0700 |
---|---|---|
committer | Nadezhda Ivanova <nivanova@symas.com> | 2013-09-16 14:44:28 -0700 |
commit | 3f464ca1f5672491edf5daf15389cf7f2dc68e2b (patch) | |
tree | f9dd6d6390632ac5968e084ef7c5cae7f5c12ec3 /auth/credentials/pycredentials.c | |
parent | 68f7cd1724480a9bae36692d19b94e10fb1b9e73 (diff) | |
download | samba-3f464ca1f5672491edf5daf15389cf7f2dc68e2b.tar.gz samba-3f464ca1f5672491edf5daf15389cf7f2dc68e2b.tar.bz2 samba-3f464ca1f5672491edf5daf15389cf7f2dc68e2b.zip |
auth/credentials: Add cli_credentials_{set,get}_forced_sasl_mech()
This will allow us to force the use of only DIGEST-MD5, for example, which is useful
to avoid hitting GSSAPI, SPNEGO or NTLM when talking to OpenLDAP and Cyrus-SASL.
Andrew Bartlett
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@symas.com>
Diffstat (limited to 'auth/credentials/pycredentials.c')
-rw-r--r-- | auth/credentials/pycredentials.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/auth/credentials/pycredentials.c b/auth/credentials/pycredentials.c index 14fd5e01ba..e32d9a93d0 100644 --- a/auth/credentials/pycredentials.c +++ b/auth/credentials/pycredentials.c @@ -229,6 +229,27 @@ static PyObject *py_creds_set_krb_forwardable(pytalloc_Object *self, PyObject *a Py_RETURN_NONE; } + +static PyObject *py_creds_get_forced_sasl_mech(pytalloc_Object *self) +{ + return PyString_FromStringOrNULL(cli_credentials_get_forced_sasl_mech(PyCredentials_AsCliCredentials(self))); +} + +static PyObject *py_creds_set_forced_sasl_mech(pytalloc_Object *self, PyObject *args) +{ + char *newval; + enum credentials_obtained obt = CRED_SPECIFIED; + int _obt = obt; + + if (!PyArg_ParseTuple(args, "s", &newval)) { + return NULL; + } + obt = _obt; + + cli_credentials_set_forced_sasl_mech(PyCredentials_AsCliCredentials(self), newval); + Py_RETURN_NONE; +} + static PyObject *py_creds_guess(pytalloc_Object *self, PyObject *args) { PyObject *py_lp_ctx = Py_None; @@ -440,6 +461,11 @@ static PyMethodDef py_creds_methods[] = { { "get_named_ccache", (PyCFunction)py_creds_get_named_ccache, METH_VARARGS, NULL }, { "set_gensec_features", (PyCFunction)py_creds_set_gensec_features, METH_VARARGS, NULL }, { "get_gensec_features", (PyCFunction)py_creds_get_gensec_features, METH_NOARGS, NULL }, + { "get_forced_sasl_mech", (PyCFunction)py_creds_get_forced_sasl_mech, METH_NOARGS, + "S.get_forced_sasl_mech() -> SASL mechanism\nObtain forced SASL mechanism." }, + { "set_forced_sasl_mech", (PyCFunction)py_creds_set_forced_sasl_mech, METH_VARARGS, + "S.set_forced_sasl_mech(name) -> None\n" + "Set forced SASL mechanism." }, { NULL } }; |