Lines 657-683
Link Here
|
657 |
callaurpc(char *host, int prognum, int versnum, int procnum, |
657 |
callaurpc(char *host, int prognum, int versnum, int procnum, |
658 |
xdrproc_t inproc, char *in, xdrproc_t outproc, char *out) |
658 |
xdrproc_t inproc, char *in, xdrproc_t outproc, char *out) |
659 |
{ |
659 |
{ |
660 |
struct sockaddr_in server_addr; |
|
|
661 |
enum clnt_stat clnt_stat; |
660 |
enum clnt_stat clnt_stat; |
662 |
struct hostent *hp; |
|
|
663 |
struct timeval timeout, tottimeout; |
661 |
struct timeval timeout, tottimeout; |
664 |
|
662 |
|
665 |
CLIENT *client = NULL; |
663 |
CLIENT *client; |
666 |
int sock = RPC_ANYSOCK; |
|
|
667 |
|
664 |
|
668 |
if ((hp = gethostbyname(host)) == NULL) |
665 |
/* XXX - If clnt_call fails, we should try other addresses and AF_ */ |
669 |
return ((int) RPC_UNKNOWNHOST); |
666 |
client = clnt_create(host, prognum, versnum, "udp"); |
|
|
667 |
if (client == NULL) |
668 |
return ((int) rpc_createerr.cf_stat); |
669 |
|
670 |
timeout.tv_usec = 0; |
670 |
timeout.tv_usec = 0; |
671 |
timeout.tv_sec = 6; |
671 |
timeout.tv_sec = 6; |
672 |
bcopy(hp->h_addr, &server_addr.sin_addr, |
672 |
(void) CLNT_CONTROL(client, |
673 |
MIN(hp->h_length,(int)sizeof(server_addr.sin_addr))); |
673 |
CLSET_RETRY_TIMEOUT, (char *)(void *)&timeout); |
674 |
server_addr.sin_family = AF_INET; |
|
|
675 |
server_addr.sin_port = 0; |
676 |
|
674 |
|
677 |
if ((client = clntudp_create(&server_addr, prognum, |
|
|
678 |
versnum, timeout, &sock)) == NULL) |
679 |
return ((int) rpc_createerr.cf_stat); |
680 |
|
681 |
client->cl_auth = authunix_create_default(); |
675 |
client->cl_auth = authunix_create_default(); |
682 |
tottimeout.tv_sec = 25; |
676 |
tottimeout.tv_sec = 25; |
683 |
tottimeout.tv_usec = 0; |
677 |
tottimeout.tv_usec = 0; |