/* Copyright (C) <2004> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA e-mail author : eugene@reedflute.com postal address : Dwarsstreet 75, Potchefstroom,NW Province, 2531, Rebublic of South Africa */ #include "Python.h" #include int deny_severity=0; int allow_severity=0; //use STRING_UNKNOWN if parameter is not available int hosts_ctl(char *daemon,char *client_name,char *client_addr, char *client_user); PyObject * pytcpwrap_hosts_ctl(PyObject *self, PyObject *args) { char *program,*host,*ip,*username; int access_ok=0; PyObject *result; if (! PyArg_ParseTuple(args, "ssss", &program, &host, &ip,&username)) { return NULL; } access_ok=hosts_ctl(program,host,ip,username); //printf("%s %s %s %s\n",program,host,ip,username); result=Py_BuildValue("i",access_ok); return result; } static PyMethodDef pytcpwrap_methods[] = { {"hosts_ctl", (PyCFunction)pytcpwrap_hosts_ctl, METH_VARARGS, "hosts_ctl(program,host,ip,username)a\n"}, {NULL, NULL, 0, NULL} }; DL_EXPORT(void) initlibtcpwrap(void) { Py_InitModule3("libtcpwrap", pytcpwrap_methods, "Interface to TCP wrapppers libwrap\n"); }