diff options
author | Linus Nordberg <linus@nordu.net> | 2011-03-14 13:27:39 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2011-03-14 13:27:39 +0100 |
commit | cef9bf7b7340b7270eb979294aeb186d741e6318 (patch) | |
tree | d4ada741c1f3cafd679f7147ffa5ca5406d18ebe /lib/packet.c | |
parent | e317a8db7aede1cc9918db51c06de469686c9fa8 (diff) |
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.
Diffstat (limited to 'lib/packet.c')
-rw-r--r-- | lib/packet.c | 33 |
1 files changed, 15 insertions, 18 deletions
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 * |