static PyObject * api_filter_prog_stream_create (PyObject *self, PyObject *args) { int status; char *progname; PyStream *py_stm, *py_input; struct mu_prog_hints hints; struct mu_wordsplit ws; if (!PyArg_ParseTuple (args, "O!sO!", &PyStreamType, &py_stm, &progname, &PyStreamType, &py_input)) return NULL; if (mu_wordsplit (progname, &ws, MU_WRDSF_DEFFLAGS)) return _ro (PyInt_FromLong (errno)); hints.mu_prog_input = py_input->stm; status = mu_prog_stream_create (&py_stm->stm, ws.ws_wordv[0], ws.ws_wordc, ws.ws_wordv, MU_PROG_HINT_INPUT, &hints, MU_STREAM_READ); mu_wordsplit_free (&ws); return _ro (PyInt_FromLong (status)); }
static PyObject * api_sieve_machine_error_text (PyObject *self, PyObject *args) { int status; PySieveMachine *py_mach; mu_stream_t estr; mu_transport_t trans[2]; PyObject *retval; mu_off_t length = 0; if (!PyArg_ParseTuple (args, "O!", &PySieveMachineType, &py_mach)) return NULL; if (!py_mach->mach) PyErr_SetString (PyExc_RuntimeError, "Uninitialized Sieve machine"); mu_sieve_get_diag_stream (py_mach->mach, &estr); status = mu_stream_ioctl (estr, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, trans); if (status == 0) { mu_stream_t str = (mu_stream_t) trans[0]; mu_stream_size (str, &length); status = mu_stream_ioctl (str, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, trans); mu_stream_truncate (str, 0); } if (status) PyErr_SetString (PyExc_RuntimeError, mu_strerror (status)); retval = PyString_FromStringAndSize ((char*) trans[0], length); mu_stream_unref (estr); return _ro (retval); }
static PyObject * api_get_auth_by_name (PyObject *self, PyObject *args) { char *username; PyAuthData *py_ad = PyAuthData_NEW (); if (!PyArg_ParseTuple (args, "s", &username)) return NULL; Py_INCREF (py_ad); py_ad->auth_data = mu_get_auth_by_name (username); if (!py_ad->auth_data) return _ro (Py_None); return _ro ((PyObject *)py_ad); }
static PyObject * api_get_auth_by_uid (PyObject *self, PyObject *args) { uid_t uid; Py_ssize_t n; PyAuthData *py_ad = PyAuthData_NEW (); if (!PyArg_ParseTuple (args, "n", &n)) return NULL; uid = (uid_t) n; Py_INCREF (py_ad); py_ad->auth_data = mu_get_auth_by_uid (uid); if (!py_ad->auth_data) return _ro (Py_None); return _ro ((PyObject *)py_ad); }
static PyObject * api_mime_destroy (PyObject *self, PyObject *args) { PyMime *py_mime; if (!PyArg_ParseTuple (args, "O!", &PyMimeType, &py_mime)) return NULL; mu_mime_destroy (&py_mime->mime); return _ro (Py_None); }
static PyObject * api_set_pam_service (PyObject *self, PyObject *args) { char *pam_service; if (!PyArg_ParseTuple (args, "s", &pam_service)) return NULL; mu_pam_service = pam_service; return _ro (Py_None); }
static PyObject * api_wicket_destroy (PyObject *self, PyObject *args) { PyWicket *py_wicket; if (!PyArg_ParseTuple (args, "O!", &PyWicketType, &py_wicket)) return NULL; mu_wicket_destroy (&py_wicket->wicket); return _ro (Py_None); }
static PyObject * api_stream_destroy (PyObject *self, PyObject *args) { PyStream *py_stm; if (!PyArg_ParseTuple (args, "O!", &PyStreamType, &py_stm)) return NULL; mu_stream_destroy (&py_stm->stm); return _ro (Py_None); }
static PyObject * api_authority_destroy (PyObject *self, PyObject *args) { PyAuthority *py_auth; if (!PyArg_ParseTuple (args, "O!", &PyAuthorityType, &py_auth)) return NULL; mu_authority_destroy (&py_auth->auth, NULL); return _ro (Py_None); }
static PyObject * api_secret_password_unref (PyObject *self, PyObject *args) { PySecret *py_secret; if (!PyArg_ParseTuple (args, "O!", &PySecretType, &py_secret)) return NULL; mu_secret_password_unref (py_secret->secret); return _ro (Py_None); }
static PyObject * api_secret_password (PyObject *self, PyObject *args) { const char *pass; PySecret *py_secret; if (!PyArg_ParseTuple (args, "O!", &PySecretType, &py_secret)) return NULL; pass = mu_secret_password (py_secret->secret); return _ro (PyString_FromString (pass ? pass : "")); }
static PyObject * api_register_module (PyObject *self, PyObject *args) { int status; char *name = NULL; if (!PyArg_ParseTuple (args, "|s", &name)) return NULL; status = register_module (name); return _ro (PyInt_FromLong (status)); }
static PyObject * api_ticket_create (PyObject *self, PyObject *args) { int status; PyTicket *py_ticket; if (!PyArg_ParseTuple (args, "O!", &PyTicketType, &py_ticket)) return NULL; status = mu_ticket_create (&py_ticket->ticket, NULL); return _ro (PyInt_FromLong (status)); }
static PyObject * api_authority_authenticate (PyObject *self, PyObject *args) { int status; PyAuthority *py_auth; if (!PyArg_ParseTuple (args, "O!", &PyAuthorityType, &py_auth)) return NULL; status = mu_authority_authenticate (py_auth->auth); return _ro (PyInt_FromLong (status)); }
static PyObject * api_registrar_set_default_format (PyObject *self, PyObject *args) { int status; char *name = NULL; if (!PyArg_ParseTuple (args, "s", &name)) return NULL; status = set_default_format (name); return _ro (PyInt_FromLong (status)); }
static PyObject * api_clear_passwd (PyObject *self, PyObject *args) { char *p; if (!PyArg_ParseTuple (args, "s", &p)) return NULL; while (*p) *p++ = 0; return _ro (Py_None); }
static PyObject * api_mime_is_multipart (PyObject *self, PyObject *args) { int ismulti; PyMime *py_mime; if (!PyArg_ParseTuple (args, "O!", &PyMimeType, &py_mime)) return NULL; ismulti = mu_mime_is_multipart (py_mime->mime); return _ro (PyBool_FromLong (ismulti)); }
static PyObject * api_sieve_disass (PyObject *self, PyObject *args) { int status; PySieveMachine *py_mach; if (!PyArg_ParseTuple (args, "O!", &PySieveMachineType, &py_mach)) return NULL; status = mu_sieve_disass (py_mach->mach); return _ro (PyInt_FromLong (status)); }
static PyObject * api_stream_flush (PyObject *self, PyObject *args) { int status; PyStream *py_stm; if (!PyArg_ParseTuple (args, "O!", &PyStreamType, &py_stm)) return NULL; status = mu_stream_flush (py_stm->stm); return _ro (PyInt_FromLong (status)); }
static PyObject * api_stream_wait (PyObject *self, PyObject *args) { int status, wflags; PyStream *py_stm; if (!PyArg_ParseTuple (args, "O!i", &PyStreamType, &py_stm, &wflags)) return NULL; status = mu_stream_wait (py_stm->stm, &wflags, NULL); return _ro (PyInt_FromLong (status)); }
static PyObject * api_stdio_stream_create (PyObject *self, PyObject *args) { int status, fd, flags; PyStream *py_stm; if (!PyArg_ParseTuple (args, "O!ii", &PyStreamType, &py_stm, &fd, &flags)) return NULL; status = mu_stdio_stream_create (&py_stm->stm, fd, flags); return _ro (PyInt_FromLong (status)); }
static PyObject * api_strerror (PyObject *self, PyObject *args) { int status; char *str = NULL; if (!PyArg_ParseTuple (args, "i", &status)) return NULL; str = (char *)mu_strerror (status); return _ro (PyString_FromString (str)); }
static PyObject * api_sieve_machine_init (PyObject *self, PyObject *args) { int status; PySieveMachine *py_mach; mu_stream_t str, estr; if (!PyArg_ParseTuple (args, "O!", &PySieveMachineType, &py_mach)) return NULL; status = mu_memory_stream_create (&str, MU_STREAM_RDWR); if (status) return _ro (PyInt_FromLong (status)); status = mu_log_stream_create (&estr, str); mu_stream_unref (str); if (status) return _ro (PyInt_FromLong (status)); status = mu_sieve_machine_init_ex (&py_mach->mach, NULL, estr); mu_stream_unref (estr); return _ro (PyInt_FromLong (status)); }
static PyObject * api_sieve_compile (PyObject *self, PyObject *args) { int status; char *name; PySieveMachine *py_mach; if (!PyArg_ParseTuple (args, "O!s", &PySieveMachineType, &py_mach, &name)) return NULL; status = mu_sieve_compile (py_mach->mach, name); return _ro (PyInt_FromLong (status)); }
static PyObject * api_wicket_create (PyObject *self, PyObject *args) { int status; char *filename; PyWicket *py_wicket; if (!PyArg_ParseTuple (args, "O!s", &PyWicketType, &py_wicket, &filename)) return NULL; status = mu_file_wicket_create (&py_wicket->wicket, filename); return _ro (PyInt_FromLong (status)); }
static PyObject * api_authenticate (PyObject *self, PyObject *args) { int status; char *pass; PyAuthData *py_ad; if (!PyArg_ParseTuple (args, "O!s", &PyAuthDataType, &py_ad, &pass)) return NULL; status = mu_authenticate (py_ad->auth_data, pass); return _ro (PyInt_FromLong (status)); }
static PyObject * api_file_stream_create (PyObject *self, PyObject *args) { int status, flags; char *filename; PyStream *py_stm; if (!PyArg_ParseTuple (args, "O!si", &PyStreamType, &py_stm, &filename, &flags)) return NULL; status = mu_file_stream_create (&py_stm->stm, filename, flags); return _ro (PyInt_FromLong (status)); }
static PyObject * api_tcp_stream_create (PyObject *self, PyObject *args) { int status, flags, port; char *host; PyStream *py_stm; if (!PyArg_ParseTuple (args, "O!sii", &PyStreamType, &py_stm, &host, &port, &flags)) return NULL; status = mu_tcp_stream_create (&py_stm->stm, host, port, flags); return _ro (PyInt_FromLong (status)); }
static PyObject * api_authority_set_ticket (PyObject *self, PyObject *args) { int status; PyAuthority *py_auth; PyTicket *py_ticket; if (!PyArg_ParseTuple (args, "O!O!", &PyAuthorityType, &py_auth, &PyTicketType, &py_ticket)) return NULL; status = mu_authority_set_ticket (py_auth->auth, py_ticket->ticket); return _ro (PyInt_FromLong (status)); }
static PyObject * api_secret_create (PyObject *self, PyObject *args) { int status; char *str; size_t len; PySecret *py_secret; if (!PyArg_ParseTuple (args, "O!si", &PySecretType, &py_secret, &str, &len)) return NULL; status = mu_secret_create (&py_secret->secret, str, len); return _ro (PyInt_FromLong (status)); }