Warnings fixed, some checking added;

v0.5.xx
Alexander Vdolainen 10 years ago
parent 734bd0201f
commit 98aa0f5305

@ -21,6 +21,7 @@
#include <uuid/uuid.h> #include <uuid/uuid.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/err.h>
#include <tdata/usrtc.h> #include <tdata/usrtc.h>
#include <sexpr/sexp.h> #include <sexpr/sexp.h>
@ -199,6 +200,7 @@ static int __resolvehost(const char *hostname, char *buf, int buf_len,
buf, buf_len, &hp, &herr); buf, buf_len, &hp, &herr);
if (!hp) return NO_ADDRESS; if (!hp) return NO_ADDRESS;
if(hres) return NO_ADDRESS;
*rhp = hp; *rhp = hp;
@ -273,9 +275,9 @@ static void __wake_up_waiters(conn_t *co, int opcode)
static int __default_auth_set_context(void *cctx, sexp_t *sx) static int __default_auth_set_context(void *cctx, sexp_t *sx)
{ {
conn_t *co = (conn_t *)cctx; conn_t *co = (conn_t *)cctx;
char *val, *var, *tbuf; char *val, *var, *tbuf = NULL;
sexp_t *lsx, *sx_iter, *sx_in; sexp_t *lsx, *sx_iter, *sx_in;
int llen, idx, err; int llen, idx, err = 0;
//co->pctx = malloc(sizeof(perm_ctx_t)); //co->pctx = malloc(sizeof(perm_ctx_t));
@ -319,9 +321,13 @@ static int __default_auth_set_context(void *cctx, sexp_t *sx)
/* ok, now we need to fill security context */ /* ok, now we need to fill security context */
tbuf = malloc(2048); tbuf = malloc(2048);
if(!tbuf) {
err = ENOMEM;
goto __reply;
}
if(conn_sys->secure_check) if(conn_sys->secure_check)
err = conn_sys->secure_check(co); err = conn_sys->secure_check(co);
__reply: __reply:
if(err) { if(err) {
snprintf(tbuf, 2048, "(auth-set-error (%d))", err); snprintf(tbuf, 2048, "(auth-set-error (%d))", err);
@ -338,7 +344,6 @@ __reply:
free(tbuf); free(tbuf);
return err; return err;
} }
static int __default_auth_set_attr(void *cctx, sexp_t *sx) static int __default_auth_set_attr(void *cctx, sexp_t *sx)
@ -1651,7 +1656,7 @@ static char *__generate_uuid(void)
*/ */
static int __verify_certcall(int preverify_ok, X509_STORE_CTX *ctx) static int __verify_certcall(int preverify_ok, X509_STORE_CTX *ctx)
{ {
X509 *cert = X509_STORE_CTX_get_current_cert(ctx); // X509 *cert = X509_STORE_CTX_get_current_cert(ctx);
int err = X509_STORE_CTX_get_error(ctx), depth = X509_STORE_CTX_get_error_depth(ctx); int err = X509_STORE_CTX_get_error(ctx), depth = X509_STORE_CTX_get_error_depth(ctx);
SSL *ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); SSL *ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
conn_t *co = SSL_get_ex_data(ssl, conn_sys->ex_ssldata_index); /* this is a custom data we're set before */ conn_t *co = SSL_get_ex_data(ssl, conn_sys->ex_ssldata_index); /* this is a custom data we're set before */
@ -1871,7 +1876,7 @@ int connection_initiate(conn_t *co, const char *host, int port,
if(!pctx) return EINVAL; if(!pctx) return EINVAL;
memset(co, 0, sizeof(conn_t)); memset(co, 0, sizeof(conn_t));
pth_dqtpoll_init(tpoll, __rpc_callback); pth_dqtpoll_init(tpoll, __rpc_callback);
if(!idx_ch) return ENOMEM; if(!idx_ch) return ENOMEM;
@ -2041,7 +2046,7 @@ int connection_initiate(conn_t *co, const char *host, int port,
int connection_create(conn_t *co, int sck) int connection_create(conn_t *co, int sck)
{ {
int r = 0, sd; int r = 0;
int bytes = 0; int bytes = 0;
char *uuid; char *uuid;
char *buf = NULL; char *buf = NULL;
@ -2307,23 +2312,20 @@ int channel_open(conn_t *co, chnl_t **ch, int type)
char *uuid_; char *uuid_;
sxpayload_t *pl; sxpayload_t *pl;
ulong_t cid; ulong_t cid;
rpc_typed_list_t *rpclist; rpc_typed_list_t *rpclist = NULL;
usrtc_node_t *node; usrtc_node_t *node = NULL;
sxmsg_t *sms; sxmsg_t *sms;
if(!(co->flags & CXCONN_ESTABL)) { if(!(co->flags & CXCONN_ESTABL)) {
return ESXNOCONNECT; return ESXNOCONNECT;
} }
uuid_ = __generate_uuid(); uuid_ = __generate_uuid();
pl = malloc(sizeof(sxpayload_t)); pl = malloc(sizeof(sxpayload_t));
node = usrtc_lookup(co->rpc_list, &type); node = usrtc_lookup(co->rpc_list, &type);
/*
if(!node) { if(node) rpclist = (rpc_typed_list_t *)usrtc_node_getdata(node);
r = EINVAL; printf("fuck\n");
goto __fini_op;
} else rpclist = (rpc_typed_list_t *)usrtc_node_getdata(node);
*/
if(!uuid_) { if(!uuid_) {
if(pl) free(pl); if(pl) free(pl);
return ENOMEM; return ENOMEM;

Loading…
Cancel
Save