From 46fcb35f238d605cab3323d01846350b7aa22603 Mon Sep 17 00:00:00 2001 From: wpaul Date: Thu, 4 Jul 1996 02:29:54 +0000 Subject: Add checks for byte order and DB type mismatches. We ignore the filename argument for now: it's really only useful for .dir/.pag-style ndbm databases, which we don't support anyway. --- usr.sbin/rpc.ypxfrd/ypxfrd_server.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'usr.sbin/rpc.ypxfrd') diff --git a/usr.sbin/rpc.ypxfrd/ypxfrd_server.c b/usr.sbin/rpc.ypxfrd/ypxfrd_server.c index dd4fcf3..d1f5e66 100644 --- a/usr.sbin/rpc.ypxfrd/ypxfrd_server.c +++ b/usr.sbin/rpc.ypxfrd/ypxfrd_server.c @@ -29,12 +29,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ypxfrd_server.c,v 1.5 1996/06/02 17:34:49 wpaul Exp $ + * $Id: ypxfrd_server.c,v 1.6 1996/07/04 02:23:11 wpaul Exp $ */ #include "ypxfrd.h" #ifndef lint -static const char rcsid[] = "$Id: ypxfrd_server.c,v 1.5 1996/06/02 17:34:49 wpaul Exp $"; +static const char rcsid[] = "$Id: ypxfrd_server.c,v 1.6 1996/07/04 02:23:11 wpaul Exp $"; #endif /* not lint */ #include @@ -46,6 +46,7 @@ static const char rcsid[] = "$Id: ypxfrd_server.c,v 1.5 1996/06/02 17:34:49 wpau #include #include #include +#include #include "ypxfrd_extern.h" int forked = 0; @@ -106,6 +107,22 @@ ypxfrd_getmap_1_svc(ypxfr_mapname *argp, struct svc_req *rqstp) result.xfr_u.xfrstat = XFR_ACCESS; return(&result); } + + if (argp->xfr_db_type != XFR_DB_BSD_HASH && + argp->xfr_db_type != XFR_DB_ANY) { + result.xfr_u.xfrstat = XFR_DB_TYPE_MISMATCH; + return(&result); + } + +#if BYTE_ORDER == LITTLE_ENDIAN + if (argp->xfr_byte_order == XFR_ENDIAN_BIG) { +#else + if (argp->xfr_byte_order == XFR_ENDIAN_LITTLE) { +#endif + result.xfr_u.xfrstat = XFR_DB_ENDIAN_MISMATCH; + return(&result); + } + #ifndef DEBUG if (children < MAX_CHILDREN && fork()) { children++; -- cgit v1.1