/*
Authors:
Sumit Bose <sbose@redhat.com>
Alexander Bokovoy <abokovoy@redhat.com>
Copyright (C) 2013 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Python.h>
#include "util/sss_python.h"
#include "sss_client/idmap/sss_nss_idmap.h"
enum lookup_type {
};
{
int ret;
py_dict = PyDict_New();
return ENOMEM;
}
if (ret != 0) {
return ret;
}
if (ret != 0) {
return ret;
}
return ret;
}
{
if (PyUnicode_Check(inp)) {
} else if (PyBytes_Check(inp)) {
} else {
return NULL;
}
return PyBytes_AS_STRING(py_str);
}
{
int ret;
const char *name;
return EINVAL;
}
if (ret == 0) {
}
return ret;
}
{
int ret;
const char *sid;
return EINVAL;
}
if (ret == 0) {
}
return ret;
}
{
long id;
const char *id_str;
char *endptr;
int ret;
#ifndef IS_PY3K
if (PyInt_Check(py_id)) {
} else
#endif
if (PyLong_Check(py_id)) {
} else {
return EINVAL;
}
errno = 0;
return EINVAL;
}
}
return EINVAL;
}
if (ret == 0) {
}
return ret;
}
{
int ret;
const char *cert;
return EINVAL;
}
if (ret == 0) {
}
return ret;
}
{
const char *sid;
int ret;
return EINVAL;
}
if (ret == 0) {
}
return ret;
}
{
switch(type) {
case SIDBYNAME:
break;
case NAMEBYSID:
break;
case SIDBYID:
break;
case IDBYSID:
break;
case NAMEBYCERT:
break;
default:
return ENOSYS;
}
return ENOSYS;
}
{
int ret;
return NULL;
}
"Only string, long or list or tuples of them " \
"are accepted\n");
return NULL;
}
py_result = PyDict_New();
"Unable to allocate resulting dictionary\n");
return NULL;
}
for(i=0; i < len; i++) {
if (ret != 0) {
/* Skip this name */
continue;
}
}
}
} else {
switch (ret) {
case 0:
case ENOENT: /* nothing found, return empty dict */
break;
case EINVAL:
return NULL;
break;
default:
return NULL;
}
}
return py_result;
}
\n\
Returns a dictionary with a dictonary of results for each given name.\n\
The result dictonary contain the SID and the type of the object which can be\n\
accessed with the key constants SID_KEY and TYPE_KEY, respectively.\n\
\n\
The return type can be one of the following constants:\n\
- ID_NOT_SPECIFIED\n\
- ID_USER\n\
- ID_GROUP\n\
- ID_BOTH"
);
{
}
\n\
Returns a dictionary with a dictonary of results for each given POSIX ID.\n\
The result dictonary contain the SID and the type of the object which can be\n\
accessed with the key constants SID_KEY and TYPE_KEY, respectively."
);
{
}
\n\
Returns a dictionary with a dictonary of results for each given SID.\n\
The result dictonary contain the name and the type of the object which can be\n\
accessed with the key constants NAME_KEY and TYPE_KEY, respectively.\n\
\n\
NOTE: getnamebysid currently works only with id_provider set as \"ad\" or \"ipa\""
);
{
}
"getidbysid(sid) -> POSIX ID\n\
\n\
Returns the POSIX ID of the object with the given SID."
\n\
Returns a dictionary with a dictonary of results for each given SID.\n\
The result dictonary contain the POSIX ID and the type of the object which\n\
can be accessed with the key constants ID_KEY and TYPE_KEY, respectively."
);
{
}
\n\
Returns a dictionary with a dictonary of results for each given certificates.\n\
The result dictonary contain the name and the type of the object which can be\n\
accessed with the key constants NAME_KEY and TYPE_KEY, respectively.\n\
\n\
NOTE: getnamebycert currently works only with id_provider set as \"ad\" or \"ipa\""
);
{
}
};
#ifdef IS_PY3K
"pysss_nss_idmap",
NULL,
-1,
NULL,
NULL,
NULL,
};
PyInit_pysss_nss_idmap(void)
#else
initpysss_nss_idmap(void)
#endif
{
#ifdef IS_PY3K
#else
sss_py_const_p(char, "SSSD ID-mapping functions"));
#endif
#ifdef IS_PY3K
return module;
#endif
}