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_main.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_main.c')
-rw-r--r-- | libexec/ypxfr/ypxfr_main.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/libexec/ypxfr/ypxfr_main.c b/libexec/ypxfr/ypxfr_main.c index f26c5cb..821bf87 100644 --- a/libexec/ypxfr/ypxfr_main.c +++ b/libexec/ypxfr/ypxfr_main.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ypxfr_main.c,v 1.18 1996/10/20 19:44:45 wpaul Exp $ + * $Id: ypxfr_main.c,v 1.19 1996/10/25 15:58:15 wpaul Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -51,7 +51,7 @@ struct dom_binding {}; #include "ypxfr_extern.h" #ifndef lint -static const char rcsid[] = "$Id: ypxfr_main.c,v 1.18 1996/10/20 19:44:45 wpaul Exp $"; +static const char rcsid[] = "$Id: ypxfr_main.c,v 1.19 1996/10/25 15:58:15 wpaul Exp $"; #endif char *progname = "ypxfr"; @@ -163,6 +163,8 @@ main(argc,argv) char buf[MAXPATHLEN + 2]; DBT key, data; int remoteport; + int interdom = 0; + int secure = 0; debug = 1; @@ -352,6 +354,14 @@ the local domain name isn't set"); ypxfr_exit(YPXFR_YPERR,NULL); } + if (ypxfr_match(ypxfr_master, ypxfr_source_domain, ypxfr_mapname, + "YP_INTERDOMAIN", sizeof("YP_INTERDOMAIN") - 1)) + interdom++; + + if (ypxfr_match(ypxfr_master, ypxfr_source_domain, ypxfr_mapname, + "YP_SECURE", sizeof("YP_SECURE") - 1)) + secure++; + key.data = "YP_LAST_MODIFIED"; key.size = sizeof("YP_LAST_MODIFIED") - 1; @@ -469,6 +479,30 @@ the local domain name isn't set"); ypxfr_exit(YPXFR_DBM,&ypxfr_temp_map); } + if (interdom) { + key.data = "YP_INTERDOMAIN"; + key.size = sizeof("YP_INTERDOMAIN") - 1; + data.data = ""; + data.size = 0; + + if (yp_put_record(dbp, &key, &data, 0) != YP_TRUE) { + yp_error("failed to add interdomain flag to database"); + ypxfr_exit(YPXFR_DBM,&ypxfr_temp_map); + } + } + + if (secure) { + key.data = "YP_SECURE"; + key.size = sizeof("YP_SECURE") - 1; + data.data = ""; + data.size = 0; + + if (yp_put_record(dbp, &key, &data, 0) != YP_TRUE) { + yp_error("failed to add secure flag to database"); + ypxfr_exit(YPXFR_DBM,&ypxfr_temp_map); + } + } + /* Now suck over the contents of the map from the master. */ if (ypxfr_get_map(ypxfr_mapname,ypxfr_source_domain, |