Deleted Added
full compact
yp_access.c (14248) yp_access.c (14262)
1/*
2 * Copyright (c) 1995
3 * Bill Paul <wpaul@ctr.columbia.edu>. 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

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

44#include <errno.h>
45#include <sys/param.h>
46#include "yp_extern.h"
47#ifdef TCP_WRAPPER
48#include "tcpd.h"
49#endif
50
51#ifndef lint
1/*
2 * Copyright (c) 1995
3 * Bill Paul <wpaul@ctr.columbia.edu>. 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

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

44#include <errno.h>
45#include <sys/param.h>
46#include "yp_extern.h"
47#ifdef TCP_WRAPPER
48#include "tcpd.h"
49#endif
50
51#ifndef lint
52static const char rcsid[] = "$Id: yp_access.c,v 1.3 1996/02/24 22:01:41 wpaul Exp $";
52static const char rcsid[] = "$Id: yp_access.c,v 1.1 1996/02/25 19:27:59 wpaul Exp $";
53#endif
54
55extern int debug;
56
53#endif
54
55extern int debug;
56
57char *yp_procs[] = { "ypproc_null" ,
57 /* NIS v1 */
58char *yp_procs[] = { "ypoldproc_null",
59 "ypoldproc_domain",
60 "ypoldproc_domain_nonack",
61 "ypoldproc_match",
62 "ypoldproc_first",
63 "ypoldproc_next",
64 "ypoldproc_poll",
65 "ypoldproc_push",
66 "ypoldproc_get",
67 "badproc1", /* placeholder */
68 "badproc2", /* placeholder */
69 "badproc3", /* placeholder */
70
71 /* NIS v2 */
72 "ypproc_null" ,
58 "ypproc_domain",
59 "ypproc_domain_nonack",
60 "ypproc_match",
61 "ypproc_first",
62 "ypproc_next",
63 "ypproc_xfr",
64 "ypproc_clear",
65 "ypproc_all",
66 "ypproc_master",
67 "ypproc_order",
68 "ypproc_maplist"
69 };
70
73 "ypproc_domain",
74 "ypproc_domain_nonack",
75 "ypproc_match",
76 "ypproc_first",
77 "ypproc_next",
78 "ypproc_xfr",
79 "ypproc_clear",
80 "ypproc_all",
81 "ypproc_master",
82 "ypproc_order",
83 "ypproc_maplist"
84 };
85
86
71#ifdef TCP_WRAPPER
72void load_securenets()
73{
74}
75#else
76struct securenet {
77 struct in_addr net;
78 struct in_addr mask;

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

195 const struct svc_req *rqstp;
196{
197 struct sockaddr_in *rqhost;
198 int status = 0;
199 unsigned long oldaddr;
200#ifndef TCP_WRAPPER
201 struct securenet *tmp;
202#endif
87#ifdef TCP_WRAPPER
88void load_securenets()
89{
90}
91#else
92struct securenet {
93 struct in_addr net;
94 struct in_addr mask;

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

211 const struct svc_req *rqstp;
212{
213 struct sockaddr_in *rqhost;
214 int status = 0;
215 unsigned long oldaddr;
216#ifndef TCP_WRAPPER
217 struct securenet *tmp;
218#endif
219 char *yp_procedure = NULL;
203
220
221 yp_procedure = rqstp->rq_prog == YPPASSWDPROG ? "yppasswdprog_update" :
222 yp_procs[rqstp->rq_proc + (12 * (rqstp->rq_vers - 1))];
223
204 rqhost = svc_getcaller(rqstp->rq_xprt);
205
206 if (debug) {
224 rqhost = svc_getcaller(rqstp->rq_xprt);
225
226 if (debug) {
207 yp_error("Procedure %s called from %s:%d",
208 /* Hack to allow rpc.yppasswdd to use this routine */
209 rqstp->rq_prog == YPPASSWDPROG ?
210 "yppasswdproc_update" :
211 yp_procs[rqstp->rq_proc], inet_ntoa(rqhost->sin_addr),
227 yp_error("Procedure %s called from %s:%d", yp_procedure,
228 inet_ntoa(rqhost->sin_addr),
212 ntohs(rqhost->sin_port));
213 if (map != NULL)
214 yp_error("Client is referencing map \"%s\".", map);
215 }
216
217 /* Check the map name if one was supplied. */
218 if (map != NULL) {
219 if ((strstr(map, "master.passwd.") ||

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

239 }
240#endif
241
242 if (!status) {
243 if (rqhost->sin_addr.s_addr != oldaddr) {
244 yp_error("connect from %s:%d to procedure %s refused",
245 inet_ntoa(rqhost->sin_addr),
246 ntohs(rqhost->sin_port),
229 ntohs(rqhost->sin_port));
230 if (map != NULL)
231 yp_error("Client is referencing map \"%s\".", map);
232 }
233
234 /* Check the map name if one was supplied. */
235 if (map != NULL) {
236 if ((strstr(map, "master.passwd.") ||

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

256 }
257#endif
258
259 if (!status) {
260 if (rqhost->sin_addr.s_addr != oldaddr) {
261 yp_error("connect from %s:%d to procedure %s refused",
262 inet_ntoa(rqhost->sin_addr),
263 ntohs(rqhost->sin_port),
247 rqstp->rq_prog == YPPASSWDPROG ?
248 "yppasswdproc_update" :
249 yp_procs[rqstp->rq_proc]);
264 yp_procedure);
250 oldaddr = rqhost->sin_addr.s_addr;
251 }
252 return(1);
253 }
254 return(0);
255
256}
257

--- 18 unchanged lines hidden ---
265 oldaddr = rqhost->sin_addr.s_addr;
266 }
267 return(1);
268 }
269 return(0);
270
271}
272

--- 18 unchanged lines hidden ---