c183a93033
This is a ported/modified version of the ypxfr program from the yps-0.21 package from the NYS project. This program is normally invoked by ypserv when it receives a yppush command from an NIS master. It can also be run from the command line to grab copies of maps when initializing a slave server. This program has been hacked in the following ways: - rpcgen'ed new yp_xdr.c, yp_svc.c and yp_clnt.c files. The old ones were rather grody. - Changed certain function names (prefended a _ to them) to avoid conflicts with certain functions lurking within libc. One major problem here is that ypxfr needs to bind to a YP master in order to work correctly, but it can't use the _yp_bind function inside libc because that function only lets you bind to a domain, not a specific host. Lots of head scratching here. - Converted from GDBM to DB at gunpoint. - Removed lots of really nasty looking DEBUG code to try to reduce clutter. - Incorporated some of the library code supplied with yps-0.21 on which ypxfr was dependent. This program still needs to be cleaned up just as a matter of principle: I get all icky just looking at it sometimes.
265 lines
5.0 KiB
C
265 lines
5.0 KiB
C
#include <rpc/rpc.h>
|
|
#include "yp.h"
|
|
#ifndef lint
|
|
/*static char sccsid[] = "from: @(#)yp.x 2.1 88/08/01 4.0 RPCSRC";*/
|
|
static char rcsid[] = "yp.x,v 1.1 1994/08/04 19:01:55 wollman Exp";
|
|
#endif /* not lint */
|
|
|
|
/* Default timeout can be changed using clnt_control() */
|
|
static struct timeval TIMEOUT = { 25, 0 };
|
|
|
|
void *
|
|
ypproc_null_2(argp, clnt)
|
|
void *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static char res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPROC_NULL, xdr_void, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return ((void *)&res);
|
|
}
|
|
|
|
|
|
bool_t *
|
|
ypproc_domain_2(argp, clnt)
|
|
domainname *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static bool_t res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPROC_DOMAIN, xdr_domainname, argp, xdr_bool, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return (&res);
|
|
}
|
|
|
|
|
|
bool_t *
|
|
ypproc_domain_nonack_2(argp, clnt)
|
|
domainname *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static bool_t res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPROC_DOMAIN_NONACK, xdr_domainname, argp, xdr_bool, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return (&res);
|
|
}
|
|
|
|
|
|
ypresp_val *
|
|
ypproc_match_2(argp, clnt)
|
|
ypreq_key *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static ypresp_val res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPROC_MATCH, xdr_ypreq_key, argp, xdr_ypresp_val, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return (&res);
|
|
}
|
|
|
|
|
|
ypresp_key_val *
|
|
ypproc_first_2(argp, clnt)
|
|
ypreq_key *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static ypresp_key_val res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPROC_FIRST, xdr_ypreq_key, argp, xdr_ypresp_key_val, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return (&res);
|
|
}
|
|
|
|
|
|
ypresp_key_val *
|
|
ypproc_next_2(argp, clnt)
|
|
ypreq_key *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static ypresp_key_val res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPROC_NEXT, xdr_ypreq_key, argp, xdr_ypresp_key_val, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return (&res);
|
|
}
|
|
|
|
|
|
ypresp_xfr *
|
|
ypproc_xfr_2(argp, clnt)
|
|
ypreq_xfr *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static ypresp_xfr res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPROC_XFR, xdr_ypreq_xfr, argp, xdr_ypresp_xfr, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return (&res);
|
|
}
|
|
|
|
|
|
void *
|
|
ypproc_clear_2(argp, clnt)
|
|
void *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static char res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPROC_CLEAR, xdr_void, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return ((void *)&res);
|
|
}
|
|
|
|
|
|
ypresp_all *
|
|
ypproc_all_2(argp, clnt)
|
|
ypreq_nokey *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static ypresp_all res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPROC_ALL, xdr_ypreq_nokey, argp, __xdr_ypresp_all, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return (&res);
|
|
}
|
|
|
|
|
|
ypresp_master *
|
|
ypproc_master_2(argp, clnt)
|
|
ypreq_nokey *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static ypresp_master res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPROC_MASTER, xdr_ypreq_nokey, argp, xdr_ypresp_master, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return (&res);
|
|
}
|
|
|
|
|
|
ypresp_order *
|
|
ypproc_order_2(argp, clnt)
|
|
ypreq_nokey *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static ypresp_order res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPROC_ORDER, xdr_ypreq_nokey, argp, xdr_ypresp_order, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return (&res);
|
|
}
|
|
|
|
|
|
ypresp_maplist *
|
|
ypproc_maplist_2(argp, clnt)
|
|
domainname *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static ypresp_maplist res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPROC_MAPLIST, xdr_domainname, argp, xdr_ypresp_maplist, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return (&res);
|
|
}
|
|
|
|
|
|
void *
|
|
yppushproc_null_1(argp, clnt)
|
|
void *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static char res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPUSHPROC_NULL, xdr_void, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return ((void *)&res);
|
|
}
|
|
|
|
|
|
yppushresp_xfr *
|
|
yppushproc_xfrresp_1(argp, clnt)
|
|
void *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static yppushresp_xfr res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPPUSHPROC_XFRRESP, xdr_void, argp, xdr_yppushresp_xfr, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return (&res);
|
|
}
|
|
|
|
|
|
void *
|
|
ypbindproc_null_2(argp, clnt)
|
|
void *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static char res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPBINDPROC_NULL, xdr_void, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return ((void *)&res);
|
|
}
|
|
|
|
|
|
ypbind_resp *
|
|
ypbindproc_domain_2(argp, clnt)
|
|
domainname *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static ypbind_resp res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPBINDPROC_DOMAIN, xdr_domainname, argp, xdr_ypbind_resp, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return (&res);
|
|
}
|
|
|
|
|
|
void *
|
|
ypbindproc_setdom_2(argp, clnt)
|
|
ypbind_setdom *argp;
|
|
CLIENT *clnt;
|
|
{
|
|
static char res;
|
|
|
|
bzero((char *)&res, sizeof(res));
|
|
if (clnt_call(clnt, YPBINDPROC_SETDOM, xdr_ypbind_setdom, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
|
|
return (NULL);
|
|
}
|
|
return ((void *)&res);
|
|
}
|
|
|