diff --git a/usr.sbin/ypserv/Makefile.yp b/usr.sbin/ypserv/Makefile.yp index 0d85712a0dcb..b8f474cccb6e 100644 --- a/usr.sbin/ypserv/Makefile.yp +++ b/usr.sbin/ypserv/Makefile.yp @@ -1,7 +1,7 @@ # # Makefile for the NIS databases # -# $Id: Makefile.yp,v 1.4 1996/04/28 04:38:46 wpaul Exp $ +# $Id: Makefile.yp,v 1.5 1996/06/03 16:24:32 wpaul Exp $ # # This Makefile should only be run on the NIS master server of a domain. # All updated maps will be pushed to all NIS slave servers listed in the @@ -136,6 +136,20 @@ aliases: mail.aliases master.passwd: master.passwd.byname master.passwd.byuid +# +# This is a special target used only when doing in-place updates with +# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd +# server and won't need to be remade. They will have to be pushed to the +# slaves however. Calling this target implicitly insures that this will +# happen. +# +pushpw: + @$(DBLOAD) -c + @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi + @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi + @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi + @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi + mail.aliases: $(ALIASES) @echo "Updating $@..." @echo $@.$$$$ > $(NFILE) @@ -356,7 +370,8 @@ services.byname: $(SERVICES) $(CAT) $(SERVICES) | \ $(AWK) \ '$$1 !~ "#" { if (index($$2,"udp")) { printf("%s/udp",$$1) } \ - else { printf("%s/tcp",$$1) }; print "\t"$$0 \ + else { printf("%s/tcp",$$1) }; print "\t"$$0 ; \ + print $$2"\t"$$0 ; \ }' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP) @$(MV) $(TMP) $@ @$(DBLOAD) -c diff --git a/usr.sbin/ypserv/yp_access.c b/usr.sbin/ypserv/yp_access.c index 24ee81c060d9..ef7fc56bc08f 100644 --- a/usr.sbin/ypserv/yp_access.c +++ b/usr.sbin/ypserv/yp_access.c @@ -52,7 +52,7 @@ #endif #ifndef lint -static const char rcsid[] = "$Id: yp_access.c,v 1.7 1996/04/28 04:38:47 wpaul Exp $"; +static const char rcsid[] = "$Id: yp_access.c,v 1.2 1996/05/01 02:39:54 wpaul Exp $"; #endif extern int debug; @@ -218,9 +218,17 @@ int yp_access(map, rqstp) struct securenet *tmp; #endif char *yp_procedure = NULL; + char procbuf[50]; - yp_procedure = rqstp->rq_prog == YPPASSWDPROG ? "yppasswdprog_update" : - yp_procs[rqstp->rq_proc + (12 * (rqstp->rq_vers - 1))]; + if (rqstp->rq_prog != YPPASSWDPROG && rqstp->rq_prog != YPPROG) { + snprintf(procbuf, sizeof(procbuf), "#%lu/#%lu", rqstp->rq_prog, + rqstp->rq_proc); + yp_procedure = (char *)&procbuf; + } else { + yp_procedure = rqstp->rq_prog == YPPASSWDPROG ? + "yppasswdprog_update" : + yp_procs[rqstp->rq_proc + (12 * (rqstp->rq_vers - 1))]; + } rqhost = svc_getcaller(rqstp->rq_xprt); diff --git a/usr.sbin/ypserv/yp_dblookup.c b/usr.sbin/ypserv/yp_dblookup.c index 76370f467d75..ea288a407507 100644 --- a/usr.sbin/ypserv/yp_dblookup.c +++ b/usr.sbin/ypserv/yp_dblookup.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: yp_dblookup.c,v 1.9 1996/05/01 02:33:52 wpaul Exp $ + * $Id: yp_dblookup.c,v 1.13 1996/06/04 04:08:21 wpaul Exp $ * */ #include @@ -47,7 +47,7 @@ #include "yp_extern.h" #ifndef lint -static const char rcsid[] = "$Id: yp_dblookup.c,v 1.9 1996/05/01 02:33:52 wpaul Exp $"; +static const char rcsid[] = "$Id: yp_dblookup.c,v 1.13 1996/06/04 04:08:21 wpaul Exp $"; #endif int ypdb_debug = 0; @@ -57,7 +57,7 @@ int yp_errno = YP_TRUE; HASHINFO openinfo = { 4096, /* bsize */ 32, /* ffactor */ - 512, /* nelem */ + 256, /* nelem */ 2048 * 512, /* cachesize */ NULL, /* hash */ 0, /* lorder */ @@ -93,7 +93,7 @@ void yp_init_dbs() * Zorch a single entry in the dbent table and release * all its resources. */ -static __inline void yp_flush(i) +static void yp_flush(i) register int i; { (void)(dbs[i]->dbp->close)(dbs[i]->dbp); @@ -128,7 +128,7 @@ void yp_flush_all() * a new entry when all our slots are already filled, we have to kick * out the entry in the last slot to make room. */ -static __inline void yp_add_db(dbp, name, size) +static void yp_add_db(dbp, name, size) DB *dbp; char *name; int size; @@ -190,7 +190,7 @@ static __inline void yp_add_db(dbp, name, size) * array so that it will be easier to find if another request for * the same database comes in later. */ -static __inline DB *yp_find_db(name, key, size) +static DB *yp_find_db(name, key, size) char *name; char *key; int size; @@ -202,12 +202,11 @@ static __inline DB *yp_find_db(name, key, size) if (dbs[i]->name != NULL && !strcmp(dbs[i]->name, name)) { if (size) { if (size != dbs[i]->size || - strncmp(dbs[i]->key, key, size)) + strncmp(dbs[i]->key, key, size)) continue; } else { - if (dbs[i]->size) { + if (dbs[i]->size) continue; - } } if (i > 0) { tmp = dbs[i]; @@ -218,6 +217,7 @@ static __inline DB *yp_find_db(name, key, size) return(dbs[0]->dbp); } } + return(NULL); } @@ -235,6 +235,9 @@ DB *yp_open_db_cache(domain, map, key, size) { DB *dbp = NULL; char buf[MAXPATHLEN + 2]; +/* + snprintf(buf, sizeof(buf), "%s/%s", domain, map); +*/ strcpy(buf, domain); strcat(buf, "/"); @@ -451,17 +454,22 @@ int yp_next_record(dbp,key,data,all,allow) key->size, key->data); if (!all) { -#ifndef DB_CACHE - if (key->size != lkey.size || - strncmp(key->data, lkey.data, key->size)) { -#else - if (!dbs[0]->size) { +#ifdef DB_CACHE + if (!dbs[0]->key) { #endif (dbp->seq)(dbp,&lkey,&ldata,R_FIRST); while(strncmp((char *)key->data,lkey.data, (int)key->size) || key->size != lkey.size) - (dbp->seq)(dbp,&lkey,&ldata,R_NEXT); + if ((dbp->seq)(dbp,&lkey,&ldata,R_NEXT)) { +#ifdef DB_CACHE + dbs[0]->size = 0; +#endif + return(YP_NOKEY); + } + +#ifdef DB_CACHE } +#endif } if ((dbp->seq)(dbp,key,data,R_NEXT)) {