* This bounds the time given to login. Not a define so it can
* be patched on machines where it's too small.
*/
-static int timeout = LOGIN_TIMEOUT;
+static unsigned int timeout = LOGIN_TIMEOUT;
static int child_pid = 0;
static volatile int got_sig = 0;
{
signal(SIGALRM, timedout2);
alarm(10);
- /* TRANSLATORS: The standard value for %d is 60. */
- warnx(_("timed out after %d seconds"), timeout);
+ /* TRANSLATORS: The standard value for %u is 60. */
+ warnx(_("timed out after %u seconds"), timeout);
signal(SIGALRM, SIG_IGN);
alarm(0);
timedout2(0);
*/
static void __attribute__ ((__noreturn__)) sleepexit(int eval)
{
- sleep(getlogindefs_num("FAIL_DELAY", LOGIN_EXIT_TIMEOUT));
+ sleep((unsigned int)getlogindefs_num("FAIL_DELAY", LOGIN_EXIT_TIMEOUT));
exit(eval);
}
grname = getlogindefs_str("TTYGROUP", TTYGRPNAME);
if (grname && *grname) {
if (*grname >= 0 && *grname <= 9) /* group by ID */
- gid = getlogindefs_num("TTYGROUP", gid);
+ gid = (gid_t)getlogindefs_num("TTYGROUP", gid);
else { /* group by name */
struct group *gr = getgrnam(grname);
if (gr)
static void loginpam_auth(struct login_context *cxt)
{
- int rc, failcount = 0, show_unknown, retries;
+ int rc, failcount = 0, show_unknown;
+ unsigned long retries;
const char *hostname = cxt->hostname ? cxt->hostname :
cxt->tty_name ? cxt->tty_name : "<unknown>";
pam_handle_t *pamh = cxt->pamh;
.conv = { misc_conv, NULL } /* PAM conversation function */
};
- timeout = getlogindefs_num("LOGIN_TIMEOUT", LOGIN_TIMEOUT);
+ timeout = (unsigned int)getlogindefs_num("LOGIN_TIMEOUT", LOGIN_TIMEOUT);
signal(SIGALRM, timedout);
siginterrupt(SIGALRM, 1); /* we have to interrupt syscalls like ioclt() */
- alarm((unsigned int)timeout);
+ alarm(timeout);
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, SIG_IGN);
return ptr && ptr->value ? (strcasecmp(ptr->value, "yes") == 0) : dflt;
}
-long getlogindefs_num(const char *name, long dflt)
+unsigned long getlogindefs_num(const char *name, long dflt)
{
struct item *ptr = search(name);
char *end = NULL;
- long retval;
+ unsigned long retval;
if (!ptr || !ptr->value)
return dflt;
errno = 0;
- retval = strtol(ptr->value, &end, 0);
+ retval = strtoul(ptr->value, &end, 0);
if (end && *end == '\0' && !errno)
return retval;
extern void logindefs_load_file(const char *filename);
extern void (*logindefs_load_defaults)(void);
extern int getlogindefs_bool(const char *name, int dflt);
-extern long getlogindefs_num(const char *name, long dflt);
+extern unsigned long getlogindefs_num(const char *name, long dflt);
extern const char *getlogindefs_str(const char *name, const char *dflt);
extern void free_getlogindefs_data(void);
extern int logindefs_setenv(const char *name, const char *conf, const char *dflt);