1995-12-16 20:54:17 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1995
|
|
|
|
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Bill Paul.
|
|
|
|
* 4. Neither the name of the author nor the names of any co-contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2003-05-03 21:06:42 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
1997-10-29 07:25:05 +00:00
|
|
|
|
1995-12-16 20:54:17 +00:00
|
|
|
#include "yp.h"
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
#include "yp_extern.h"
|
1995-12-16 20:54:17 +00:00
|
|
|
#include <dirent.h>
|
1997-10-29 07:25:05 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include <stdlib.h>
|
1995-12-16 20:54:17 +00:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
1995-12-23 21:35:35 +00:00
|
|
|
#include <rpc/rpc.h>
|
1995-12-16 20:54:17 +00:00
|
|
|
|
|
|
|
int children = 0;
|
1997-08-10 20:37:48 +00:00
|
|
|
|
|
|
|
#define MASTER_STRING "YP_MASTER_NAME"
|
|
|
|
#define MASTER_SZ sizeof(MASTER_STRING) - 1
|
|
|
|
#define ORDER_STRING "YP_LAST_MODIFIED"
|
|
|
|
#define ORDER_SZ sizeof(ORDER_STRING) - 1
|
Performance enhancements (I hope) and new stuff:
yp_dblookup.c:
- Implement database handle caching. What this means is that instead
of opening and closing map databases for each request, we open a
database and save the handle (and, if requested, the key index)
in an array. This saves a bit of overhead on things like repeated
YPPROC_NEXT calls, such as you'd get from getpwent(). Normally,
each YPPROC_NEXT would require open()ing the database, seeking
to the location supplied by the caller (which is time consuming with
hash databases as the R_CURSOR flag doesn't work), reading the
data, close()ing the database and then shipping the data off to
the caller. The system call overhead is prohibitive, especially
with very large maps. By caching the handle to an open database,
we elimitate at least the open()/close() system calls, as well
as the associated DB setup and tear-down operations, for a large
percentage of the time. This improves performance substantially at
the cost of consuming a little more memory than before.
Note that all the caching support is surrounded by #ifdef DB_CACHE
so that this same source module can still be used by other programs
that don't need it.
- Make yp_open_db() call yp_validdomain(). Doing it here saves cycles
when caching is enabled since a hit on the map cache list by
definition means that the domain being referenced is valid.
- Also make yp_open_db() check for exhaustion of file descriptors,
just in case.
yp_server.c:
- Reorganize things a little to take advantage of the database
handle caching. Add a call to yp_flush_all() in ypproc_clear_2_svc().
- Remove calls to yp_validdomain() from some of the service procedures.
yp_validdomain() is called inside yp_open_db() now, so procedures that
call into the database package don't need to use yp_validdomain()
themselves.
- Fix a bogosity in ypproc_maplist_2_svc(): don't summarily initiallize
the result.maps pointer to NULL. This causes yp_maplist_free()
to fail and leaks memory.
- Make ypproc_master_2_svc() copy the string it gets from the database
package into a private static buffer before trying to NUL terminate it.
This is necessary with the DB handle caching: stuffing a NUL into the
data returned by DB package will goof it up internally.
yp_main.c:
- Stuff for DB handle caching: call yp_init_dbs() to clear the
handle array and add call to yp_flush_all() to the SIGHUP
signal handler.
Makefile.yp:
- Reorganize to deal with database caching. yp_mkdb(8) can now be used
to send a YPPROC_CLEAR signal to ypserv(8). Call it after each map
is created to refresh ypserv's cache.
- Add support for mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
- Make default location for the netgroups source file be /var/yp/netgroup
instead of /etc/netgroup.
mkaliases:
- New file: script to generate mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
Makefile:
- Install Makefile.yp as /var/yp/Makefile.dist and link it to
/var/yp/Makefile only if /var/yp/Makefile doesn't already exist.
Suggested by Peter Wemm.
- Install new mkaliases script in /usr/libexec along with mknetid.
- Use somewhat saner approach to generating rpcgen-dependent files
as suggested by Garrett Wollman.
1996-04-28 04:38:52 +00:00
|
|
|
|
2002-02-06 15:26:07 +00:00
|
|
|
static pid_t
|
|
|
|
yp_fork(void)
|
1999-04-29 20:24:00 +00:00
|
|
|
{
|
|
|
|
if (yp_pid != getpid()) {
|
|
|
|
yp_error("child %d trying to fork!", getpid());
|
|
|
|
errno = EEXIST;
|
|
|
|
return(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(fork());
|
|
|
|
}
|
|
|
|
|
1996-02-26 02:34:27 +00:00
|
|
|
/*
|
|
|
|
* NIS v2 support. This is where most of the action happens.
|
|
|
|
*/
|
|
|
|
|
1995-12-16 20:54:17 +00:00
|
|
|
void *
|
|
|
|
ypproc_null_2_svc(void *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static char * result;
|
|
|
|
static char rval = 0;
|
|
|
|
|
1996-10-24 18:58:26 +00:00
|
|
|
#ifdef DB_CACHE
|
|
|
|
if (yp_access(NULL, NULL, (struct svc_req *)rqstp))
|
|
|
|
#else
|
1995-12-16 20:54:17 +00:00
|
|
|
if (yp_access(NULL, (struct svc_req *)rqstp))
|
1996-10-24 18:58:26 +00:00
|
|
|
#endif
|
1995-12-16 20:54:17 +00:00
|
|
|
return(NULL);
|
|
|
|
|
|
|
|
result = &rval;
|
|
|
|
|
|
|
|
return((void *) &result);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool_t *
|
|
|
|
ypproc_domain_2_svc(domainname *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static bool_t result;
|
|
|
|
|
1996-10-24 18:58:26 +00:00
|
|
|
#ifdef DB_CACHE
|
|
|
|
if (yp_access(NULL, NULL, (struct svc_req *)rqstp)) {
|
|
|
|
#else
|
1995-12-16 20:54:17 +00:00
|
|
|
if (yp_access(NULL, (struct svc_req *)rqstp)) {
|
1996-10-24 18:58:26 +00:00
|
|
|
#endif
|
1995-12-16 20:54:17 +00:00
|
|
|
result = FALSE;
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argp == NULL || yp_validdomain(*argp))
|
|
|
|
result = FALSE;
|
|
|
|
else
|
|
|
|
result = TRUE;
|
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool_t *
|
|
|
|
ypproc_domain_nonack_2_svc(domainname *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static bool_t result;
|
|
|
|
|
1996-10-24 18:58:26 +00:00
|
|
|
#ifdef DB_CACHE
|
|
|
|
if (yp_access(NULL, NULL, (struct svc_req *)rqstp))
|
|
|
|
#else
|
1995-12-16 20:54:17 +00:00
|
|
|
if (yp_access(NULL, (struct svc_req *)rqstp))
|
1996-10-24 18:58:26 +00:00
|
|
|
#endif
|
1995-12-16 20:54:17 +00:00
|
|
|
return (NULL);
|
|
|
|
|
|
|
|
if (argp == NULL || yp_validdomain(*argp))
|
|
|
|
return (NULL);
|
|
|
|
else
|
|
|
|
result = TRUE;
|
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
ypresp_val *
|
|
|
|
ypproc_match_2_svc(ypreq_key *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresp_val result;
|
|
|
|
|
1996-03-01 03:49:47 +00:00
|
|
|
result.val.valdat_val = "";
|
|
|
|
result.val.valdat_len = 0;
|
1996-10-24 18:58:26 +00:00
|
|
|
|
|
|
|
#ifdef DB_CACHE
|
|
|
|
if (yp_access(argp->map, argp->domain, (struct svc_req *)rqstp)) {
|
|
|
|
#else
|
1995-12-16 20:54:17 +00:00
|
|
|
if (yp_access(argp->map, (struct svc_req *)rqstp)) {
|
1996-10-24 18:58:26 +00:00
|
|
|
#endif
|
1995-12-16 20:54:17 +00:00
|
|
|
result.stat = YP_YPERR;
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argp->domain == NULL || argp->map == NULL) {
|
|
|
|
result.stat = YP_BADARGS;
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
Fix a bug in the database handle caching. This has to do with the way the
underlying database code works. When dealing with first/next queries, you
have the notion of a database 'cursor,' which is essentially a file pointer
for the database. To select the first entry, you do a fetch with the
R_FIRST flag set, then you can use the R_NEXT flag to enumerate the other
entries in the database. Unfortunately, doing a direct fetch with no flag
does _not_ set the 'cursor,' so you can't do a direct fetch and then
enumerate the table from there.
The bug is that cached handles generated as the result of a YPPROC_MATCH
were being treated as though they were the same as handles generated by
a YPPROC_FIRST, which is not the case. The manifestation is that if you
do a 'ypmatch first-key-in-map map' followed by a yp_first()/yp_next()
pair, the yp_first() and yp_next() both return the first key in the
table, which makes the entry appear to be duplicated.
A couple smaller things since I'm here:
- yp_main.c and yp_error.c both have a global 'int debug' in them.
For some reason, our cc/ld doesn't flag this as a multiply defined
symbol even though it should. Removed the declaration from yp_main.c;
we want the one in yp_error.c.
- The Makefile wasn't installing ypinit in the right place.
1998-02-11 19:15:32 +00:00
|
|
|
if (yp_select_map(argp->map, argp->domain, NULL, 1) != YP_TRUE) {
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
result.stat = yp_errno;
|
|
|
|
return(&result);
|
1995-12-16 20:54:17 +00:00
|
|
|
}
|
|
|
|
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
result.stat = yp_getbykey(&argp->key, &result.val);
|
|
|
|
|
1995-12-16 20:54:17 +00:00
|
|
|
/*
|
|
|
|
* Do DNS lookups for hosts maps if database lookup failed.
|
|
|
|
*/
|
|
|
|
|
1996-10-24 18:58:26 +00:00
|
|
|
#ifdef DB_CACHE
|
2006-06-09 14:01:07 +00:00
|
|
|
if (do_dns && result.stat != YP_TRUE &&
|
1996-10-24 18:58:26 +00:00
|
|
|
(yp_testflag(argp->map, argp->domain, YP_INTERDOMAIN) ||
|
2006-06-09 14:01:07 +00:00
|
|
|
(strstr(argp->map, "hosts") || strstr(argp->map, "ipnodes")))) {
|
1996-10-24 18:58:26 +00:00
|
|
|
#else
|
2005-05-02 09:34:07 +00:00
|
|
|
if (do_dns && result.stat != YP_TRUE &&
|
2005-05-02 09:42:59 +00:00
|
|
|
(strstr(argp->map, "hosts") || strstr(argp->map, "ipnodes"))) {
|
1996-10-24 18:58:26 +00:00
|
|
|
#endif
|
1997-07-21 17:39:39 +00:00
|
|
|
char nbuf[YPMAXRECORD];
|
2002-02-06 13:30:31 +00:00
|
|
|
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
/* NUL terminate! NUL terminate!! NUL TERMINATE!!! */
|
1997-07-21 17:39:39 +00:00
|
|
|
bcopy(argp->key.keydat_val, nbuf, argp->key.keydat_len);
|
|
|
|
nbuf[argp->key.keydat_len] = '\0';
|
1995-12-16 20:54:17 +00:00
|
|
|
|
|
|
|
if (debug)
|
1997-10-29 07:25:05 +00:00
|
|
|
yp_error("doing DNS lookup of %s", nbuf);
|
1995-12-16 20:54:17 +00:00
|
|
|
|
|
|
|
if (!strcmp(argp->map, "hosts.byname"))
|
2005-05-02 09:34:07 +00:00
|
|
|
result.stat = yp_async_lookup_name(rqstp, nbuf,
|
|
|
|
AF_INET);
|
1995-12-16 20:54:17 +00:00
|
|
|
else if (!strcmp(argp->map, "hosts.byaddr"))
|
2005-05-02 09:34:07 +00:00
|
|
|
result.stat = yp_async_lookup_addr(rqstp, nbuf,
|
|
|
|
AF_INET);
|
|
|
|
else if (!strcmp(argp->map, "ipnodes.byname"))
|
|
|
|
result.stat = yp_async_lookup_name(rqstp, nbuf,
|
|
|
|
AF_INET6);
|
|
|
|
else if (!strcmp(argp->map, "ipnodes.byaddr"))
|
|
|
|
result.stat = yp_async_lookup_addr(rqstp, nbuf,
|
|
|
|
AF_INET6);
|
1995-12-16 20:54:17 +00:00
|
|
|
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
if (result.stat == YP_TRUE)
|
|
|
|
return(NULL);
|
1995-12-16 20:54:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
ypresp_key_val *
|
|
|
|
ypproc_first_2_svc(ypreq_nokey *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresp_key_val result;
|
|
|
|
|
1996-03-01 03:49:47 +00:00
|
|
|
result.val.valdat_val = result.key.keydat_val = "";
|
|
|
|
result.val.valdat_len = result.key.keydat_len = 0;
|
1996-10-24 18:58:26 +00:00
|
|
|
|
|
|
|
#ifdef DB_CACHE
|
|
|
|
if (yp_access(argp->map, argp->domain, (struct svc_req *)rqstp)) {
|
|
|
|
#else
|
1995-12-16 20:54:17 +00:00
|
|
|
if (yp_access(argp->map, (struct svc_req *)rqstp)) {
|
1996-10-24 18:58:26 +00:00
|
|
|
#endif
|
1995-12-16 20:54:17 +00:00
|
|
|
result.stat = YP_YPERR;
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argp->domain == NULL) {
|
|
|
|
result.stat = YP_BADARGS;
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
Fix a bug in the database handle caching. This has to do with the way the
underlying database code works. When dealing with first/next queries, you
have the notion of a database 'cursor,' which is essentially a file pointer
for the database. To select the first entry, you do a fetch with the
R_FIRST flag set, then you can use the R_NEXT flag to enumerate the other
entries in the database. Unfortunately, doing a direct fetch with no flag
does _not_ set the 'cursor,' so you can't do a direct fetch and then
enumerate the table from there.
The bug is that cached handles generated as the result of a YPPROC_MATCH
were being treated as though they were the same as handles generated by
a YPPROC_FIRST, which is not the case. The manifestation is that if you
do a 'ypmatch first-key-in-map map' followed by a yp_first()/yp_next()
pair, the yp_first() and yp_next() both return the first key in the
table, which makes the entry appear to be duplicated.
A couple smaller things since I'm here:
- yp_main.c and yp_error.c both have a global 'int debug' in them.
For some reason, our cc/ld doesn't flag this as a multiply defined
symbol even though it should. Removed the declaration from yp_main.c;
we want the one in yp_error.c.
- The Makefile wasn't installing ypinit in the right place.
1998-02-11 19:15:32 +00:00
|
|
|
if (yp_select_map(argp->map, argp->domain, NULL, 0) != YP_TRUE) {
|
1995-12-16 20:54:17 +00:00
|
|
|
result.stat = yp_errno;
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
result.stat = yp_firstbykey(&result.key, &result.val);
|
1995-12-16 20:54:17 +00:00
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
ypresp_key_val *
|
|
|
|
ypproc_next_2_svc(ypreq_key *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresp_key_val result;
|
|
|
|
|
1996-03-01 03:49:47 +00:00
|
|
|
result.val.valdat_val = result.key.keydat_val = "";
|
|
|
|
result.val.valdat_len = result.key.keydat_len = 0;
|
Performance enhancements (I hope) and new stuff:
yp_dblookup.c:
- Implement database handle caching. What this means is that instead
of opening and closing map databases for each request, we open a
database and save the handle (and, if requested, the key index)
in an array. This saves a bit of overhead on things like repeated
YPPROC_NEXT calls, such as you'd get from getpwent(). Normally,
each YPPROC_NEXT would require open()ing the database, seeking
to the location supplied by the caller (which is time consuming with
hash databases as the R_CURSOR flag doesn't work), reading the
data, close()ing the database and then shipping the data off to
the caller. The system call overhead is prohibitive, especially
with very large maps. By caching the handle to an open database,
we elimitate at least the open()/close() system calls, as well
as the associated DB setup and tear-down operations, for a large
percentage of the time. This improves performance substantially at
the cost of consuming a little more memory than before.
Note that all the caching support is surrounded by #ifdef DB_CACHE
so that this same source module can still be used by other programs
that don't need it.
- Make yp_open_db() call yp_validdomain(). Doing it here saves cycles
when caching is enabled since a hit on the map cache list by
definition means that the domain being referenced is valid.
- Also make yp_open_db() check for exhaustion of file descriptors,
just in case.
yp_server.c:
- Reorganize things a little to take advantage of the database
handle caching. Add a call to yp_flush_all() in ypproc_clear_2_svc().
- Remove calls to yp_validdomain() from some of the service procedures.
yp_validdomain() is called inside yp_open_db() now, so procedures that
call into the database package don't need to use yp_validdomain()
themselves.
- Fix a bogosity in ypproc_maplist_2_svc(): don't summarily initiallize
the result.maps pointer to NULL. This causes yp_maplist_free()
to fail and leaks memory.
- Make ypproc_master_2_svc() copy the string it gets from the database
package into a private static buffer before trying to NUL terminate it.
This is necessary with the DB handle caching: stuffing a NUL into the
data returned by DB package will goof it up internally.
yp_main.c:
- Stuff for DB handle caching: call yp_init_dbs() to clear the
handle array and add call to yp_flush_all() to the SIGHUP
signal handler.
Makefile.yp:
- Reorganize to deal with database caching. yp_mkdb(8) can now be used
to send a YPPROC_CLEAR signal to ypserv(8). Call it after each map
is created to refresh ypserv's cache.
- Add support for mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
- Make default location for the netgroups source file be /var/yp/netgroup
instead of /etc/netgroup.
mkaliases:
- New file: script to generate mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
Makefile:
- Install Makefile.yp as /var/yp/Makefile.dist and link it to
/var/yp/Makefile only if /var/yp/Makefile doesn't already exist.
Suggested by Peter Wemm.
- Install new mkaliases script in /usr/libexec along with mknetid.
- Use somewhat saner approach to generating rpcgen-dependent files
as suggested by Garrett Wollman.
1996-04-28 04:38:52 +00:00
|
|
|
|
1996-10-24 18:58:26 +00:00
|
|
|
#ifdef DB_CACHE
|
|
|
|
if (yp_access(argp->map, argp->domain, (struct svc_req *)rqstp)) {
|
|
|
|
#else
|
1995-12-16 20:54:17 +00:00
|
|
|
if (yp_access(argp->map, (struct svc_req *)rqstp)) {
|
1996-10-24 18:58:26 +00:00
|
|
|
#endif
|
1995-12-16 20:54:17 +00:00
|
|
|
result.stat = YP_YPERR;
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argp->domain == NULL || argp->map == NULL) {
|
|
|
|
result.stat = YP_BADARGS;
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
if (yp_select_map(argp->map, argp->domain, &argp->key, 0) != YP_TRUE) {
|
1995-12-16 20:54:17 +00:00
|
|
|
result.stat = yp_errno;
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
result.key.keydat_len = argp->key.keydat_len;
|
|
|
|
result.key.keydat_val = argp->key.keydat_val;
|
|
|
|
|
|
|
|
result.stat = yp_nextbykey(&result.key, &result.val);
|
1995-12-16 20:54:17 +00:00
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
2002-02-06 15:26:07 +00:00
|
|
|
static void
|
|
|
|
ypxfr_callback(ypxfrstat rval, struct sockaddr_in *addr, unsigned int transid,
|
|
|
|
unsigned int prognum, unsigned long port)
|
1995-12-23 21:35:35 +00:00
|
|
|
{
|
|
|
|
CLIENT *clnt;
|
|
|
|
int sock = RPC_ANYSOCK;
|
|
|
|
struct timeval timeout;
|
|
|
|
yppushresp_xfr ypxfr_resp;
|
1996-01-10 16:07:39 +00:00
|
|
|
struct rpc_err err;
|
1995-12-23 21:35:35 +00:00
|
|
|
|
1996-01-10 16:07:39 +00:00
|
|
|
timeout.tv_sec = 5;
|
1995-12-23 21:35:35 +00:00
|
|
|
timeout.tv_usec = 0;
|
|
|
|
addr->sin_port = htons(port);
|
|
|
|
|
1996-10-23 15:49:22 +00:00
|
|
|
if ((clnt = clntudp_create(addr,prognum,1,timeout,&sock)) == NULL) {
|
|
|
|
yp_error("%s: %s", inet_ntoa(addr->sin_addr),
|
1996-10-24 18:58:26 +00:00
|
|
|
clnt_spcreateerror("failed to establish callback handle"));
|
1996-10-23 15:49:22 +00:00
|
|
|
return;
|
|
|
|
}
|
1995-12-23 21:35:35 +00:00
|
|
|
|
|
|
|
ypxfr_resp.status = rval;
|
|
|
|
ypxfr_resp.transid = transid;
|
|
|
|
|
1996-01-10 16:07:39 +00:00
|
|
|
/* Turn the timeout off -- we don't want to block. */
|
|
|
|
timeout.tv_sec = 0;
|
2002-04-28 15:18:50 +00:00
|
|
|
if (clnt_control(clnt, CLSET_TIMEOUT, &timeout) == FALSE)
|
1996-01-10 16:07:39 +00:00
|
|
|
yp_error("failed to set timeout on ypproc_xfr callback");
|
|
|
|
|
|
|
|
if (yppushproc_xfrresp_1(&ypxfr_resp, clnt) == NULL) {
|
|
|
|
clnt_geterr(clnt, &err);
|
|
|
|
if (err.re_status != RPC_SUCCESS &&
|
|
|
|
err.re_status != RPC_TIMEDOUT)
|
|
|
|
yp_error("%s", clnt_sperror(clnt,
|
|
|
|
"ypxfr callback failed"));
|
|
|
|
}
|
1995-12-23 21:35:35 +00:00
|
|
|
|
|
|
|
clnt_destroy(clnt);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Performance enhancements (I hope) and new stuff:
yp_dblookup.c:
- Implement database handle caching. What this means is that instead
of opening and closing map databases for each request, we open a
database and save the handle (and, if requested, the key index)
in an array. This saves a bit of overhead on things like repeated
YPPROC_NEXT calls, such as you'd get from getpwent(). Normally,
each YPPROC_NEXT would require open()ing the database, seeking
to the location supplied by the caller (which is time consuming with
hash databases as the R_CURSOR flag doesn't work), reading the
data, close()ing the database and then shipping the data off to
the caller. The system call overhead is prohibitive, especially
with very large maps. By caching the handle to an open database,
we elimitate at least the open()/close() system calls, as well
as the associated DB setup and tear-down operations, for a large
percentage of the time. This improves performance substantially at
the cost of consuming a little more memory than before.
Note that all the caching support is surrounded by #ifdef DB_CACHE
so that this same source module can still be used by other programs
that don't need it.
- Make yp_open_db() call yp_validdomain(). Doing it here saves cycles
when caching is enabled since a hit on the map cache list by
definition means that the domain being referenced is valid.
- Also make yp_open_db() check for exhaustion of file descriptors,
just in case.
yp_server.c:
- Reorganize things a little to take advantage of the database
handle caching. Add a call to yp_flush_all() in ypproc_clear_2_svc().
- Remove calls to yp_validdomain() from some of the service procedures.
yp_validdomain() is called inside yp_open_db() now, so procedures that
call into the database package don't need to use yp_validdomain()
themselves.
- Fix a bogosity in ypproc_maplist_2_svc(): don't summarily initiallize
the result.maps pointer to NULL. This causes yp_maplist_free()
to fail and leaks memory.
- Make ypproc_master_2_svc() copy the string it gets from the database
package into a private static buffer before trying to NUL terminate it.
This is necessary with the DB handle caching: stuffing a NUL into the
data returned by DB package will goof it up internally.
yp_main.c:
- Stuff for DB handle caching: call yp_init_dbs() to clear the
handle array and add call to yp_flush_all() to the SIGHUP
signal handler.
Makefile.yp:
- Reorganize to deal with database caching. yp_mkdb(8) can now be used
to send a YPPROC_CLEAR signal to ypserv(8). Call it after each map
is created to refresh ypserv's cache.
- Add support for mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
- Make default location for the netgroups source file be /var/yp/netgroup
instead of /etc/netgroup.
mkaliases:
- New file: script to generate mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
Makefile:
- Install Makefile.yp as /var/yp/Makefile.dist and link it to
/var/yp/Makefile only if /var/yp/Makefile doesn't already exist.
Suggested by Peter Wemm.
- Install new mkaliases script in /usr/libexec along with mknetid.
- Use somewhat saner approach to generating rpcgen-dependent files
as suggested by Garrett Wollman.
1996-04-28 04:38:52 +00:00
|
|
|
#define YPXFR_RETURN(CODE) \
|
|
|
|
/* Order is important: send regular RPC reply, then callback */ \
|
|
|
|
result.xfrstat = CODE; \
|
2002-04-28 15:18:50 +00:00
|
|
|
svc_sendreply(rqstp->rq_xprt, (xdrproc_t)xdr_ypresp_xfr, &result); \
|
Performance enhancements (I hope) and new stuff:
yp_dblookup.c:
- Implement database handle caching. What this means is that instead
of opening and closing map databases for each request, we open a
database and save the handle (and, if requested, the key index)
in an array. This saves a bit of overhead on things like repeated
YPPROC_NEXT calls, such as you'd get from getpwent(). Normally,
each YPPROC_NEXT would require open()ing the database, seeking
to the location supplied by the caller (which is time consuming with
hash databases as the R_CURSOR flag doesn't work), reading the
data, close()ing the database and then shipping the data off to
the caller. The system call overhead is prohibitive, especially
with very large maps. By caching the handle to an open database,
we elimitate at least the open()/close() system calls, as well
as the associated DB setup and tear-down operations, for a large
percentage of the time. This improves performance substantially at
the cost of consuming a little more memory than before.
Note that all the caching support is surrounded by #ifdef DB_CACHE
so that this same source module can still be used by other programs
that don't need it.
- Make yp_open_db() call yp_validdomain(). Doing it here saves cycles
when caching is enabled since a hit on the map cache list by
definition means that the domain being referenced is valid.
- Also make yp_open_db() check for exhaustion of file descriptors,
just in case.
yp_server.c:
- Reorganize things a little to take advantage of the database
handle caching. Add a call to yp_flush_all() in ypproc_clear_2_svc().
- Remove calls to yp_validdomain() from some of the service procedures.
yp_validdomain() is called inside yp_open_db() now, so procedures that
call into the database package don't need to use yp_validdomain()
themselves.
- Fix a bogosity in ypproc_maplist_2_svc(): don't summarily initiallize
the result.maps pointer to NULL. This causes yp_maplist_free()
to fail and leaks memory.
- Make ypproc_master_2_svc() copy the string it gets from the database
package into a private static buffer before trying to NUL terminate it.
This is necessary with the DB handle caching: stuffing a NUL into the
data returned by DB package will goof it up internally.
yp_main.c:
- Stuff for DB handle caching: call yp_init_dbs() to clear the
handle array and add call to yp_flush_all() to the SIGHUP
signal handler.
Makefile.yp:
- Reorganize to deal with database caching. yp_mkdb(8) can now be used
to send a YPPROC_CLEAR signal to ypserv(8). Call it after each map
is created to refresh ypserv's cache.
- Add support for mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
- Make default location for the netgroups source file be /var/yp/netgroup
instead of /etc/netgroup.
mkaliases:
- New file: script to generate mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
Makefile:
- Install Makefile.yp as /var/yp/Makefile.dist and link it to
/var/yp/Makefile only if /var/yp/Makefile doesn't already exist.
Suggested by Peter Wemm.
- Install new mkaliases script in /usr/libexec along with mknetid.
- Use somewhat saner approach to generating rpcgen-dependent files
as suggested by Garrett Wollman.
1996-04-28 04:38:52 +00:00
|
|
|
ypxfr_callback(CODE,rqhost,argp->transid, \
|
|
|
|
argp->prog,argp->port); \
|
|
|
|
return(NULL);
|
|
|
|
|
1995-12-16 20:54:17 +00:00
|
|
|
ypresp_xfr *
|
|
|
|
ypproc_xfr_2_svc(ypreq_xfr *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresp_xfr result;
|
1995-12-23 21:35:35 +00:00
|
|
|
struct sockaddr_in *rqhost;
|
1997-04-10 14:12:51 +00:00
|
|
|
ypresp_master *mres;
|
|
|
|
ypreq_nokey mreq;
|
1995-12-16 20:54:17 +00:00
|
|
|
|
1996-01-10 16:07:39 +00:00
|
|
|
result.transid = argp->transid;
|
|
|
|
rqhost = svc_getcaller(rqstp->rq_xprt);
|
|
|
|
|
1996-10-24 18:58:26 +00:00
|
|
|
#ifdef DB_CACHE
|
|
|
|
if (yp_access(argp->map_parms.map,
|
|
|
|
argp->map_parms.domain, (struct svc_req *)rqstp)) {
|
|
|
|
#else
|
1995-12-16 20:54:17 +00:00
|
|
|
if (yp_access(argp->map_parms.map, (struct svc_req *)rqstp)) {
|
1996-10-24 18:58:26 +00:00
|
|
|
#endif
|
1997-04-10 14:12:51 +00:00
|
|
|
YPXFR_RETURN(YPXFR_REFUSED)
|
1995-12-16 20:54:17 +00:00
|
|
|
}
|
|
|
|
|
1997-04-10 14:12:51 +00:00
|
|
|
|
1995-12-16 20:54:17 +00:00
|
|
|
if (argp->map_parms.domain == NULL) {
|
1997-04-10 14:12:51 +00:00
|
|
|
YPXFR_RETURN(YPXFR_BADARGS)
|
1995-12-16 20:54:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (yp_validdomain(argp->map_parms.domain)) {
|
1997-04-10 14:12:51 +00:00
|
|
|
YPXFR_RETURN(YPXFR_NODOM)
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Determine the master host ourselves. The caller may
|
|
|
|
* be up to no good. This has the side effect of verifying
|
|
|
|
* that the requested map and domain actually exist.
|
|
|
|
*/
|
|
|
|
|
|
|
|
mreq.domain = argp->map_parms.domain;
|
|
|
|
mreq.map = argp->map_parms.map;
|
|
|
|
|
|
|
|
mres = ypproc_master_2_svc(&mreq, rqstp);
|
|
|
|
|
|
|
|
if (mres->stat != YP_TRUE) {
|
|
|
|
yp_error("couldn't find master for map %s@%s",
|
|
|
|
argp->map_parms.map,
|
|
|
|
argp->map_parms.domain);
|
|
|
|
yp_error("host at %s (%s) may be pulling my leg",
|
|
|
|
argp->map_parms.peer,
|
|
|
|
inet_ntoa(rqhost->sin_addr));
|
|
|
|
YPXFR_RETURN(YPXFR_REFUSED)
|
1995-12-16 20:54:17 +00:00
|
|
|
}
|
|
|
|
|
2002-02-06 13:30:31 +00:00
|
|
|
switch (yp_fork()) {
|
1995-12-16 20:54:17 +00:00
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
char g[11], t[11], p[11];
|
|
|
|
char ypxfr_command[MAXPATHLEN + 2];
|
|
|
|
|
2001-07-23 09:22:21 +00:00
|
|
|
snprintf (ypxfr_command, sizeof(ypxfr_command), "%sypxfr", _PATH_LIBEXEC);
|
|
|
|
snprintf (t, sizeof(t), "%u", argp->transid);
|
|
|
|
snprintf (g, sizeof(g), "%u", argp->prog);
|
|
|
|
snprintf (p, sizeof(p), "%u", argp->port);
|
1997-02-06 05:28:52 +00:00
|
|
|
if (debug) {
|
1995-12-23 21:35:35 +00:00
|
|
|
close(0); close(1); close(2);
|
1997-02-06 05:28:52 +00:00
|
|
|
}
|
1995-12-23 21:35:35 +00:00
|
|
|
if (strcmp(yp_dir, _PATH_YP)) {
|
1996-03-01 03:49:47 +00:00
|
|
|
execl(ypxfr_command, "ypxfr",
|
|
|
|
"-d", argp->map_parms.domain,
|
1997-04-10 14:12:51 +00:00
|
|
|
"-h", mres->peer,
|
1996-03-01 03:49:47 +00:00
|
|
|
"-p", yp_dir, "-C", t,
|
|
|
|
g, inet_ntoa(rqhost->sin_addr),
|
|
|
|
p, argp->map_parms.map,
|
2002-04-28 15:18:50 +00:00
|
|
|
NULL);
|
1995-12-23 21:35:35 +00:00
|
|
|
} else {
|
1996-03-01 03:49:47 +00:00
|
|
|
execl(ypxfr_command, "ypxfr",
|
|
|
|
"-d", argp->map_parms.domain,
|
1997-04-10 14:12:51 +00:00
|
|
|
"-h", mres->peer,
|
1996-03-01 03:49:47 +00:00
|
|
|
"-C", t,
|
|
|
|
g, inet_ntoa(rqhost->sin_addr),
|
|
|
|
p, argp->map_parms.map,
|
2002-04-28 15:18:50 +00:00
|
|
|
NULL);
|
1995-12-23 21:35:35 +00:00
|
|
|
}
|
Performance enhancements (I hope) and new stuff:
yp_dblookup.c:
- Implement database handle caching. What this means is that instead
of opening and closing map databases for each request, we open a
database and save the handle (and, if requested, the key index)
in an array. This saves a bit of overhead on things like repeated
YPPROC_NEXT calls, such as you'd get from getpwent(). Normally,
each YPPROC_NEXT would require open()ing the database, seeking
to the location supplied by the caller (which is time consuming with
hash databases as the R_CURSOR flag doesn't work), reading the
data, close()ing the database and then shipping the data off to
the caller. The system call overhead is prohibitive, especially
with very large maps. By caching the handle to an open database,
we elimitate at least the open()/close() system calls, as well
as the associated DB setup and tear-down operations, for a large
percentage of the time. This improves performance substantially at
the cost of consuming a little more memory than before.
Note that all the caching support is surrounded by #ifdef DB_CACHE
so that this same source module can still be used by other programs
that don't need it.
- Make yp_open_db() call yp_validdomain(). Doing it here saves cycles
when caching is enabled since a hit on the map cache list by
definition means that the domain being referenced is valid.
- Also make yp_open_db() check for exhaustion of file descriptors,
just in case.
yp_server.c:
- Reorganize things a little to take advantage of the database
handle caching. Add a call to yp_flush_all() in ypproc_clear_2_svc().
- Remove calls to yp_validdomain() from some of the service procedures.
yp_validdomain() is called inside yp_open_db() now, so procedures that
call into the database package don't need to use yp_validdomain()
themselves.
- Fix a bogosity in ypproc_maplist_2_svc(): don't summarily initiallize
the result.maps pointer to NULL. This causes yp_maplist_free()
to fail and leaks memory.
- Make ypproc_master_2_svc() copy the string it gets from the database
package into a private static buffer before trying to NUL terminate it.
This is necessary with the DB handle caching: stuffing a NUL into the
data returned by DB package will goof it up internally.
yp_main.c:
- Stuff for DB handle caching: call yp_init_dbs() to clear the
handle array and add call to yp_flush_all() to the SIGHUP
signal handler.
Makefile.yp:
- Reorganize to deal with database caching. yp_mkdb(8) can now be used
to send a YPPROC_CLEAR signal to ypserv(8). Call it after each map
is created to refresh ypserv's cache.
- Add support for mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
- Make default location for the netgroups source file be /var/yp/netgroup
instead of /etc/netgroup.
mkaliases:
- New file: script to generate mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
Makefile:
- Install Makefile.yp as /var/yp/Makefile.dist and link it to
/var/yp/Makefile only if /var/yp/Makefile doesn't already exist.
Suggested by Peter Wemm.
- Install new mkaliases script in /usr/libexec along with mknetid.
- Use somewhat saner approach to generating rpcgen-dependent files
as suggested by Garrett Wollman.
1996-04-28 04:38:52 +00:00
|
|
|
yp_error("ypxfr execl(%s): %s", ypxfr_command, strerror(errno));
|
1997-04-10 14:12:51 +00:00
|
|
|
YPXFR_RETURN(YPXFR_XFRERR)
|
1999-04-30 16:44:17 +00:00
|
|
|
/*
|
|
|
|
* Just to safe, prevent PR #10970 from biting us in
|
|
|
|
* the unlikely case that execing ypxfr fails. We don't
|
|
|
|
* want to have any child processes spawned from this
|
|
|
|
* child process.
|
|
|
|
*/
|
|
|
|
_exit(0);
|
1995-12-23 21:35:35 +00:00
|
|
|
break;
|
1995-12-16 20:54:17 +00:00
|
|
|
}
|
|
|
|
case -1:
|
|
|
|
yp_error("ypxfr fork(): %s", strerror(errno));
|
1997-04-10 14:12:51 +00:00
|
|
|
YPXFR_RETURN(YPXFR_XFRERR)
|
1995-12-16 20:54:17 +00:00
|
|
|
break;
|
|
|
|
default:
|
1996-01-10 16:07:39 +00:00
|
|
|
result.xfrstat = YPXFR_SUCC;
|
1995-12-23 21:35:35 +00:00
|
|
|
children++;
|
1995-12-16 20:54:17 +00:00
|
|
|
break;
|
|
|
|
}
|
1996-01-10 16:07:39 +00:00
|
|
|
|
|
|
|
return (&result);
|
1995-12-16 20:54:17 +00:00
|
|
|
}
|
Performance enhancements (I hope) and new stuff:
yp_dblookup.c:
- Implement database handle caching. What this means is that instead
of opening and closing map databases for each request, we open a
database and save the handle (and, if requested, the key index)
in an array. This saves a bit of overhead on things like repeated
YPPROC_NEXT calls, such as you'd get from getpwent(). Normally,
each YPPROC_NEXT would require open()ing the database, seeking
to the location supplied by the caller (which is time consuming with
hash databases as the R_CURSOR flag doesn't work), reading the
data, close()ing the database and then shipping the data off to
the caller. The system call overhead is prohibitive, especially
with very large maps. By caching the handle to an open database,
we elimitate at least the open()/close() system calls, as well
as the associated DB setup and tear-down operations, for a large
percentage of the time. This improves performance substantially at
the cost of consuming a little more memory than before.
Note that all the caching support is surrounded by #ifdef DB_CACHE
so that this same source module can still be used by other programs
that don't need it.
- Make yp_open_db() call yp_validdomain(). Doing it here saves cycles
when caching is enabled since a hit on the map cache list by
definition means that the domain being referenced is valid.
- Also make yp_open_db() check for exhaustion of file descriptors,
just in case.
yp_server.c:
- Reorganize things a little to take advantage of the database
handle caching. Add a call to yp_flush_all() in ypproc_clear_2_svc().
- Remove calls to yp_validdomain() from some of the service procedures.
yp_validdomain() is called inside yp_open_db() now, so procedures that
call into the database package don't need to use yp_validdomain()
themselves.
- Fix a bogosity in ypproc_maplist_2_svc(): don't summarily initiallize
the result.maps pointer to NULL. This causes yp_maplist_free()
to fail and leaks memory.
- Make ypproc_master_2_svc() copy the string it gets from the database
package into a private static buffer before trying to NUL terminate it.
This is necessary with the DB handle caching: stuffing a NUL into the
data returned by DB package will goof it up internally.
yp_main.c:
- Stuff for DB handle caching: call yp_init_dbs() to clear the
handle array and add call to yp_flush_all() to the SIGHUP
signal handler.
Makefile.yp:
- Reorganize to deal with database caching. yp_mkdb(8) can now be used
to send a YPPROC_CLEAR signal to ypserv(8). Call it after each map
is created to refresh ypserv's cache.
- Add support for mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
- Make default location for the netgroups source file be /var/yp/netgroup
instead of /etc/netgroup.
mkaliases:
- New file: script to generate mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
Makefile:
- Install Makefile.yp as /var/yp/Makefile.dist and link it to
/var/yp/Makefile only if /var/yp/Makefile doesn't already exist.
Suggested by Peter Wemm.
- Install new mkaliases script in /usr/libexec along with mknetid.
- Use somewhat saner approach to generating rpcgen-dependent files
as suggested by Garrett Wollman.
1996-04-28 04:38:52 +00:00
|
|
|
#undef YPXFR_RETURN
|
1995-12-16 20:54:17 +00:00
|
|
|
|
|
|
|
void *
|
|
|
|
ypproc_clear_2_svc(void *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static char * result;
|
|
|
|
static char rval = 0;
|
|
|
|
|
1996-10-24 18:58:26 +00:00
|
|
|
#ifdef DB_CACHE
|
|
|
|
if (yp_access(NULL, NULL, (struct svc_req *)rqstp))
|
|
|
|
#else
|
1995-12-16 20:54:17 +00:00
|
|
|
if (yp_access(NULL, (struct svc_req *)rqstp))
|
1996-10-24 18:58:26 +00:00
|
|
|
#endif
|
1995-12-16 20:54:17 +00:00
|
|
|
return (NULL);
|
Performance enhancements (I hope) and new stuff:
yp_dblookup.c:
- Implement database handle caching. What this means is that instead
of opening and closing map databases for each request, we open a
database and save the handle (and, if requested, the key index)
in an array. This saves a bit of overhead on things like repeated
YPPROC_NEXT calls, such as you'd get from getpwent(). Normally,
each YPPROC_NEXT would require open()ing the database, seeking
to the location supplied by the caller (which is time consuming with
hash databases as the R_CURSOR flag doesn't work), reading the
data, close()ing the database and then shipping the data off to
the caller. The system call overhead is prohibitive, especially
with very large maps. By caching the handle to an open database,
we elimitate at least the open()/close() system calls, as well
as the associated DB setup and tear-down operations, for a large
percentage of the time. This improves performance substantially at
the cost of consuming a little more memory than before.
Note that all the caching support is surrounded by #ifdef DB_CACHE
so that this same source module can still be used by other programs
that don't need it.
- Make yp_open_db() call yp_validdomain(). Doing it here saves cycles
when caching is enabled since a hit on the map cache list by
definition means that the domain being referenced is valid.
- Also make yp_open_db() check for exhaustion of file descriptors,
just in case.
yp_server.c:
- Reorganize things a little to take advantage of the database
handle caching. Add a call to yp_flush_all() in ypproc_clear_2_svc().
- Remove calls to yp_validdomain() from some of the service procedures.
yp_validdomain() is called inside yp_open_db() now, so procedures that
call into the database package don't need to use yp_validdomain()
themselves.
- Fix a bogosity in ypproc_maplist_2_svc(): don't summarily initiallize
the result.maps pointer to NULL. This causes yp_maplist_free()
to fail and leaks memory.
- Make ypproc_master_2_svc() copy the string it gets from the database
package into a private static buffer before trying to NUL terminate it.
This is necessary with the DB handle caching: stuffing a NUL into the
data returned by DB package will goof it up internally.
yp_main.c:
- Stuff for DB handle caching: call yp_init_dbs() to clear the
handle array and add call to yp_flush_all() to the SIGHUP
signal handler.
Makefile.yp:
- Reorganize to deal with database caching. yp_mkdb(8) can now be used
to send a YPPROC_CLEAR signal to ypserv(8). Call it after each map
is created to refresh ypserv's cache.
- Add support for mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
- Make default location for the netgroups source file be /var/yp/netgroup
instead of /etc/netgroup.
mkaliases:
- New file: script to generate mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
Makefile:
- Install Makefile.yp as /var/yp/Makefile.dist and link it to
/var/yp/Makefile only if /var/yp/Makefile doesn't already exist.
Suggested by Peter Wemm.
- Install new mkaliases script in /usr/libexec along with mknetid.
- Use somewhat saner approach to generating rpcgen-dependent files
as suggested by Garrett Wollman.
1996-04-28 04:38:52 +00:00
|
|
|
#ifdef DB_CACHE
|
|
|
|
/* clear out the database cache */
|
|
|
|
yp_flush_all();
|
|
|
|
#endif
|
1996-02-24 22:01:48 +00:00
|
|
|
/* Re-read the securenets database for the hell of it. */
|
|
|
|
load_securenets();
|
|
|
|
|
1995-12-16 20:54:17 +00:00
|
|
|
result = &rval;
|
|
|
|
return((void *) &result);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For ypproc_all, we have to send a stream of ypresp_all structures
|
|
|
|
* via TCP, but the XDR filter generated from the yp.x protocol
|
|
|
|
* definition file only serializes one such structure. This means that
|
|
|
|
* to send the whole stream, you need a wrapper which feeds all the
|
|
|
|
* records into the underlying XDR routine until it hits an 'EOF.'
|
|
|
|
* But to use the wrapper, you have to violate the boundaries between
|
|
|
|
* RPC layers by calling svc_sendreply() directly from the ypproc_all
|
|
|
|
* service routine instead of letting the RPC dispatcher do it.
|
|
|
|
*
|
|
|
|
* Bleah.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
1996-12-03 02:37:39 +00:00
|
|
|
* Custom XDR routine for serialzing results of ypproc_all: keep
|
|
|
|
* reading from the database and spew until we run out of records
|
|
|
|
* or encounter an error.
|
1995-12-16 20:54:17 +00:00
|
|
|
*/
|
|
|
|
static bool_t
|
|
|
|
xdr_my_ypresp_all(register XDR *xdrs, ypresp_all *objp)
|
|
|
|
{
|
1996-12-03 02:37:39 +00:00
|
|
|
while (1) {
|
|
|
|
/* Get a record. */
|
|
|
|
if ((objp->ypresp_all_u.val.stat =
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
yp_nextbykey(&objp->ypresp_all_u.val.key,
|
|
|
|
&objp->ypresp_all_u.val.val)) == YP_TRUE) {
|
1996-12-03 02:37:39 +00:00
|
|
|
objp->more = TRUE;
|
|
|
|
} else {
|
|
|
|
objp->more = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Serialize. */
|
|
|
|
if (!xdr_ypresp_all(xdrs, objp))
|
|
|
|
return(FALSE);
|
|
|
|
if (objp->more == FALSE)
|
|
|
|
return(TRUE);
|
|
|
|
}
|
1995-12-16 20:54:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ypresp_all *
|
|
|
|
ypproc_all_2_svc(ypreq_nokey *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresp_all result;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set this here so that the client will be forced to make
|
|
|
|
* at least one attempt to read from us even if all we're
|
|
|
|
* doing is returning an error.
|
|
|
|
*/
|
|
|
|
result.more = TRUE;
|
1996-03-01 03:49:47 +00:00
|
|
|
result.ypresp_all_u.val.key.keydat_len = 0;
|
|
|
|
result.ypresp_all_u.val.key.keydat_val = "";
|
1995-12-16 20:54:17 +00:00
|
|
|
|
1996-10-24 18:58:26 +00:00
|
|
|
#ifdef DB_CACHE
|
|
|
|
if (yp_access(argp->map, argp->domain, (struct svc_req *)rqstp)) {
|
|
|
|
#else
|
1995-12-16 20:54:17 +00:00
|
|
|
if (yp_access(argp->map, (struct svc_req *)rqstp)) {
|
1996-10-24 18:58:26 +00:00
|
|
|
#endif
|
1995-12-16 20:54:17 +00:00
|
|
|
result.ypresp_all_u.val.stat = YP_YPERR;
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argp->domain == NULL || argp->map == NULL) {
|
|
|
|
result.ypresp_all_u.val.stat = YP_BADARGS;
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
1997-01-07 06:07:21 +00:00
|
|
|
/*
|
|
|
|
* XXX If we hit the child limit, fail the request.
|
|
|
|
* If we don't, and the map is large, we could block for
|
|
|
|
* a long time in the parent.
|
|
|
|
*/
|
|
|
|
if (children >= MAX_CHILDREN) {
|
|
|
|
result.ypresp_all_u.val.stat = YP_YPERR;
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
1996-12-03 02:37:39 +00:00
|
|
|
/*
|
|
|
|
* The ypproc_all procedure can take a while to complete.
|
|
|
|
* Best to handle it in a subprocess so the parent doesn't
|
|
|
|
* block. (Is there a better way to do this? Maybe with
|
|
|
|
* async socket I/O?)
|
|
|
|
*/
|
1999-02-10 16:16:14 +00:00
|
|
|
if (!debug) {
|
2002-02-06 13:30:31 +00:00
|
|
|
switch (yp_fork()) {
|
1999-02-10 16:16:14 +00:00
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
case -1:
|
|
|
|
yp_error("ypall fork(): %s", strerror(errno));
|
|
|
|
result.ypresp_all_u.val.stat = YP_YPERR;
|
|
|
|
return(&result);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
children++;
|
|
|
|
return (NULL);
|
|
|
|
break;
|
|
|
|
}
|
1996-12-03 02:37:39 +00:00
|
|
|
}
|
|
|
|
|
1999-04-30 16:59:48 +00:00
|
|
|
/*
|
|
|
|
* Fix for PR #10971: don't let the child ypserv share
|
|
|
|
* DB handles with the parent process.
|
|
|
|
*/
|
|
|
|
#ifdef DB_CACHE
|
|
|
|
yp_flush_all();
|
|
|
|
#endif
|
|
|
|
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
if (yp_select_map(argp->map, argp->domain,
|
|
|
|
&result.ypresp_all_u.val.key, 0) != YP_TRUE) {
|
1995-12-16 20:54:17 +00:00
|
|
|
result.ypresp_all_u.val.stat = yp_errno;
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Kick off the actual data transfer. */
|
2002-04-28 15:18:50 +00:00
|
|
|
svc_sendreply(rqstp->rq_xprt, (xdrproc_t)xdr_my_ypresp_all, &result);
|
1996-12-03 02:37:39 +00:00
|
|
|
|
1995-12-16 20:54:17 +00:00
|
|
|
/*
|
1999-04-30 16:44:17 +00:00
|
|
|
* Proper fix for PR #10970: exit here so that we don't risk
|
|
|
|
* having a child spawned from this sub-process.
|
1995-12-16 20:54:17 +00:00
|
|
|
*/
|
2009-12-04 14:12:37 +00:00
|
|
|
if (!debug)
|
|
|
|
_exit(0);
|
|
|
|
|
|
|
|
return &result;
|
1995-12-16 20:54:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ypresp_master *
|
|
|
|
ypproc_master_2_svc(ypreq_nokey *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresp_master result;
|
Performance enhancements (I hope) and new stuff:
yp_dblookup.c:
- Implement database handle caching. What this means is that instead
of opening and closing map databases for each request, we open a
database and save the handle (and, if requested, the key index)
in an array. This saves a bit of overhead on things like repeated
YPPROC_NEXT calls, such as you'd get from getpwent(). Normally,
each YPPROC_NEXT would require open()ing the database, seeking
to the location supplied by the caller (which is time consuming with
hash databases as the R_CURSOR flag doesn't work), reading the
data, close()ing the database and then shipping the data off to
the caller. The system call overhead is prohibitive, especially
with very large maps. By caching the handle to an open database,
we elimitate at least the open()/close() system calls, as well
as the associated DB setup and tear-down operations, for a large
percentage of the time. This improves performance substantially at
the cost of consuming a little more memory than before.
Note that all the caching support is surrounded by #ifdef DB_CACHE
so that this same source module can still be used by other programs
that don't need it.
- Make yp_open_db() call yp_validdomain(). Doing it here saves cycles
when caching is enabled since a hit on the map cache list by
definition means that the domain being referenced is valid.
- Also make yp_open_db() check for exhaustion of file descriptors,
just in case.
yp_server.c:
- Reorganize things a little to take advantage of the database
handle caching. Add a call to yp_flush_all() in ypproc_clear_2_svc().
- Remove calls to yp_validdomain() from some of the service procedures.
yp_validdomain() is called inside yp_open_db() now, so procedures that
call into the database package don't need to use yp_validdomain()
themselves.
- Fix a bogosity in ypproc_maplist_2_svc(): don't summarily initiallize
the result.maps pointer to NULL. This causes yp_maplist_free()
to fail and leaks memory.
- Make ypproc_master_2_svc() copy the string it gets from the database
package into a private static buffer before trying to NUL terminate it.
This is necessary with the DB handle caching: stuffing a NUL into the
data returned by DB package will goof it up internally.
yp_main.c:
- Stuff for DB handle caching: call yp_init_dbs() to clear the
handle array and add call to yp_flush_all() to the SIGHUP
signal handler.
Makefile.yp:
- Reorganize to deal with database caching. yp_mkdb(8) can now be used
to send a YPPROC_CLEAR signal to ypserv(8). Call it after each map
is created to refresh ypserv's cache.
- Add support for mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
- Make default location for the netgroups source file be /var/yp/netgroup
instead of /etc/netgroup.
mkaliases:
- New file: script to generate mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
Makefile:
- Install Makefile.yp as /var/yp/Makefile.dist and link it to
/var/yp/Makefile only if /var/yp/Makefile doesn't already exist.
Suggested by Peter Wemm.
- Install new mkaliases script in /usr/libexec along with mknetid.
- Use somewhat saner approach to generating rpcgen-dependent files
as suggested by Garrett Wollman.
1996-04-28 04:38:52 +00:00
|
|
|
static char ypvalbuf[YPMAXRECORD];
|
1997-08-10 20:37:48 +00:00
|
|
|
keydat key = { MASTER_SZ, MASTER_STRING };
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
valdat val;
|
1995-12-16 20:54:17 +00:00
|
|
|
|
1996-02-29 23:10:38 +00:00
|
|
|
result.peer = "";
|
|
|
|
|
1996-10-24 18:58:26 +00:00
|
|
|
#ifdef DB_CACHE
|
|
|
|
if (yp_access(argp->map, argp->domain, (struct svc_req *)rqstp)) {
|
|
|
|
#else
|
|
|
|
if (yp_access(argp->map, (struct svc_req *)rqstp)) {
|
|
|
|
#endif
|
1995-12-16 20:54:17 +00:00
|
|
|
result.stat = YP_YPERR;
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argp->domain == NULL) {
|
|
|
|
result.stat = YP_BADARGS;
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
if (yp_select_map(argp->map, argp->domain, &key, 1) != YP_TRUE) {
|
|
|
|
result.stat = yp_errno;
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
Performance enhancements (I hope) and new stuff:
yp_dblookup.c:
- Implement database handle caching. What this means is that instead
of opening and closing map databases for each request, we open a
database and save the handle (and, if requested, the key index)
in an array. This saves a bit of overhead on things like repeated
YPPROC_NEXT calls, such as you'd get from getpwent(). Normally,
each YPPROC_NEXT would require open()ing the database, seeking
to the location supplied by the caller (which is time consuming with
hash databases as the R_CURSOR flag doesn't work), reading the
data, close()ing the database and then shipping the data off to
the caller. The system call overhead is prohibitive, especially
with very large maps. By caching the handle to an open database,
we elimitate at least the open()/close() system calls, as well
as the associated DB setup and tear-down operations, for a large
percentage of the time. This improves performance substantially at
the cost of consuming a little more memory than before.
Note that all the caching support is surrounded by #ifdef DB_CACHE
so that this same source module can still be used by other programs
that don't need it.
- Make yp_open_db() call yp_validdomain(). Doing it here saves cycles
when caching is enabled since a hit on the map cache list by
definition means that the domain being referenced is valid.
- Also make yp_open_db() check for exhaustion of file descriptors,
just in case.
yp_server.c:
- Reorganize things a little to take advantage of the database
handle caching. Add a call to yp_flush_all() in ypproc_clear_2_svc().
- Remove calls to yp_validdomain() from some of the service procedures.
yp_validdomain() is called inside yp_open_db() now, so procedures that
call into the database package don't need to use yp_validdomain()
themselves.
- Fix a bogosity in ypproc_maplist_2_svc(): don't summarily initiallize
the result.maps pointer to NULL. This causes yp_maplist_free()
to fail and leaks memory.
- Make ypproc_master_2_svc() copy the string it gets from the database
package into a private static buffer before trying to NUL terminate it.
This is necessary with the DB handle caching: stuffing a NUL into the
data returned by DB package will goof it up internally.
yp_main.c:
- Stuff for DB handle caching: call yp_init_dbs() to clear the
handle array and add call to yp_flush_all() to the SIGHUP
signal handler.
Makefile.yp:
- Reorganize to deal with database caching. yp_mkdb(8) can now be used
to send a YPPROC_CLEAR signal to ypserv(8). Call it after each map
is created to refresh ypserv's cache.
- Add support for mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
- Make default location for the netgroups source file be /var/yp/netgroup
instead of /etc/netgroup.
mkaliases:
- New file: script to generate mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
Makefile:
- Install Makefile.yp as /var/yp/Makefile.dist and link it to
/var/yp/Makefile only if /var/yp/Makefile doesn't already exist.
Suggested by Peter Wemm.
- Install new mkaliases script in /usr/libexec along with mknetid.
- Use somewhat saner approach to generating rpcgen-dependent files
as suggested by Garrett Wollman.
1996-04-28 04:38:52 +00:00
|
|
|
/*
|
|
|
|
* Note that we copy the data retrieved from the database to
|
|
|
|
* a private buffer and NUL terminate the buffer rather than
|
|
|
|
* terminating the data in place. We do this because by stuffing
|
|
|
|
* a '\0' into data.data, we will actually be corrupting memory
|
|
|
|
* allocated by the DB package. This is a bad thing now that we
|
|
|
|
* cache DB handles rather than closing the database immediately.
|
|
|
|
*/
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
result.stat = yp_getbykey(&key, &val);
|
|
|
|
if (result.stat == YP_TRUE) {
|
2002-04-28 15:18:50 +00:00
|
|
|
bcopy(val.valdat_val, &ypvalbuf, val.valdat_len);
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
ypvalbuf[val.valdat_len] = '\0';
|
2002-04-28 15:18:50 +00:00
|
|
|
result.peer = ypvalbuf;
|
1995-12-16 20:54:17 +00:00
|
|
|
} else
|
|
|
|
result.peer = "";
|
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
ypresp_order *
|
|
|
|
ypproc_order_2_svc(ypreq_nokey *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresp_order result;
|
1997-08-10 20:37:48 +00:00
|
|
|
keydat key = { ORDER_SZ, ORDER_STRING };
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
valdat val;
|
1995-12-16 20:54:17 +00:00
|
|
|
|
1996-03-01 03:49:47 +00:00
|
|
|
result.ordernum = 0;
|
|
|
|
|
1996-10-24 18:58:26 +00:00
|
|
|
#ifdef DB_CACHE
|
|
|
|
if (yp_access(argp->map, argp->domain, (struct svc_req *)rqstp)) {
|
|
|
|
#else
|
|
|
|
if (yp_access(argp->map, (struct svc_req *)rqstp)) {
|
|
|
|
#endif
|
1995-12-16 20:54:17 +00:00
|
|
|
result.stat = YP_YPERR;
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argp->domain == NULL) {
|
|
|
|
result.stat = YP_BADARGS;
|
|
|
|
return (&result);
|
|
|
|
}
|
2002-02-06 13:30:31 +00:00
|
|
|
|
1995-12-16 20:54:17 +00:00
|
|
|
/*
|
|
|
|
* We could just check the timestamp on the map file,
|
|
|
|
* but that's a hack: we'll only know the last time the file
|
|
|
|
* was touched, not the last time the database contents were
|
|
|
|
* updated.
|
|
|
|
*/
|
|
|
|
|
Big round o changes:
- yp_dblookup.c: Create non-DB specific database access functions.
Using these allows access to the underlying database functions without
needing explicit knowledge of Berkeley DB. (These are used only
when DB_CACHE is #defined. Other programs that use the non-caching
functions (yp_mkdb, ypxfr, yppush, rpc.yppasswdd) shouldn't notice
the difference.)
- yp_dnslookup: Implement async DNS lookups. We send our own DNS
requests using UDP and put the request in a queue. When the response
arrives, we use the ID in the header to find the corresponsing queue
entry and then send the response to the client. We can go about our
business and handle other YP requests in the meantime. This way, we
can deal with time consuming DNS requests without blocking and without
forking.
- yp_server.c: Convert to using new non-DB-specific database access
functions. This simplifies the code a bit and removes the need for
this module to know anything about Berkeley DB. Also convert the
ypproc_match_2_svc() function to use the async DNS lookup routines.
- yp_main.c: tweak yp_svc_run() to add the resolver socket to the
set of descriptors monitored in the select() loop. Also add a
timeout to select(); we may get stale DNS requests stuck in the
queue which we want to invalidate after a while. If the timeout
hits, we decrement the ttl on all pending DNS requests and nuke
those requests that aren't handled before ttl hits zero.
- yp_extern.h: Add prototypes for new stuff.
- yp_svc_udp.c (new file): The async resolver code needs to be able
to rummage around inside the RPC UDP transport handle in order to
work correcty. There's basically one transport handle, and each time
a request comes in, the transaction ID in the handle is changed.
This means that if we queue a DNS request, then we handle some other
unrelated requests, we will be unable to send the DNS response because
the transaction ID and remote address of the client that made the DNS
request will have been lost. What we need to do is save the client
address and transaction ID in the queue entry for the DNS request,
then put the transaction ID and address back in the transport handle
when we're ready to reply. (And then we have to undo the change so
as not to confuse any other part of the server.) The trouble is that
the transaction ID is hidden in an opaque part of the transport handle,
and only the code in the svc_udp module in the RPC library knows how
to handle it. This file contains a couple of functions that let us
read and set the transaction ID in spite of this. This is really a
dirty trick and I should be taken out and shot for even thinking about
it, but there's no other way to get this stuff to work.
- Makefile: add yp_svc_udp.c to SRCS.
1996-12-22 22:30:58 +00:00
|
|
|
if (yp_select_map(argp->map, argp->domain, &key, 1) != YP_TRUE) {
|
|
|
|
result.stat = yp_errno;
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
result.stat = yp_getbykey(&key, &val);
|
|
|
|
|
|
|
|
if (result.stat == YP_TRUE)
|
2002-04-28 15:18:50 +00:00
|
|
|
result.ordernum = atoi(val.valdat_val);
|
1995-12-16 20:54:17 +00:00
|
|
|
else
|
|
|
|
result.ordernum = 0;
|
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
2002-02-06 15:26:07 +00:00
|
|
|
static void yp_maplist_free(struct ypmaplist *yp_maplist)
|
1995-12-16 20:54:17 +00:00
|
|
|
{
|
|
|
|
register struct ypmaplist *next;
|
|
|
|
|
2002-02-06 13:30:31 +00:00
|
|
|
while (yp_maplist) {
|
1995-12-16 20:54:17 +00:00
|
|
|
next = yp_maplist->next;
|
|
|
|
free(yp_maplist->map);
|
|
|
|
free(yp_maplist);
|
|
|
|
yp_maplist = next;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-02-06 15:26:07 +00:00
|
|
|
static struct ypmaplist *
|
|
|
|
yp_maplist_create(const char *domain)
|
1995-12-16 20:54:17 +00:00
|
|
|
{
|
|
|
|
char yp_mapdir[MAXPATHLEN + 2];
|
|
|
|
char yp_mapname[MAXPATHLEN + 2];
|
|
|
|
struct ypmaplist *cur = NULL;
|
|
|
|
struct ypmaplist *yp_maplist = NULL;
|
|
|
|
DIR *dird;
|
|
|
|
struct dirent *dirp;
|
|
|
|
struct stat statbuf;
|
|
|
|
|
|
|
|
snprintf(yp_mapdir, sizeof(yp_mapdir), "%s/%s", yp_dir, domain);
|
|
|
|
|
|
|
|
if ((dird = opendir(yp_mapdir)) == NULL) {
|
1996-01-31 15:21:56 +00:00
|
|
|
yp_error("opendir(%s) failed: %s", yp_mapdir, strerror(errno));
|
1995-12-16 20:54:17 +00:00
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((dirp = readdir(dird)) != NULL) {
|
|
|
|
if (strcmp(dirp->d_name, ".") && strcmp(dirp->d_name, "..")) {
|
1996-03-01 03:49:47 +00:00
|
|
|
snprintf(yp_mapname, sizeof(yp_mapname), "%s/%s",
|
|
|
|
yp_mapdir,dirp->d_name);
|
|
|
|
if (stat(yp_mapname, &statbuf) < 0 ||
|
|
|
|
!S_ISREG(statbuf.st_mode))
|
1995-12-16 20:54:17 +00:00
|
|
|
continue;
|
1996-03-01 03:49:47 +00:00
|
|
|
if ((cur = (struct ypmaplist *)
|
1996-05-31 16:01:51 +00:00
|
|
|
malloc(sizeof(struct ypmaplist))) == NULL) {
|
1997-10-29 07:25:05 +00:00
|
|
|
yp_error("malloc() failed");
|
1995-12-16 20:54:17 +00:00
|
|
|
closedir(dird);
|
|
|
|
yp_maplist_free(yp_maplist);
|
|
|
|
return(NULL);
|
|
|
|
}
|
2002-04-28 15:18:50 +00:00
|
|
|
if ((cur->map = strdup(dirp->d_name)) == NULL) {
|
1996-03-01 03:49:47 +00:00
|
|
|
yp_error("strdup() failed: %s",strerror(errno));
|
1995-12-16 20:54:17 +00:00
|
|
|
closedir(dird);
|
|
|
|
yp_maplist_free(yp_maplist);
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
cur->next = yp_maplist;
|
|
|
|
yp_maplist = cur;
|
|
|
|
if (debug)
|
|
|
|
yp_error("map: %s", yp_maplist->map);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
closedir(dird);
|
|
|
|
return(yp_maplist);
|
|
|
|
}
|
|
|
|
|
|
|
|
ypresp_maplist *
|
|
|
|
ypproc_maplist_2_svc(domainname *argp, struct svc_req *rqstp)
|
|
|
|
{
|
Performance enhancements (I hope) and new stuff:
yp_dblookup.c:
- Implement database handle caching. What this means is that instead
of opening and closing map databases for each request, we open a
database and save the handle (and, if requested, the key index)
in an array. This saves a bit of overhead on things like repeated
YPPROC_NEXT calls, such as you'd get from getpwent(). Normally,
each YPPROC_NEXT would require open()ing the database, seeking
to the location supplied by the caller (which is time consuming with
hash databases as the R_CURSOR flag doesn't work), reading the
data, close()ing the database and then shipping the data off to
the caller. The system call overhead is prohibitive, especially
with very large maps. By caching the handle to an open database,
we elimitate at least the open()/close() system calls, as well
as the associated DB setup and tear-down operations, for a large
percentage of the time. This improves performance substantially at
the cost of consuming a little more memory than before.
Note that all the caching support is surrounded by #ifdef DB_CACHE
so that this same source module can still be used by other programs
that don't need it.
- Make yp_open_db() call yp_validdomain(). Doing it here saves cycles
when caching is enabled since a hit on the map cache list by
definition means that the domain being referenced is valid.
- Also make yp_open_db() check for exhaustion of file descriptors,
just in case.
yp_server.c:
- Reorganize things a little to take advantage of the database
handle caching. Add a call to yp_flush_all() in ypproc_clear_2_svc().
- Remove calls to yp_validdomain() from some of the service procedures.
yp_validdomain() is called inside yp_open_db() now, so procedures that
call into the database package don't need to use yp_validdomain()
themselves.
- Fix a bogosity in ypproc_maplist_2_svc(): don't summarily initiallize
the result.maps pointer to NULL. This causes yp_maplist_free()
to fail and leaks memory.
- Make ypproc_master_2_svc() copy the string it gets from the database
package into a private static buffer before trying to NUL terminate it.
This is necessary with the DB handle caching: stuffing a NUL into the
data returned by DB package will goof it up internally.
yp_main.c:
- Stuff for DB handle caching: call yp_init_dbs() to clear the
handle array and add call to yp_flush_all() to the SIGHUP
signal handler.
Makefile.yp:
- Reorganize to deal with database caching. yp_mkdb(8) can now be used
to send a YPPROC_CLEAR signal to ypserv(8). Call it after each map
is created to refresh ypserv's cache.
- Add support for mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
- Make default location for the netgroups source file be /var/yp/netgroup
instead of /etc/netgroup.
mkaliases:
- New file: script to generate mail.alias map.
Contributed by Mike Murphy (mrm@sceard.com).
Makefile:
- Install Makefile.yp as /var/yp/Makefile.dist and link it to
/var/yp/Makefile only if /var/yp/Makefile doesn't already exist.
Suggested by Peter Wemm.
- Install new mkaliases script in /usr/libexec along with mknetid.
- Use somewhat saner approach to generating rpcgen-dependent files
as suggested by Garrett Wollman.
1996-04-28 04:38:52 +00:00
|
|
|
static ypresp_maplist result = { 0, NULL };
|
1996-03-01 03:49:47 +00:00
|
|
|
|
1996-10-24 18:58:26 +00:00
|
|
|
#ifdef DB_CACHE
|
|
|
|
if (yp_access(NULL, NULL, (struct svc_req *)rqstp)) {
|
|
|
|
#else
|
1995-12-16 20:54:17 +00:00
|
|
|
if (yp_access(NULL, (struct svc_req *)rqstp)) {
|
1996-10-24 18:58:26 +00:00
|
|
|
#endif
|
1995-12-16 20:54:17 +00:00
|
|
|
result.stat = YP_YPERR;
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (argp == NULL) {
|
|
|
|
result.stat = YP_BADARGS;
|
|
|
|
return (&result);
|
|
|
|
}
|
2002-02-06 13:30:31 +00:00
|
|
|
|
1995-12-16 20:54:17 +00:00
|
|
|
if (yp_validdomain(*argp)) {
|
|
|
|
result.stat = YP_NODOM;
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We have to construct a linked list for the ypproc_maplist
|
|
|
|
* procedure using dynamically allocated memory. Since the XDR
|
|
|
|
* layer won't free this list for us, we have to deal with it
|
|
|
|
* ourselves. We call yp_maplist_free() first to free any
|
|
|
|
* previously allocated data we may have accumulated to insure
|
|
|
|
* that we have only one linked list in memory at any given
|
|
|
|
* time.
|
|
|
|
*/
|
|
|
|
|
|
|
|
yp_maplist_free(result.maps);
|
|
|
|
|
|
|
|
if ((result.maps = yp_maplist_create(*argp)) == NULL) {
|
|
|
|
yp_error("yp_maplist_create failed");
|
|
|
|
result.stat = YP_YPERR;
|
|
|
|
return(&result);
|
|
|
|
} else
|
|
|
|
result.stat = YP_TRUE;
|
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
1996-02-26 02:34:27 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* NIS v1 support. The nullproc, domain and domain_nonack
|
|
|
|
* functions from v1 are identical to those in v2, so all
|
|
|
|
* we have to do is hand off to them.
|
|
|
|
*
|
|
|
|
* The other functions are mostly just wrappers around their v2
|
|
|
|
* counterparts. For example, for the v1 'match' procedure, we
|
|
|
|
* crack open the argument structure, make a request to the v2
|
|
|
|
* 'match' function, repackage the data into a v1 response and
|
|
|
|
* then send it on its way.
|
|
|
|
*
|
|
|
|
* Note that we don't support the pull, push and get procedures.
|
|
|
|
* There's little documentation available to show what they
|
|
|
|
* do, and I suspect they're meant largely for map transfers
|
|
|
|
* between master and slave servers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void *
|
|
|
|
ypoldproc_null_1_svc(void *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
return(ypproc_null_2_svc(argp, rqstp));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool_t *
|
|
|
|
ypoldproc_domain_1_svc(domainname *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
return(ypproc_domain_2_svc(argp, rqstp));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool_t *
|
|
|
|
ypoldproc_domain_nonack_1_svc(domainname *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
return (ypproc_domain_nonack_2_svc(argp, rqstp));
|
|
|
|
}
|
|
|
|
|
1996-03-01 03:49:47 +00:00
|
|
|
/*
|
|
|
|
* the 'match' procedure sends a response of type YPRESP_VAL
|
|
|
|
*/
|
1996-02-26 02:34:27 +00:00
|
|
|
ypresponse *
|
|
|
|
ypoldproc_match_1_svc(yprequest *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresponse result;
|
|
|
|
ypresp_val *v2_result;
|
|
|
|
|
|
|
|
result.yp_resptype = YPRESP_VAL;
|
1996-03-01 03:49:47 +00:00
|
|
|
result.ypresponse_u.yp_resp_valtype.val.valdat_val = "";
|
|
|
|
result.ypresponse_u.yp_resp_valtype.val.valdat_len = 0;
|
1996-02-26 02:34:27 +00:00
|
|
|
|
|
|
|
if (argp->yp_reqtype != YPREQ_KEY) {
|
|
|
|
result.ypresponse_u.yp_resp_valtype.stat = YP_BADARGS;
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
v2_result = ypproc_match_2_svc(&argp->yprequest_u.yp_req_keytype,rqstp);
|
|
|
|
if (v2_result == NULL)
|
|
|
|
return(NULL);
|
|
|
|
|
2002-04-28 15:18:50 +00:00
|
|
|
bcopy(v2_result, &result.ypresponse_u.yp_resp_valtype,
|
1996-02-26 02:34:27 +00:00
|
|
|
sizeof(ypresp_val));
|
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
1996-03-01 03:49:47 +00:00
|
|
|
/*
|
|
|
|
* the 'first' procedure sends a response of type YPRESP_KEY_VAL
|
|
|
|
*/
|
1996-02-26 02:34:27 +00:00
|
|
|
ypresponse *
|
|
|
|
ypoldproc_first_1_svc(yprequest *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresponse result;
|
|
|
|
ypresp_key_val *v2_result;
|
|
|
|
|
|
|
|
result.yp_resptype = YPRESP_KEY_VAL;
|
1996-03-01 03:49:47 +00:00
|
|
|
result.ypresponse_u.yp_resp_key_valtype.val.valdat_val =
|
|
|
|
result.ypresponse_u.yp_resp_key_valtype.key.keydat_val = "";
|
|
|
|
result.ypresponse_u.yp_resp_key_valtype.val.valdat_len =
|
|
|
|
result.ypresponse_u.yp_resp_key_valtype.key.keydat_len = 0;
|
1996-02-26 02:34:27 +00:00
|
|
|
|
|
|
|
if (argp->yp_reqtype != YPREQ_NOKEY) {
|
|
|
|
result.ypresponse_u.yp_resp_key_valtype.stat = YP_BADARGS;
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
v2_result = ypproc_first_2_svc(&argp->yprequest_u.yp_req_nokeytype,
|
|
|
|
rqstp);
|
|
|
|
if (v2_result == NULL)
|
|
|
|
return(NULL);
|
|
|
|
|
2002-04-28 15:18:50 +00:00
|
|
|
bcopy(v2_result, &result.ypresponse_u.yp_resp_key_valtype,
|
1996-02-26 02:34:27 +00:00
|
|
|
sizeof(ypresp_key_val));
|
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
1996-03-01 03:49:47 +00:00
|
|
|
/*
|
|
|
|
* the 'next' procedure sends a response of type YPRESP_KEY_VAL
|
|
|
|
*/
|
1996-02-26 02:34:27 +00:00
|
|
|
ypresponse *
|
|
|
|
ypoldproc_next_1_svc(yprequest *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresponse result;
|
|
|
|
ypresp_key_val *v2_result;
|
|
|
|
|
|
|
|
result.yp_resptype = YPRESP_KEY_VAL;
|
1996-03-01 03:49:47 +00:00
|
|
|
result.ypresponse_u.yp_resp_key_valtype.val.valdat_val =
|
|
|
|
result.ypresponse_u.yp_resp_key_valtype.key.keydat_val = "";
|
|
|
|
result.ypresponse_u.yp_resp_key_valtype.val.valdat_len =
|
|
|
|
result.ypresponse_u.yp_resp_key_valtype.key.keydat_len = 0;
|
1996-02-26 02:34:27 +00:00
|
|
|
|
|
|
|
if (argp->yp_reqtype != YPREQ_KEY) {
|
|
|
|
result.ypresponse_u.yp_resp_key_valtype.stat = YP_BADARGS;
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
v2_result = ypproc_next_2_svc(&argp->yprequest_u.yp_req_keytype,rqstp);
|
|
|
|
if (v2_result == NULL)
|
|
|
|
return(NULL);
|
|
|
|
|
2002-04-28 15:18:50 +00:00
|
|
|
bcopy(v2_result, &result.ypresponse_u.yp_resp_key_valtype,
|
1996-02-26 02:34:27 +00:00
|
|
|
sizeof(ypresp_key_val));
|
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
1996-03-01 03:49:47 +00:00
|
|
|
/*
|
|
|
|
* the 'poll' procedure sends a response of type YPRESP_MAP_PARMS
|
|
|
|
*/
|
1996-02-26 02:34:27 +00:00
|
|
|
ypresponse *
|
|
|
|
ypoldproc_poll_1_svc(yprequest *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresponse result;
|
|
|
|
ypresp_master *v2_result1;
|
|
|
|
ypresp_order *v2_result2;
|
|
|
|
|
|
|
|
result.yp_resptype = YPRESP_MAP_PARMS;
|
|
|
|
result.ypresponse_u.yp_resp_map_parmstype.domain =
|
|
|
|
argp->yprequest_u.yp_req_nokeytype.domain;
|
|
|
|
result.ypresponse_u.yp_resp_map_parmstype.map =
|
|
|
|
argp->yprequest_u.yp_req_nokeytype.map;
|
|
|
|
/*
|
|
|
|
* Hmm... there is no 'status' value in the
|
|
|
|
* yp_resp_map_parmstype structure, so I have to
|
|
|
|
* guess at what to do to indicate a failure.
|
|
|
|
* I hope this is right.
|
|
|
|
*/
|
|
|
|
result.ypresponse_u.yp_resp_map_parmstype.ordernum = 0;
|
|
|
|
result.ypresponse_u.yp_resp_map_parmstype.peer = "";
|
|
|
|
|
|
|
|
if (argp->yp_reqtype != YPREQ_MAP_PARMS) {
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
v2_result1 = ypproc_master_2_svc(&argp->yprequest_u.yp_req_nokeytype,
|
|
|
|
rqstp);
|
|
|
|
if (v2_result1 == NULL)
|
|
|
|
return(NULL);
|
|
|
|
|
|
|
|
if (v2_result1->stat != YP_TRUE) {
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
v2_result2 = ypproc_order_2_svc(&argp->yprequest_u.yp_req_nokeytype,
|
|
|
|
rqstp);
|
|
|
|
if (v2_result2 == NULL)
|
|
|
|
return(NULL);
|
|
|
|
|
|
|
|
if (v2_result2->stat != YP_TRUE) {
|
|
|
|
return(&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
result.ypresponse_u.yp_resp_map_parmstype.peer =
|
|
|
|
v2_result1->peer;
|
|
|
|
result.ypresponse_u.yp_resp_map_parmstype.ordernum =
|
|
|
|
v2_result2->ordernum;
|
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
ypresponse *
|
|
|
|
ypoldproc_push_1_svc(yprequest *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresponse result;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Not implemented.
|
|
|
|
*/
|
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
ypresponse *
|
|
|
|
ypoldproc_pull_1_svc(yprequest *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresponse result;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Not implemented.
|
|
|
|
*/
|
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|
|
|
|
|
|
|
|
ypresponse *
|
|
|
|
ypoldproc_get_1_svc(yprequest *argp, struct svc_req *rqstp)
|
|
|
|
{
|
|
|
|
static ypresponse result;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Not implemented.
|
|
|
|
*/
|
|
|
|
|
|
|
|
return (&result);
|
|
|
|
}
|