Skip to content

Commit

Permalink
Use pairmove2() instead of pairadd(a,b);b=NULL
Browse files Browse the repository at this point in the history
Now that we use talloc, we have to re-parent everything
properly.
  • Loading branch information
alandekok committed Mar 20, 2013
1 parent fb73fad commit 691f568
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/main/process.c
Expand Up @@ -1847,8 +1847,8 @@ static int process_proxy_reply(REQUEST *request)
* Add the attributes left in the proxy
* reply to the reply list.
*/
pairadd(&request->reply->vps, request->proxy_reply->vps);
request->proxy_reply->vps = NULL;
pairmove2(request->reply, &request->reply->vps,
&request->proxy_reply->vps, 0, 0, TAG_ANY);

/*
* Free proxy request pairs.
Expand Down
11 changes: 7 additions & 4 deletions src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c
Expand Up @@ -481,8 +481,10 @@ static int mschapv2_authenticate(void *arg, eap_handler_t *handler)
switch (ccode) {
case PW_EAP_MSCHAPV2_SUCCESS:
eap_ds->request->code = PW_EAP_SUCCESS;
pairadd(&request->reply->vps, data->mppe_keys);
data->mppe_keys = NULL;

pairmove2(request->reply,
&request->reply->vps,
&data->mppe_keys, 0, 0, TAG_ANY);
/* fall through... */

case PW_EAP_MSCHAPV2_ACK:
Expand All @@ -492,8 +494,9 @@ static int mschapv2_authenticate(void *arg, eap_handler_t *handler)
*/
request->options &= ~RAD_REQUEST_OPTION_PROXY_EAP;
#endif
pairadd(&request->reply->vps, data->reply);
data->reply = NULL;
pairmove2(request->reply,
&request->reply->vps,
&data->reply, 0, 0, TAG_ANY);
return 1;
}
radlog(L_ERR, "rlm_eap_mschapv2: Sent SUCCESS expecting SUCCESS (or ACK) but got %d", ccode);
Expand Down
10 changes: 6 additions & 4 deletions src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c
Expand Up @@ -377,14 +377,16 @@ static int mod_authenticate(void *arg, eap_handler_t *handler)
if (peap->soh_reply_vps) {
RDEBUG2("Using saved attributes from the SoH reply");
debug_pair_list(peap->soh_reply_vps);
pairadd(&handler->request->reply->vps, peap->soh_reply_vps);
peap->soh_reply_vps = NULL;
pairmove2(handler->request->reply,
&handler->request->reply->vps,
&peap->soh_reply_vps, 0, 0, TAG_ANY);
}
if (peap->accept_vps) {
RDEBUG2("Using saved attributes from the original Access-Accept");
debug_pair_list(peap->accept_vps);
pairadd(&handler->request->reply->vps, peap->accept_vps);
peap->accept_vps = NULL;
pairmove2(handler->request->reply,
&handler->request->reply->vps,
&peap->accept_vps, 0, 0, TAG_ANY);
}

/*
Expand Down
4 changes: 2 additions & 2 deletions src/modules/rlm_eap/types/rlm_eap_tls/rlm_eap_tls.c
Expand Up @@ -181,8 +181,8 @@ static int mod_authenticate(void *type_arg, eap_handler_t *handler)
RDEBUG("} # server %s", fake->server);

/* copy the reply vps back to our reply */
pairadd(&request->reply->vps, fake->reply->vps);
fake->reply->vps = NULL;
pairmove2(request->reply, &request->reply->vps,
&fake->reply->vps, 0, 0, TAG_ANY);

/* reject if virtual server didn't return accept */
if (fake->reply->code != PW_AUTHENTICATION_ACK) {
Expand Down
6 changes: 3 additions & 3 deletions src/modules/rlm_eap/types/rlm_eap_ttls/rlm_eap_ttls.c
Expand Up @@ -283,9 +283,9 @@ static int mod_authenticate(void *arg, eap_handler_t *handler)
if (t && t->authenticated) {
RDEBUG2("Using saved attributes from the original Access-Accept");
debug_pair_list(t->accept_vps);
pairadd(&handler->request->reply->vps,
t->accept_vps);
t->accept_vps = NULL;
pairmove2(handler->request->reply,
&handler->request->reply->vps,
&t->accept_vps, 0, 0, TAG_ANY);
do_keys:
/*
* Success: Automatically return MPPE keys.
Expand Down
4 changes: 2 additions & 2 deletions src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c
Expand Up @@ -753,8 +753,8 @@ static int process_reply(eap_handler_t *handler, tls_session_t *tls_session,
*/
if (t->use_tunneled_reply) {
pairdelete(&reply->vps, PW_PROXY_STATE, 0, TAG_ANY);
pairadd(&request->reply->vps, reply->vps);
reply->vps = NULL;
pairmove2(request->reply, &request->reply->vps,
&reply->vps, 0, 0, TAG_ANY);
}
break;

Expand Down

0 comments on commit 691f568

Please sign in to comment.