Be more clever :)

master
Emiel Kollof 9 months ago
parent 7822495228
commit 04c6686af9

@ -175,6 +175,17 @@ static void do_log(int type, char * format, ...) {
}
}
char *my_itoa(int num, char *str)
{
if(str == NULL)
{
return NULL;
}
sprintf(str, "%d", num);
return str;
}
#ifdef DEBUG
#define log_error(format, ...) do_log(LOG_ERR, "linotp:ERROR: " #format, ## __VA_ARGS__)
#define log_debug(format, ...) do_log(LOG_ERR, "linotp:DEBUG: " #format, ## __VA_ARGS__)
@ -810,8 +821,8 @@ int pam_linotp_get_config(int argc, const char *argv[], LinOTPConfig * config, i
/* check for timeout */
else if (check_prefix(argv[i], "timeout=", &temp) > 0) {
/* validation */
if ( strlen(temp) != strlen( sprintf("%d", atoi(temp)) ) ) {
log_error("Timeout should be a number");
if ( ! atoi(temp) ) {
log_error("Timeout should be a number larger than 0");
return (PAM_AUTH_ERR);
} else {
config->timeout = temp;

Loading…
Cancel
Save