Deleted Added
full compact
rwalld.c (90868) rwalld.c (95658)
1/*
2 * Copyright (c) 1993 Christopher G. Demetriou
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#ifndef lint
31static const char rcsid[] =
1/*
2 * Copyright (c) 1993 Christopher G. Demetriou
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#ifndef lint
31static const char rcsid[] =
32 "$FreeBSD: head/libexec/rpc.rwalld/rwalld.c 90868 2002-02-18 20:35:27Z mike $";
32 "$FreeBSD: head/libexec/rpc.rwalld/rwalld.c 95658 2002-04-28 15:18:50Z des $";
33#endif /* not lint */
34
35#include <err.h>
36#include <pwd.h>
37#include <signal.h>
38#include <stdio.h>
39#include <stdlib.h>
40#include <string.h>

--- 55 unchanged lines hidden (view full) ---

96
97 if (!from_inetd) {
98 if (!nodaemon)
99 possess();
100
101 (void)pmap_unset(WALLPROG, WALLVERS);
102 if ((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
103 err(1, "socket");
33#endif /* not lint */
34
35#include <err.h>
36#include <pwd.h>
37#include <signal.h>
38#include <stdio.h>
39#include <stdlib.h>
40#include <string.h>

--- 55 unchanged lines hidden (view full) ---

96
97 if (!from_inetd) {
98 if (!nodaemon)
99 possess();
100
101 (void)pmap_unset(WALLPROG, WALLVERS);
102 if ((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
103 err(1, "socket");
104 bzero((char *)&sa, sizeof sa);
104 bzero(&sa, sizeof sa);
105 if (bind(s, (struct sockaddr *)&sa, sizeof sa) < 0)
106 err(1, "bind");
107
108 salen = sizeof sa;
109 if (getsockname(s, (struct sockaddr *)&sa, &salen))
110 err(1, "getsockname");
111
112 pmap_set(WALLPROG, WALLVERS, IPPROTO_UDP, ntohs(sa.sin_port));

--- 66 unchanged lines hidden (view full) ---

179 char *wallproc_wall_1_arg;
180 } argument;
181 char *result;
182 bool_t (*xdr_argument)(), (*xdr_result)();
183 char *(*local)();
184
185 switch (rqstp->rq_proc) {
186 case NULLPROC:
105 if (bind(s, (struct sockaddr *)&sa, sizeof sa) < 0)
106 err(1, "bind");
107
108 salen = sizeof sa;
109 if (getsockname(s, (struct sockaddr *)&sa, &salen))
110 err(1, "getsockname");
111
112 pmap_set(WALLPROG, WALLVERS, IPPROTO_UDP, ntohs(sa.sin_port));

--- 66 unchanged lines hidden (view full) ---

179 char *wallproc_wall_1_arg;
180 } argument;
181 char *result;
182 bool_t (*xdr_argument)(), (*xdr_result)();
183 char *(*local)();
184
185 switch (rqstp->rq_proc) {
186 case NULLPROC:
187 (void)svc_sendreply(transp, xdr_void, (char *)NULL);
187 (void)svc_sendreply(transp, (xdrproc_t)xdr_void, NULL);
188 goto leave;
189
190 case WALLPROC_WALL:
191 xdr_argument = xdr_wrapstring;
192 xdr_result = xdr_void;
193 local = (char *(*)()) wallproc_wall_1_svc;
194 break;
195
196 default:
197 svcerr_noproc(transp);
198 goto leave;
199 }
188 goto leave;
189
190 case WALLPROC_WALL:
191 xdr_argument = xdr_wrapstring;
192 xdr_result = xdr_void;
193 local = (char *(*)()) wallproc_wall_1_svc;
194 break;
195
196 default:
197 svcerr_noproc(transp);
198 goto leave;
199 }
200 bzero((char *)&argument, sizeof(argument));
201 if (!svc_getargs(transp, xdr_argument, (caddr_t)&argument)) {
200 bzero(&argument, sizeof(argument));
201 if (!svc_getargs(transp, (xdrproc_t)xdr_argument, &argument)) {
202 svcerr_decode(transp);
203 goto leave;
204 }
205 result = (*local)(&argument, rqstp);
202 svcerr_decode(transp);
203 goto leave;
204 }
205 result = (*local)(&argument, rqstp);
206 if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
206 if (result != NULL &&
207 !svc_sendreply(transp, (xdrproc_t)xdr_result, result)) {
207 svcerr_systemerr(transp);
208 }
208 svcerr_systemerr(transp);
209 }
209 if (!svc_freeargs(transp, xdr_argument, (caddr_t)&argument)) {
210 if (!svc_freeargs(transp, (xdrproc_t)xdr_argument, &argument)) {
210 syslog(LOG_ERR, "unable to free arguments");
211 exit(1);
212 }
213leave:
214 if (from_inetd)
215 exit(0);
216}
211 syslog(LOG_ERR, "unable to free arguments");
212 exit(1);
213 }
214leave:
215 if (from_inetd)
216 exit(0);
217}