clnt_udp.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. /* @(#)clnt_udp.c 2.2 88/08/01 4.0 RPCSRC */
  2. /*
  3. * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  4. * unrestricted use provided that this legend is included on all tape
  5. * media and as a part of the software program in whole or part. Users
  6. * may copy or modify Sun RPC without charge, but are not authorized
  7. * to license or distribute it to anyone else except as part of a product or
  8. * program developed by the user.
  9. *
  10. * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  11. * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  12. * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  13. *
  14. * Sun RPC is provided with no support and without any obligation on the
  15. * part of Sun Microsystems, Inc. to assist in its use, correction,
  16. * modification or enhancement.
  17. *
  18. * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  19. * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  20. * OR ANY PART THEREOF.
  21. *
  22. * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  23. * or profits or other special, indirect and consequential damages, even if
  24. * Sun has been advised of the possibility of such damages.
  25. *
  26. * Sun Microsystems, Inc.
  27. * 2550 Garcia Avenue
  28. * Mountain View, California 94043
  29. */
  30. #if 0
  31. static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
  32. #endif
  33. /*
  34. * clnt_udp.c, Implements a UDP/IP based, client side RPC.
  35. *
  36. * Copyright (C) 1984, Sun Microsystems, Inc.
  37. */
  38. #define __FORCE_GLIBC
  39. #include <features.h>
  40. #include <stdio.h>
  41. #include <unistd.h>
  42. #include <rpc/rpc.h>
  43. #include <rpc/xdr.h>
  44. #include <rpc/clnt.h>
  45. #include <sys/poll.h>
  46. #include <sys/socket.h>
  47. #include <sys/ioctl.h>
  48. #include <netdb.h>
  49. #include <errno.h>
  50. #include <rpc/pmap_clnt.h>
  51. #include <net/if.h>
  52. #ifdef USE_IN_LIBIO
  53. # include <wchar.h>
  54. #endif
  55. #ifdef IP_RECVERR
  56. #include "errqueue.h"
  57. #include <sys/uio.h>
  58. #endif
  59. extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *);
  60. extern u_long _create_xid (void);
  61. /*
  62. * UDP bases client side rpc operations
  63. */
  64. static enum clnt_stat clntudp_call (CLIENT *, u_long, xdrproc_t, caddr_t,
  65. xdrproc_t, caddr_t, struct timeval);
  66. static void clntudp_abort (void);
  67. static void clntudp_geterr (CLIENT *, struct rpc_err *);
  68. static bool_t clntudp_freeres (CLIENT *, xdrproc_t, caddr_t);
  69. static bool_t clntudp_control (CLIENT *, int, char *);
  70. static void clntudp_destroy (CLIENT *);
  71. static struct clnt_ops udp_ops =
  72. {
  73. clntudp_call,
  74. clntudp_abort,
  75. clntudp_geterr,
  76. clntudp_freeres,
  77. clntudp_destroy,
  78. clntudp_control
  79. };
  80. /*
  81. * Private data kept per client handle
  82. */
  83. struct cu_data
  84. {
  85. int cu_sock;
  86. bool_t cu_closeit;
  87. struct sockaddr_in cu_raddr;
  88. int cu_rlen;
  89. struct timeval cu_wait;
  90. struct timeval cu_total;
  91. struct rpc_err cu_error;
  92. XDR cu_outxdrs;
  93. u_int cu_xdrpos;
  94. u_int cu_sendsz;
  95. char *cu_outbuf;
  96. u_int cu_recvsz;
  97. char cu_inbuf[1];
  98. };
  99. /*
  100. * Create a UDP based client handle.
  101. * If *sockp<0, *sockp is set to a newly created UPD socket.
  102. * If raddr->sin_port is 0 a binder on the remote machine
  103. * is consulted for the correct port number.
  104. * NB: It is the clients responsibility to close *sockp.
  105. * NB: The rpch->cl_auth is initialized to null authentication.
  106. * Caller may wish to set this something more useful.
  107. *
  108. * wait is the amount of time used between retransmitting a call if
  109. * no response has been heard; retransmission occurs until the actual
  110. * rpc call times out.
  111. *
  112. * sendsz and recvsz are the maximum allowable packet sizes that can be
  113. * sent and received.
  114. */
  115. CLIENT *
  116. clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
  117. struct timeval wait, int *sockp, u_int sendsz,
  118. u_int recvsz)
  119. {
  120. CLIENT *cl;
  121. struct cu_data *cu = NULL;
  122. struct rpc_msg call_msg;
  123. cl = (CLIENT *) mem_alloc (sizeof (CLIENT));
  124. sendsz = ((sendsz + 3) / 4) * 4;
  125. recvsz = ((recvsz + 3) / 4) * 4;
  126. cu = (struct cu_data *) mem_alloc (sizeof (*cu) + sendsz + recvsz);
  127. if (cl == NULL || cu == NULL)
  128. {
  129. struct rpc_createerr *ce = &get_rpc_createerr ();
  130. #ifdef USE_IN_LIBIO
  131. if (_IO_fwide (stderr, 0) > 0)
  132. (void) __fwprintf (stderr, L"%s",
  133. _("clntudp_create: out of memory\n"));
  134. else
  135. #endif
  136. (void) fputs (_("clntudp_create: out of memory\n"), stderr);
  137. ce->cf_stat = RPC_SYSTEMERROR;
  138. ce->cf_error.re_errno = ENOMEM;
  139. goto fooy;
  140. }
  141. cu->cu_outbuf = &cu->cu_inbuf[recvsz];
  142. if (raddr->sin_port == 0)
  143. {
  144. u_short port;
  145. if ((port =
  146. pmap_getport (raddr, program, version, IPPROTO_UDP)) == 0)
  147. {
  148. goto fooy;
  149. }
  150. raddr->sin_port = htons (port);
  151. }
  152. cl->cl_ops = &udp_ops;
  153. cl->cl_private = (caddr_t) cu;
  154. cu->cu_raddr = *raddr;
  155. cu->cu_rlen = sizeof (cu->cu_raddr);
  156. cu->cu_wait = wait;
  157. cu->cu_total.tv_sec = -1;
  158. cu->cu_total.tv_usec = -1;
  159. cu->cu_sendsz = sendsz;
  160. cu->cu_recvsz = recvsz;
  161. call_msg.rm_xid = _create_xid ();
  162. call_msg.rm_direction = CALL;
  163. call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
  164. call_msg.rm_call.cb_prog = program;
  165. call_msg.rm_call.cb_vers = version;
  166. xdrmem_create (&(cu->cu_outxdrs), cu->cu_outbuf,
  167. sendsz, XDR_ENCODE);
  168. if (!xdr_callhdr (&(cu->cu_outxdrs), &call_msg))
  169. {
  170. goto fooy;
  171. }
  172. cu->cu_xdrpos = XDR_GETPOS (&(cu->cu_outxdrs));
  173. if (*sockp < 0)
  174. {
  175. int dontblock = 1;
  176. *sockp = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
  177. if (*sockp < 0)
  178. {
  179. struct rpc_createerr *ce = &get_rpc_createerr ();
  180. ce->cf_stat = RPC_SYSTEMERROR;
  181. ce->cf_error.re_errno = errno;
  182. goto fooy;
  183. }
  184. /* attempt to bind to prov port */
  185. (void) bindresvport (*sockp, (struct sockaddr_in *) 0);
  186. /* the sockets rpc controls are non-blocking */
  187. (void) ioctl (*sockp, FIONBIO, (char *) &dontblock);
  188. #ifdef IP_RECVERR
  189. {
  190. int on = 1;
  191. setsockopt(*sockp, SOL_IP, IP_RECVERR, &on, sizeof(on));
  192. }
  193. #endif
  194. cu->cu_closeit = TRUE;
  195. }
  196. else
  197. {
  198. cu->cu_closeit = FALSE;
  199. }
  200. cu->cu_sock = *sockp;
  201. cl->cl_auth = authnone_create ();
  202. return cl;
  203. fooy:
  204. if (cu)
  205. mem_free ((caddr_t) cu, sizeof (*cu) + sendsz + recvsz);
  206. if (cl)
  207. mem_free ((caddr_t) cl, sizeof (CLIENT));
  208. return (CLIENT *) NULL;
  209. }
  210. CLIENT *
  211. clntudp_create (raddr, program, version, wait, sockp)
  212. struct sockaddr_in *raddr;
  213. u_long program;
  214. u_long version;
  215. struct timeval wait;
  216. int *sockp;
  217. {
  218. return clntudp_bufcreate (raddr, program, version, wait, sockp,
  219. UDPMSGSIZE, UDPMSGSIZE);
  220. }
  221. static int
  222. is_network_up (int sock)
  223. {
  224. struct ifconf ifc;
  225. char buf[UDPMSGSIZE];
  226. struct ifreq ifreq, *ifr;
  227. int n;
  228. ifc.ifc_len = sizeof (buf);
  229. ifc.ifc_buf = buf;
  230. if (ioctl(sock, SIOCGIFCONF, (char *) &ifc) == 0)
  231. {
  232. ifr = ifc.ifc_req;
  233. for (n = ifc.ifc_len / sizeof (struct ifreq); n > 0; n--, ifr++)
  234. {
  235. ifreq = *ifr;
  236. if (ioctl (sock, SIOCGIFFLAGS, (char *) &ifreq) < 0)
  237. break;
  238. if ((ifreq.ifr_flags & IFF_UP)
  239. && ifr->ifr_addr.sa_family == AF_INET)
  240. return 1;
  241. }
  242. }
  243. return 0;
  244. }
  245. static enum clnt_stat
  246. clntudp_call (cl, proc, xargs, argsp, xresults, resultsp, utimeout)
  247. CLIENT *cl; /* client handle */
  248. u_long proc; /* procedure number */
  249. xdrproc_t xargs; /* xdr routine for args */
  250. caddr_t argsp; /* pointer to args */
  251. xdrproc_t xresults; /* xdr routine for results */
  252. caddr_t resultsp; /* pointer to results */
  253. struct timeval utimeout; /* seconds to wait before giving up */
  254. {
  255. struct cu_data *cu = (struct cu_data *) cl->cl_private;
  256. XDR *xdrs;
  257. int outlen = 0;
  258. int inlen;
  259. socklen_t fromlen;
  260. struct pollfd fd;
  261. int milliseconds = (cu->cu_wait.tv_sec * 1000) +
  262. (cu->cu_wait.tv_usec / 1000);
  263. struct sockaddr_in from;
  264. struct rpc_msg reply_msg;
  265. XDR reply_xdrs;
  266. struct timeval time_waited;
  267. bool_t ok;
  268. int nrefreshes = 2; /* number of times to refresh cred */
  269. struct timeval timeout;
  270. int anyup; /* any network interface up */
  271. if (cu->cu_total.tv_usec == -1)
  272. {
  273. timeout = utimeout; /* use supplied timeout */
  274. }
  275. else
  276. {
  277. timeout = cu->cu_total; /* use default timeout */
  278. }
  279. time_waited.tv_sec = 0;
  280. time_waited.tv_usec = 0;
  281. call_again:
  282. xdrs = &(cu->cu_outxdrs);
  283. if (xargs == NULL)
  284. goto get_reply;
  285. xdrs->x_op = XDR_ENCODE;
  286. XDR_SETPOS (xdrs, cu->cu_xdrpos);
  287. /*
  288. * the transaction is the first thing in the out buffer
  289. */
  290. (*(uint32_t *) (cu->cu_outbuf))++;
  291. if ((!XDR_PUTLONG (xdrs, (long *) &proc)) ||
  292. (!AUTH_MARSHALL (cl->cl_auth, xdrs)) ||
  293. (!(*xargs) (xdrs, argsp)))
  294. return (cu->cu_error.re_status = RPC_CANTENCODEARGS);
  295. outlen = (int) XDR_GETPOS (xdrs);
  296. send_again:
  297. if (sendto (cu->cu_sock, cu->cu_outbuf, outlen, 0,
  298. (struct sockaddr *) &(cu->cu_raddr), cu->cu_rlen)
  299. != outlen)
  300. {
  301. cu->cu_error.re_errno = errno;
  302. return (cu->cu_error.re_status = RPC_CANTSEND);
  303. }
  304. /*
  305. * Hack to provide rpc-based message passing
  306. */
  307. if (timeout.tv_sec == 0 && timeout.tv_usec == 0)
  308. {
  309. return (cu->cu_error.re_status = RPC_TIMEDOUT);
  310. }
  311. get_reply:
  312. /*
  313. * sub-optimal code appears here because we have
  314. * some clock time to spare while the packets are in flight.
  315. * (We assume that this is actually only executed once.)
  316. */
  317. reply_msg.acpted_rply.ar_verf = _null_auth;
  318. reply_msg.acpted_rply.ar_results.where = resultsp;
  319. reply_msg.acpted_rply.ar_results.proc = xresults;
  320. fd.fd = cu->cu_sock;
  321. fd.events = POLLIN;
  322. anyup = 0;
  323. for (;;)
  324. {
  325. switch (poll (&fd, 1, milliseconds))
  326. {
  327. case 0:
  328. if (anyup == 0)
  329. {
  330. anyup = is_network_up (cu->cu_sock);
  331. if (!anyup)
  332. return (cu->cu_error.re_status = RPC_CANTRECV);
  333. }
  334. time_waited.tv_sec += cu->cu_wait.tv_sec;
  335. time_waited.tv_usec += cu->cu_wait.tv_usec;
  336. while (time_waited.tv_usec >= 1000000)
  337. {
  338. time_waited.tv_sec++;
  339. time_waited.tv_usec -= 1000000;
  340. }
  341. if ((time_waited.tv_sec < timeout.tv_sec) ||
  342. ((time_waited.tv_sec == timeout.tv_sec) &&
  343. (time_waited.tv_usec < timeout.tv_usec)))
  344. goto send_again;
  345. return (cu->cu_error.re_status = RPC_TIMEDOUT);
  346. /*
  347. * buggy in other cases because time_waited is not being
  348. * updated.
  349. */
  350. case -1:
  351. if (errno == EINTR)
  352. continue;
  353. cu->cu_error.re_errno = errno;
  354. return (cu->cu_error.re_status = RPC_CANTRECV);
  355. }
  356. #ifdef IP_RECVERR
  357. if (fd.revents & POLLERR)
  358. {
  359. struct msghdr msg;
  360. struct cmsghdr *cmsg;
  361. struct sock_extended_err *e;
  362. struct sockaddr_in err_addr;
  363. struct iovec iov;
  364. char *cbuf = (char *) alloca (outlen + 256);
  365. int ret;
  366. iov.iov_base = cbuf + 256;
  367. iov.iov_len = outlen;
  368. msg.msg_name = (void *) &err_addr;
  369. msg.msg_namelen = sizeof (err_addr);
  370. msg.msg_iov = &iov;
  371. msg.msg_iovlen = 1;
  372. msg.msg_flags = 0;
  373. msg.msg_control = cbuf;
  374. msg.msg_controllen = 256;
  375. ret = recvmsg (cu->cu_sock, &msg, MSG_ERRQUEUE);
  376. if (ret >= 0
  377. && memcmp (cbuf + 256, cu->cu_outbuf, ret) == 0
  378. && (msg.msg_flags & MSG_ERRQUEUE)
  379. && ((msg.msg_namelen == 0
  380. && ret >= 12)
  381. || (msg.msg_namelen == sizeof (err_addr)
  382. && err_addr.sin_family == AF_INET
  383. && memcmp (&err_addr.sin_addr, &cu->cu_raddr.sin_addr,
  384. sizeof (err_addr.sin_addr)) == 0
  385. && err_addr.sin_port == cu->cu_raddr.sin_port)))
  386. for (cmsg = CMSG_FIRSTHDR (&msg); cmsg;
  387. cmsg = CMSG_NXTHDR (&msg, cmsg))
  388. if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR)
  389. {
  390. e = (struct sock_extended_err *) CMSG_DATA(cmsg);
  391. cu->cu_error.re_errno = e->ee_errno;
  392. return (cu->cu_error.re_status = RPC_CANTRECV);
  393. }
  394. }
  395. #endif
  396. do
  397. {
  398. fromlen = sizeof (struct sockaddr);
  399. inlen = recvfrom (cu->cu_sock, cu->cu_inbuf,
  400. (int) cu->cu_recvsz, 0,
  401. (struct sockaddr *) &from, &fromlen);
  402. }
  403. while (inlen < 0 && errno == EINTR);
  404. if (inlen < 0)
  405. {
  406. if (errno == EWOULDBLOCK)
  407. continue;
  408. cu->cu_error.re_errno = errno;
  409. return (cu->cu_error.re_status = RPC_CANTRECV);
  410. }
  411. if (inlen < 4)
  412. continue;
  413. /* see if reply transaction id matches sent id.
  414. Don't do this if we only wait for a replay */
  415. if (xargs != NULL
  416. && (*((u_int32_t *) (cu->cu_inbuf))
  417. != *((u_int32_t *) (cu->cu_outbuf))))
  418. continue;
  419. /* we now assume we have the proper reply */
  420. break;
  421. }
  422. /*
  423. * now decode and validate the response
  424. */
  425. xdrmem_create (&reply_xdrs, cu->cu_inbuf, (u_int) inlen, XDR_DECODE);
  426. ok = xdr_replymsg (&reply_xdrs, &reply_msg);
  427. /* XDR_DESTROY(&reply_xdrs); save a few cycles on noop destroy */
  428. if (ok)
  429. {
  430. _seterr_reply (&reply_msg, &(cu->cu_error));
  431. if (cu->cu_error.re_status == RPC_SUCCESS)
  432. {
  433. if (!AUTH_VALIDATE (cl->cl_auth,
  434. &reply_msg.acpted_rply.ar_verf))
  435. {
  436. cu->cu_error.re_status = RPC_AUTHERROR;
  437. cu->cu_error.re_why = AUTH_INVALIDRESP;
  438. }
  439. if (reply_msg.acpted_rply.ar_verf.oa_base != NULL)
  440. {
  441. xdrs->x_op = XDR_FREE;
  442. (void) xdr_opaque_auth (xdrs,
  443. &(reply_msg.acpted_rply.ar_verf));
  444. }
  445. } /* end successful completion */
  446. else
  447. {
  448. /* maybe our credentials need to be refreshed ... */
  449. if (nrefreshes > 0 && AUTH_REFRESH (cl->cl_auth))
  450. {
  451. nrefreshes--;
  452. goto call_again;
  453. }
  454. } /* end of unsuccessful completion */
  455. } /* end of valid reply message */
  456. else
  457. {
  458. cu->cu_error.re_status = RPC_CANTDECODERES;
  459. }
  460. return cu->cu_error.re_status;
  461. }
  462. static void
  463. clntudp_geterr (CLIENT *cl, struct rpc_err *errp)
  464. {
  465. struct cu_data *cu = (struct cu_data *) cl->cl_private;
  466. *errp = cu->cu_error;
  467. }
  468. static bool_t
  469. clntudp_freeres (CLIENT *cl, xdrproc_t xdr_res, caddr_t res_ptr)
  470. {
  471. struct cu_data *cu = (struct cu_data *) cl->cl_private;
  472. XDR *xdrs = &(cu->cu_outxdrs);
  473. xdrs->x_op = XDR_FREE;
  474. return (*xdr_res) (xdrs, res_ptr);
  475. }
  476. static void
  477. clntudp_abort (void)
  478. {
  479. }
  480. static bool_t
  481. clntudp_control (CLIENT *cl, int request, char *info)
  482. {
  483. struct cu_data *cu = (struct cu_data *) cl->cl_private;
  484. switch (request)
  485. {
  486. case CLSET_FD_CLOSE:
  487. cu->cu_closeit = TRUE;
  488. break;
  489. case CLSET_FD_NCLOSE:
  490. cu->cu_closeit = FALSE;
  491. break;
  492. case CLSET_TIMEOUT:
  493. cu->cu_total = *(struct timeval *) info;
  494. break;
  495. case CLGET_TIMEOUT:
  496. *(struct timeval *) info = cu->cu_total;
  497. break;
  498. case CLSET_RETRY_TIMEOUT:
  499. cu->cu_wait = *(struct timeval *) info;
  500. break;
  501. case CLGET_RETRY_TIMEOUT:
  502. *(struct timeval *) info = cu->cu_wait;
  503. break;
  504. case CLGET_SERVER_ADDR:
  505. *(struct sockaddr_in *) info = cu->cu_raddr;
  506. break;
  507. case CLGET_FD:
  508. *(int *)info = cu->cu_sock;
  509. break;
  510. case CLGET_XID:
  511. /*
  512. * use the knowledge that xid is the
  513. * first element in the call structure *.
  514. * This will get the xid of the PREVIOUS call
  515. */
  516. *(u_long *)info = ntohl(*(u_long *)cu->cu_outbuf);
  517. break;
  518. case CLSET_XID:
  519. /* This will set the xid of the NEXT call */
  520. *(u_long *)cu->cu_outbuf = htonl(*(u_long *)info - 1);
  521. /* decrement by 1 as clntudp_call() increments once */
  522. case CLGET_VERS:
  523. /*
  524. * This RELIES on the information that, in the call body,
  525. * the version number field is the fifth field from the
  526. * begining of the RPC header. MUST be changed if the
  527. * call_struct is changed
  528. */
  529. *(u_long *)info = ntohl(*(u_long *)(cu->cu_outbuf +
  530. 4 * BYTES_PER_XDR_UNIT));
  531. break;
  532. case CLSET_VERS:
  533. *(u_long *)(cu->cu_outbuf + 4 * BYTES_PER_XDR_UNIT)
  534. = htonl(*(u_long *)info);
  535. break;
  536. case CLGET_PROG:
  537. /*
  538. * This RELIES on the information that, in the call body,
  539. * the program number field is the field from the
  540. * begining of the RPC header. MUST be changed if the
  541. * call_struct is changed
  542. */
  543. *(u_long *)info = ntohl(*(u_long *)(cu->cu_outbuf +
  544. 3 * BYTES_PER_XDR_UNIT));
  545. break;
  546. case CLSET_PROG:
  547. *(u_long *)(cu->cu_outbuf + 3 * BYTES_PER_XDR_UNIT)
  548. = htonl(*(u_long *)info);
  549. break;
  550. /* The following are only possible with TI-RPC */
  551. case CLGET_SVC_ADDR:
  552. case CLSET_SVC_ADDR:
  553. case CLSET_PUSH_TIMOD:
  554. case CLSET_POP_TIMOD:
  555. default:
  556. return FALSE;
  557. }
  558. return TRUE;
  559. }
  560. static void
  561. clntudp_destroy (CLIENT *cl)
  562. {
  563. struct cu_data *cu = (struct cu_data *) cl->cl_private;
  564. if (cu->cu_closeit)
  565. {
  566. (void) close (cu->cu_sock);
  567. }
  568. XDR_DESTROY (&(cu->cu_outxdrs));
  569. mem_free ((caddr_t) cu, (sizeof (*cu) + cu->cu_sendsz + cu->cu_recvsz));
  570. mem_free ((caddr_t) cl, sizeof (CLIENT));
  571. }