Cast interval values to ints before use, so we don't get sign issues with time_t...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 26 May 2014 12:30:48 +0000 (13:30 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 26 May 2014 12:33:37 +0000 (13:33 +0100)
src/main/command.c
src/main/detail.c
src/main/realms.c
src/main/threads.c
src/main/tls.c
src/modules/rlm_eap/mem.c
src/modules/rlm_otp/rlm_otp.c

index 97a5ade..d3e2cb7 100644 (file)
@@ -707,11 +707,11 @@ static int command_show_home_servers(rad_listen_t *listener, UNUSED int argc, UN
                         *      The *reported* state changes because
                         *      the internal state machine NEEDS THE
                         *      RIGHT STATE.  However, reporting that
-                        *      to the admin will confuse him.  So...
-                        *      we lie.  Yes, that dress doesn't make
-                        *      you look fat.
+                        *      to the admin will confuse them.
+                        *      So... we lie.  No, that dress doesn't
+                        *      make you look fat...
                         */
-                       if ((home->last_packet_recv + home->ping_interval) >= now) {
+                       if ((home->last_packet_recv + (int)home->ping_interval) >= now) {
                                state = "alive";
                        } else {
                                state = "unknown";
index 5fd271f..93ab327 100644 (file)
@@ -492,7 +492,7 @@ static RADIUS_PACKET *detail_poll(rad_listen_t *listener)
                         *      retry it.
                         */
                case STATE_RUNNING:
-                       if (time(NULL) < (data->running + data->retry_interval)) {
+                       if (time(NULL) < (data->running + (int)data->retry_interval)) {
                                return NULL;
                        }
 
index d24b7c2..9373b2f 100644 (file)
@@ -682,11 +682,10 @@ static int home_server_add(realm_config_t *rc, CONF_SECTION *cs)
                home->response_window.tv_usec = tmp;
 
        } else {
-               uint32_t tmp = home->response_window.tv_sec; /* which isn't an integer */
+               int tmp = (int)home->response_window.tv_sec; /* which isn't an integer */
 
                FR_INTEGER_BOUND_CHECK("response_window", tmp, <=, 60);
-               FR_INTEGER_BOUND_CHECK("response_window", tmp, <=, main_config.max_request_time);
-               FR_INTEGER_BOUND_CHECK("response_window", tmp, <=, main_config.max_request_time);
+               FR_INTEGER_BOUND_CHECK("response_window", tmp, <=, (int)main_config.max_request_time);
 
                if (home->response_window.tv_sec != tmp) {
                        home->response_window.tv_sec = tmp;
index a53b0e9..24f5870 100644 (file)
@@ -1188,7 +1188,7 @@ static void thread_pool_manage(time_t now)
         *      passed since we last created one.  This helps to minimize
         *      the amount of create/delete cycles.
         */
-       if ((now - thread_pool.time_last_spawned) < thread_pool.cleanup_delay) {
+       if ((now - thread_pool.time_last_spawned) < (int)thread_pool.cleanup_delay) {
                return;
        }
 
index fa6279d..347d977 100644 (file)
@@ -193,7 +193,7 @@ tls_session_t *tls_new_session(fr_tls_server_conf_t *conf, REQUEST *request,
         *      FIXME: Also do it every N sessions?
         */
        if (conf->session_cache_enable &&
-           ((conf->session_last_flushed + (conf->session_timeout * 1800)) <= request->timestamp)){
+           ((conf->session_last_flushed + ((int)conf->session_timeout * 1800)) <= request->timestamp)){
                RDEBUG2("Flushing SSL sessions (of #%ld)",
                        SSL_CTX_sess_number(conf->ctx));
 
index 500b53d..ccafa74 100644 (file)
@@ -286,7 +286,7 @@ static void eaplist_expire(rlm_eap_t *inst, REQUEST *request, time_t timestamp)
                 *      Expire entries from the start of the list.
                 *      They should be the oldest ones.
                 */
-               if ((timestamp - handler->timestamp) > inst->timer_limit) {
+               if ((timestamp - handler->timestamp) > (int)inst->timer_limit) {
                        rbnode_t *node;
                        node = rbtree_find(inst->session_tree, handler);
                        rad_assert(node != NULL);
index bbe3269..971b01c 100644 (file)
@@ -392,7 +392,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(void *instance, REQUEST *re
                 *      State is valid, but check expiry.
                 */
                then = ntohl(then);
-               if (time(NULL) - then > inst->challenge_delay) {
+               if ((time(NULL) - then) > (int)inst->challenge_delay) {
                        REDEBUG("bad radstate for [%s]: expired",username);
 
                        return RLM_MODULE_REJECT;