Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/ypmatch PR/9513: Graywolf: ypmatch fails on mail.ali...
details: https://anonhg.NetBSD.org/src/rev/3c338b8c7bfa
branches: trunk
changeset: 545630:3c338b8c7bfa
user: christos <christos%NetBSD.org@localhost>
date: Sat Apr 12 09:13:28 2003 +0000
description:
PR/9513: Graywolf: ypmatch fails on mail.aliases, mail.byaddr from Solaris
diffstat:
usr.bin/ypmatch/ypmatch.1 | 8 ++++++--
usr.bin/ypmatch/ypmatch.c | 26 +++++++++++++++++---------
2 files changed, 23 insertions(+), 11 deletions(-)
diffs (105 lines):
diff -r 3c5087275b63 -r 3c338b8c7bfa usr.bin/ypmatch/ypmatch.1
--- a/usr.bin/ypmatch/ypmatch.1 Sat Apr 12 09:03:25 2003 +0000
+++ b/usr.bin/ypmatch/ypmatch.1 Sat Apr 12 09:13:28 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: ypmatch.1,v 1.11 2003/02/25 10:36:03 wiz Exp $
+.\" $NetBSD: ypmatch.1,v 1.12 2003/04/12 09:13:28 christos Exp $
.\"
.\" Copyright (c) 1993 Winning Strategies, Inc.
.\" All rights reserved.
@@ -36,7 +36,7 @@
.Nd "print the values of one or more keys in a YP database"
.Sh SYNOPSIS
.Nm
-.Op Fl kt
+.Op Fl ktz
.Op Fl d Ar domainname
.Ar key ...
.Ar mapname
@@ -63,6 +63,10 @@
to their corresponding map names.
.It Fl x
Display the map nickname table.
+.It Fl z
+Append a NUL character at the end of the key when doing the lookup.
+This is useful for mail.aliases maps, which include a trailing NUL in
+the keys.
.El
.Sh SEE ALSO
.Xr domainname 1 ,
diff -r 3c5087275b63 -r 3c338b8c7bfa usr.bin/ypmatch/ypmatch.c
--- a/usr.bin/ypmatch/ypmatch.c Sat Apr 12 09:03:25 2003 +0000
+++ b/usr.bin/ypmatch/ypmatch.c Sat Apr 12 09:13:28 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ypmatch.c,v 1.13 2001/02/19 23:03:54 cgd Exp $ */
+/* $NetBSD: ypmatch.c,v 1.14 2003/04/12 09:13:29 christos Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt%fsa.ca@localhost>
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ypmatch.c,v 1.13 2001/02/19 23:03:54 cgd Exp $");
+__RCSID("$NetBSD: ypmatch.c,v 1.14 2003/04/12 09:13:29 christos Exp $");
#endif
#include <sys/param.h>
@@ -75,13 +75,13 @@
{
char *domainname;
char *inkey, *inmap, *outbuf;
- int outbuflen, key, notrans;
- int c, r, i;
+ int outbuflen, key, null, notrans;
+ int c, r, i, len;
int rval;
domainname = NULL;
- notrans = key = 0;
- while ((c = getopt(argc, argv, "xd:kt")) != -1) {
+ notrans = key = null = 0;
+ while ((c = getopt(argc, argv, "xd:ktz")) != -1) {
switch (c) {
case 'x':
for(i = 0;
@@ -103,6 +103,10 @@
key++;
break;
+ case 'z':
+ null++;
+ break;
+
default:
usage();
}
@@ -128,13 +132,17 @@
for(i = 0; i < (argc - 1); i++) {
inkey = argv[i];
- r = yp_match(domainname, inmap, inkey, strlen(inkey),
+ len = strlen(inkey);
+ if (null)
+ len++;
+ r = yp_match(domainname, inmap, inkey, len,
&outbuf, &outbuflen);
switch (r) {
case 0:
if (key)
printf("%s: ", inkey);
- printf("%*.*s\n", outbuflen, outbuflen, outbuf);
+ fwrite(outbuf, outbuflen, 1, stdout);
+ putc('\n', stdout);
break;
case YPERR_YPBIND:
@@ -155,7 +163,7 @@
usage()
{
- fprintf(stderr, "usage: %s [-d domain] [-t] [-k] key [key ...] "
+ fprintf(stderr, "Usage: %s [-d domain] [-tkz] key [key ...] "
"mapname\n", getprogname());
fprintf(stderr, " %s -x\n", getprogname());
exit(1);
Home |
Main Index |
Thread Index |
Old Index