#include <ctype.h>
/* timestr.c */
-int timestr_match(char const *, time_t);
+int timestr_match(char const *, fr_time_t);
/*
* Define a structure for our module configuration.
/*
* Compare the current time to a range.
*/
-static int timecmp(UNUSED void *instance, request_t *req, UNUSED fr_pair_list_t *request_list, fr_pair_t const *check)
+static int timecmp(UNUSED void *instance, request_t *request, UNUSED fr_pair_list_t *request_list, fr_pair_t const *check)
{
/*
* If there's a request, use that timestamp.
*/
- if (timestr_match(check->vp_strvalue, req ? fr_time_to_sec(req->packet->timestamp) : time(NULL)) >= 0) return 0;
+ if (timestr_match(check->vp_strvalue, request->packet->timestamp) >= 0) return 0;
return -1;
}
/*
* Compare the time the request was received with the current Login-Time value
*/
- left = timestr_match(ends->vp_strvalue, fr_time_to_sec(request->packet->timestamp));
+ left = timestr_match(ends->vp_strvalue, request->packet->timestamp);
if (left < 0) RETURN_MODULE_DISALLOW; /* outside of the allowed time */
/*
#include <ctype.h>
-int timestr_match(char const *, time_t);
+int timestr_match(char const *, fr_time_t);
static char const *days[] =
{ "su", "mo", "tu", "we", "th", "fr", "sa", "wk", "any", "al" };
* Match a timestring and return seconds left.
* -1 for no match, 0 for unlimited.
*/
-int timestr_match(char const *tmstr, time_t t)
+int timestr_match(char const *tmstr, fr_time_t when)
{
struct tm *tm, s_tm;
char bitmap[WEEKMIN / 8];
char *s;
char null[8];
#endif
+ time_t t = fr_time_to_sec(when);
tm = localtime_r(&t, &s_tm);
now = tm->tm_wday * DAYMIN + tm->tm_hour * 60 + tm->tm_min;