diff options
author | wpaul <wpaul@FreeBSD.org> | 1996-10-25 16:13:09 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1996-10-25 16:13:09 +0000 |
commit | 4561c758bb75d0deb7daba0a85778b82027a1cec (patch) | |
tree | 92894046c11fdcd1d6d68f347976a9f2dc4a1636 /libexec/ypxfr/ypxfr_misc.c | |
parent | f4c288024bae04ebcd38b182b94f88401d1080c6 (diff) | |
download | FreeBSD-src-4561c758bb75d0deb7daba0a85778b82027a1cec.zip FreeBSD-src-4561c758bb75d0deb7daba0a85778b82027a1cec.tar.gz |
Give ypxfr the ability to detect the presence of the YP_INTERDOMAIN
and YP_SECURE flags so that it can properly add them to newly created
maps when needed. This applies only when using the 'standard' method
for map transfers. When using rpc.ypxfrd, the whole map is copied
verbatim, along with any special entries that may be encoded in it.
Also made -Wall a little quieter for ypxfrd_getmap.c.
Diffstat (limited to 'libexec/ypxfr/ypxfr_misc.c')
-rw-r--r-- | libexec/ypxfr/ypxfr_misc.c | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/libexec/ypxfr/ypxfr_misc.c b/libexec/ypxfr/ypxfr_misc.c index 2c0e895..93efdb0 100644 --- a/libexec/ypxfr/ypxfr_misc.c +++ b/libexec/ypxfr/ypxfr_misc.c @@ -29,8 +29,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ypxfr_misc.c,v 1.8 1996/06/02 05:12:00 wpaul Exp $ + * $Id: ypxfr_misc.c,v 1.9 1996/10/25 15:58:15 wpaul Exp $ */ +#include <stdio.h> +#include <string.h> #include <stdlib.h> #include <unistd.h> #include <sys/param.h> @@ -41,7 +43,7 @@ struct dom_binding {}; #include "ypxfr_extern.h" #ifndef lint -static const char rcsid[] = "$Id: ypxfr_misc.c,v 1.8 1996/06/02 05:12:00 wpaul Exp $"; +static const char rcsid[] = "$Id: ypxfr_misc.c,v 1.9 1996/10/25 15:58:15 wpaul Exp $"; #endif char *ypxfrerr_string(code) @@ -257,3 +259,47 @@ failed")); return(resp->ordernum); } } + +int ypxfr_match(server, domain, map, key, keylen) + char *server; + char *domain; + char *map; + char *key; + unsigned long keylen; +{ + ypreq_key ypkey; + ypresp_val *ypval; + CLIENT *clnt; + static char buf[YPMAXRECORD + 2]; + + bzero((char *)buf, sizeof(buf)); + + if ((clnt = clnt_create(server, YPPROG,YPVERS,"udp")) == NULL) { + yp_error("failed to create UDP handle: %s", + clnt_spcreateerror(server)); + return(0); + } + + ypkey.domain = domain; + ypkey.map = map; + ypkey.key.keydat_len = keylen; + ypkey.key.keydat_val = key; + + if ((ypval = ypproc_match_2(&ypkey, clnt)) == NULL) { + clnt_destroy(clnt); + yp_error("%s: %s", server, + clnt_sperror(clnt,"YPPROC_MATCH failed")); + return(0); + } + + clnt_destroy(clnt); + + if (ypval->stat != YP_TRUE) { + xdr_free(xdr_ypresp_val, (char *)ypval); + return(0); + } + + xdr_free(xdr_ypresp_val, (char *)ypval); + + return(1); +} |