diff options
author | wpaul <wpaul@FreeBSD.org> | 1995-12-08 17:58:50 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1995-12-08 17:58:50 +0000 |
commit | 5a5b07fa54887595e0725dba442af441c842786a (patch) | |
tree | 66666be3ba6600fa5aaf32e4ea6e45c4354efa39 /include/rpcsvc/yp.x | |
parent | ed86a6f0a2a787d2c7097489a375138bc7794424 (diff) | |
download | FreeBSD-src-5a5b07fa54887595e0725dba442af441c842786a.zip FreeBSD-src-5a5b07fa54887595e0725dba442af441c842786a.tar.gz |
"What? He's modifying the NIS protocol definition!?"
No, not really. There are just a couple of long-standing bogosities here
that I feel compelled to fix. :)
There are two small changes here:
1) yp.x actually contains _three_ protocol definitions: YPPROG (standard
NIS client/server procedures), YPPUSH_XFRRESPPROG (callback handler
for the YPPROC_XFR service, aka ypxfr/yppush) and YPBINDPROG (for ypbind,
ypset & friends). The problem is that when you run yp.x through rpcgen(1),
it generates client and server stubs with hooks for all three services.
This makes it impossible to actually use the rpcgen-erated code in a
program that only deals with _one_ of these services (ypserv, ypbind,
etc...) without manually removing the unneeded stubs (either by hand
editing or by committing unspeakable horrors with sed). This defeats
the whole purpose of using rpcgen and is generally annoying.
What I've done is to insert a few #ifndefs and #endifs to allow a
programmer to selectively blot out those functions that aren't needed
for a particular program. For instance, if you do 'rpcgen -DYPSERV_ONLY',
you'll get only the necessary client/server stubs to implement the
standard yp client and server functions. If you do 'rpcgen -DYPBIND_ONLY',
you get only what you need for ypbind. If you don't #define anything,
you get the whole mess, just like before, so existing programs won't
notice the difference. (Note that the -D flag is not supported by our
existing crufty version of rpcgen, but I intend to update it soon.)
2) The definition for the ypresp_key_val structure is actually incorrect
with respect to reality: the key and val members are specified in the
wrong order. It should be val/key rather than key/val. For whatever
the reason, Sun's actual NIS implementation contradicts the protocol
definition in this case. Again, accounting for this bogosity here is
cleaner and easier than mangling the output from rpcgen.
Diffstat (limited to 'include/rpcsvc/yp.x')
-rw-r--r-- | include/rpcsvc/yp.x | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/include/rpcsvc/yp.x b/include/rpcsvc/yp.x index f20dee0..0a5658c 100644 --- a/include/rpcsvc/yp.x +++ b/include/rpcsvc/yp.x @@ -34,7 +34,7 @@ #ifndef RPC_HDR %#ifndef lint %/*static char sccsid[] = "from: @(#)yp.x 2.1 88/08/01 4.0 RPCSRC";*/ -%static char rcsid[] = "$Id: yp.x,v 1.1 1993/09/14 17:42:53 jtc Exp $"; +%static char rcsid[] = "$Id$"; %#endif /* not lint */ #endif @@ -119,8 +119,13 @@ struct ypresp_val { struct ypresp_key_val { ypstat stat; +#ifdef STUPID_SUN_BUG /* These are backwards */ keydat key; valdat val; +#else + valdat val; + keydat key; +#endif }; @@ -218,7 +223,7 @@ struct ypbind_setdom { unsigned ypsetdom_vers; }; - +#if !defined(YPBIND_ONLY) && !defined(YPPUSH_ONLY) /* * YP access protocol */ @@ -261,8 +266,8 @@ program YPPROG { YPPROC_MAPLIST(domainname) = 11; } = 2; } = 100004; - - +#endif +#if !defined(YPSERV_ONLY) && !defined(YPBIND_ONLY) /* * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR */ @@ -275,8 +280,8 @@ program YPPUSH_XFRRESPPROG { YPPUSHPROC_XFRRESP(void) = 1; } = 1; } = 0x40000000; /* transient: could be anything up to 0x5fffffff */ - - +#endif +#if !defined(YPSERV_ONLY) && !defined(YPPUSH_ONLY) /* * YP binding protocol */ @@ -293,4 +298,4 @@ program YPBINDPROG { } = 2; } = 100007; - +#endif |