diff options
-rw-r--r-- | Makefile.rules | 2 | ||||
-rw-r--r-- | man/automount.8 | 5 | ||||
-rw-r--r-- | modules/Makefile | 8 | ||||
-rw-r--r-- | modules/lookup_nisplus.c | 25 |
4 files changed, 21 insertions, 19 deletions
diff --git a/Makefile.rules b/Makefile.rules index 5f64100..d1fe66e 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -10,7 +10,7 @@ # Special parameters for glibc. # If you're compiling for glibc (libc 6), uncomment these. -#YPLIBS = -lnsl +#LIBNSL = -lnsl #LIBRESOLV = -lresolv # Uncomment these to build hesiod support. HESIOD should point to the diff --git a/man/automount.8 b/man/automount.8 index ee0fa1c..86ab58e 100644 --- a/man/automount.8 +++ b/man/automount.8 @@ -54,7 +54,10 @@ The map is an executable program, which is passed a key on the command line and returns an entry on stdout if successful. .TP .B yp -The map is an NIS (YP) database. +The map is a NIS (YP) database. +.TP +.B nisplus +The map is a NIS+ database. .TP .B hesiod The map is a hesiod database whose diff --git a/modules/Makefile b/modules/Makefile index 694a8c9..7d6634c 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -40,13 +40,15 @@ install: all # Ad hoc compilation rules for modules which need auxilliary libraries # lookup_yp.so: lookup_yp.c - $(CC) $(SOLDFLAGS) $(CFLAGS) -o lookup_yp.so lookup_yp.c $(YPLIBS) + $(CC) $(SOLDFLAGS) $(CFLAGS) -o lookup_yp.so lookup_yp.c $(LIBNSL) $(STRIP) lookup_yp.so lookup_nisplus.so: lookup_nisplus.c - $(CC) $(SOLDFLAGS) $(CFLAGS) -o lookup_nisplus.so lookup_nisplus.c $(YPLIBS) + $(CC) $(SOLDFLAGS) $(CFLAGS) -o lookup_nisplus.so lookup_nisplus.c \ + $(LIBNSL) $(STRIP) lookup_nisplus.so lookup_hesiod.so: lookup_hesiod.c $(CC) $(SOLDFLAGS) $(CFLAGS) -I$(HESIOD)/include -o lookup_hesiod.so \ - lookup_hesiod.c $(HESIOD_LIBS) + lookup_hesiod.c $(HESIOD_LIBS) + $(STRIP) lookup_hesiod.so diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c index dfaf675..f3a3121 100644 --- a/modules/lookup_nisplus.c +++ b/modules/lookup_nisplus.c @@ -16,7 +16,6 @@ #include <rpc/rpc.h> #include <rpc/xdr.h> #include <rpcsvc/nis.h> -#include <rpcsvc/ypclnt.h> #define MODULE_LOOKUP #include "automount.h" @@ -26,17 +25,17 @@ #define MODPREFIX "lookup(nisplus): " struct lookup_context { - char *domainname; - char *mapname; + const char *domainname; + const char *mapname; struct parse_mod *parse; }; int lookup_version = AUTOFS_LOOKUP_VERSION; /* Required by protocol */ -int lookup_init(char *mapfmt, int argc, char **argv, void **context) +int lookup_init(const char *mapfmt, int argc, const char * const *argv, + void **context) { struct lookup_context *ctxt; - int err; if ( !(*context = ctxt = malloc(sizeof(struct lookup_context))) ) { syslog(LOG_CRIT, MODPREFIX "%m"); @@ -49,11 +48,9 @@ int lookup_init(char *mapfmt, int argc, char **argv, void **context) } ctxt->mapname = argv[0]; - err = yp_get_default_domain(&ctxt->domainname); - if ( err ) { - syslog(LOG_CRIT, MODPREFIX "map %s: %s\n", ctxt->mapname, yperr_string(err)); - return 1; - } + /* nis_local_directory () returns a pointer to a static buffer. + We don't need to copy or free it. */ + ctxt->domainname = nis_local_directory (); if ( !mapfmt ) mapfmt = MAPFMT_DEFAULT; @@ -61,7 +58,8 @@ int lookup_init(char *mapfmt, int argc, char **argv, void **context) return !(ctxt->parse = open_parse(mapfmt,MODPREFIX,argc-1,argv+1)); } -int lookup_mount(char *root, char *name, int name_len, void *context) +int lookup_mount(const char *root, const char *name, int name_len, + void *context) { struct lookup_context *ctxt = (struct lookup_context *) context; char tablename[strlen (name) + strlen (ctxt->mapname) + @@ -71,15 +69,14 @@ int lookup_mount(char *root, char *name, int name_len, void *context) syslog(LOG_DEBUG, MODPREFIX "looking up %s", name); - sprintf (tablename, "[key=%s],%s.org_dir.%s.", name, ctxt->mapname, + sprintf (tablename, "[key=%s],%s.org_dir.%s", name, ctxt->mapname, ctxt->domainname); - result = nis_list (tablename, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); if (result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) { /* Try to get the "*" entry if there is one - note that we *don't* modify "name" so & -> the name we used, not "*" */ - sprintf (tablename, "[key=*],%s.org_dir.%s.", ctxt->mapname, + sprintf (tablename, "[key=*],%s.org_dir.%s", ctxt->mapname, ctxt->domainname); result = nis_list (tablename, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL); } |