projects
/
radsecproxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't provide bogus info in an error.
[radsecproxy.git]
/
lib
/
event.c
diff --git
a/lib/event.c
b/lib/event.c
index
2229689
..
c625850
100644
(file)
--- a/
lib/event.c
+++ b/
lib/event.c
@@
-1,11
+1,14
@@
-/* Copyright 2011 NORDUnet A/S. All rights reserved.
- See
the file COPYING for licensing information.
*/
+/* Copyright 2011
-2013
NORDUnet A/S. All rights reserved.
+ See
LICENSE for licensing information.
*/
#if defined HAVE_CONFIG_H
#include <config.h>
#endif
#include <assert.h>
#if defined HAVE_CONFIG_H
#include <config.h>
#endif
#include <assert.h>
+#include <string.h>
+#include <errno.h>
+
#include <event2/event.h>
#include <event2/bufferevent.h>
#if defined (RS_ENABLE_TLS)
#include <event2/event.h>
#include <event2/bufferevent.h>
#if defined (RS_ENABLE_TLS)
@@
-219,9
+222,7
@@
event_loopbreak (struct rs_connection *conn)
{
int err = event_base_loopbreak (conn->evb);
if (err < 0)
{
int err = event_base_loopbreak (conn->evb);
if (err < 0)
- rs_err_conn_push_fl (conn, RSE_EVENT, __FILE__, __LINE__,
- "event_base_loopbreak: %s",
- evutil_gai_strerror (err));
+ rs_err_conn_push (conn, RSE_EVENT, "event_base_loopbreak");
return err;
}
return err;
}
@@
-236,10
+237,21
@@
event_on_disconnect (struct rs_connection *conn)
conn->callbacks.disconnected_cb (conn->user_data);
}
conn->callbacks.disconnected_cb (conn->user_data);
}
-void
+/** Internal connect event returning 0 on success or -1 on error. */
+int
event_on_connect (struct rs_connection *conn, struct rs_packet *pkt)
{
assert (!conn->is_connecting);
event_on_connect (struct rs_connection *conn, struct rs_packet *pkt)
{
assert (!conn->is_connecting);
+
+#if defined (RS_ENABLE_TLS)
+ if (conn_type_tls(conn) && !conn_cred_psk(conn))
+ if (tls_verify_cert (conn) != RSE_OK)
+ {
+ rs_debug (("%s: server cert verification failed\n", __func__));
+ return -1;
+ }
+#endif /* RS_ENABLE_TLS */
+
conn->is_connected = 1;
rs_debug (("%s: %p connected\n", __func__, conn->active_peer));
conn->is_connected = 1;
rs_debug (("%s: %p connected\n", __func__, conn->active_peer));
@@
-248,6
+260,8
@@
event_on_connect (struct rs_connection *conn, struct rs_packet *pkt)
if (pkt)
packet_do_send (pkt);
if (pkt)
packet_do_send (pkt);
+
+ return 0;
}
int
}
int