From cef9bf7b7340b7270eb979294aeb186d741e6318 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Mon, 14 Mar 2011 13:27:39 +0100 Subject: Remove struct rs_attr and all use of it. A new API for attributes will be added once we've decided how to deal with RADIUS packets internally. For now, removing the half baked wrapping seems more sensible than trying to free rs_attr objects and their VALUE_PAIR's. --- lib/packet.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'lib/packet.c') diff --git a/lib/packet.c b/lib/packet.c index 48fb55e..3519c1c 100644 --- a/lib/packet.c +++ b/lib/packet.c @@ -150,7 +150,7 @@ rs_packet_create_authn_request (struct rs_connection *conn, const char *user_name, const char *user_pw) { struct rs_packet *pkt; - struct rs_attr *attr; + VALUE_PAIR *vp = NULL; if (rs_packet_create (conn, pkt_out)) return -1; @@ -159,26 +159,23 @@ rs_packet_create_authn_request (struct rs_connection *conn, if (user_name) { - if (rs_attr_create (conn, &attr, "User-Name", user_name)) - return -1; - rs_packet_add_attr (pkt, attr); - - if (user_pw) - { - if (rs_attr_create (conn, &attr, "User-Password", user_pw)) - return -1; - rs_packet_add_attr (pkt, attr); - } + vp = pairmake ("User-Name", user_name, T_OP_EQ); + if (vp == NULL) + return rs_err_conn_push_fl (conn, RSE_FR, __FILE__, __LINE__, + "pairmake: %s", fr_strerror ()); + pairadd (&pkt->rpkt->vps, vp); } - return RSE_OK; -} + if (user_pw) + { + vp = pairmake ("User-Password", user_pw, T_OP_EQ); + if (vp == NULL) + return rs_err_conn_push_fl (conn, RSE_FR, __FILE__, __LINE__, + "pairmake: %s", fr_strerror ()); + pairadd (&pkt->rpkt->vps, vp); + } -void -rs_packet_add_attr (struct rs_packet *pkt, struct rs_attr *attr) -{ - pairadd (&pkt->rpkt->vps, attr->vp); - attr->pkt = pkt; + return RSE_OK; } struct radius_packet * -- cgit v1.1