Skip to content

Commit

Permalink
Sign fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Dec 30, 2013
1 parent 7116058 commit fe2e923
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/radsniff.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
* End of variable length bits, do basic check now to see if packet looks long enough
*/
len = (p - data) + sizeof(struct udp_header) + (sizeof(radius_packet_t) - 1); /* length value */
if (len > header->caplen) {
if ((size_t) len > header->caplen) {
REDEBUG("Packet too small, we require at least %zu bytes, captured %i bytes",
(size_t) len, header->caplen);
return;
Expand Down
11 changes: 6 additions & 5 deletions src/modules/rlm_counter/rlm_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ static rlm_rcode_t mod_accounting(void *instance, REQUEST *request)
*/
key_vp = pairfind(request->packet->vps, PW_ACCT_DELAY_TIME, 0, TAG_ANY);
if (key_vp != NULL) {
if (key_vp->vp_integer != 0 && (request->timestamp - key_vp->vp_integer) < inst->last_reset) {
if ((key_vp->vp_integer != 0) && (request->timestamp - (time_t) key_vp->vp_integer) < inst->last_reset) {
DEBUG("rlm_counter: This packet is too old. Returning NOOP");
return RLM_MODULE_NOOP;
}
Expand Down Expand Up @@ -647,7 +647,7 @@ static rlm_rcode_t mod_accounting(void *instance, REQUEST *request)
* day). That is the right thing
*/
diff = request->timestamp - inst->last_reset;
counter.user_counter += (count_vp->vp_integer < diff) ? count_vp->vp_integer : diff;
counter.user_counter += ((time_t) count_vp->vp_integer < diff) ? count_vp->vp_integer : diff;

} else if (count_vp->da->type == PW_TYPE_INTEGER) {
/*
Expand Down Expand Up @@ -711,8 +711,9 @@ static rlm_rcode_t mod_authorize(UNUSED void *instance, UNUSED REQUEST *request)
pthread_mutex_lock(&inst->mutex);
rcode2 = reset_db(inst);
pthread_mutex_unlock(&inst->mutex);
if (rcode2 != RLM_MODULE_OK)
if (rcode2 != RLM_MODULE_OK) {
return rcode2;
}
}


Expand All @@ -722,7 +723,7 @@ static rlm_rcode_t mod_authorize(UNUSED void *instance, UNUSED REQUEST *request)
*/
DEBUG2("rlm_counter: Entering module authorize code");
key_vp = (inst->key_attr->attr == PW_USER_NAME) ? request->username :
pairfind_da(request->packet->vps, inst->key_attr, TAG_ANY);
pairfind_da(request->packet->vps, inst->key_attr, TAG_ANY);
if (!key_vp) {
DEBUG2("rlm_counter: Could not find Key value pair");
return rcode;
Expand All @@ -731,7 +732,7 @@ static rlm_rcode_t mod_authorize(UNUSED void *instance, UNUSED REQUEST *request)
/*
* Look for the check item
*/
if ((check_vp=pairfind_da(request->config_items, inst->check_attr, TAG_ANY)) == NULL) {
if ((check_vp = pairfind_da(request->config_items, inst->check_attr, TAG_ANY)) == NULL) {
DEBUG2("rlm_counter: Could not find Check item value pair");
return rcode;
}
Expand Down

0 comments on commit fe2e923

Please sign in to comment.