#include <pwd.h>
#ifndef BSD
+#ifndef NO_SHADOW
#include <shadow.h>
+#endif
#include <crypt.h>
#endif
struct group *gr;
errno = 0;
if (lua_isnumber(L, 1)) {
- gr = getgrgid(lua_tonumber(L, 1));
+ gr = getgrgid(lua_tointeger(L, 1));
} else if (lua_isstring(L, 1)) {
gr = getgrnam(lua_tostring(L, 1));
} else if (lua_isnoneornil(L, 1)) {
struct passwd *pw;
errno = 0;
if (lua_isnumber(L, 1)) {
- pw = getpwuid(lua_tonumber(L, 1));
+ pw = getpwuid(lua_tointeger(L, 1));
} else if (lua_isstring(L, 1)) {
pw = getpwnam(lua_tostring(L, 1));
} else if (lua_isnoneornil(L, 1)) {
}
#ifndef BSD
+#ifndef NO_SHADOW
static int nixio__push_spwd(lua_State *L, struct spwd *sp) {
lua_createtable(L, 0, 9);
lua_pushstring(L, sp->sp_namp);
return nixio__push_spwd(L, sp);
}
}
+#endif /* !NO_SHADOW */
#endif /* !BSD */
static int nixio_crypt(lua_State *L) {
{"getgr", nixio_getgr},
{"getpw", nixio_getpw},
#ifndef BSD
+#ifndef NO_SHADOW
{"getsp", nixio_getsp},
#endif
+#endif
{NULL, NULL}
};