From 5d1a02eb41025020b8c25ab927baca978fb733a9 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Sun, 10 Oct 2010 11:47:43 +0200 Subject: Rename rs_req_* --> rs_request_. Contributed by Luke Howard. --- lib/include/radsec/request.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/include/radsec') diff --git a/lib/include/radsec/request.h b/lib/include/radsec/request.h index 3827da5..939345e 100644 --- a/lib/include/radsec/request.h +++ b/lib/include/radsec/request.h @@ -2,6 +2,6 @@ struct rs_request; -int rs_req_create(struct rs_connection *conn, struct rs_request **req_out); -void rs_req_destroy(struct rs_request *request); -int rs_req_send(struct rs_request *request, struct rs_packet *req, struct rs_packet **resp); +int rs_request_create(struct rs_connection *conn, struct rs_request **req_out); +void rs_request_destroy(struct rs_request *request); +int rs_request_send(struct rs_request *request, struct rs_packet *req, struct rs_packet **resp); -- cgit v1.1 From 8a676ab2d88022aea68a2a31ac83dfe25d64e175 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Sun, 10 Oct 2010 15:53:37 +0200 Subject: Robustness fixes (and some callback invocation) by Luke Howard. * lib/packet.c (_packet_create): Set packet identity properly. (_do_send): Return an int. (_do_send): Don't ignore rad_encode() errors. (_do_send): Do invoke rad_sign(). (_event_cb): Invoke callbacks. (_event_cb): Honour _do_send() return code. (_read_cb): Check packet (by invoking rad_packet_ok()). (_read_cb): Don't ignore rad_decode() errors. (_read_cb): Invoke callbacks. --- lib/include/radsec/radsec-impl.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/include/radsec') diff --git a/lib/include/radsec/radsec-impl.h b/lib/include/radsec/radsec-impl.h index b46bc47..d2ea095 100644 --- a/lib/include/radsec/radsec-impl.h +++ b/lib/include/radsec/radsec-impl.h @@ -63,9 +63,11 @@ struct rs_connection { enum rs_conn_type type; struct rs_credentials transport_credentials; struct rs_conn_callbacks callbacks; + void *user_data; struct rs_peer *peers; struct rs_peer *active_peer; struct rs_error *err; + int nextid; }; struct rs_packet { -- cgit v1.1 From ff55882798b6c482faec920d30a4ffdc10b306f7 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Mon, 11 Oct 2010 10:41:58 +0200 Subject: Request object implementation and bug fixes by Luke Howard. --- lib/include/radsec/radsec-impl.h | 1 + lib/include/radsec/radsec.h | 2 ++ lib/include/radsec/request-impl.h | 6 ++++++ 3 files changed, 9 insertions(+) (limited to 'lib/include/radsec') diff --git a/lib/include/radsec/radsec-impl.h b/lib/include/radsec/radsec-impl.h index d2ea095..3ce01d0 100644 --- a/lib/include/radsec/radsec-impl.h +++ b/lib/include/radsec/radsec-impl.h @@ -68,6 +68,7 @@ struct rs_connection { struct rs_peer *active_peer; struct rs_error *err; int nextid; + int user_dispatch_flag : 1; /* User does the dispatching. */ }; struct rs_packet { diff --git a/lib/include/radsec/radsec.h b/lib/include/radsec/radsec.h index c8b43bf..db1e1a7 100644 --- a/lib/include/radsec/radsec.h +++ b/lib/include/radsec/radsec.h @@ -17,6 +17,7 @@ enum rs_err_code { RSE_EVENT = 9, RSE_CONNERR = 10, RSE_CONFIG = 11, + RSE_BADAUTH = 12, RSE_SOME_ERROR = 21, }; @@ -118,6 +119,7 @@ int rs_packet_send(struct rs_packet *pkt, void *data); struct radius_packet *rs_packet_frpkt(struct rs_packet *pkt); /* Attribute. */ +/* FIXME: Replace (or complement) with a wrapper for paircreate(). */ int rs_attr_create(struct rs_connection *conn, struct rs_attr **attr, const char *type, const char *val); void rs_attr_destroy(struct rs_attr *attr); diff --git a/lib/include/radsec/request-impl.h b/lib/include/radsec/request-impl.h index 339dfea..4fa0ca9 100644 --- a/lib/include/radsec/request-impl.h +++ b/lib/include/radsec/request-impl.h @@ -7,4 +7,10 @@ struct rs_request struct rs_packet *req; struct rs_packet *resp; struct rs_conn_callbacks saved_cb; + int verified; }; + +#define VENDORPEC_MS 311 /* RFC 2548 */ + +#define PW_MS_MPPE_SEND_KEY 16 +#define PW_MS_MPPE_RECV_KEY 17 -- cgit v1.1 From 06936d1f263c456017e20ea6c74d2756e1e30fcc Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Sat, 9 Oct 2010 11:54:37 +0200 Subject: Have rad_decode() verify responses. --- lib/include/radsec/radsec-impl.h | 1 + lib/include/radsec/radsec.h | 1 + lib/include/radsec/request-impl.h | 6 ------ 3 files changed, 2 insertions(+), 6 deletions(-) (limited to 'lib/include/radsec') diff --git a/lib/include/radsec/radsec-impl.h b/lib/include/radsec/radsec-impl.h index 3ce01d0..6e5ee83 100644 --- a/lib/include/radsec/radsec-impl.h +++ b/lib/include/radsec/radsec-impl.h @@ -76,6 +76,7 @@ struct rs_packet { char hdr_read_flag; uint8_t hdr[4]; RADIUS_PACKET *rpkt; + struct rs_packet *original; }; struct rs_attr { diff --git a/lib/include/radsec/radsec.h b/lib/include/radsec/radsec.h index db1e1a7..dd784cc 100644 --- a/lib/include/radsec/radsec.h +++ b/lib/include/radsec/radsec.h @@ -97,6 +97,7 @@ int rs_conn_select_server(struct rs_connection *conn, const char *name); int rs_conn_get_current_server(struct rs_connection *conn, const char *name, size_t buflen); int rs_conn_receive_packet(struct rs_connection *conn, + struct rs_packet *request, struct rs_packet **pkt_out); int rs_conn_fd(struct rs_connection *conn); diff --git a/lib/include/radsec/request-impl.h b/lib/include/radsec/request-impl.h index 4fa0ca9..339dfea 100644 --- a/lib/include/radsec/request-impl.h +++ b/lib/include/radsec/request-impl.h @@ -7,10 +7,4 @@ struct rs_request struct rs_packet *req; struct rs_packet *resp; struct rs_conn_callbacks saved_cb; - int verified; }; - -#define VENDORPEC_MS 311 /* RFC 2548 */ - -#define PW_MS_MPPE_SEND_KEY 16 -#define PW_MS_MPPE_RECV_KEY 17 -- cgit v1.1