if (!io->s_ctx)
return set_error(cc, ENOMEM, posix_error, "Not enough memory");
+ io->authn_mech.type = AUTH_UNDEF;
io->sock = -1;
return 0;
}
io_handler *io_cc = (io_handler*) io;
if (io_cc->s_ctx) {
- if (io_cc->s_ctx->ssl_io) {
- SSL_free(io_cc->s_ctx->ssl_io);
- io_cc->s_ctx->ssl_io = NULL;
- }
+ if (io_cc->s_ctx->ssl_io)
+ ssl_free(cc, io_cc->s_ctx->ssl_io);
+
+ free (io_cc->s_ctx);
+ io_cc->s_ctx = NULL;
}
- free (io_cc->s_ctx);
- io_cc->s_ctx = NULL;
+
+ return;
}
typedef enum _CANL_AUTH_MECHANISM
{
+ AUTH_UNDEF = -1,
x509 = 0,
KRB5 = 1, /* and others may be added*/
TLS,
canl_err_code (*server_init)
(glb_ctx *, void *);
+ canl_err_code (*free_ctx)
+ (glb_ctx *, void *);
+
canl_err_code (*connect)
(glb_ctx *, void *, io_handler *, struct timeval *, const char *);
struct timeval *timeout);
int ssl_client_init(glb_ctx *cc, io_handler *io);
int ssl_server_init(glb_ctx *cc);
+int ssl_free(glb_ctx *cc, void *ctx);
int ssl_connect(glb_ctx *cc, io_handler *io, struct timeval *timeout, const char * host);
int ssl_accept(glb_ctx *cc, io_handler *io,
struct timeval *timeout);
}
}
+int
+ssl_free(glb_ctx *cc, void *ctx)
+{
+ SSL_free(ctx);
+ return 0;
+}
+
canl_err_code
canl_ctx_set_ssl_cred(canl_ctx cc, char *cert, char *key,
canl_password_callback cb, void *userdata)
ssl_initialize,
ssl_client_init,
ssl_server_init,
+ ssl_free,
ssl_connect,
ssl_accept,
ssl_close,