static PyObject *py_ldb_set_session_info(PyObject *self, PyObject *args) { PyObject *py_session_info; struct auth_session_info *info; struct ldb_context *ldb; PyObject *mod_samba_auth; PyObject *PyAuthSession_Type; bool ret; mod_samba_auth = PyImport_ImportModule("samba.dcerpc.auth"); if (mod_samba_auth == NULL) return NULL; PyAuthSession_Type = PyObject_GetAttrString(mod_samba_auth, "session_info"); if (PyAuthSession_Type == NULL) return NULL; ret = PyArg_ParseTuple(args, "O!", PyAuthSession_Type, &py_session_info); Py_DECREF(PyAuthSession_Type); Py_DECREF(mod_samba_auth); if (!ret) return NULL; ldb = pyldb_Ldb_AsLdbContext(self); info = PyAuthSession_AsSession(py_session_info); ldb_set_opaque(ldb, "sessionInfo", info); Py_RETURN_NONE; }
static PyObject *py_ldb_set_session_info(PyObject *self, PyObject *args) { PyObject *py_session_info, *py_ldb; struct auth_session_info *info; struct ldb_context *ldb; if (!PyArg_ParseTuple(args, "OO", &py_ldb, &py_session_info)) return NULL; PyErr_LDB_OR_RAISE(py_ldb, ldb); /*if (!PyAuthSession_Check(py_session_info)) { PyErr_SetString(PyExc_TypeError, "Expected session info object"); return NULL; }*/ info = PyAuthSession_AsSession(py_session_info); ldb_set_opaque(ldb, "sessionInfo", info); Py_RETURN_NONE; }