#include <sys/stat.h>
#include <sys/types.h>
#include <utmpx.h>
+
#include "defines.h"
#include "prototypes.h"
#include "shadowlog.h"
#include "sizeof.h"
-#include "string/strcpy/zustr2stp.h"
+#include "string/strdup/strndupa.h"
/*
static int
check_login(const struct utmpx *ut)
{
- char user[sizeof(ut->ut_user) + 1];
- char line[sizeof(ut->ut_line) + 1];
+ char *user;
+ char *line;
time_t now;
- ZUSTR2STP(user, ut->ut_user);
- ZUSTR2STP(line, ut->ut_line);
+ user = STRNDUPA(ut->ut_user);
+ line = STRNDUPA(ut->ut_line);
now = time(NULL);
- /*
- * Check if they are allowed to be logged in right now.
- */
- if (!isttytime(user, line, now)) {
- return 0;
- }
- return 1;
+ return isttytime(user, line, now);
}
*/
while ((ut = getutxent()) != NULL) {
int tty_fd;
- char user[sizeof(ut->ut_user) + 1]; // NUL
char tty_name[sizeof(ut->ut_line) + 6]; // /dev/ + NUL
if (ut->ut_type != USER_PROCESS) {
kill (-ut->ut_pid, SIGKILL);
}
- ZUSTR2STP(user, ut->ut_user);
-
SYSLOG ((LOG_NOTICE,
- "logged off user '%s' on '%s'", user,
+ "logged off user '%s' on '%s'",
+ STRNDUPA(ut->ut_user),
tty_name));
/*