Skip to content

Commit

Permalink
Sprinkle vp->type = VT_DATA in more places, this will be needed later
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Jul 9, 2013
1 parent ff6ae7d commit 0de7d43
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/radius.c
Original file line number Diff line number Diff line change
Expand Up @@ -3797,7 +3797,7 @@ static ssize_t data2vp(RADIUS_PACKET *packet,
fr_strerror_printf("Internal sanity check %d", __LINE__);
return -1;
}

vp->type = VT_DATA;
*pvp = vp;

return attrlen;
Expand Down
3 changes: 3 additions & 0 deletions src/lib/valuepair.c
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,7 @@ static VALUE_PAIR *pairmake_any(TALLOC_CTX *ctx,
}

vp->vp_octets = data;
vp->type = VT_DATA;
return vp;
}

Expand Down Expand Up @@ -2821,6 +2822,7 @@ void pairstrcpy(VALUE_PAIR *vp, char const *src)
talloc_free(q);

vp->vp_strvalue = p;
vp->type = VT_DATA;
vp->length = strlen(vp->vp_strvalue);
}

Expand All @@ -2847,6 +2849,7 @@ void pairsprintf(VALUE_PAIR *vp, char const *fmt, ...)
talloc_free(q);

vp->vp_strvalue = p;
vp->type = VT_DATA;

/*
* vsnprintf returns random things on different platforms
Expand Down
1 change: 1 addition & 0 deletions src/main/detail.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ int detail_recv(rad_listen_t *listener)
vp = paircreate(data, PW_PACKET_ORIGINAL_TIMESTAMP, 0);
if (vp) {
vp->vp_date = (uint32_t) data->timestamp;
vp->type = VT_DATA;
pairinsert(&cursor, vp);
}
continue;
Expand Down
1 change: 1 addition & 0 deletions src/main/soh.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ static int eapsoh_mstlv(REQUEST *request, uint8_t const *p, unsigned int data_le
if (!vp) return 0;

vp->vp_strvalue = q = talloc_array(vp, char, t);
vp->type = VT_DATA;

memcpy(q, p, t);
q[t] = 0;
Expand Down
3 changes: 3 additions & 0 deletions src/modules/proto_dhcp/dhcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ static int fr_dhcp_attr2vp(RADIUS_PACKET *packet, VALUE_PAIR *vp, uint8_t const

case PW_TYPE_STRING:
vp->vp_strvalue = q = talloc_array(vp, char, alen + 1);
vp->type = VT_DATA;
memcpy(q, p , alen);
q[alen] = '\0';
break;
Expand Down Expand Up @@ -767,6 +768,7 @@ int fr_dhcp_decode(RADIUS_PACKET *packet)

case PW_TYPE_STRING:
vp->vp_strvalue = q = talloc_array(vp, char, dhcp_header_sizes[i] + 1);
vp->type = VT_DATA;
memcpy(q, p, dhcp_header_sizes[i]);
q[dhcp_header_sizes[i]] = '\0';
vp->length = strlen(vp->vp_strvalue);
Expand Down Expand Up @@ -1286,6 +1288,7 @@ int fr_dhcp_encode(RADIUS_PACKET *packet)

case PW_TYPE_STRING:
vp->vp_strvalue = q = talloc_array(vp, char, dhcp_header_sizes[i]);
vp->type = VT_DATA;
memcpy(q, p, dhcp_header_sizes[i]);
q[dhcp_header_sizes[i]] = '\0';
vp->length = strlen(vp->vp_strvalue);
Expand Down
1 change: 1 addition & 0 deletions src/modules/proto_vmps/vqp.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ int vqp_decode(RADIUS_PACKET *packet)
case PW_TYPE_STRING:
vp->length = length;
vp->vp_strvalue = p = talloc_array(vp, char, vp->length + 1);
vp->type = VT_DATA;
memcpy(p, ptr, vp->length);
p[vp->length] = '\0';
break;
Expand Down
1 change: 1 addition & 0 deletions src/modules/rlm_eap/rlm_eap.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ static rlm_rcode_t mod_post_proxy(void *inst, REQUEST *request)
request->packet->vector);
// talloc_free(vp->vp_strvalue);
vp->vp_strvalue = p;
vp->type = VT_DATA;

return RLM_MODULE_UPDATED;
}
Expand Down
1 change: 1 addition & 0 deletions src/modules/rlm_eap/types/rlm_eap_gtc/rlm_eap_gtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ static int mod_authenticate(void *instance, eap_handler_t *handler)
}
vp->length = eap_ds->response->type.length;
vp->vp_strvalue = p = talloc_array(vp, char, vp->length + 1);
vp->type = VT_DATA;
memcpy(p, eap_ds->response->type.data, vp->length);
p[vp->length] = 0;

Expand Down
1 change: 1 addition & 0 deletions src/modules/rlm_eap/types/rlm_eap_leap/eap_leap.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ leap_packet_t *eapleap_stage6(leap_packet_t *packet, REQUEST *request,
vp->length = 17 + i;
// talloc_free(vp->vp_strvalue);
vp->vp_strvalue = q;
vp->type = VT_DATA;

return reply;
}
Expand Down
1 change: 1 addition & 0 deletions src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ static VALUE_PAIR *diameter2vp(REQUEST *request, REQUEST *fake, SSL *ssl,
*/
case PW_TYPE_STRING:
vp->vp_strvalue = p = talloc_array(vp, char, size + 1);
vp->type = VT_DATA;
memcpy(p, data, size);
p[size] = '\0';
vp->length = strlen(p);
Expand Down
1 change: 1 addition & 0 deletions src/modules/rlm_otp/rlm_otp.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ static rlm_rcode_t mod_authorize(void *instance, REQUEST *request)
vp->vp_strvalue = expanded;
vp->length = len;
vp->op = T_OP_SET;
vp->type = VT_DATA;

pairadd(&request->reply->vps, vp);
}
Expand Down
1 change: 1 addition & 0 deletions src/modules/rlm_wimax/rlm_wimax.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static rlm_rcode_t mod_authorize(UNUSED void *instance, UNUSED REQUEST *request)
memcpy(buffer, vp->vp_strvalue, 6);
vp->length = (5*3)+2;
vp->vp_strvalue = p = talloc_array(vp, char, vp->length + 1);
vp->type = VT_DATA;

/*
* RFC 3580 Section 3.20 says this is the preferred
Expand Down

0 comments on commit 0de7d43

Please sign in to comment.