added inaddr to permission context, to have ability for controlling the connection;

This commit is contained in:
Alexander Vdolainen 2015-03-24 17:41:13 +02:00
parent 1cde3a1eb8
commit 877d8602b4
2 changed files with 11 additions and 3 deletions

@ -1,4 +1,4 @@
/*
/*
* File: connection.h
* Author: vdo
*
@ -63,6 +63,7 @@ typedef struct __perm_context_type {
ulong_t *gids;
int n_gids;
int p_attr;
struct in_addr *addr;
void *priv;
} perm_ctx_t;
@ -230,7 +231,8 @@ int connections_subsystem_setrpclist_function(usrtc_t* (*get_rpc_typed_list_tree
int connection_initiate (conn_t *co, const char *host, int port,
const char *SSL_cert, perm_ctx_t *pctx);
int connection_create(conn_t *co, int sck);
int connection_create_fapi(conn_t *co, int sck, struct in_addr *addr);
#define connection_create(c, s) connection_create_fapi((c), (s), NULL)
int connection_close(conn_t *co);

@ -2288,7 +2288,7 @@ int connection_initiate(conn_t *co, const char *host, int port,
return r;
}
int connection_create(conn_t *co, int sck)
int connection_create_fapi(conn_t *co, int sck, struct in_addr *addr)
{
int r = 0;
int bytes = 0;
@ -2393,6 +2393,12 @@ int connection_create(conn_t *co, int sck)
} /* if success we're ready to use established SSL channel */
BIO_set_nbio(SSL_get_rbio(co->ssl), 1);
/* ok now we need to initialize address */
if(addr) {
co->pctx->addr = malloc(sizeof(struct in_addr));
memcpy(co->pctx->addr, addr, sizeof(struct in_addr));
} else co->pctx->addr = NULL;
/*******************************************/
/*-=Protocol part of connection establish=-*/
/*******************************************/