summaryrefslogtreecommitdiff
path: root/ecp/server
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2024-05-11 15:58:48 +0200
committerUros Majstorovic <majstor@majstor.org>2024-05-11 15:58:48 +0200
commit7a0e44998f426752c58975ae686d8e88aa131195 (patch)
treeb410237e4d9986a06108e9c0beff015a97effc55 /ecp/server
parentb3c62e6acc5761171822f522dc9d784558f9afbe (diff)
added error handler per connection type; improved handlers API and error reporting
Diffstat (limited to 'ecp/server')
-rw-r--r--ecp/server/dir.c4
-rw-r--r--ecp/server/server.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/ecp/server/dir.c b/ecp/server/dir.c
index 03474df..149d14d 100644
--- a/ecp/server/dir.c
+++ b/ecp/server/dir.c
@@ -990,7 +990,7 @@ int dir_init(ECPSocket *sock) {
pthread_rwlock_destroy(&dir_shadow_rwlock);
return ECP_ERR_ALLOC;
}
- ecp_conn_handler_init(handler, dir_handle_msg, NULL, NULL, NULL);
+ ecp_conn_handler_init(handler, NULL, NULL, dir_handle_msg, NULL);
if (is_dir) {
c_handler = malloc(sizeof(ECPConnHandler));
@@ -1005,7 +1005,7 @@ int dir_init(ECPSocket *sock) {
if (c_handler) free(c_handler);
return ECP_ERR_ALLOC;
}
- ecp_conn_handler_init(c_handler, dir_handle_client_msg, NULL, NULL, NULL);
+ ecp_conn_handler_init(c_handler, NULL, NULL, dir_handle_client_msg, NULL);
memset(dir_online, 0, sizeof(DIROnline));
}
diff --git a/ecp/server/server.c b/ecp/server/server.c
index 5493762..223c548 100644
--- a/ecp/server/server.c
+++ b/ecp/server/server.c
@@ -103,7 +103,7 @@ static void conn_free(ECPConnection *conn) {
free(conn);
}
-static int key_check(ECPSocket *sock, ECPConnection *parent, unsigned char ctype, ecp_ecdh_public_t *public) {
+static int conn_auth(ECPSocket *sock, ECPConnection *parent, unsigned char ctype, ecp_ecdh_public_t *public) {
switch (ctype) {
case CTYPE_DIR: {
if (public == NULL) return 0;
@@ -145,7 +145,7 @@ void log_print(int level, char *format, ...) {
int ecp_init(ECPContext *ctx, ECPConnHandler *vconn_handler, ECPConnHandler *vlink_handler) {
int rv;
- rv = ecp_ctx_init(ctx, handle_err, conn_new, conn_free, key_check);
+ rv = ecp_ctx_init(ctx, conn_auth, conn_new, conn_free, handle_err);
if (rv) return rv;
rv = ecp_vconn_handler_init(ctx, vconn_handler);