From: deraadt Date: Sat, 12 Apr 1997 00:14:28 +0000 (+0000) Subject: -1 flag enables v1 YP, otherwise it is disabled; from maja X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6e72607212546499ebd187dfc8e7879a6256cf09;p=openbsd -1 flag enables v1 YP, otherwise it is disabled; from maja --- diff --git a/usr.sbin/ypserv/ypserv/ypserv.8 b/usr.sbin/ypserv/ypserv/ypserv.8 index 559cb64ae6a..5a2af84386f 100644 --- a/usr.sbin/ypserv/ypserv/ypserv.8 +++ b/usr.sbin/ypserv/ypserv/ypserv.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ypserv.8,v 1.7 1996/12/07 12:18:40 deraadt Exp $ +.\" $OpenBSD: ypserv.8,v 1.8 1997/04/12 00:14:28 deraadt Exp $ .\" Copyright (c) 1994 Mats O Jansson .\" All rights reserved. .\" @@ -36,6 +36,7 @@ .Nd YP server daemon .Sh SYNOPSIS .Nm ypserv +.Op Fl 1 .Op Fl a Ar aclfile .Op Fl d .Op Fl x @@ -85,6 +86,8 @@ exists then messages will be written to the file. .Pp The options are as follows: .Bl -tag -width indent +.It Fl 1 +Allow ypserv to answer old YP version 1 requests. .It Fl a Ar aclfile Don't use .Ar /var/yp/securenet . diff --git a/usr.sbin/ypserv/ypserv/ypserv.c b/usr.sbin/ypserv/ypserv/ypserv.c index e6fbca7de1a..d253346ac79 100644 --- a/usr.sbin/ypserv/ypserv/ypserv.c +++ b/usr.sbin/ypserv/ypserv/ypserv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypserv.c,v 1.8 1997/03/30 20:51:20 maja Exp $ */ +/* $OpenBSD: ypserv.c,v 1.9 1997/04/12 00:14:28 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: ypserv.c,v 1.8 1997/03/30 20:51:20 maja Exp $"; +static char rcsid[] = "$OpenBSD: ypserv.c,v 1.9 1997/04/12 00:14:28 deraadt Exp $"; #endif #include "yp.h" @@ -347,11 +347,15 @@ char *argv[]; int asize = sizeof (saddr); int usage = 0; int xflag = 0; + int allowv1 = 0; int ch; extern char *optarg; - while ((ch = getopt(argc, argv, "a:dx")) != -1) + while ((ch = getopt(argc, argv, "1a:dx")) != -1) switch (ch) { + case '1': + allowv1 = TRUE; + break; case 'a': aclfile = optarg; break; @@ -449,9 +453,11 @@ char *argv[]; } if (!_rpcpmstart) proto = IPPROTO_UDP; - if (!svc_register(transp, YPPROG, YPOLDVERS, ypprog_1, proto)) { - _msgout("unable to register (YPPROG, YPOLDVERS, udp)."); - exit(1); + if (allowv1) { + if (!svc_register(transp, YPPROG, YPOLDVERS, ypprog_1, proto)) { + _msgout("unable to register (YPPROG, YPOLDVERS, udp)."); + exit(1); + } } if (!svc_register(transp, YPPROG, YPVERS, ypprog_2, proto)) { _msgout("unable to register (YPPROG, YPVERS, udp)."); @@ -470,9 +476,11 @@ char *argv[]; } if (!_rpcpmstart) proto = IPPROTO_TCP; - if (!svc_register(transp, YPPROG, YPOLDVERS, ypprog_1, proto)) { - _msgout("unable to register (YPPROG, YPOLDVERS, tcp)."); - exit(1); + if (allowv1) { + if (!svc_register(transp, YPPROG, YPOLDVERS, ypprog_1, proto)) { + _msgout("unable to register (YPPROG, YPOLDVERS, tcp)."); + exit(1); + } } if (!svc_register(transp, YPPROG, YPVERS, ypprog_2, proto)) { _msgout("unable to register (YPPROG, YPVERS, tcp).");