From 21504c46ebe577dd9657b388ad7754513e7959ec Mon Sep 17 00:00:00 2001 From: lukem Date: Mon, 13 Oct 1997 03:47:07 +0000 Subject: [PATCH] - ignore trailing NUL in database key/value pairs (which sendmail's aliases.db has) - add rcsid --- usr.sbin/ypserv/makedbm/makedbm.8 | 10 +++------- usr.sbin/ypserv/makedbm/makedbm.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/usr.sbin/ypserv/makedbm/makedbm.8 b/usr.sbin/ypserv/makedbm/makedbm.8 index ef9b0fde2a44..32670085935d 100644 --- a/usr.sbin/ypserv/makedbm/makedbm.8 +++ b/usr.sbin/ypserv/makedbm/makedbm.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: makedbm.8,v 1.3 1997/10/07 14:23:50 lukem Exp $ +.\" $NetBSD: makedbm.8,v 1.4 1997/10/13 03:47:07 lukem Exp $ .\" .\" Copyright (c) 1994 Mats O Jansson .\" All rights reserved. @@ -64,9 +64,7 @@ is a comment character and indicates that the rest of the line should be ignored. .Pp .Ar outfile -is the pathname of the generated databases, sans the -.Dq .db -suffix. +is the pathname of the generated databases. .Pp The options are as follows: .Bl -tag -width indent @@ -105,9 +103,7 @@ Dump the contents of to standard output, in a format suitable to be passed back into .Nm "" . .Ar dbfile -is the pathname to the database, sans the -.Dq .db -suffix. +is the pathname to the database. .El .Sh SEE ALSO .Xr db 3 , diff --git a/usr.sbin/ypserv/makedbm/makedbm.c b/usr.sbin/ypserv/makedbm/makedbm.c index b16f0b8ef99a..02979f927ebb 100644 --- a/usr.sbin/ypserv/makedbm/makedbm.c +++ b/usr.sbin/ypserv/makedbm/makedbm.c @@ -1,4 +1,4 @@ -/* $NetBSD: makedbm.c,v 1.5 1997/10/07 14:42:33 lukem Exp $ */ +/* $NetBSD: makedbm.c,v 1.6 1997/10/13 03:47:09 lukem Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -31,6 +31,11 @@ * SUCH DAMAGE. */ +#include +#ifndef lint +__RCSID("$NetBSD: makedbm.c,v 1.6 1997/10/13 03:47:09 lukem Exp $"); +#endif + #include #include @@ -209,6 +214,11 @@ list_database(database) while (key.dptr != NULL) { val = ypdb_fetch(db, key); + /* workround trailing \0 in aliases.db */ + if (key.dptr[key.dsize - 1] == '\0') + key.dsize--; + if (val.dptr[val.dsize - 1] == '\0') + val.dsize--; printf("%*.*s %*.*s\n", key.dsize, key.dsize, key.dptr, val.dsize, val.dsize, val.dptr);