--- libaitrpc/src/cli.c 2015/01/27 23:50:46 1.24.2.1 +++ libaitrpc/src/cli.c 2015/01/28 00:06:22 1.24.2.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: cli.c,v 1.24.2.1 2015/01/27 23:50:46 misho Exp $ +* $Id: cli.c,v 1.24.2.2 2015/01/28 00:06:22 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -161,6 +161,11 @@ rpc_cli_openClient(u_char InstID, int netBuf, const ch rpc_cli_t *cli = NULL; sockaddr_t sa = E_SOCKADDR_INIT; + if (proto < 0 || proto > SOCK_RAW) { + rpc_SetErr(EINVAL, "Invalid parameters can`t open RPC client"); + return NULL; + } + if (!e_gethostbyname(csHost, Port, &sa)) return NULL; if (!Port) @@ -195,7 +200,8 @@ rpc_cli_openClient(u_char InstID, int netBuf, const ch AIT_SET_BUFSIZ(&cli->cli_buf, 0, netBuf); /* connect to RPC server */ - cli->cli_sock = socket(cli->cli_sa.sa.sa_family, cli->cli_id, 0); + cli->cli_sock = socket(cli->cli_sa.sa.sa_family, cli->cli_id, + cli->cli_id == SOCK_RAW ? IPPROTO_ERPC : 0); if (cli->cli_sock == -1) { LOGERR; goto err;