summaryrefslogtreecommitdiff
path: root/lib/packet.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2010-10-10 10:10:11 +0200
committerLinus Nordberg <linus@nordu.net>2010-10-10 10:10:11 +0200
commite8b4f04f2d0e3854347f86155dad764d745f855b (patch)
tree1ae33935ad07e946b97d461c2ebf880cd6a3c895 /lib/packet.c
parentc4a0f86a63acd899dbf29c03100c4735011ceeac (diff)
Don't require username & pw in rs_packet_create_acc_request().
Diffstat (limited to 'lib/packet.c')
-rw-r--r--lib/packet.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/packet.c b/lib/packet.c
index 54bfc01..9ac392d 100644
--- a/lib/packet.c
+++ b/lib/packet.c
@@ -319,14 +319,20 @@ rs_packet_create_acc_request (struct rs_connection *conn,
pkt = *pkt_out;
pkt->rpkt->code = PW_AUTHENTICATION_REQUEST;
- if (rs_attr_create (conn, &attr, "User-Name", user_name))
- return -1;
- rs_packet_add_attr (pkt, attr);
+ if (user_name)
+ {
+ if (rs_attr_create (conn, &attr, "User-Name", user_name))
+ return -1;
+ rs_packet_add_attr (pkt, attr);
+ }
- if (rs_attr_create (conn, &attr, "User-Password", user_pw))
- return -1;
- /* FIXME: need this too? rad_pwencode(user_pw, &pwlen, SECRET, reqauth) */
- rs_packet_add_attr (pkt, attr);
+ if (user_pw)
+ {
+ if (rs_attr_create (conn, &attr, "User-Password", user_pw))
+ return -1;
+ /* FIXME: need this too? rad_pwencode(user_pw, &pwlen, SECRET, reqauth) */
+ rs_packet_add_attr (pkt, attr);
+ }
return RSE_OK;
}
@@ -421,6 +427,7 @@ rs_packet_destroy(struct rs_packet *pkt)
{
if (pkt)
{
+ // TODO: free all attributes
rad_free (&pkt->rpkt);
rs_free (pkt->conn->ctx, pkt);
}