blob: f9e0644f264d880953f3fed2a957c890dfc176e9 [file] [log] [blame]
Brett Cannon9f49e312014-08-22 14:08:46 -04001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(pwd_getpwuid__doc__,
6"getpwuid($module, uidobj, /)\n"
7"--\n"
8"\n"
9"Return the password database entry for the given numeric user ID.\n"
10"\n"
11"See `help(pwd)` for more on password database entries.");
12
13#define PWD_GETPWUID_METHODDEF \
14 {"getpwuid", (PyCFunction)pwd_getpwuid, METH_O, pwd_getpwuid__doc__},
15
16PyDoc_STRVAR(pwd_getpwnam__doc__,
17"getpwnam($module, arg, /)\n"
18"--\n"
19"\n"
20"Return the password database entry for the given user name.\n"
21"\n"
22"See `help(pwd)` for more on password database entries.");
23
24#define PWD_GETPWNAM_METHODDEF \
Serhiy Storchaka92e8af62015-04-04 00:12:11 +030025 {"getpwnam", (PyCFunction)pwd_getpwnam, METH_O, pwd_getpwnam__doc__},
Brett Cannon9f49e312014-08-22 14:08:46 -040026
27static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030028pwd_getpwnam_impl(PyObject *module, PyObject *arg);
Brett Cannon9f49e312014-08-22 14:08:46 -040029
30static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030031pwd_getpwnam(PyObject *module, PyObject *arg_)
Brett Cannon9f49e312014-08-22 14:08:46 -040032{
33 PyObject *return_value = NULL;
34 PyObject *arg;
35
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030036 if (!PyArg_Parse(arg_, "U:getpwnam", &arg)) {
Brett Cannon9f49e312014-08-22 14:08:46 -040037 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030038 }
Brett Cannon9f49e312014-08-22 14:08:46 -040039 return_value = pwd_getpwnam_impl(module, arg);
40
41exit:
42 return return_value;
43}
44
45#if defined(HAVE_GETPWENT)
46
47PyDoc_STRVAR(pwd_getpwall__doc__,
48"getpwall($module, /)\n"
49"--\n"
50"\n"
51"Return a list of all available password database entries, in arbitrary order.\n"
52"\n"
53"See help(pwd) for more on password database entries.");
54
55#define PWD_GETPWALL_METHODDEF \
56 {"getpwall", (PyCFunction)pwd_getpwall, METH_NOARGS, pwd_getpwall__doc__},
57
58static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030059pwd_getpwall_impl(PyObject *module);
Brett Cannon9f49e312014-08-22 14:08:46 -040060
61static PyObject *
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030062pwd_getpwall(PyObject *module, PyObject *Py_UNUSED(ignored))
Brett Cannon9f49e312014-08-22 14:08:46 -040063{
64 return pwd_getpwall_impl(module);
65}
66
67#endif /* defined(HAVE_GETPWENT) */
68
69#ifndef PWD_GETPWALL_METHODDEF
70 #define PWD_GETPWALL_METHODDEF
71#endif /* !defined(PWD_GETPWALL_METHODDEF) */
Serhiy Storchaka2954f832016-07-07 18:20:03 +030072/*[clinic end generated code: output=fc41d8d88ec206d8 input=a9049054013a1b77]*/