glb_ctx *g_cc = cc;
int err = 0;
- if (!g_cc || io == NULL)
+ if (!g_cc)
return EINVAL;
-
+ if (!io)
+ return set_error(g_cc, EINVAL, POSIX_ERROR, "IO handler not"
+ " initialized");
+
/*create io handler*/
new_io_h = (io_handler *) calloc(1, sizeof(*new_io_h));
if (!new_io_h)
return set_error(g_cc, ENOMEM, POSIX_ERROR, "Not enough memory");
/* allocate memory and initialize io content*/
- if ((err = init_io_content(g_cc ,new_io_h))){
+ if ((err = init_io_content(g_cc, new_io_h))){
free(new_io_h);
return err;
}
}
canl_err_code
-canl_io_connect(canl_ctx cc, canl_io_handler io, const char *host, const char *service,
- int port, gss_OID_set auth_mechs,
+canl_io_connect(canl_ctx cc, canl_io_handler io, const char *host,
+ const char *service, int port, gss_OID_set auth_mechs,
int flags, struct timeval *timeout)
{
int err = 0;
return &canl_mech_ssl;
}
-canl_err_code
+canl_err_code
canl_princ_name(canl_ctx cc, const canl_principal princ, char **name)
{
struct _principal_int *p = (struct _principal_int *) princ;
if (cc == NULL)
- return -1;
+ return EINVAL;
if (princ == NULL)
return set_error(cc, EINVAL, POSIX_ERROR, "Principal not initialized");
return err;
}
}
+ if (err && (!m_ctx->cert_key || !m_ctx->cert_key->cert ||
+ !m_ctx->cert_key->key))
+ update_error(cc, EINVAL, POSIX_ERROR, "No key or certificate"
+ " found");
free(user_cert_fn);
user_cert_fn = NULL;
return EINVAL;
if (ssl_ctx == NULL)
- return set_error(cc, EINVAL, POSIX_ERROR, "SSL not initialized");
+ return set_error(cc, EINVAL, POSIX_ERROR, "SSL context not"
+ " initialized");
err = proxy_get_filenames(0, NULL, NULL, &user_proxy_fn,
&user_cert_fn, &user_key_fn);
- if (!err && (!m_ctx->cert_key || !m_ctx->cert_key->cert || !m_ctx->cert_key->key)) {
+ if (!err && (!m_ctx->cert_key || !m_ctx->cert_key->cert ||
+ !m_ctx->cert_key->key)) {
if (user_proxy_fn && !access(user_proxy_fn, R_OK)) {
- err = do_set_ctx_own_cert_file(cc, m_ctx, NULL, NULL, user_proxy_fn);
+ err = do_set_ctx_own_cert_file(cc, m_ctx, NULL, NULL,
+ user_proxy_fn);
if (err)
return err;
}
}
}
+ if (err && (!m_ctx->cert_key || !m_ctx->cert_key->cert ||
+ !m_ctx->cert_key->key))
+ update_error(cc, EINVAL, POSIX_ERROR, "No key or certificate"
+ " found");
+
free(user_cert_fn);
user_cert_fn = NULL;
free(user_key_fn);