Use fr_pair_list_mcopy... instead of fr_pair_list_move...
authorAlan T. DeKok <aland@freeradius.org>
Fri, 11 Sep 2015 16:16:53 +0000 (12:16 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 11 Sep 2015 16:16:53 +0000 (12:16 -0400)
src/main/state.c
src/main/tls.c
src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c
src/modules/rlm_eap/types/rlm_eap_peap/peap.c
src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c
src/modules/rlm_eap/types/rlm_eap_tls/rlm_eap_tls.c
src/modules/rlm_eap/types/rlm_eap_ttls/rlm_eap_ttls.c
src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c

index d52edf2..e292e04 100644 (file)
@@ -399,7 +399,7 @@ void fr_state_get_vps(REQUEST *request, RADIUS_PACKET *packet)
         *      isn't thread-safe.
         */
        if (entry) {
-               fr_pair_list_move_by_num(request, &request->state, &entry->vps, 0, 0, TAG_ANY);
+               fr_pair_list_mcopy_by_num(request, &request->state, &entry->vps, 0, 0, TAG_ANY);
                RDEBUG2("session-state: Found cached attributes");
                rdebug_pair_list(L_DBG_LVL_1, request, request->state, NULL);
 
@@ -450,7 +450,7 @@ bool fr_state_put_vps(REQUEST *request, RADIUS_PACKET *original, RADIUS_PACKET *
         *      This has to be done in a mutex lock, because talloc
         *      isn't thread-safe.
         */
-       fr_pair_list_move_by_num(entry, &entry->vps, &request->state, 0, 0, TAG_ANY);
+       fr_pair_list_mcopy_by_num(entry, &entry->vps, &request->state, 0, 0, TAG_ANY);
        PTHREAD_MUTEX_UNLOCK(&state->mutex);
 
        rad_assert(request->state == NULL);
index b5c665b..ad092d4 100644 (file)
@@ -1336,7 +1336,7 @@ static SSL_SESSION *cbtls_get_session(SSL *ssl, unsigned char *data, int len, in
                }
 
                /* move the cached VPs into the session */
-               fr_pair_list_move_by_num(talloc_ctx, &vps, &pairlist->reply, 0, 0, TAG_ANY);
+               fr_pair_list_mcopy_by_num(talloc_ctx, &vps, &pairlist->reply, 0, 0, TAG_ANY);
 
                SSL_SESSION_set_ex_data(sess, fr_tls_ex_index_vps, vps);
                RWDEBUG("Successfully restored session %s", buffer);
index 96660b7..abb5479 100644 (file)
@@ -46,10 +46,10 @@ static CONF_PARSER module_config[] = {
 
 static void fix_mppe_keys(eap_handler_t *handler, mschapv2_opaque_t *data)
 {
-       fr_pair_list_move_by_num(data, &data->mppe_keys, &handler->request->reply->vps, 7, VENDORPEC_MICROSOFT, TAG_ANY);
-       fr_pair_list_move_by_num(data, &data->mppe_keys, &handler->request->reply->vps, 8, VENDORPEC_MICROSOFT, TAG_ANY);
-       fr_pair_list_move_by_num(data, &data->mppe_keys, &handler->request->reply->vps, 16, VENDORPEC_MICROSOFT, TAG_ANY);
-       fr_pair_list_move_by_num(data, &data->mppe_keys, &handler->request->reply->vps, 17, VENDORPEC_MICROSOFT, TAG_ANY);
+       fr_pair_list_mcopy_by_num(data, &data->mppe_keys, &handler->request->reply->vps, 7, VENDORPEC_MICROSOFT, TAG_ANY);
+       fr_pair_list_mcopy_by_num(data, &data->mppe_keys, &handler->request->reply->vps, 8, VENDORPEC_MICROSOFT, TAG_ANY);
+       fr_pair_list_mcopy_by_num(data, &data->mppe_keys, &handler->request->reply->vps, 16, VENDORPEC_MICROSOFT, TAG_ANY);
+       fr_pair_list_mcopy_by_num(data, &data->mppe_keys, &handler->request->reply->vps, 17, VENDORPEC_MICROSOFT, TAG_ANY);
 }
 
 /*
@@ -316,7 +316,7 @@ static int CC_HINT(nonnull) mschap_postproxy(eap_handler_t *handler, UNUSED void
                 *      Move the attribute, so it doesn't go into
                 *      the reply.
                 */
-               fr_pair_list_move_by_num(data, &response, &request->reply->vps, PW_MSCHAP2_SUCCESS, VENDORPEC_MICROSOFT, TAG_ANY);
+               fr_pair_list_mcopy_by_num(data, &response, &request->reply->vps, PW_MSCHAP2_SUCCESS, VENDORPEC_MICROSOFT, TAG_ANY);
                break;
 
        default:
@@ -482,7 +482,7 @@ failure:
                case PW_EAP_MSCHAPV2_SUCCESS:
                        eap_ds->request->code = PW_EAP_SUCCESS;
 
-                       fr_pair_list_move_by_num(request->reply, &request->reply->vps, &data->mppe_keys, 0, 0, TAG_ANY);
+                       fr_pair_list_mcopy_by_num(request->reply, &request->reply->vps, &data->mppe_keys, 0, 0, TAG_ANY);
                        /* FALL-THROUGH */
 
                case PW_EAP_MSCHAPV2_ACK:
@@ -492,7 +492,7 @@ failure:
                         */
                        request->options &= ~RAD_REQUEST_OPTION_PROXY_EAP;
 #endif
-                       fr_pair_list_move_by_num(request->reply, &request->reply->vps, &data->reply, 0, 0, TAG_ANY);
+                       fr_pair_list_mcopy_by_num(request->reply, &request->reply->vps, &data->reply, 0, 0, TAG_ANY);
                        return 1;
                }
                REDEBUG("Sent SUCCESS expecting SUCCESS (or ACK) but got %d", ccode);
@@ -676,10 +676,10 @@ packet_ready:
         */
        response = NULL;
        if (rcode == RLM_MODULE_OK) {
-               fr_pair_list_move_by_num(data, &response, &request->reply->vps, PW_MSCHAP2_SUCCESS, VENDORPEC_MICROSOFT, TAG_ANY);
+               fr_pair_list_mcopy_by_num(data, &response, &request->reply->vps, PW_MSCHAP2_SUCCESS, VENDORPEC_MICROSOFT, TAG_ANY);
                data->code = PW_EAP_MSCHAPV2_SUCCESS;
        } else if (inst->send_error) {
-               fr_pair_list_move_by_num(data, &response, &request->reply->vps, PW_MSCHAP_ERROR, VENDORPEC_MICROSOFT, TAG_ANY);
+               fr_pair_list_mcopy_by_num(data, &response, &request->reply->vps, PW_MSCHAP_ERROR, VENDORPEC_MICROSOFT, TAG_ANY);
                if (response) {
                        int n,err,retry;
                        char buf[34];
index cd40f2e..3f575e4 100644 (file)
@@ -458,7 +458,7 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_handler_t *handler, tls_se
                        fr_pair_delete_by_num(&reply->vps, 17, VENDORPEC_MICROSOFT, TAG_ANY);
 
                        fr_pair_list_free(&t->accept_vps); /* for proxying MS-CHAP2 */
-                       fr_pair_list_move_by_num(t, &t->accept_vps, &reply->vps, 0, 0, TAG_ANY);
+                       fr_pair_list_mcopy_by_num(t, &t->accept_vps, &reply->vps, 0, 0, TAG_ANY);
                        rad_assert(!reply->vps);
                }
                break;
@@ -479,7 +479,7 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_handler_t *handler, tls_se
                 *      Get rid of the old State, too.
                 */
                fr_pair_list_free(&t->state);
-               fr_pair_list_move_by_num(t, &t->state, &reply->vps, PW_STATE, 0, TAG_ANY);
+               fr_pair_list_mcopy_by_num(t, &t->state, &reply->vps, PW_STATE, 0, TAG_ANY);
 
                /*
                 *      PEAP takes only EAP-Message attributes inside
@@ -487,7 +487,7 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_handler_t *handler, tls_se
                 *      Access-Challenge is ignored.
                 */
                vp = NULL;
-               fr_pair_list_move_by_num(t, &vp, &reply->vps, PW_EAP_MESSAGE, 0, TAG_ANY);
+               fr_pair_list_mcopy_by_num(t, &vp, &reply->vps, PW_EAP_MESSAGE, 0, TAG_ANY);
 
                /*
                 *      Handle EAP-MSCHAP-V2, where Access-Accept's
@@ -506,7 +506,7 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_handler_t *handler, tls_se
                        fr_pair_delete_by_num(&reply->vps, PW_MESSAGE_AUTHENTICATOR, 0, TAG_ANY);
 
                        rad_assert(!t->accept_vps);
-                       fr_pair_list_move_by_num(t, &t->accept_vps, &reply->vps, 0, 0, TAG_ANY);
+                       fr_pair_list_mcopy_by_num(t, &t->accept_vps, &reply->vps, 0, 0, TAG_ANY);
                        rad_assert(!reply->vps);
                }
 
@@ -823,7 +823,7 @@ rlm_rcode_t eappeap_process(eap_handler_t *handler, tls_session_t *tls_session)
 
                /* save the SoH VPs */
                rad_assert(!t->soh_reply_vps);
-               fr_pair_list_move_by_num(t, &t->soh_reply_vps, &fake->reply->vps, 0, 0, TAG_ANY);
+               fr_pair_list_mcopy_by_num(t, &t->soh_reply_vps, &fake->reply->vps, 0, 0, TAG_ANY);
                rad_assert(!fake->reply->vps);
                talloc_free(fake);
 
@@ -1092,7 +1092,7 @@ rlm_rcode_t eappeap_process(eap_handler_t *handler, tls_session_t *tls_session)
                         *      Tell the original request that it's going
                         *      to be proxied.
                         */
-                       fr_pair_list_move_by_num(request, &request->config,
+                       fr_pair_list_mcopy_by_num(request, &request->config,
                                   &fake->config,
                                   PW_PROXY_TO_REALM, 0, TAG_ANY);
 
index d9d1930..15ea812 100644 (file)
@@ -319,14 +319,14 @@ static int mod_process(void *arg, eap_handler_t *handler)
                if (peap->soh_reply_vps) {
                        RDEBUG2("Using saved attributes from the SoH reply");
                        rdebug_pair_list(L_DBG_LVL_2, request, peap->soh_reply_vps, NULL);
-                       fr_pair_list_move_by_num(handler->request->reply,
+                       fr_pair_list_mcopy_by_num(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");
                        rdebug_pair_list(L_DBG_LVL_2, request, peap->accept_vps, NULL);
-                       fr_pair_list_move_by_num(handler->request->reply,
+                       fr_pair_list_mcopy_by_num(handler->request->reply,
                                  &handler->request->reply->vps,
                                  &peap->accept_vps, 0, 0, TAG_ANY);
                } else if (peap->use_tunneled_reply) {
index acd2dc7..44433c3 100644 (file)
@@ -173,7 +173,7 @@ static int CC_HINT(nonnull) mod_process(void *type_arg, eap_handler_t *handler)
                        rad_virtual_server(fake);
 
                        /* copy the reply vps back to our reply */
-                       fr_pair_list_move_by_num(request->reply, &request->reply->vps,
+                       fr_pair_list_mcopy_by_num(request->reply, &request->reply->vps,
                                  &fake->reply->vps, 0, 0, TAG_ANY);
 
                        /* reject if virtual server didn't return accept */
index 84de581..c00f7a2 100644 (file)
@@ -253,7 +253,7 @@ static int mod_process(void *arg, eap_handler_t *handler)
                        if (t->accept_vps) {
                                RDEBUG2("Using saved attributes from the original Access-Accept");
                                rdebug_pair_list(L_DBG_LVL_2, request, t->accept_vps, NULL);
-                               fr_pair_list_move_by_num(handler->request->reply,
+                               fr_pair_list_mcopy_by_num(handler->request->reply,
                                           &handler->request->reply->vps,
                                           &t->accept_vps, 0, 0, TAG_ANY);
                        } else if (t->use_tunneled_reply) {
index c53e95c..63d33a8 100644 (file)
@@ -660,7 +660,7 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_handler_t *handler, tls_se
                 *      packet, and we will send EAP-Success.
                 */
                vp = NULL;
-               fr_pair_list_move_by_num(tls_session, &vp, &reply->vps, PW_MSCHAP2_SUCCESS, VENDORPEC_MICROSOFT, TAG_ANY);
+               fr_pair_list_mcopy_by_num(tls_session, &vp, &reply->vps, PW_MSCHAP2_SUCCESS, VENDORPEC_MICROSOFT, TAG_ANY);
                if (vp) {
                        RDEBUG("Got MS-CHAP2-Success, tunneling it to the client in a challenge");
                        rcode = RLM_MODULE_HANDLED;
@@ -671,7 +671,7 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_handler_t *handler, tls_se
                         */
                        if (t->use_tunneled_reply) {
                                rad_assert(!t->accept_vps);
-                               fr_pair_list_move_by_num(t, &t->accept_vps, &reply->vps,
+                               fr_pair_list_mcopy_by_num(t, &t->accept_vps, &reply->vps,
                                          0, 0, TAG_ANY);
                                rad_assert(!reply->vps);
                        }
@@ -686,12 +686,12 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_handler_t *handler, tls_se
                         *      can figure it out, from the non-tunneled
                         *      EAP-Success packet.
                         */
-                       fr_pair_list_move_by_num(tls_session, &vp, &reply->vps, PW_EAP_MESSAGE, 0, TAG_ANY);
+                       fr_pair_list_mcopy_by_num(tls_session, &vp, &reply->vps, PW_EAP_MESSAGE, 0, TAG_ANY);
                        fr_pair_list_free(&vp);
                }
 
                /* move channel binding responses; we need to send them */
-               fr_pair_list_move_by_num(tls_session, &vp, &reply->vps, PW_UKERNA_CHBIND, VENDORPEC_UKERNA, TAG_ANY);
+               fr_pair_list_mcopy_by_num(tls_session, &vp, &reply->vps, PW_UKERNA_CHBIND, VENDORPEC_UKERNA, TAG_ANY);
                if (fr_pair_find_by_num(vp, PW_UKERNA_CHBIND, VENDORPEC_UKERNA, TAG_ANY) != NULL) {
                        t->authenticated = true;
                        /*
@@ -699,7 +699,7 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_handler_t *handler, tls_se
                         */
                        if (t->use_tunneled_reply) {
                                rad_assert(!t->accept_vps);
-                               fr_pair_list_move_by_num(t, &t->accept_vps, &reply->vps,
+                               fr_pair_list_mcopy_by_num(t, &t->accept_vps, &reply->vps,
                                          0, 0, TAG_ANY);
                                rad_assert(!reply->vps);
                        }
@@ -727,7 +727,7 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_handler_t *handler, tls_se
                 */
                if (t->use_tunneled_reply) {
                        fr_pair_delete_by_num(&reply->vps, PW_PROXY_STATE, 0, TAG_ANY);
-                       fr_pair_list_move_by_num(request->reply, &request->reply->vps,
+                       fr_pair_list_mcopy_by_num(request->reply, &request->reply->vps,
                                  &reply->vps, 0, 0, TAG_ANY);
                }
                break;
@@ -753,7 +753,7 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_handler_t *handler, tls_se
                 *      Get rid of the old State, too.
                 */
                fr_pair_list_free(&t->state);
-               fr_pair_list_move_by_num(t, &t->state, &reply->vps, PW_STATE, 0, TAG_ANY);
+               fr_pair_list_mcopy_by_num(t, &t->state, &reply->vps, PW_STATE, 0, TAG_ANY);
 
                /*
                 *      We should really be a bit smarter about this,
@@ -763,7 +763,7 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_handler_t *handler, tls_se
                 *      method works in 99.9% of the situations.
                 */
                vp = NULL;
-               fr_pair_list_move_by_num(t, &vp, &reply->vps, PW_EAP_MESSAGE, 0, TAG_ANY);
+               fr_pair_list_mcopy_by_num(t, &vp, &reply->vps, PW_EAP_MESSAGE, 0, TAG_ANY);
 
                /*
                 *      There MUST be a Reply-Message in the challenge,
@@ -773,10 +773,10 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_handler_t *handler, tls_se
                 *      we MUST create one, with an empty string as
                 *      it's value.
                 */
-               fr_pair_list_move_by_num(t, &vp, &reply->vps, PW_REPLY_MESSAGE, 0, TAG_ANY);
+               fr_pair_list_mcopy_by_num(t, &vp, &reply->vps, PW_REPLY_MESSAGE, 0, TAG_ANY);
 
                /* also move chbind messages, if any */
-               fr_pair_list_move_by_num(t, &vp, &reply->vps, PW_UKERNA_CHBIND, VENDORPEC_UKERNA,
+               fr_pair_list_mcopy_by_num(t, &vp, &reply->vps, PW_UKERNA_CHBIND, VENDORPEC_UKERNA,
                          TAG_ANY);
 
                /*
@@ -1217,7 +1217,7 @@ int eapttls_process(eap_handler_t *handler, tls_session_t *tls_session)
                         *      Tell the original request that it's going
                         *      to be proxied.
                         */
-                       fr_pair_list_move_by_num(request, &request->config,
+                       fr_pair_list_mcopy_by_num(request, &request->config,
                                  &fake->config,
                                  PW_PROXY_TO_REALM, 0, TAG_ANY);