freebsd-dev/usr.sbin/ypserv/Makefile
Bill Paul 0d15a95009 Fix a bug in the database handle caching. This has to do with the way the
underlying database code works. When dealing with first/next queries, you
have the notion of a database 'cursor,' which is essentially a file pointer
for the database. To select the first entry, you do a fetch with the
R_FIRST flag set, then you can use the R_NEXT flag to enumerate the other
entries in the database. Unfortunately, doing a direct fetch with no flag
does _not_ set the 'cursor,' so you can't do a direct fetch and then
enumerate the table from there.

The bug is that cached handles generated as the result of a YPPROC_MATCH
were being treated as though they were the same as handles generated by
a YPPROC_FIRST, which is not the case. The manifestation is that if you
do a 'ypmatch first-key-in-map map' followed by a yp_first()/yp_next()
pair, the yp_first() and yp_next() both return the first key in the
table, which makes the entry appear to be duplicated.

A couple smaller things since I'm here:

- yp_main.c and yp_error.c both have a global 'int debug' in them.
  For some reason, our cc/ld doesn't flag this as a multiply defined
  symbol even though it should. Removed the declaration from yp_main.c;
  we want the one in yp_error.c.

- The Makefile wasn't installing ypinit in the right place.
1998-02-11 19:15:32 +00:00

42 lines
1.1 KiB
Makefile

# $Id: Makefile,v 1.12 1997/11/10 22:17:09 wpaul Exp $
PROG= ypserv
SRCS= yp_svc.c yp_server.c yp_dblookup.c yp_dnslookup.c \
ypxfr_clnt.c yp_main.c yp_error.c yp_access.c yp_svc_udp.c
MAN8= ypserv.8 ypinit.8
CFLAGS+= -I. -DDB_CACHE
CLEANFILES= yp_svc.c ypxfr_clnt.c yp.h
RPCDIR= ${.CURDIR}/../../include/rpcsvc
.PATH: ${RPCDIR}
RPCGEN= rpcgen -I -C
# We need to remove the 'static' keyword from _rpcsvcstate so that
# yp_main.c can see it.
yp_svc.c: yp.x yp.h
rm -f ${.TARGET}
${RPCGEN} -DYPSERV_ONLY -m ${RPCDIR}/yp.x | \
sed s/"static int _rpcsvcstate"/"int _rpcsvcstate"/g > ${.TARGET}
ypxfr_clnt.c: yp.x yp.h
${RPCGEN} -DYPPUSH_ONLY -l -o ${.TARGET} ${RPCDIR}/yp.x
yp.h: yp.x
${RPCGEN} -h -o ${.TARGET} ${RPCDIR}/yp.x
afterinstall:
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
${.CURDIR}/Makefile.yp \
${DESTDIR}/var/yp/Makefile.dist
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
${.CURDIR}/ypinit.sh ${DESTDIR}/${BINDIR}/ypinit
@if [ ! -f ${DESTDIR}/var/yp/Makefile.dist ]; then \
ln -s ${DESTDIR}/var/yp/Makefile.dist \
${DESTDIR}/var/yp/Makefile; fi
.include <bsd.prog.mk>