pycredentials: add py_creds_get_secure_channel_type
authorJoe Guo <joeg@catalyst.net.nz>
Wed, 2 May 2018 21:40:39 +0000 (21:40 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 12 May 2018 00:09:28 +0000 (02:09 +0200)
We have only set, need get.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
auth/credentials/pycredentials.c

index 68bb3060a993a6da7a73eb4c52d08cf99c5be8b0..c626e3fa8a07c9e734e7542aedafb6fccc9b3f03 100644 (file)
@@ -680,6 +680,16 @@ static PyObject *py_creds_set_secure_channel_type(PyObject *self, PyObject *args
        Py_RETURN_NONE;
 }
 
+static PyObject *py_creds_get_secure_channel_type(PyObject *self, PyObject *args)
+{
+       enum netr_SchannelType channel_type = SEC_CHAN_NULL;
+
+       channel_type = cli_credentials_get_secure_channel_type(
+               PyCredentials_AsCliCredentials(self));
+
+       return PyInt_FromLong(channel_type);
+}
+
 static PyObject *py_creds_encrypt_netr_crypt_password(PyObject *self,
                                                      PyObject *args)
 {
@@ -815,6 +825,8 @@ static PyMethodDef py_creds_methods[] = {
                "Get a new client NETLOGON_AUTHENTICATOR"},
        { "set_secure_channel_type", py_creds_set_secure_channel_type,
          METH_VARARGS, NULL },
+       { "get_secure_channel_type", py_creds_get_secure_channel_type,
+         METH_VARARGS },
        { "encrypt_netr_crypt_password",
                py_creds_encrypt_netr_crypt_password,
                METH_VARARGS,