- Update to upstream release 5.0.2.
This commit is contained in:
parent
05033492fb
commit
88265cbe1e
@ -1,2 +1 @@
|
||||
autofs-5.0.1-rc3.tar.bz2
|
||||
autofs-5.0.1.tar.bz2
|
||||
autofs-5.0.2.tar.bz2
|
||||
|
||||
@ -1,342 +0,0 @@
|
||||
--- autofs-5.0.1/man/auto.master.5.in.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800
|
||||
+++ autofs-5.0.1/man/auto.master.5.in 2007-06-12 20:29:38.000000000 +0800
|
||||
@@ -101,8 +101,9 @@
|
||||
.B filsys
|
||||
entries are used for maps.
|
||||
.TP
|
||||
-.B ldap
|
||||
-The map is stored in an LDAP directory.
|
||||
+.B ldap \fPor\fB ldaps
|
||||
+The map is stored in an LDAP directory. If \fBldaps\fP is used the
|
||||
+appropriate certificate must be configured in the LDAP client.
|
||||
.RE
|
||||
.TP
|
||||
\fBformat\fP
|
||||
--- autofs-5.0.1/include/lookup_ldap.h.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800
|
||||
+++ autofs-5.0.1/include/lookup_ldap.h 2007-06-12 20:29:38.000000000 +0800
|
||||
@@ -13,6 +13,7 @@
|
||||
char *mapname;
|
||||
|
||||
char *server;
|
||||
+ int port;
|
||||
char *base;
|
||||
char *qdn;
|
||||
|
||||
--- autofs-5.0.1/daemon/lookup.c.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800
|
||||
+++ autofs-5.0.1/daemon/lookup.c 2007-06-12 20:29:38.000000000 +0800
|
||||
@@ -169,20 +169,30 @@
|
||||
char source[10];
|
||||
|
||||
memset(source, 0, 10);
|
||||
- /* TODO: ldaps is not yet handled by ldap module */
|
||||
- /* TODO: must tighten up this test */
|
||||
- if (!strncmp(name, "file", 4) ||
|
||||
- !strncmp(name, "yp", 2) ||
|
||||
- !strncmp(name, "nis", 3) ||
|
||||
- !strncmp(name, "nisplus", 7) ||
|
||||
- !strncmp(name, "ldap", 4)) {
|
||||
+ if (!strncmp(name, "file:", 5) ||
|
||||
+ !strncmp(name, "yp:", 3) ||
|
||||
+ !strncmp(name, "nis:", 4) ||
|
||||
+ !strncmp(name, "nisplus:", 8) ||
|
||||
+ !strncmp(name, "ldap:", 5) ||
|
||||
+ !strncmp(name, "ldaps:", 6)) {
|
||||
strncpy(source, name, tmp - name);
|
||||
|
||||
- master->name = tmp + 1;
|
||||
-
|
||||
- debug(LOGOPT_NONE,
|
||||
- "reading master %s %s",
|
||||
- source, master->name);
|
||||
+ /*
|
||||
+ * If it's an ldap map leave the source in the
|
||||
+ * name so the lookup module can work out if
|
||||
+ * ldaps has been requested.
|
||||
+ */
|
||||
+ if (strncmp(name, "ldap", 4)) {
|
||||
+ master->name = tmp + 1;
|
||||
+ debug(LOGOPT_NONE,
|
||||
+ "reading master %s %s",
|
||||
+ source, master->name);
|
||||
+ } else {
|
||||
+ master->name = name;
|
||||
+ debug(LOGOPT_NONE,
|
||||
+ "reading master %s %s",
|
||||
+ source, tmp + 1);
|
||||
+ }
|
||||
|
||||
result = do_read_master(master, source, age);
|
||||
master->name = name;
|
||||
--- autofs-5.0.1/modules/lookup_ldap.c.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800
|
||||
+++ autofs-5.0.1/modules/lookup_ldap.c 2007-06-12 20:29:38.000000000 +0800
|
||||
@@ -100,14 +100,8 @@
|
||||
ctxt->version = 3;
|
||||
|
||||
/* Initialize the LDAP context. */
|
||||
- /* LDAP_PORT should not be hard-coded, here. If we are going to
|
||||
- * parse ldap strings ourselves, then we can put the port specified
|
||||
- * in the host:port format here. Otherwise, we can just pass the
|
||||
- * host:port string to the ldap_init call and let the library handle
|
||||
- * it. -JM
|
||||
- */
|
||||
- ldap = ldap_init(ctxt->server, LDAP_PORT);
|
||||
- if (!ldap) {
|
||||
+ rv = ldap_initialize(&ldap, ctxt->server);
|
||||
+ if (rv != LDAP_OPT_SUCCESS) {
|
||||
crit(LOGOPT_ANY,
|
||||
MODPREFIX "couldn't initialize LDAP connection to %s",
|
||||
ctxt->server ? ctxt->server : "default server");
|
||||
@@ -119,8 +113,8 @@
|
||||
if (rv != LDAP_OPT_SUCCESS) {
|
||||
/* fall back to LDAPv2 */
|
||||
ldap_unbind_ext(ldap, NULL, NULL);
|
||||
- ldap = ldap_init(ctxt->server, LDAP_PORT);
|
||||
- if (!ldap) {
|
||||
+ rv = ldap_initialize(&ldap, ctxt->server);
|
||||
+ if (rv != LDAP_OPT_SUCCESS) {
|
||||
crit(LOGOPT_ANY, MODPREFIX "couldn't initialize LDAP");
|
||||
return NULL;
|
||||
}
|
||||
@@ -348,7 +342,7 @@
|
||||
goto out;
|
||||
}
|
||||
|
||||
- if (!usetls)
|
||||
+ if (!usetls || ctxt->port == LDAPS_PORT)
|
||||
use_tls = LDAP_TLS_DONT_USE;
|
||||
else {
|
||||
if (!strcasecmp(usetls, "yes"))
|
||||
@@ -551,16 +545,31 @@
|
||||
*/
|
||||
static int parse_server_string(const char *url, struct lookup_context *ctxt)
|
||||
{
|
||||
- char buf[MAX_ERR_BUF], *tmp = NULL;
|
||||
- const char *ptr;
|
||||
- int l;
|
||||
+ char buf[MAX_ERR_BUF], *tmp = NULL, proto[9];
|
||||
+ const char *ptr, *name;
|
||||
+ int l, al_len;
|
||||
|
||||
+ *proto = '\0';
|
||||
ptr = url;
|
||||
|
||||
debug(LOGOPT_NONE,
|
||||
MODPREFIX
|
||||
"Attempting to parse LDAP information from string \"%s\".", ptr);
|
||||
|
||||
+ ctxt->port = LDAP_PORT;
|
||||
+ if (!strncmp(ptr, "ldap:", 5) || !strncmp(ptr, "ldaps:", 6)) {
|
||||
+ if (*(ptr + 4) == 's') {
|
||||
+ ctxt->port = LDAPS_PORT;
|
||||
+ memcpy(proto, ptr, 6);
|
||||
+ strcat(proto, "//");
|
||||
+ ptr += 6;
|
||||
+ } else {
|
||||
+ memcpy(proto, ptr, 5);
|
||||
+ strcat(proto, "//");
|
||||
+ ptr += 5;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (!strncmp(ptr, "//", 2)) {
|
||||
const char *s = ptr + 2;
|
||||
const char *q = NULL;
|
||||
@@ -568,7 +577,13 @@
|
||||
/* Isolate the server(s). */
|
||||
if ((q = strchr(s, '/'))) {
|
||||
l = q - s;
|
||||
- tmp = malloc(l + 1);
|
||||
+ if (*proto) {
|
||||
+ al_len = l + strlen(proto) + 2;
|
||||
+ tmp = malloc(al_len);
|
||||
+ } else {
|
||||
+ al_len = l + 1;
|
||||
+ tmp = malloc(al_len);
|
||||
+ }
|
||||
if (!tmp) {
|
||||
char *estr;
|
||||
estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
@@ -576,8 +591,13 @@
|
||||
return 0;
|
||||
}
|
||||
ctxt->server = tmp;
|
||||
- memset(ctxt->server, 0, l + 1);
|
||||
- memcpy(ctxt->server, s, l);
|
||||
+ memset(ctxt->server, 0, al_len);
|
||||
+ if (*proto) {
|
||||
+ strcpy(ctxt->server, proto);
|
||||
+ memcpy(ctxt->server + strlen(proto), s, l);
|
||||
+ strcat(ctxt->server, "/");
|
||||
+ } else
|
||||
+ memcpy(ctxt->server, s, l);
|
||||
ptr = q + 1;
|
||||
} else {
|
||||
crit(LOGOPT_ANY,
|
||||
@@ -613,8 +633,14 @@
|
||||
}
|
||||
|
||||
l = q - ptr;
|
||||
+ if (proto) {
|
||||
+ al_len = l + strlen(proto) + 2;
|
||||
+ tmp = malloc(al_len);
|
||||
+ } else {
|
||||
+ al_len = l + 1;
|
||||
+ tmp = malloc(al_len);
|
||||
+ }
|
||||
/* Isolate the server's name. */
|
||||
- tmp = malloc(l + 1);
|
||||
if (!tmp) {
|
||||
char *estr;
|
||||
estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
@@ -622,8 +648,13 @@
|
||||
return 0;
|
||||
}
|
||||
ctxt->server = tmp;
|
||||
- memset(ctxt->server, 0, l + 1);
|
||||
- memcpy(ctxt->server, ptr, l);
|
||||
+ memset(ctxt->server, 0, al_len);
|
||||
+ if (*proto) {
|
||||
+ strcpy(ctxt->server, proto);
|
||||
+ memcpy(ctxt->server + strlen(proto), ptr, l);
|
||||
+ strcat(ctxt->server, "/");
|
||||
+ } else
|
||||
+ memcpy(ctxt->server, ptr, l);
|
||||
ptr += l + 1;
|
||||
}
|
||||
|
||||
@@ -639,29 +670,41 @@
|
||||
* the later LDAP calls will fail.
|
||||
*/
|
||||
l = strlen(ptr);
|
||||
- if (strchr(ptr, '=')) {
|
||||
+ if ((name = strchr(ptr, '='))) {
|
||||
char *base;
|
||||
|
||||
+ /*
|
||||
+ * An '=' with no ',' means a mapname has been given so just
|
||||
+ * grab it alone to keep it independent of schema otherwize
|
||||
+ * we expect a full dn.
|
||||
+ */
|
||||
if (!strchr(ptr, ',')) {
|
||||
- debug(LOGOPT_NONE,
|
||||
- MODPREFIX "LDAP dn not fuly specified");
|
||||
- if (ctxt->server)
|
||||
- free(ctxt->server);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- base = malloc(l + 1);
|
||||
- if (!base) {
|
||||
- char *estr;
|
||||
- estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- crit(LOGOPT_ANY, MODPREFIX "malloc: %s", estr);
|
||||
- if (ctxt->server)
|
||||
- free(ctxt->server);
|
||||
- return 0;
|
||||
+ char *map = strdup(name + 1);
|
||||
+ if (map)
|
||||
+ ctxt->mapname = map;
|
||||
+ else {
|
||||
+ char *estr;
|
||||
+ estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ crit(LOGOPT_ANY, MODPREFIX "malloc: %s", estr);
|
||||
+ if (ctxt->server)
|
||||
+ free(ctxt->server);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ } else {
|
||||
+ base = malloc(l + 1);
|
||||
+ if (!base) {
|
||||
+ char *estr;
|
||||
+ estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ crit(LOGOPT_ANY, MODPREFIX "malloc: %s", estr);
|
||||
+ if (ctxt->server)
|
||||
+ free(ctxt->server);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ ctxt->base = base;
|
||||
+ memset(ctxt->base, 0, l + 1);
|
||||
+ memcpy(ctxt->base, ptr, l);
|
||||
}
|
||||
- ctxt->base = base;
|
||||
- memset(ctxt->base, 0, l + 1);
|
||||
- memcpy(ctxt->base, ptr, l);
|
||||
} else {
|
||||
char *map = malloc(l + 1);
|
||||
if (!map) {
|
||||
@@ -676,6 +719,14 @@
|
||||
memset(ctxt->mapname, 0, l + 1);
|
||||
memcpy(map, ptr, l);
|
||||
}
|
||||
+
|
||||
+ if (!ctxt->server && *proto) {
|
||||
+ if (!strncmp(proto, "ldaps", 5)) {
|
||||
+ warn(LOGOPT_ANY, MODPREFIX
|
||||
+ "server must be given to force ldaps, connection "
|
||||
+ "will use LDAP client configured protocol");
|
||||
+ }
|
||||
+ }
|
||||
done:
|
||||
if (ctxt->mapname)
|
||||
debug(LOGOPT_NONE, MODPREFIX "mapname %s", ctxt->mapname);
|
||||
--- autofs-5.0.1/modules/Makefile.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800
|
||||
+++ autofs-5.0.1/modules/Makefile 2007-06-12 20:29:38.000000000 +0800
|
||||
@@ -64,6 +64,7 @@
|
||||
-rm -f $(INSTALLROOT)$(autofslibdir)/mount_smbfs.so
|
||||
ln -fs lookup_file.so $(INSTALLROOT)$(autofslibdir)/lookup_files.so
|
||||
ln -fs lookup_yp.so $(INSTALLROOT)$(autofslibdir)/lookup_nis.so
|
||||
+ ln -fs lookup_ldap.so $(INSTALLROOT)$(autofslibdir)/lookup_ldaps.so
|
||||
ln -fs mount_nfs.so $(INSTALLROOT)$(autofslibdir)/mount_nfs4.so
|
||||
ifeq ($(EXT2FS), 1)
|
||||
ifeq ($(EXT3FS), 1)
|
||||
--- autofs-5.0.1/lib/master_tok.l.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800
|
||||
+++ autofs-5.0.1/lib/master_tok.l 2007-06-12 20:29:38.000000000 +0800
|
||||
@@ -104,7 +104,7 @@
|
||||
DNNAMESTR ([[:alnum:]_.\-]+)
|
||||
|
||||
INTMAP (-hosts|-null)
|
||||
-MTYPE ((file|program|yp|nis|nisplus|ldap|hesiod|userdir)(,(sun|hesiod))?)
|
||||
+MTYPE ((file|program|yp|nis|nisplus|ldap|ldaps|hesiod|userdir)(,(sun|hesiod))?)
|
||||
|
||||
|
||||
OPTTOUT (-t{OPTWS}|-t{OPTWS}={OPTWS}|--timeout{OPTWS}|--timeout{OPTWS}={OPTWS})
|
||||
--- autofs-5.0.1/lib/master_parse.y.add-ldaps-support 2007-06-12 20:29:23.000000000 +0800
|
||||
+++ autofs-5.0.1/lib/master_parse.y 2007-06-12 20:29:38.000000000 +0800
|
||||
@@ -290,6 +290,19 @@
|
||||
local_free_vars();
|
||||
YYABORT;
|
||||
}
|
||||
+ /* Add back the type for lookup_ldap.c to handle ldaps */
|
||||
+ if (*local_argv[0]) {
|
||||
+ tmp = malloc(strlen(type) + strlen(local_argv[0]) + 2);
|
||||
+ if (!tmp) {
|
||||
+ local_free_vars();
|
||||
+ YYABORT;
|
||||
+ }
|
||||
+ strcpy(tmp, type);
|
||||
+ strcat(tmp, ":");
|
||||
+ strcat(tmp, local_argv[0]);
|
||||
+ free(local_argv[0]);
|
||||
+ local_argv[0] = tmp;
|
||||
+ }
|
||||
}
|
||||
;
|
||||
|
||||
@@ -343,12 +356,12 @@
|
||||
strcat($$, ",");
|
||||
strcat($$, $5);
|
||||
}
|
||||
- | DNATTR
|
||||
+ | DNNAME
|
||||
{
|
||||
- master_notify($1);
|
||||
- YYABORT;
|
||||
+ /* Matches map in old style syntax ldap:server:map */
|
||||
+ strcpy($$, $1);
|
||||
}
|
||||
- | DNNAME
|
||||
+ | DNATTR
|
||||
{
|
||||
master_notify($1);
|
||||
YYABORT;
|
||||
@ -1,66 +0,0 @@
|
||||
diff --git a/lib/alarm.c b/lib/alarm.c
|
||||
index e0e6fd4..4a72605 100755
|
||||
--- a/lib/alarm.c
|
||||
+++ b/lib/alarm.c
|
||||
@@ -168,7 +168,6 @@ void alarm_delete(struct autofs_point *ap)
|
||||
static void *alarm_handler(void *arg)
|
||||
{
|
||||
struct list_head *head;
|
||||
- struct autofs_point *ap;
|
||||
struct timespec expire;
|
||||
time_t now;
|
||||
int status;
|
||||
@@ -192,10 +191,11 @@ static void *alarm_handler(void *arg)
|
||||
|
||||
current = list_entry(head->next, struct alarm, list);
|
||||
|
||||
- ap = current->ap;
|
||||
now = time(NULL);
|
||||
|
||||
if (current->time <= now) {
|
||||
+ struct autofs_point *ap;
|
||||
+
|
||||
list_del(¤t->list);
|
||||
|
||||
if (current->cancel) {
|
||||
@@ -203,11 +203,15 @@ static void *alarm_handler(void *arg)
|
||||
continue;
|
||||
}
|
||||
|
||||
+ ap = current->ap;
|
||||
+ free(current);
|
||||
+ alarm_unlock();
|
||||
+
|
||||
state_mutex_lock(ap);
|
||||
nextstate(ap->state_pipe[1], ST_EXPIRE);
|
||||
state_mutex_unlock(ap);
|
||||
|
||||
- free(current);
|
||||
+ alarm_lock();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -215,6 +219,7 @@ static void *alarm_handler(void *arg)
|
||||
expire.tv_nsec = 0;
|
||||
|
||||
while (1) {
|
||||
+ struct autofs_point *ap;
|
||||
struct alarm *next;
|
||||
|
||||
status = pthread_cond_timedwait(&cond, &mutex, &expire);
|
||||
@@ -232,12 +237,15 @@ static void *alarm_handler(void *arg)
|
||||
break;
|
||||
|
||||
list_del(¤t->list);
|
||||
+ ap = current->ap;
|
||||
free(current);
|
||||
+ alarm_unlock();
|
||||
|
||||
state_mutex_lock(ap);
|
||||
nextstate(ap->state_pipe[1], ST_EXPIRE);
|
||||
state_mutex_unlock(ap);
|
||||
|
||||
+ alarm_lock();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
diff --git a/lib/master_tok.l b/lib/master_tok.l
|
||||
index a5d6066..c15ef68 100644
|
||||
--- a/lib/master_tok.l
|
||||
+++ b/lib/master_tok.l
|
||||
@@ -89,7 +89,7 @@ NL \r?\n
|
||||
CONT \\\n{OPTWS}
|
||||
|
||||
OPTIONSTR ([\-]?([[:alpha:]_]([[:alnum:]_\-])*(=([[:alnum:]_\-])+)*)+)
|
||||
-MACROSTR (-D{OPTWS}([[:alpha:]_]([[:alnum:]_\-])*)=([[:alnum:]_\-])+)
|
||||
+MACROSTR (-D{OPTWS}([[:alpha:]_]([[:alnum:]_\-])*)=([[:alnum:]_\-\.])+)
|
||||
SLASHIFYSTR (--(no-)?slashify-colons)
|
||||
NUMBER [0-9]+
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
diff --git a/daemon/automount.c b/daemon/automount.c
|
||||
index 938ee1b..37e040b 100644
|
||||
--- a/daemon/automount.c
|
||||
+++ b/daemon/automount.c
|
||||
@@ -276,7 +276,7 @@ static int walk_tree(const char *base, int (*fn) (const char *file,
|
||||
|
||||
static int rm_unwanted_fn(const char *file, const struct stat *st, int when, void *arg)
|
||||
{
|
||||
- dev_t dev = *(int *) arg;
|
||||
+ dev_t dev = *(dev_t *) arg;
|
||||
char buf[MAX_ERR_BUF];
|
||||
struct stat newst;
|
||||
|
||||
@ -1,99 +0,0 @@
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 34fad3e..b379431 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -3,6 +3,7 @@
|
||||
- fix return check for getpwuid_r and getgrgid_r.
|
||||
- give up trying to update exports list while host is mounted.
|
||||
- fix to "@network" matching.
|
||||
+- check for fstab update and retry if not updated.
|
||||
|
||||
20/2/2007 autofs-5.0.1
|
||||
----------------------
|
||||
diff --git a/daemon/spawn.c b/daemon/spawn.c
|
||||
index 7f0a6e0..271d37e 100644
|
||||
--- a/daemon/spawn.c
|
||||
+++ b/daemon/spawn.c
|
||||
@@ -34,6 +34,8 @@ static pthread_mutex_t spawn_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
#define SPAWN_OPT_LOCK 0x0001
|
||||
#define SPAWN_OPT_ACCESS 0x0002
|
||||
|
||||
+#define MTAB_LOCK_RETRIES 3
|
||||
+
|
||||
inline void dump_core(void)
|
||||
{
|
||||
sigset_t segv;
|
||||
@@ -267,6 +269,8 @@ int spawn_mount(logger *log, ...)
|
||||
char prog[] = PATH_MOUNT;
|
||||
char arg0[] = PATH_MOUNT;
|
||||
unsigned int options;
|
||||
+ unsigned int retries = MTAB_LOCK_RETRIES;
|
||||
+ int ret;
|
||||
|
||||
/* If we use mount locking we can't validate the location */
|
||||
#ifdef ENABLE_MOUNT_LOCKING
|
||||
@@ -289,7 +293,14 @@ int spawn_mount(logger *log, ...)
|
||||
while ((*p++ = va_arg(arg, char *)));
|
||||
va_end(arg);
|
||||
|
||||
- return do_spawn(log, options, prog, (const char **) argv);
|
||||
+ while (retries--) {
|
||||
+ ret = do_spawn(log, options, prog, (const char **) argv);
|
||||
+ if (ret & MTAB_NOTUPDATED)
|
||||
+ continue;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -309,6 +320,8 @@ int spawn_bind_mount(logger *log, ...)
|
||||
char arg0[] = PATH_MOUNT;
|
||||
char bind[] = "--bind";
|
||||
unsigned int options;
|
||||
+ unsigned int retries = MTAB_LOCK_RETRIES;
|
||||
+ int ret;
|
||||
|
||||
/* If we use mount locking we can't validate the location */
|
||||
#ifdef ENABLE_MOUNT_LOCKING
|
||||
@@ -332,7 +345,14 @@ int spawn_bind_mount(logger *log, ...)
|
||||
while ((*p++ = va_arg(arg, char *)));
|
||||
va_end(arg);
|
||||
|
||||
- return do_spawn(log, options, prog, (const char **) argv);
|
||||
+ while (retries--) {
|
||||
+ ret = do_spawn(log, options, prog, (const char **) argv);
|
||||
+ if (ret & MTAB_NOTUPDATED)
|
||||
+ continue;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
int spawn_umount(logger *log, ...)
|
||||
@@ -343,6 +363,8 @@ int spawn_umount(logger *log, ...)
|
||||
char prog[] = PATH_UMOUNT;
|
||||
char arg0[] = PATH_UMOUNT;
|
||||
unsigned int options;
|
||||
+ unsigned int retries = MTAB_LOCK_RETRIES;
|
||||
+ int ret;
|
||||
|
||||
#ifdef ENABLE_MOUNT_LOCKING
|
||||
options = SPAWN_OPT_LOCK;
|
||||
@@ -364,6 +386,13 @@ int spawn_umount(logger *log, ...)
|
||||
while ((*p++ = va_arg(arg, char *)));
|
||||
va_end(arg);
|
||||
|
||||
- return do_spawn(log, options, prog, (const char **) argv);
|
||||
+ while (retries--) {
|
||||
+ ret = do_spawn(log, options, prog, (const char **) argv);
|
||||
+ if (ret & MTAB_NOTUPDATED)
|
||||
+ continue;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
@ -1,56 +0,0 @@
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 3a7f47e..d416684 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -1,3 +1,7 @@
|
||||
+??/??/2007 autofs-5.0.2
|
||||
+-----------------------
|
||||
+- fix return check for getpwuid_r and getgrgid_r.
|
||||
+
|
||||
20/2/2007 autofs-5.0.1
|
||||
----------------------
|
||||
- fix typo in Fix typo in var when removing temp directory.
|
||||
diff --git a/daemon/direct.c b/daemon/direct.c
|
||||
index 0869858..2dc23db 100644
|
||||
--- a/daemon/direct.c
|
||||
+++ b/daemon/direct.c
|
||||
@@ -1335,7 +1335,7 @@ static void *do_mount_direct(void *arg)
|
||||
}
|
||||
|
||||
status = getpwuid_r(mt->uid, ppw, pw_tmp, tmplen, pppw);
|
||||
- if (status) {
|
||||
+ if (status || !ppw) {
|
||||
error(ap->logopt, "failed to get passwd info from getpwuid_r");
|
||||
free(tsv);
|
||||
free(pw_tmp);
|
||||
@@ -1382,7 +1382,7 @@ static void *do_mount_direct(void *arg)
|
||||
}
|
||||
|
||||
status = getgrgid_r(mt->gid, pgr, gr_tmp, tmplen, ppgr);
|
||||
- if (status) {
|
||||
+ if (status || !pgr) {
|
||||
error(ap->logopt, "failed to get group info from getgrgid_r");
|
||||
free(tsv->user);
|
||||
free(tsv->home);
|
||||
diff --git a/daemon/indirect.c b/daemon/indirect.c
|
||||
index 46e3f99..2068c16 100644
|
||||
--- a/daemon/indirect.c
|
||||
+++ b/daemon/indirect.c
|
||||
@@ -807,7 +807,7 @@ static void *do_mount_indirect(void *arg)
|
||||
}
|
||||
|
||||
status = getpwuid_r(mt->uid, ppw, pw_tmp, tmplen, pppw);
|
||||
- if (status) {
|
||||
+ if (status || !ppw) {
|
||||
error(ap->logopt, "failed to get passwd info from getpwuid_r");
|
||||
free(tsv);
|
||||
free(pw_tmp);
|
||||
@@ -854,7 +854,7 @@ static void *do_mount_indirect(void *arg)
|
||||
}
|
||||
|
||||
status = getgrgid_r(mt->gid, pgr, gr_tmp, tmplen, ppgr);
|
||||
- if (status) {
|
||||
+ if (status || !pgr) {
|
||||
error(ap->logopt, "failed to get group info from getgrgid_r");
|
||||
free(tsv->user);
|
||||
free(tsv->home);
|
||||
@ -1,156 +0,0 @@
|
||||
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
|
||||
index 0494e76..99961c3 100644
|
||||
--- a/modules/parse_sun.c
|
||||
+++ b/modules/parse_sun.c
|
||||
@@ -264,7 +264,7 @@ int parse_init(int argc, const char *const *argv, void **context)
|
||||
{
|
||||
struct parse_context *ctxt;
|
||||
char buf[MAX_ERR_BUF];
|
||||
- char *noptstr, *def, *val, *macros;
|
||||
+ char *noptstr, *def, *val, *macros, *gbl_options;
|
||||
const char *xopt;
|
||||
int optlen, len, offset;
|
||||
int i, bval;
|
||||
@@ -397,25 +397,31 @@ int parse_init(int argc, const char *const *argv, void **context)
|
||||
}
|
||||
}
|
||||
|
||||
+ gbl_options = NULL;
|
||||
if (global_options) {
|
||||
+ if (ctxt->optstr && strstr(ctxt->optstr, global_options))
|
||||
+ goto options_done;
|
||||
+ gbl_options = strdup(global_options);
|
||||
+ }
|
||||
+
|
||||
+ if (gbl_options) {
|
||||
append_options = defaults_get_append_options();
|
||||
if (append_options) {
|
||||
- char *tmp = concat_options(global_options, ctxt->optstr);
|
||||
+ char *tmp = concat_options(gbl_options, ctxt->optstr);
|
||||
if (!tmp) {
|
||||
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
error(LOGOPT_ANY, MODPREFIX "concat_options: %s", estr);
|
||||
+ free(gbl_options);
|
||||
} else
|
||||
ctxt->optstr = tmp;
|
||||
} else {
|
||||
if (!ctxt->optstr)
|
||||
- ctxt->optstr = strdup(global_options);
|
||||
- if (!ctxt->optstr) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- warn(LOGOPT_ANY, MODPREFIX "%s", estr);
|
||||
- }
|
||||
+ ctxt->optstr = gbl_options;
|
||||
+ else
|
||||
+ free(gbl_options);
|
||||
}
|
||||
}
|
||||
-
|
||||
+options_done:
|
||||
debug(LOGOPT_NONE,
|
||||
MODPREFIX "init gathered global options: %s", ctxt->optstr);
|
||||
|
||||
@@ -799,18 +805,23 @@ static int parse_mapent(const char *ent, char *g_options, char **options, char *
|
||||
char *tmp, *newopt = NULL;
|
||||
|
||||
p = parse_options(p, &newopt, logopt);
|
||||
- tmp = concat_options(myoptions, newopt);
|
||||
- if (!tmp) {
|
||||
- char *estr;
|
||||
- estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- error(logopt, MODPREFIX
|
||||
- "concat_options: %s", estr);
|
||||
- if (newopt)
|
||||
- free(newopt);
|
||||
+ if (newopt && strstr(newopt, myoptions)) {
|
||||
free(myoptions);
|
||||
- return 0;
|
||||
+ myoptions = newopt;
|
||||
+ } else {
|
||||
+ tmp = concat_options(myoptions, newopt);
|
||||
+ if (!tmp) {
|
||||
+ char *estr;
|
||||
+ estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ error(logopt, MODPREFIX
|
||||
+ "concat_options: %s", estr);
|
||||
+ if (newopt)
|
||||
+ free(newopt);
|
||||
+ free(myoptions);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ myoptions = tmp;
|
||||
}
|
||||
- myoptions = tmp;
|
||||
|
||||
p = skipspace(p);
|
||||
} while (*p == '-');
|
||||
@@ -1042,19 +1053,24 @@ int parse_mount(struct autofs_point *ap, const char *name,
|
||||
char *noptions = NULL;
|
||||
|
||||
p = parse_options(p, &noptions, ap->logopt);
|
||||
- tmp = concat_options(mnt_options, noptions);
|
||||
- if (!tmp) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- error(ap->logopt,
|
||||
- MODPREFIX "concat_options: %s", estr);
|
||||
- if (noptions)
|
||||
- free(noptions);
|
||||
- if (mnt_options)
|
||||
- free(mnt_options);
|
||||
- free(options);
|
||||
- return 1;
|
||||
+ if (mnt_options && noptions && strstr(noptions, mnt_options)) {
|
||||
+ free(mnt_options);
|
||||
+ mnt_options = noptions;
|
||||
+ } else {
|
||||
+ tmp = concat_options(mnt_options, noptions);
|
||||
+ if (!tmp) {
|
||||
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ error(ap->logopt,
|
||||
+ MODPREFIX "concat_options: %s", estr);
|
||||
+ if (noptions)
|
||||
+ free(noptions);
|
||||
+ if (mnt_options)
|
||||
+ free(mnt_options);
|
||||
+ free(options);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ mnt_options = tmp;
|
||||
}
|
||||
- mnt_options = tmp;
|
||||
|
||||
p = skipspace(p);
|
||||
} while (*p == '-');
|
||||
@@ -1065,17 +1081,22 @@ int parse_mount(struct autofs_point *ap, const char *name,
|
||||
}
|
||||
|
||||
if (append_options) {
|
||||
- tmp = concat_options(options, mnt_options);
|
||||
- if (!tmp) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- error(ap->logopt, MODPREFIX "concat_options: %s", estr);
|
||||
- if (options)
|
||||
- free(options);
|
||||
- if (mnt_options)
|
||||
- free(mnt_options);
|
||||
- return 1;
|
||||
+ if (options && mnt_options && strstr(mnt_options, options)) {
|
||||
+ free(options);
|
||||
+ options = mnt_options;
|
||||
+ } else {
|
||||
+ tmp = concat_options(options, mnt_options);
|
||||
+ if (!tmp) {
|
||||
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ error(ap->logopt, MODPREFIX "concat_options: %s", estr);
|
||||
+ if (options)
|
||||
+ free(options);
|
||||
+ if (mnt_options)
|
||||
+ free(mnt_options);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ options = tmp;
|
||||
}
|
||||
- options = tmp;
|
||||
} else
|
||||
options = mnt_options;
|
||||
}
|
||||
@ -1,143 +0,0 @@
|
||||
diff --git a/daemon/automount.c b/daemon/automount.c
|
||||
index 37e040b..a8327d1 100644
|
||||
--- a/daemon/automount.c
|
||||
+++ b/daemon/automount.c
|
||||
@@ -47,6 +47,8 @@ const char *libdir = AUTOFS_LIB_DIR; /* Location of library modules */
|
||||
const char *mapdir = AUTOFS_MAP_DIR; /* Location of mount maps */
|
||||
const char *confdir = AUTOFS_CONF_DIR; /* Location of autofs config file */
|
||||
|
||||
+const char *global_options; /* Global option, from command line */
|
||||
+
|
||||
static char *pid_file = NULL; /* File in which to keep pid */
|
||||
unsigned int random_selection; /* use random policy when selecting
|
||||
* which multi-mount host to mount */
|
||||
@@ -1367,6 +1369,8 @@ static void usage(void)
|
||||
/*" -f --foreground do not fork into background\n" */
|
||||
" -r --random-replicated-selection"
|
||||
" use ramdom replicated server selection\n"
|
||||
+ " -O --global-options"
|
||||
+ " specify global mount options\n"
|
||||
" -V --version print version, build config and exit\n"
|
||||
, program);
|
||||
}
|
||||
@@ -1452,7 +1456,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int res, opt, status;
|
||||
unsigned ghost, logging;
|
||||
- unsigned foreground;
|
||||
+ unsigned foreground, have_global_options;
|
||||
time_t timeout;
|
||||
time_t age = time(NULL);
|
||||
sigset_t allsigs;
|
||||
@@ -1466,6 +1470,7 @@ int main(int argc, char *argv[])
|
||||
{"define", 1, 0, 'D'},
|
||||
{"foreground", 0, 0, 'f'},
|
||||
{"random-selection", 0, 0, 'r'},
|
||||
+ {"global-options", 1, 0, 'O'},
|
||||
{"version", 0, 0, 'V'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
@@ -1482,10 +1487,12 @@ int main(int argc, char *argv[])
|
||||
ghost = defaults_get_browse_mode();
|
||||
logging = defaults_get_logging();
|
||||
random_selection = 0;
|
||||
+ global_options = NULL;
|
||||
+ have_global_options = 0;
|
||||
foreground = 0;
|
||||
|
||||
opterr = 0;
|
||||
- while ((opt = getopt_long(argc, argv, "+hp:t:vdD:fVr", long_options, NULL)) != EOF) {
|
||||
+ while ((opt = getopt_long(argc, argv, "+hp:t:vdD:fVrO:", long_options, NULL)) != EOF) {
|
||||
switch (opt) {
|
||||
case 'h':
|
||||
usage();
|
||||
@@ -1523,6 +1530,16 @@ int main(int argc, char *argv[])
|
||||
random_selection = 1;
|
||||
break;
|
||||
|
||||
+ case 'O':
|
||||
+ if (!have_global_options) {
|
||||
+ global_options = strdup(optarg);
|
||||
+ have_global_options = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ printf("%s: global options already specified.\n",
|
||||
+ program);
|
||||
+ break;
|
||||
+
|
||||
case '?':
|
||||
case ':':
|
||||
printf("%s: Ambiguous or unknown options\n", program);
|
||||
diff --git a/man/automount.8.in b/man/automount.8.in
|
||||
index 59f2805..b01be83 100644
|
||||
--- a/man/automount.8.in
|
||||
+++ b/man/automount.8.in
|
||||
@@ -51,6 +51,12 @@ mount entries.
|
||||
Enables the use of ramdom selection when choosing a host from a
|
||||
list of replicated servers.
|
||||
.TP
|
||||
+.I "\-O, \-\-global-options"
|
||||
+Allows the specification of global mount options used for all master
|
||||
+map entries. These options will either replace or be appened to options
|
||||
+given in a master map entry depending on the APPEND_OPTIONS configuration
|
||||
+setting.
|
||||
+.TP
|
||||
.I "\-V, \-\-version"
|
||||
Display the version number, then exit.
|
||||
.SH ARGUMENTS
|
||||
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
|
||||
index 276493a..0494e76 100644
|
||||
--- a/modules/parse_sun.c
|
||||
+++ b/modules/parse_sun.c
|
||||
@@ -42,6 +42,8 @@ int parse_version = AUTOFS_PARSE_VERSION; /* Required by protocol */
|
||||
static struct mount_mod *mount_nfs = NULL;
|
||||
static int init_ctr = 0;
|
||||
|
||||
+extern const char *global_options;
|
||||
+
|
||||
struct parse_context {
|
||||
char *optstr; /* Mount options */
|
||||
char *macros; /* Map wide macro defines */
|
||||
@@ -65,6 +67,8 @@ static struct parse_context default_context = {
|
||||
1 /* Do slashify_colons */
|
||||
};
|
||||
|
||||
+static char *concat_options(char *left, char *right);
|
||||
+
|
||||
/* Free all storage associated with this context */
|
||||
static void kill_context(struct parse_context *ctxt)
|
||||
{
|
||||
@@ -264,6 +268,7 @@ int parse_init(int argc, const char *const *argv, void **context)
|
||||
const char *xopt;
|
||||
int optlen, len, offset;
|
||||
int i, bval;
|
||||
+ unsigned int append_options;
|
||||
|
||||
/* Get processor information for predefined escapes */
|
||||
|
||||
@@ -392,6 +397,25 @@ int parse_init(int argc, const char *const *argv, void **context)
|
||||
}
|
||||
}
|
||||
|
||||
+ if (global_options) {
|
||||
+ append_options = defaults_get_append_options();
|
||||
+ if (append_options) {
|
||||
+ char *tmp = concat_options(global_options, ctxt->optstr);
|
||||
+ if (!tmp) {
|
||||
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ error(LOGOPT_ANY, MODPREFIX "concat_options: %s", estr);
|
||||
+ } else
|
||||
+ ctxt->optstr = tmp;
|
||||
+ } else {
|
||||
+ if (!ctxt->optstr)
|
||||
+ ctxt->optstr = strdup(global_options);
|
||||
+ if (!ctxt->optstr) {
|
||||
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ warn(LOGOPT_ANY, MODPREFIX "%s", estr);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
debug(LOGOPT_NONE,
|
||||
MODPREFIX "init gathered global options: %s", ctxt->optstr);
|
||||
|
||||
@ -1,158 +0,0 @@
|
||||
diff --git a/include/defaults.h b/include/defaults.h
|
||||
index b64735f..ef58467 100644
|
||||
--- a/include/defaults.h
|
||||
+++ b/include/defaults.h
|
||||
@@ -34,6 +34,7 @@
|
||||
#define DEFAULT_ENTRY_ATTR "cn"
|
||||
#define DEFAULT_VALUE_ATTR "nisMapEntry"
|
||||
|
||||
+#define DEFAULT_APPEND_OPTIONS 1
|
||||
#define DEFAULT_AUTH_CONF_FILE AUTOFS_MAP_DIR "/autofs_ldap_auth.conf"
|
||||
|
||||
unsigned int defaults_read_config(void);
|
||||
@@ -47,6 +48,7 @@ const char *defaults_get_entry_obj_class(void);
|
||||
const char *defaults_get_map_attr(void);
|
||||
const char *defaults_get_entry_attr(void);
|
||||
const char *defaults_get_value_attr(void);
|
||||
+unsigned int defaults_get_append_options(void);
|
||||
const char *defaults_get_auth_conf_file(void);
|
||||
|
||||
#endif
|
||||
diff --git a/lib/defaults.c b/lib/defaults.c
|
||||
index f76478e..4b4acba 100644
|
||||
--- a/lib/defaults.c
|
||||
+++ b/lib/defaults.c
|
||||
@@ -37,6 +37,7 @@
|
||||
#define ENV_NAME_ENTRY_ATTR "ENTRY_ATTRIBUTE"
|
||||
#define ENV_NAME_VALUE_ATTR "VALUE_ATTRIBUTE"
|
||||
|
||||
+#define ENV_APPEND_OPTIONS "APPEND_OPTIONS"
|
||||
#define ENV_AUTH_CONF_FILE "AUTH_CONF_FILE"
|
||||
|
||||
static const char *default_master_map_name = DEFAULT_MASTER_MAP_NAME;
|
||||
@@ -200,6 +201,7 @@ unsigned int defaults_read_config(void)
|
||||
check_set_config_value(res, ENV_NAME_MAP_ATTR, value) ||
|
||||
check_set_config_value(res, ENV_NAME_ENTRY_ATTR, value) ||
|
||||
check_set_config_value(res, ENV_NAME_VALUE_ATTR, value) ||
|
||||
+ check_set_config_value(res, ENV_APPEND_OPTIONS, value) ||
|
||||
check_set_config_value(res, ENV_AUTH_CONF_FILE, value))
|
||||
;
|
||||
}
|
||||
@@ -338,6 +340,17 @@ const char *defaults_get_value_attr(void)
|
||||
return (const char *) va;
|
||||
}
|
||||
|
||||
+unsigned int defaults_get_append_options(void)
|
||||
+{
|
||||
+ int res;
|
||||
+
|
||||
+ res = get_env_yesno(ENV_APPEND_OPTIONS);
|
||||
+ if (res < 0)
|
||||
+ res = DEFAULT_APPEND_OPTIONS;
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
const char *defaults_get_auth_conf_file(void)
|
||||
{
|
||||
char *cf;
|
||||
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
|
||||
index 9323e7c..276493a 100644
|
||||
--- a/modules/parse_sun.c
|
||||
+++ b/modules/parse_sun.c
|
||||
@@ -140,7 +140,7 @@ int expandsunent(const char *src, char *dst, const char *key,
|
||||
* re preserved, we need to escape them here.
|
||||
*/
|
||||
if (strchr(key, ' ')) {
|
||||
- char *keyp = key;
|
||||
+ const char *keyp = key;
|
||||
while (*keyp) {
|
||||
if (isspace(*keyp)) {
|
||||
if (dst) {
|
||||
@@ -953,6 +953,7 @@ int parse_mount(struct autofs_point *ap, const char *name,
|
||||
int mapent_len, rv = 0;
|
||||
int optlen, cur_state;
|
||||
int slashify = ctxt->slashify_colons;
|
||||
+ unsigned int append_options;
|
||||
|
||||
source = ap->entry->current;
|
||||
ap->entry->current = NULL;
|
||||
@@ -998,6 +999,7 @@ int parse_mount(struct autofs_point *ap, const char *name,
|
||||
|
||||
debug(ap->logopt, MODPREFIX "expanded entry: %s", pmapent);
|
||||
|
||||
+ append_options = defaults_get_append_options();
|
||||
options = strdup(ctxt->optstr ? ctxt->optstr : "");
|
||||
if (!options) {
|
||||
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
@@ -1010,10 +1012,10 @@ int parse_mount(struct autofs_point *ap, const char *name,
|
||||
|
||||
/* Deal with 0 or more options */
|
||||
if (*p == '-') {
|
||||
- char *mnt_options = NULL;
|
||||
+ char *tmp, *mnt_options = NULL;
|
||||
|
||||
do {
|
||||
- char *tmp, *noptions = NULL;
|
||||
+ char *noptions = NULL;
|
||||
|
||||
p = parse_options(p, &noptions, ap->logopt);
|
||||
tmp = concat_options(mnt_options, noptions);
|
||||
@@ -1033,10 +1035,25 @@ int parse_mount(struct autofs_point *ap, const char *name,
|
||||
p = skipspace(p);
|
||||
} while (*p == '-');
|
||||
|
||||
- if (options)
|
||||
+ if (options && !append_options) {
|
||||
free(options);
|
||||
+ options = NULL;
|
||||
+ }
|
||||
|
||||
- options = mnt_options;
|
||||
+ if (append_options) {
|
||||
+ tmp = concat_options(options, mnt_options);
|
||||
+ if (!tmp) {
|
||||
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ error(ap->logopt, MODPREFIX "concat_options: %s", estr);
|
||||
+ if (options)
|
||||
+ free(options);
|
||||
+ if (mnt_options)
|
||||
+ free(mnt_options);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ options = tmp;
|
||||
+ } else
|
||||
+ options = mnt_options;
|
||||
}
|
||||
|
||||
debug(ap->logopt, MODPREFIX "gathered options: %s", options);
|
||||
diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in
|
||||
index 84d524b..8299b55 100644
|
||||
--- a/redhat/autofs.sysconfig.in
|
||||
+++ b/redhat/autofs.sysconfig.in
|
||||
@@ -13,6 +13,10 @@ TIMEOUT=300
|
||||
#
|
||||
BROWSE_MODE="no"
|
||||
#
|
||||
+# APPEND_OPTIONS - append to global options instead of replace.
|
||||
+#
|
||||
+#APPEND_OPTIONS="yes"
|
||||
+#
|
||||
# LOGGING - set default log level "none", "verbose" or "debug"
|
||||
#
|
||||
#LOGGING="none"
|
||||
diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
|
||||
index 84d524b..8299b55 100644
|
||||
--- a/samples/autofs.conf.default.in
|
||||
+++ b/samples/autofs.conf.default.in
|
||||
@@ -13,6 +13,10 @@ TIMEOUT=300
|
||||
#
|
||||
BROWSE_MODE="no"
|
||||
#
|
||||
+# APPEND_OPTIONS - append to global options instead of replace.
|
||||
+#
|
||||
+#APPEND_OPTIONS="yes"
|
||||
+#
|
||||
# LOGGING - set default log level "none", "verbose" or "debug"
|
||||
#
|
||||
#LOGGING="none"
|
||||
@ -1,57 +0,0 @@
|
||||
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
|
||||
index cc1964f..6346602 100644
|
||||
--- a/modules/lookup_file.c
|
||||
+++ b/modules/lookup_file.c
|
||||
@@ -979,12 +979,12 @@ static int check_map_indirect(struct autofs_point *ap,
|
||||
}
|
||||
} else {
|
||||
/* Wildcard not in map but now is */
|
||||
- if (wild & (CHE_OK || CHE_UPDATED))
|
||||
+ if (wild & (CHE_OK | CHE_UPDATED))
|
||||
source->stale = 1;
|
||||
}
|
||||
pthread_cleanup_pop(1);
|
||||
|
||||
- if (wild & (CHE_OK || CHE_UPDATED))
|
||||
+ if (wild & (CHE_OK | CHE_UPDATED))
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c
|
||||
index eae8702..83e99e0 100644
|
||||
--- a/modules/lookup_nisplus.c
|
||||
+++ b/modules/lookup_nisplus.c
|
||||
@@ -438,12 +438,12 @@ static int check_map_indirect(struct autofs_point *ap,
|
||||
}
|
||||
} else {
|
||||
/* Wildcard not in map but now is */
|
||||
- if (wild & (CHE_OK || CHE_UPDATED))
|
||||
+ if (wild & (CHE_OK | CHE_UPDATED))
|
||||
source->stale = 1;
|
||||
}
|
||||
pthread_cleanup_pop(1);
|
||||
|
||||
- if (wild & (CHE_UPDATED || CHE_OK))
|
||||
+ if (wild & (CHE_UPDATED | CHE_OK))
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c
|
||||
index 5a154cd..da280cc 100644
|
||||
--- a/modules/lookup_yp.c
|
||||
+++ b/modules/lookup_yp.c
|
||||
@@ -523,12 +523,12 @@ static int check_map_indirect(struct autofs_point *ap,
|
||||
}
|
||||
} else {
|
||||
/* Wildcard not in map but now is */
|
||||
- if (wild & (CHE_OK || CHE_UPDATED))
|
||||
+ if (wild & (CHE_OK | CHE_UPDATED))
|
||||
source->stale = 1;
|
||||
}
|
||||
pthread_cleanup_pop(1);
|
||||
|
||||
- if (wild & (CHE_OK || CHE_UPDATED))
|
||||
+ if (wild & (CHE_OK | CHE_UPDATED))
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c
|
||||
index f6a65ae..a9a4c75 100644
|
||||
--- a/modules/lookup_hosts.c
|
||||
+++ b/modules/lookup_hosts.c
|
||||
@@ -208,7 +208,7 @@ done:
|
||||
exp = rpc_get_exports(name, 10, 0, RPC_CLOSE_NOLINGER);
|
||||
|
||||
/* Check exports for obvious ones we don't have access to */
|
||||
- exp = rpc_exports_prune(exp);
|
||||
+ /*exp = rpc_exports_prune(exp);*/
|
||||
|
||||
mapent = NULL;
|
||||
while (exp) {
|
||||
@ -1,467 +0,0 @@
|
||||
diff --git a/README.v5.release b/README.v5.release
|
||||
index 3f23b91..3b4e02b 100644
|
||||
--- a/README.v5.release
|
||||
+++ b/README.v5.release
|
||||
@@ -13,8 +13,7 @@ Differences between version 4 and version 5.
|
||||
installed "/etc/auto.master" to ensure that those using NIS will
|
||||
still find their master map. This is in line with other industry
|
||||
automount implementations. The name of the default master map can
|
||||
- be overridden by setting the DEFAULT_MASTER_MAP_NAME configuration
|
||||
- variable.
|
||||
+ be overridden by setting the MASTER_MAP_NAME configuration variable.
|
||||
|
||||
- The `automount' daemon is now a multi-threaded application and so
|
||||
appears as a single process (unless a thread process display option
|
||||
diff --git a/gentoo/net-fs/autofs/files/autofs.conf b/gentoo/net-fs/autofs/files/autofs.conf
|
||||
index 836a4a1..7b34c20 100644
|
||||
--- a/gentoo/net-fs/autofs/files/autofs.conf
|
||||
+++ b/gentoo/net-fs/autofs/files/autofs.conf
|
||||
@@ -1,50 +1,50 @@
|
||||
#
|
||||
# Define default options for autofs.
|
||||
#
|
||||
-# DEFAULT_MASTER_MAP_NAME - default map name for the master map.
|
||||
+# MASTER_MAP_NAME - default map name for the master map.
|
||||
#
|
||||
-#DEFAULT_MASTER_MAP_NAME="/etc/auto.master"
|
||||
+#MASTER_MAP_NAME="/etc/auto.master"
|
||||
#
|
||||
-# DEFAULT_TIMEOUT - set the default mount timeout (default 600).
|
||||
+# TIMEOUT - set the default mount timeout (default 600).
|
||||
#
|
||||
-DEFAULT_TIMEOUT=300
|
||||
+TIMEOUT=300
|
||||
#
|
||||
-# DEFAULT_BROWSE_MODE - maps are browsable by default.
|
||||
+# BROWSE_MODE - maps are browsable by default.
|
||||
#
|
||||
-DEFAULT_BROWSE_MODE="no"
|
||||
+BROWSE_MODE="no"
|
||||
#
|
||||
-# DEFAULT_LOGGING - set default log level "none", "verbode" or "debug"
|
||||
+# LOGGING - set default log level "none", "verbode" or "debug"
|
||||
#
|
||||
-#DEFAULT_LOGGING="none"
|
||||
+#LOGGING="none"
|
||||
#
|
||||
# Define the default LDAP schema to use for lookups
|
||||
#
|
||||
# System default
|
||||
#
|
||||
-#DEFAULT_MAP_OBJECT_CLASS="nisMap"
|
||||
-#DEFAULT_ENTRY_OBJECT_CLASS="nisObject"
|
||||
-#DEFAULT_MAP_ATTRIBUTE="nisMapName"
|
||||
-#DEFAULT_ENTRY_ATTRIBUTE="cn"
|
||||
-#DEFAULT_VALUE_ATTRIBUTE="nisMapEntry"
|
||||
+#MAP_OBJECT_CLASS="nisMap"
|
||||
+#ENTRY_OBJECT_CLASS="nisObject"
|
||||
+#MAP_ATTRIBUTE="nisMapName"
|
||||
+#ENTRY_ATTRIBUTE="cn"
|
||||
+#VALUE_ATTRIBUTE="nisMapEntry"
|
||||
#
|
||||
# Other common LDAP nameing
|
||||
#
|
||||
-#DEFAULT_MAP_OBJECT_CLASS="automountMap"
|
||||
-#DEFAULT_ENTRY_OBJECT_CLASS="automount"
|
||||
-#DEFAULT_MAP_ATTRIBUTE="ou"
|
||||
-#DEFAULT_ENTRY_ATTRIBUTE="cn"
|
||||
-#DEFAULT_VALUE_ATTRIBUTE="automountInformation"
|
||||
+#MAP_OBJECT_CLASS="automountMap"
|
||||
+#ENTRY_OBJECT_CLASS="automount"
|
||||
+#MAP_ATTRIBUTE="ou"
|
||||
+#ENTRY_ATTRIBUTE="cn"
|
||||
+#VALUE_ATTRIBUTE="automountInformation"
|
||||
#
|
||||
-#DEFAULT_MAP_OBJECT_CLASS="automountMap"
|
||||
-#DEFAULT_ENTRY_OBJECT_CLASS="automount"
|
||||
-#DEFAULT_MAP_ATTRIBUTE="automountMapName"
|
||||
-#DEFAULT_ENTRY_ATTRIBUTE="automountKey"
|
||||
-#DEFAULT_VALUE_ATTRIBUTE="automountInformation"
|
||||
+#MAP_OBJECT_CLASS="automountMap"
|
||||
+#ENTRY_OBJECT_CLASS="automount"
|
||||
+#MAP_ATTRIBUTE="automountMapName"
|
||||
+#ENTRY_ATTRIBUTE="automountKey"
|
||||
+#VALUE_ATTRIBUTE="automountInformation"
|
||||
#
|
||||
-# DEFAULT_AUTH_CONF_FILE - set the default location for the SASL
|
||||
-# authentication configuration file.
|
||||
+# AUTH_CONF_FILE - set the default location for the SASL
|
||||
+# authentication configuration file.
|
||||
#
|
||||
-#DEFAULT_AUTH_CONF_FILE="/etc/autofs/autofs-auth.conf"
|
||||
+#AUTH_CONF_FILE="/etc/autofs/autofs-auth.conf"
|
||||
#
|
||||
# General global options
|
||||
#
|
||||
diff --git a/lib/defaults.c b/lib/defaults.c
|
||||
index 65dbd8d..f76478e 100644
|
||||
--- a/lib/defaults.c
|
||||
+++ b/lib/defaults.c
|
||||
@@ -23,21 +23,21 @@
|
||||
#define DEFAULTS_CONFIG_FILE AUTOFS_CONF_DIR "/autofs"
|
||||
#define MAX_LINE_LEN 256
|
||||
|
||||
-#define ENV_NAME_MASTER_MAP "DEFAULT_MASTER_MAP_NAME"
|
||||
+#define ENV_NAME_MASTER_MAP "MASTER_MAP_NAME"
|
||||
|
||||
-#define ENV_NAME_TIMEOUT "DEFAULT_TIMEOUT"
|
||||
-#define ENV_NAME_BROWSE_MODE "DEFAULT_BROWSE_MODE"
|
||||
-#define ENV_NAME_LOGGING "DEFAULT_LOGGING"
|
||||
+#define ENV_NAME_TIMEOUT "TIMEOUT"
|
||||
+#define ENV_NAME_BROWSE_MODE "BROWSE_MODE"
|
||||
+#define ENV_NAME_LOGGING "LOGGING"
|
||||
|
||||
-#define ENV_LDAP_SERVER "DEFAULT_LDAP_SERVER"
|
||||
+#define ENV_LDAP_SERVER "LDAP_SERVER"
|
||||
|
||||
-#define ENV_NAME_MAP_OBJ_CLASS "DEFAULT_MAP_OBJECT_CLASS"
|
||||
-#define ENV_NAME_ENTRY_OBJ_CLASS "DEFAULT_ENTRY_OBJECT_CLASS"
|
||||
-#define ENV_NAME_MAP_ATTR "DEFAULT_MAP_ATTRIBUTE"
|
||||
-#define ENV_NAME_ENTRY_ATTR "DEFAULT_ENTRY_ATTRIBUTE"
|
||||
-#define ENV_NAME_VALUE_ATTR "DEFAULT_VALUE_ATTRIBUTE"
|
||||
+#define ENV_NAME_MAP_OBJ_CLASS "MAP_OBJECT_CLASS"
|
||||
+#define ENV_NAME_ENTRY_OBJ_CLASS "ENTRY_OBJECT_CLASS"
|
||||
+#define ENV_NAME_MAP_ATTR "MAP_ATTRIBUTE"
|
||||
+#define ENV_NAME_ENTRY_ATTR "ENTRY_ATTRIBUTE"
|
||||
+#define ENV_NAME_VALUE_ATTR "VALUE_ATTRIBUTE"
|
||||
|
||||
-#define ENV_AUTH_CONF_FILE "DEFAULT_AUTH_CONF_FILE"
|
||||
+#define ENV_AUTH_CONF_FILE "AUTH_CONF_FILE"
|
||||
|
||||
static const char *default_master_map_name = DEFAULT_MASTER_MAP_NAME;
|
||||
|
||||
@@ -104,6 +104,39 @@ static int get_env_yesno(const char *name)
|
||||
}
|
||||
|
||||
/*
|
||||
+ * We've changed the key names so we need to check for the
|
||||
+ * config key and it's old name for backward conpatibility.
|
||||
+*/
|
||||
+static int check_set_config_value(const char *res, const char *name, const char *value)
|
||||
+{
|
||||
+ char *old_name;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!strcasecmp(res, name)) {
|
||||
+ ret = setenv(name, value, 0);
|
||||
+ if (ret)
|
||||
+ fprintf(stderr,
|
||||
+ "can't set config value for %s, "
|
||||
+ "error %d", name, ret);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ old_name = alloca(strlen(name) + 9);
|
||||
+ strcpy(old_name, "DEFAULT_");
|
||||
+ strcat(old_name, name);
|
||||
+
|
||||
+ if (!strcasecmp(res, old_name)) {
|
||||
+ ret = setenv(name, value, 0);
|
||||
+ if (ret)
|
||||
+ fprintf(stderr,
|
||||
+ "can't set config value for %s, "
|
||||
+ "error %d", name, ret);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* Read config env variables and check they have been set.
|
||||
*
|
||||
* This simple minded routine assumes the config file
|
||||
@@ -115,7 +148,6 @@ unsigned int defaults_read_config(void)
|
||||
FILE *f;
|
||||
char buf[MAX_LINE_LEN];
|
||||
char *res, *value;
|
||||
- unsigned int ret;
|
||||
|
||||
f = fopen(DEFAULTS_CONFIG_FILE, "r");
|
||||
if (!f)
|
||||
@@ -158,23 +190,18 @@ unsigned int defaults_read_config(void)
|
||||
while (*trailer && (*trailer == '"' || isblank(*trailer)))
|
||||
*(trailer--) = '\0';;
|
||||
|
||||
- if (!strcasecmp(res, ENV_NAME_MASTER_MAP) ||
|
||||
- !strcasecmp(res, ENV_NAME_TIMEOUT) ||
|
||||
- !strcasecmp(res, ENV_NAME_BROWSE_MODE) ||
|
||||
- !strcasecmp(res, ENV_NAME_LOGGING) ||
|
||||
- !strcasecmp(res, ENV_LDAP_SERVER) ||
|
||||
- !strcasecmp(res, ENV_NAME_MAP_OBJ_CLASS) ||
|
||||
- !strcasecmp(res, ENV_NAME_ENTRY_OBJ_CLASS) ||
|
||||
- !strcasecmp(res, ENV_NAME_MAP_ATTR) ||
|
||||
- !strcasecmp(res, ENV_NAME_ENTRY_ATTR) ||
|
||||
- !strcasecmp(res, ENV_NAME_VALUE_ATTR) ||
|
||||
- !strcasecmp(res, ENV_AUTH_CONF_FILE)) {
|
||||
- ret = setenv(res, value, 0);
|
||||
- if (ret)
|
||||
- fprintf(stderr,
|
||||
- "can't set config value for %s, "
|
||||
- "error %d", res, ret);
|
||||
- }
|
||||
+ if (check_set_config_value(res, ENV_NAME_MASTER_MAP, value) ||
|
||||
+ check_set_config_value(res, ENV_NAME_TIMEOUT, value) ||
|
||||
+ check_set_config_value(res, ENV_NAME_BROWSE_MODE, value) ||
|
||||
+ check_set_config_value(res, ENV_NAME_LOGGING, value) ||
|
||||
+ check_set_config_value(res, ENV_LDAP_SERVER, value) ||
|
||||
+ check_set_config_value(res, ENV_NAME_MAP_OBJ_CLASS, value) ||
|
||||
+ check_set_config_value(res, ENV_NAME_ENTRY_OBJ_CLASS, value) ||
|
||||
+ check_set_config_value(res, ENV_NAME_MAP_ATTR, value) ||
|
||||
+ check_set_config_value(res, ENV_NAME_ENTRY_ATTR, value) ||
|
||||
+ check_set_config_value(res, ENV_NAME_VALUE_ATTR, value) ||
|
||||
+ check_set_config_value(res, ENV_AUTH_CONF_FILE, value))
|
||||
+ ;
|
||||
}
|
||||
|
||||
if (!feof(f)) {
|
||||
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
|
||||
index cb3c1d6..cfeefe7 100644
|
||||
--- a/man/auto.master.5.in
|
||||
+++ b/man/auto.master.5.in
|
||||
@@ -25,7 +25,7 @@ The default location of the master map is
|
||||
but an alternate name may be given on the command line when running
|
||||
the automounter and the default master map may changed by setting the
|
||||
.nh
|
||||
-.B "DEFAULT_MASTER_MAP_NAME"
|
||||
+.B "MASTER_MAP_NAME"
|
||||
.hy
|
||||
configuration variable in
|
||||
.nh
|
||||
@@ -144,13 +144,13 @@ configuration file
|
||||
.hy
|
||||
They are:
|
||||
.TP
|
||||
-.B DEFAULT_TIMEOUT
|
||||
+.B TIMEOUT
|
||||
sets the default mount timeout (program default 600).
|
||||
.TP
|
||||
-.B DEFAULT_BROWSE_MODE
|
||||
+.B BROWSE_MODE
|
||||
Maps are browsable by default (program default "yes").
|
||||
.TP
|
||||
-.B DEFAULT_LOGGING
|
||||
+.B LOGGING
|
||||
set default log level "none", "verbose" or "debug" (program default "none").
|
||||
=======
|
||||
.SH GENERAL SYSTEM DEFAULTS CONFIGURATION
|
||||
@@ -163,13 +163,13 @@ configuration file
|
||||
.P
|
||||
They are:
|
||||
.TP
|
||||
-.B DEFAULT_TIMEOUT
|
||||
+.B TIMEOUT
|
||||
sets the default mount timeout (program default 600).
|
||||
.TP
|
||||
-.B DEFAULT_BROWSE_MODE
|
||||
+.B BROWSE_MODE
|
||||
Maps are browsable by default (program default "yes").
|
||||
.TP
|
||||
-.B DEFAULT_LOGGING
|
||||
+.B LOGGING
|
||||
set default log level "none", "verbose" or "debug" (program default "none").
|
||||
.SH BUILTIN MAP -hosts
|
||||
If "-hosts" is given as the map then accessing a key under the mount point
|
||||
@@ -215,7 +215,7 @@ located in
|
||||
.P
|
||||
The configuration settings available are:
|
||||
.TP
|
||||
-\fBDEFAULT_MAP_OBJECT_CLASS\fP
|
||||
+\fBMAP_OBJECT_CLASS\fP
|
||||
The map object class. Its Default value is "nisMap". In the
|
||||
.nh
|
||||
automountMap
|
||||
@@ -225,14 +225,14 @@ schema this corresponds to the class
|
||||
.BR automountMap .
|
||||
.hy
|
||||
.TP
|
||||
-.B DEFAULT_ENTRY_OBJECT_CLASS
|
||||
+.B ENTRY_OBJECT_CLASS
|
||||
The map entry object class. Its default value is \fBnisObject\fP.
|
||||
In the automountMap schema this corresponds to the class
|
||||
.nh
|
||||
.BR automount .
|
||||
.hy
|
||||
.TP
|
||||
-.B DEFAULT_MAP_ATTRIBUTE
|
||||
+.B MAP_ATTRIBUTE
|
||||
The attribute used to identify the name of the map to which this
|
||||
entry belongs. Its default value is
|
||||
.nh
|
||||
@@ -247,7 +247,7 @@ schema this corresponds to the attributes \fBou\fP or
|
||||
.BR automountMapName .
|
||||
.hy
|
||||
.TP
|
||||
-.B DEFAULT_ENTRY_ATTRIBUTE
|
||||
+.B ENTRY_ATTRIBUTE
|
||||
The attribute used to identify a map key. Its default value is
|
||||
In the
|
||||
.nh
|
||||
@@ -258,7 +258,7 @@ schema this corresponds to the attribute
|
||||
.BR automountKey .
|
||||
.hy
|
||||
.TP
|
||||
-.B DEFAULT_VALUE_ATTRIBUTE
|
||||
+.B VALUE_ATTRIBUTE
|
||||
The attribute used to identify the value of the map entry. Its default
|
||||
value is
|
||||
.nh
|
||||
diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in
|
||||
index 7cbc03f..84d524b 100644
|
||||
--- a/redhat/autofs.sysconfig.in
|
||||
+++ b/redhat/autofs.sysconfig.in
|
||||
@@ -1,50 +1,50 @@
|
||||
#
|
||||
# Define default options for autofs.
|
||||
#
|
||||
-# DEFAULT_MASTER_MAP_NAME - default map name for the master map.
|
||||
+# MASTER_MAP_NAME - default map name for the master map.
|
||||
#
|
||||
-#DEFAULT_MASTER_MAP_NAME="auto.master"
|
||||
+#MASTER_MAP_NAME="auto.master"
|
||||
#
|
||||
-# DEFAULT_TIMEOUT - set the default mount timeout (default 600).
|
||||
+# TIMEOUT - set the default mount timeout (default 600).
|
||||
#
|
||||
-DEFAULT_TIMEOUT=300
|
||||
+TIMEOUT=300
|
||||
#
|
||||
-# DEFAULT_BROWSE_MODE - maps are browsable by default.
|
||||
+# BROWSE_MODE - maps are browsable by default.
|
||||
#
|
||||
-DEFAULT_BROWSE_MODE="no"
|
||||
+BROWSE_MODE="no"
|
||||
#
|
||||
-# DEFAULT_LOGGING - set default log level "none", "verbose" or "debug"
|
||||
+# LOGGING - set default log level "none", "verbose" or "debug"
|
||||
#
|
||||
-#DEFAULT_LOGGING="none"
|
||||
+#LOGGING="none"
|
||||
#
|
||||
# Define the default LDAP schema to use for lookups
|
||||
#
|
||||
# System default
|
||||
#
|
||||
-#DEFAULT_MAP_OBJECT_CLASS="nisMap"
|
||||
-#DEFAULT_ENTRY_OBJECT_CLASS="nisObject"
|
||||
-#DEFAULT_MAP_ATTRIBUTE="nisMapName"
|
||||
-#DEFAULT_ENTRY_ATTRIBUTE="cn"
|
||||
-#DEFAULT_VALUE_ATTRIBUTE="nisMapEntry"
|
||||
+#MAP_OBJECT_CLASS="nisMap"
|
||||
+#ENTRY_OBJECT_CLASS="nisObject"
|
||||
+#MAP_ATTRIBUTE="nisMapName"
|
||||
+#ENTRY_ATTRIBUTE="cn"
|
||||
+#VALUE_ATTRIBUTE="nisMapEntry"
|
||||
#
|
||||
# Other common LDAP nameing
|
||||
#
|
||||
-#DEFAULT_MAP_OBJECT_CLASS="automountMap"
|
||||
-#DEFAULT_ENTRY_OBJECT_CLASS="automount"
|
||||
-#DEFAULT_MAP_ATTRIBUTE="ou"
|
||||
-#DEFAULT_ENTRY_ATTRIBUTE="cn"
|
||||
-#DEFAULT_VALUE_ATTRIBUTE="automountInformation"
|
||||
+#MAP_OBJECT_CLASS="automountMap"
|
||||
+#ENTRY_OBJECT_CLASS="automount"
|
||||
+#MAP_ATTRIBUTE="ou"
|
||||
+#ENTRY_ATTRIBUTE="cn"
|
||||
+#VALUE_ATTRIBUTE="automountInformation"
|
||||
#
|
||||
-#DEFAULT_MAP_OBJECT_CLASS="automountMap"
|
||||
-#DEFAULT_ENTRY_OBJECT_CLASS="automount"
|
||||
-#DEFAULT_MAP_ATTRIBUTE="automountMapName"
|
||||
-#DEFAULT_ENTRY_ATTRIBUTE="automountKey"
|
||||
-#DEFAULT_VALUE_ATTRIBUTE="automountInformation"
|
||||
+#MAP_OBJECT_CLASS="automountMap"
|
||||
+#ENTRY_OBJECT_CLASS="automount"
|
||||
+#MAP_ATTRIBUTE="automountMapName"
|
||||
+#ENTRY_ATTRIBUTE="automountKey"
|
||||
+#VALUE_ATTRIBUTE="automountInformation"
|
||||
#
|
||||
-# DEFAULT_AUTH_CONF_FILE - set the default location for the SASL
|
||||
+# AUTH_CONF_FILE - set the default location for the SASL
|
||||
# authentication configuration file.
|
||||
#
|
||||
-#DEFAULT_AUTH_CONF_FILE="@@autofsmapdir@@/autofs_ldap_auth.conf"
|
||||
+#AUTH_CONF_FILE="@@autofsmapdir@@/autofs_ldap_auth.conf"
|
||||
#
|
||||
# General global options
|
||||
#
|
||||
diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
|
||||
index 7cbc03f..84d524b 100644
|
||||
--- a/samples/autofs.conf.default.in
|
||||
+++ b/samples/autofs.conf.default.in
|
||||
@@ -1,50 +1,50 @@
|
||||
#
|
||||
# Define default options for autofs.
|
||||
#
|
||||
-# DEFAULT_MASTER_MAP_NAME - default map name for the master map.
|
||||
+# MASTER_MAP_NAME - default map name for the master map.
|
||||
#
|
||||
-#DEFAULT_MASTER_MAP_NAME="auto.master"
|
||||
+#MASTER_MAP_NAME="auto.master"
|
||||
#
|
||||
-# DEFAULT_TIMEOUT - set the default mount timeout (default 600).
|
||||
+# TIMEOUT - set the default mount timeout (default 600).
|
||||
#
|
||||
-DEFAULT_TIMEOUT=300
|
||||
+TIMEOUT=300
|
||||
#
|
||||
-# DEFAULT_BROWSE_MODE - maps are browsable by default.
|
||||
+# BROWSE_MODE - maps are browsable by default.
|
||||
#
|
||||
-DEFAULT_BROWSE_MODE="no"
|
||||
+BROWSE_MODE="no"
|
||||
#
|
||||
-# DEFAULT_LOGGING - set default log level "none", "verbose" or "debug"
|
||||
+# LOGGING - set default log level "none", "verbose" or "debug"
|
||||
#
|
||||
-#DEFAULT_LOGGING="none"
|
||||
+#LOGGING="none"
|
||||
#
|
||||
# Define the default LDAP schema to use for lookups
|
||||
#
|
||||
# System default
|
||||
#
|
||||
-#DEFAULT_MAP_OBJECT_CLASS="nisMap"
|
||||
-#DEFAULT_ENTRY_OBJECT_CLASS="nisObject"
|
||||
-#DEFAULT_MAP_ATTRIBUTE="nisMapName"
|
||||
-#DEFAULT_ENTRY_ATTRIBUTE="cn"
|
||||
-#DEFAULT_VALUE_ATTRIBUTE="nisMapEntry"
|
||||
+#MAP_OBJECT_CLASS="nisMap"
|
||||
+#ENTRY_OBJECT_CLASS="nisObject"
|
||||
+#MAP_ATTRIBUTE="nisMapName"
|
||||
+#ENTRY_ATTRIBUTE="cn"
|
||||
+#VALUE_ATTRIBUTE="nisMapEntry"
|
||||
#
|
||||
# Other common LDAP nameing
|
||||
#
|
||||
-#DEFAULT_MAP_OBJECT_CLASS="automountMap"
|
||||
-#DEFAULT_ENTRY_OBJECT_CLASS="automount"
|
||||
-#DEFAULT_MAP_ATTRIBUTE="ou"
|
||||
-#DEFAULT_ENTRY_ATTRIBUTE="cn"
|
||||
-#DEFAULT_VALUE_ATTRIBUTE="automountInformation"
|
||||
+#MAP_OBJECT_CLASS="automountMap"
|
||||
+#ENTRY_OBJECT_CLASS="automount"
|
||||
+#MAP_ATTRIBUTE="ou"
|
||||
+#ENTRY_ATTRIBUTE="cn"
|
||||
+#VALUE_ATTRIBUTE="automountInformation"
|
||||
#
|
||||
-#DEFAULT_MAP_OBJECT_CLASS="automountMap"
|
||||
-#DEFAULT_ENTRY_OBJECT_CLASS="automount"
|
||||
-#DEFAULT_MAP_ATTRIBUTE="automountMapName"
|
||||
-#DEFAULT_ENTRY_ATTRIBUTE="automountKey"
|
||||
-#DEFAULT_VALUE_ATTRIBUTE="automountInformation"
|
||||
+#MAP_OBJECT_CLASS="automountMap"
|
||||
+#ENTRY_OBJECT_CLASS="automount"
|
||||
+#MAP_ATTRIBUTE="automountMapName"
|
||||
+#ENTRY_ATTRIBUTE="automountKey"
|
||||
+#VALUE_ATTRIBUTE="automountInformation"
|
||||
#
|
||||
-# DEFAULT_AUTH_CONF_FILE - set the default location for the SASL
|
||||
+# AUTH_CONF_FILE - set the default location for the SASL
|
||||
# authentication configuration file.
|
||||
#
|
||||
-#DEFAULT_AUTH_CONF_FILE="@@autofsmapdir@@/autofs_ldap_auth.conf"
|
||||
+#AUTH_CONF_FILE="@@autofsmapdir@@/autofs_ldap_auth.conf"
|
||||
#
|
||||
# General global options
|
||||
#
|
||||
@ -1,144 +0,0 @@
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 0bb91e9..34fad3e 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -2,6 +2,7 @@
|
||||
-----------------------
|
||||
- fix return check for getpwuid_r and getgrgid_r.
|
||||
- give up trying to update exports list while host is mounted.
|
||||
+- fix to "@network" matching.
|
||||
|
||||
20/2/2007 autofs-5.0.1
|
||||
----------------------
|
||||
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
|
||||
index f51ca82..2c5b5d5 100644
|
||||
--- a/lib/rpc_subs.c
|
||||
+++ b/lib/rpc_subs.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <rpcsvc/ypclnt.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
+#include <ctype.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "mount.h"
|
||||
@@ -46,6 +47,8 @@
|
||||
#define MAX_IFC_BUF 1024
|
||||
#define MAX_ERR_BUF 128
|
||||
|
||||
+#define MAX_NETWORK_LEN 255
|
||||
+
|
||||
/* Get numeric value of the n bits starting at position p */
|
||||
#define getbits(x, p, n) ((x >> (p + 1 - n)) & ~(~0 << n))
|
||||
|
||||
@@ -1066,6 +1069,9 @@ static char *inet_fill_net(const char *net_num, char *net)
|
||||
char *np;
|
||||
unsigned int dots = 3;
|
||||
|
||||
+ if (strlen(net_num) > INET_ADDRSTRLEN)
|
||||
+ return NULL;
|
||||
+
|
||||
*net = '\0';
|
||||
strcpy(net, net_num);
|
||||
|
||||
@@ -1076,6 +1082,11 @@ static char *inet_fill_net(const char *net_num, char *net)
|
||||
if (!*np && dots)
|
||||
strcat(net, "0");
|
||||
}
|
||||
+
|
||||
+ if (!isdigit(*np) || dots < 0) {
|
||||
+ *net = '\0';
|
||||
+ return NULL;
|
||||
+ }
|
||||
}
|
||||
|
||||
while (dots--)
|
||||
@@ -1088,13 +1099,21 @@ static int match_network(const char *network)
|
||||
{
|
||||
struct netent *pnent, nent;
|
||||
const char *pcnet;
|
||||
- char *net, cnet[INET_ADDRSTRLEN + 1], mask[4], *pmask;
|
||||
+ char *net, cnet[MAX_NETWORK_LEN], mask[4], *pmask;
|
||||
unsigned int size;
|
||||
+ size_t l_network = strlen(network) + 1;
|
||||
int status;
|
||||
|
||||
- net = alloca(strlen(network) + 1);
|
||||
+ if (l_network > MAX_NETWORK_LEN) {
|
||||
+ error(LOGOPT_ANY,
|
||||
+ "match string \"%s\" too long", network);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ net = alloca(l_network);
|
||||
if (!net)
|
||||
return 0;
|
||||
+ memset(net, 0, l_network);
|
||||
strcpy(net, network);
|
||||
|
||||
if ((pmask = strchr(net, '/')))
|
||||
@@ -1115,32 +1134,48 @@ static int match_network(const char *network)
|
||||
if (pnent) {
|
||||
uint32_t n_net;
|
||||
|
||||
- n_net = ntohl(nent.n_net);
|
||||
- pcnet = inet_ntop(nent.n_addrtype, &n_net, cnet, INET_ADDRSTRLEN);
|
||||
- if (!pcnet)
|
||||
+ switch (nent.n_addrtype) {
|
||||
+ case AF_INET:
|
||||
+ n_net = ntohl(nent.n_net);
|
||||
+ pcnet = inet_ntop(AF_INET, &n_net, cnet, INET_ADDRSTRLEN);
|
||||
+ if (!pcnet)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (!pmask) {
|
||||
+ size = inet_get_net_len(nent.n_net);
|
||||
+ if (!size)
|
||||
+ return 0;
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case AF_INET6:
|
||||
return 0;
|
||||
|
||||
- if (!pmask) {
|
||||
- size = inet_get_net_len(nent.n_net);
|
||||
- if (!size)
|
||||
- return 0;
|
||||
+ default:
|
||||
+ return 0;
|
||||
}
|
||||
} else {
|
||||
- struct in_addr addr;
|
||||
int ret;
|
||||
|
||||
- pcnet = inet_fill_net(net, cnet);
|
||||
- if (!pcnet)
|
||||
+ if (strchr(net, ':')) {
|
||||
return 0;
|
||||
+ } else {
|
||||
+ struct in_addr addr;
|
||||
|
||||
- ret = inet_pton(AF_INET, pcnet, &addr);
|
||||
- if (ret <= 0)
|
||||
- return 0;
|
||||
+ pcnet = inet_fill_net(net, cnet);
|
||||
+ if (!pcnet)
|
||||
+ return 0;
|
||||
|
||||
- if (!pmask) {
|
||||
- size = inet_get_net_len(htonl(addr.s_addr));
|
||||
- if (!size)
|
||||
+ ret = inet_pton(AF_INET, pcnet, &addr);
|
||||
+ if (ret <= 0)
|
||||
return 0;
|
||||
+
|
||||
+ if (!pmask) {
|
||||
+ uint32_t nl_addr = htonl(addr.s_addr);
|
||||
+ size = inet_get_net_len(nl_addr);
|
||||
+ if (!size)
|
||||
+ return 0;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index b379431..2fc3c9e 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -4,6 +4,7 @@
|
||||
- give up trying to update exports list while host is mounted.
|
||||
- fix to "@network" matching.
|
||||
- check for fstab update and retry if not updated.
|
||||
+- change file map lexer to allow white-space only blank lines.
|
||||
|
||||
20/2/2007 autofs-5.0.1
|
||||
----------------------
|
||||
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
|
||||
index 0f4d8f1..4a5674e 100644
|
||||
--- a/modules/lookup_file.c
|
||||
+++ b/modules/lookup_file.c
|
||||
@@ -236,11 +236,21 @@ static int read_one(FILE *f, char *key, unsigned int *k_len, char *mapent, unsig
|
||||
|
||||
case st_badent:
|
||||
if (ch == '\n') {
|
||||
+ nch = getc(f);
|
||||
+ if (nch != EOF && isblank(nch)) {
|
||||
+ ungetc(nch, f);
|
||||
+ break;
|
||||
+ }
|
||||
+ ungetc(nch, f);
|
||||
state = st_begin;
|
||||
if (gotten == got_real || gotten == getting)
|
||||
goto got_it;
|
||||
+ warn(LOGOPT_ANY, MODPREFIX
|
||||
+ "bad map entry \"%s...\" for key "
|
||||
+ "\"%s\"", mapent, key);
|
||||
goto next;
|
||||
- }
|
||||
+ } else if (!isblank(ch))
|
||||
+ gotten = got_nothing;
|
||||
break;
|
||||
|
||||
case st_entspc:
|
||||
@@ -274,24 +284,21 @@ static int read_one(FILE *f, char *key, unsigned int *k_len, char *mapent, unsig
|
||||
|
||||
case st_getent:
|
||||
if (ch == '\n') {
|
||||
+ if (escape == esc_all) {
|
||||
+ state = st_begin;
|
||||
+ warn(LOGOPT_ANY, MODPREFIX
|
||||
+ "unmatched \" in %s for key %s",
|
||||
+ mapent, key);
|
||||
+ goto next;
|
||||
+ }
|
||||
nch = getc(f);
|
||||
if (nch != EOF && isblank(nch)) {
|
||||
ungetc(nch, f);
|
||||
state = st_badent;
|
||||
- gotten = got_nothing;
|
||||
- warn(LOGOPT_ANY, MODPREFIX
|
||||
- "bad map entry \"%s...\" for key "
|
||||
- "\"%s\"", mapent, key);
|
||||
break;
|
||||
}
|
||||
ungetc(nch, f);
|
||||
state = st_begin;
|
||||
- if (escape == esc_all) {
|
||||
- warn(LOGOPT_ANY, MODPREFIX
|
||||
- "unmatched \" in %s for key %s",
|
||||
- mapent, key);
|
||||
- goto next;
|
||||
- }
|
||||
if (gotten == got_real || gotten == getting)
|
||||
goto got_it;
|
||||
} else if (mapent_len < MAPENT_MAX_LEN) {
|
||||
@ -1,52 +0,0 @@
|
||||
diff --git a/daemon/lookup.c b/daemon/lookup.c
|
||||
index aded82b..4429edb 100644
|
||||
--- a/daemon/lookup.c
|
||||
+++ b/daemon/lookup.c
|
||||
@@ -423,6 +423,7 @@ int lookup_nss_read_map(struct autofs_point *ap, time_t age)
|
||||
struct nss_source *this;
|
||||
struct map_source *map;
|
||||
enum nsswitch_status status;
|
||||
+ unsigned int at_least_one = 0;
|
||||
int result = 0;
|
||||
|
||||
/*
|
||||
@@ -493,9 +494,13 @@ int lookup_nss_read_map(struct autofs_point *ap, time_t age)
|
||||
if (result == NSS_STATUS_UNKNOWN)
|
||||
continue;
|
||||
|
||||
+ if (result == NSS_STATUS_SUCCESS) {
|
||||
+ at_least_one = 1;
|
||||
+ result = NSS_STATUS_TRYAGAIN;
|
||||
+ }
|
||||
+
|
||||
status = check_nss_result(this, result);
|
||||
if (status >= 0) {
|
||||
- result = !status;
|
||||
map = NULL;
|
||||
break;
|
||||
}
|
||||
@@ -509,7 +514,10 @@ int lookup_nss_read_map(struct autofs_point *ap, time_t age)
|
||||
}
|
||||
pthread_cleanup_pop(1);
|
||||
|
||||
- return !result;
|
||||
+ if (!result || at_least_one)
|
||||
+ return 1;
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
int lookup_ghost(struct autofs_point *ap)
|
||||
diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c
|
||||
index bc75be0..5f03b2f 100644
|
||||
--- a/modules/lookup_yp.c
|
||||
+++ b/modules/lookup_yp.c
|
||||
@@ -305,7 +305,7 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
|
||||
|
||||
mapname = alloca(strlen(ctxt->mapname) + 1);
|
||||
if (!mapname)
|
||||
- return 0;
|
||||
+ return NSS_STATUS_UNKNOWN;
|
||||
|
||||
strcpy(mapname, ctxt->mapname);
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index d416684..0bb91e9 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -1,6 +1,7 @@
|
||||
??/??/2007 autofs-5.0.2
|
||||
-----------------------
|
||||
- fix return check for getpwuid_r and getgrgid_r.
|
||||
+- give up trying to update exports list while host is mounted.
|
||||
|
||||
20/2/2007 autofs-5.0.1
|
||||
----------------------
|
||||
diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c
|
||||
index 1a16b96..8855ed7 100644
|
||||
--- a/modules/lookup_hosts.c
|
||||
+++ b/modules/lookup_hosts.c
|
||||
@@ -189,7 +189,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
|
||||
if (!ret)
|
||||
return NSS_STATUS_SUCCESS;
|
||||
|
||||
- debug(ap->logopt, MODPREFIX "mount failed - update exports list");
|
||||
+ return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
done:
|
||||
/*
|
||||
@ -1,15 +0,0 @@
|
||||
diff --git a/lib/mounts.c b/lib/mounts.c
|
||||
index 524f0ee..0e428e8 100644
|
||||
--- a/lib/mounts.c
|
||||
+++ b/lib/mounts.c
|
||||
@@ -371,7 +371,9 @@ int contained_in_local_fs(const char *path)
|
||||
ret = 1;
|
||||
} else
|
||||
ret = 1;
|
||||
- }
|
||||
+ } else if (!strncmp("LABEL=", this->fs_name, 6) ||
|
||||
+ !strncmp("UUID=", this->fs_name, 5))
|
||||
+ ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,31 +0,0 @@
|
||||
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
|
||||
index 2c5b5d5..5151a1e 100644
|
||||
--- a/lib/rpc_subs.c
|
||||
+++ b/lib/rpc_subs.c
|
||||
@@ -1072,18 +1072,23 @@ static char *inet_fill_net(const char *net_num, char *net)
|
||||
if (strlen(net_num) > INET_ADDRSTRLEN)
|
||||
return NULL;
|
||||
|
||||
+ if (!isdigit(*net_num))
|
||||
+ return NULL;
|
||||
+
|
||||
*net = '\0';
|
||||
strcpy(net, net_num);
|
||||
|
||||
np = net;
|
||||
- while (*np) {
|
||||
- if (*np++ == '.') {
|
||||
+ while (*np++) {
|
||||
+ if (*np == '.') {
|
||||
+ np++;
|
||||
dots--;
|
||||
if (!*np && dots)
|
||||
strcat(net, "0");
|
||||
+ continue;
|
||||
}
|
||||
|
||||
- if (!isdigit(*np) || dots < 0) {
|
||||
+ if ((*np && !isdigit(*np)) || dots < 0) {
|
||||
*net = '\0';
|
||||
return NULL;
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
|
||||
index 5151a1e..831d456 100644
|
||||
--- a/lib/rpc_subs.c
|
||||
+++ b/lib/rpc_subs.c
|
||||
@@ -52,7 +52,7 @@
|
||||
/* Get numeric value of the n bits starting at position p */
|
||||
#define getbits(x, p, n) ((x >> (p + 1 - n)) & ~(~0 << n))
|
||||
|
||||
-static char *ypdomain = NULL;
|
||||
+static char *domain = NULL;
|
||||
|
||||
inline void dump_core(void);
|
||||
static pthread_mutex_t networks_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
@@ -946,8 +946,8 @@ static int name_match(const char *name, const char *pattern)
|
||||
else {
|
||||
ret = !memcmp(name, pattern, strlen(pattern));
|
||||
/* Name could still be a netgroup (Solaris) */
|
||||
- if (!ret && ypdomain)
|
||||
- ret = innetgr(pattern, name, NULL, ypdomain);
|
||||
+ if (!ret)
|
||||
+ ret = innetgr(pattern, name, NULL, domain);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1228,8 +1228,8 @@ static int host_match(char *pattern)
|
||||
if (gethostname(myname, MAXHOSTNAMELEN))
|
||||
return 0;
|
||||
|
||||
- if (yp_get_default_domain(&ypdomain))
|
||||
- ypdomain = NULL;
|
||||
+ if (yp_get_default_domain(&domain))
|
||||
+ domain = NULL;
|
||||
|
||||
if (*m_pattern == '@') {
|
||||
/*
|
||||
@@ -1237,8 +1237,8 @@ static int host_match(char *pattern)
|
||||
* spec or it's a netgroup.
|
||||
*/
|
||||
ret = match_network(m_pattern + 1);
|
||||
- if (!ret && ypdomain)
|
||||
- ret = innetgr(m_pattern + 1, myname, NULL, ypdomain);
|
||||
+ if (!ret)
|
||||
+ ret = innetgr(m_pattern + 1, myname, NULL, domain);
|
||||
} else if (*m_pattern == '.') {
|
||||
size_t m_len = strlen(m_pattern);
|
||||
char *has_dot = strchr(myname, '.');
|
||||
@ -1,173 +0,0 @@
|
||||
--- autofs-5.0.1/include/replicated.h.random-selection 2007-03-16 16:27:36.000000000 +0900
|
||||
+++ autofs-5.0.1/include/replicated.h 2007-03-16 16:27:54.000000000 +0900
|
||||
@@ -60,6 +60,7 @@ struct host {
|
||||
struct host *next;
|
||||
};
|
||||
|
||||
+void seed_random(void);
|
||||
void free_host_list(struct host **);
|
||||
int parse_location(struct host **, const char *);
|
||||
int prune_host_list(struct host **, unsigned int, const char *);
|
||||
--- autofs-5.0.1/modules/replicated.c.random-selection 2007-03-16 16:27:36.000000000 +0900
|
||||
+++ autofs-5.0.1/modules/replicated.c 2007-03-16 16:27:54.000000000 +0900
|
||||
@@ -74,6 +74,29 @@
|
||||
#define max(x, y) (x >= y ? x : y)
|
||||
#define mmax(x, y, z) (max(x, y) == x ? max(x, z) : max(y, z))
|
||||
|
||||
+extern unsigned int random_selection;
|
||||
+
|
||||
+void seed_random(void)
|
||||
+{
|
||||
+ int fd;
|
||||
+ unsigned int seed;
|
||||
+
|
||||
+ fd = open("/dev/random", O_RDONLY);
|
||||
+ if (fd < 0) {
|
||||
+ srandom(time(NULL));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (read(fd, &seed, sizeof(seed)) != -1)
|
||||
+ srandom(seed);
|
||||
+ else
|
||||
+ srandom(time(NULL));
|
||||
+
|
||||
+ close(fd);
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
static unsigned int get_proximity(const char *host_addr, int addr_len)
|
||||
{
|
||||
struct sockaddr_in *msk_addr, *if_addr;
|
||||
@@ -403,7 +426,11 @@ static unsigned int get_nfs_info(struct
|
||||
status = rpc_ping_proto(rpc_info);
|
||||
gettimeofday(&end, &tz);
|
||||
if (status) {
|
||||
- taken += elapsed(start, end);
|
||||
+ if (random_selection)
|
||||
+ /* Random value between 0 and 1 */
|
||||
+ taken += ((float) random())/((float) RAND_MAX+1);
|
||||
+ else
|
||||
+ taken += elapsed(start, end);;
|
||||
count++;
|
||||
supported = NFS4_SUPPORTED;
|
||||
}
|
||||
@@ -440,7 +467,11 @@ v3_ver:
|
||||
status = rpc_ping_proto(rpc_info);
|
||||
gettimeofday(&end, &tz);
|
||||
if (status) {
|
||||
- taken += elapsed(start, end);
|
||||
+ if (random_selection)
|
||||
+ /* Random value between 0 and 1 */
|
||||
+ taken += ((float) random())/((float) RAND_MAX+1);
|
||||
+ else
|
||||
+ taken += elapsed(start, end);;
|
||||
count++;
|
||||
supported |= NFS3_SUPPORTED;
|
||||
}
|
||||
@@ -470,7 +501,11 @@ v2_ver:
|
||||
status = rpc_ping_proto(rpc_info);
|
||||
gettimeofday(&end, &tz);
|
||||
if (status) {
|
||||
- taken += elapsed(start, end);
|
||||
+ if (random_selection)
|
||||
+ /* Random value between 0 and 1 */
|
||||
+ taken += ((float) random())/((float) RAND_MAX+1);
|
||||
+ else
|
||||
+ taken += elapsed(start, end);;
|
||||
count++;
|
||||
supported |= NFS2_SUPPORTED;
|
||||
}
|
||||
@@ -610,8 +645,13 @@ static int get_supported_ver_and_cost(st
|
||||
gettimeofday(&start, &tz);
|
||||
status = rpc_ping_proto(&rpc_info);
|
||||
gettimeofday(&end, &tz);
|
||||
- if (status)
|
||||
- taken = elapsed(start, end);
|
||||
+ if (status) {
|
||||
+ if (random_selection)
|
||||
+ /* Random value between 0 and 1 */
|
||||
+ taken = ((float) random())/((float) RAND_MAX+1);
|
||||
+ else
|
||||
+ taken = elapsed(start, end);
|
||||
+ }
|
||||
}
|
||||
done:
|
||||
if (rpc_info.proto->p_proto == IPPROTO_UDP) {
|
||||
--- autofs-5.0.1/modules/mount_nfs.c.random-selection 2007-03-16 16:27:36.000000000 +0900
|
||||
+++ autofs-5.0.1/modules/mount_nfs.c 2007-03-16 16:27:54.000000000 +0900
|
||||
@@ -51,6 +51,8 @@ int mount_init(void **context)
|
||||
} else
|
||||
init_ctr++;
|
||||
|
||||
+ seed_random();
|
||||
+
|
||||
return !mount_bind;
|
||||
}
|
||||
|
||||
--- autofs-5.0.1/daemon/automount.c.random-selection 2007-03-16 16:27:36.000000000 +0900
|
||||
+++ autofs-5.0.1/daemon/automount.c 2007-03-16 16:27:54.000000000 +0900
|
||||
@@ -48,6 +48,8 @@ const char *mapdir = AUTOFS_MAP_DIR; /*
|
||||
const char *confdir = AUTOFS_CONF_DIR; /* Location of autofs config file */
|
||||
|
||||
static char *pid_file = NULL; /* File in which to keep pid */
|
||||
+unsigned int random_selection; /* use random policy when selecting
|
||||
+ * which multi-mount host to mount */
|
||||
static int start_pipefd[2];
|
||||
static int st_stat = 0;
|
||||
static int *pst_stat = &st_stat;
|
||||
@@ -1363,6 +1365,8 @@ static void usage(void)
|
||||
" -d --debug log debuging info\n"
|
||||
" -D --define define global macro variable\n"
|
||||
/*" -f --foreground do not fork into background\n" */
|
||||
+ " -r --random-replicated-selection"
|
||||
+ " use ramdom replicated server selection\n"
|
||||
" -V --version print version, build config and exit\n"
|
||||
, program);
|
||||
}
|
||||
@@ -1461,6 +1465,7 @@ int main(int argc, char *argv[])
|
||||
{"debug", 0, 0, 'd'},
|
||||
{"define", 1, 0, 'D'},
|
||||
{"foreground", 0, 0, 'f'},
|
||||
+ {"random-selection", 0, 0, 'r'},
|
||||
{"version", 0, 0, 'V'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
@@ -1476,10 +1481,11 @@ int main(int argc, char *argv[])
|
||||
timeout = defaults_get_timeout();
|
||||
ghost = defaults_get_browse_mode();
|
||||
logging = defaults_get_logging();
|
||||
+ random_selection = 0;
|
||||
foreground = 0;
|
||||
|
||||
opterr = 0;
|
||||
- while ((opt = getopt_long(argc, argv, "+hp:t:vdD:fV", long_options, NULL)) != EOF) {
|
||||
+ while ((opt = getopt_long(argc, argv, "+hp:t:vdD:fVr", long_options, NULL)) != EOF) {
|
||||
switch (opt) {
|
||||
case 'h':
|
||||
usage();
|
||||
@@ -1513,6 +1519,10 @@ int main(int argc, char *argv[])
|
||||
show_build_info();
|
||||
exit(0);
|
||||
|
||||
+ case 'r':
|
||||
+ random_selection = 1;
|
||||
+ break;
|
||||
+
|
||||
case '?':
|
||||
case ':':
|
||||
printf("%s: Ambiguous or unknown options\n", program);
|
||||
--- autofs-5.0.1/man/automount.8.in.random-selection 2007-03-16 16:27:36.000000000 +0900
|
||||
+++ autofs-5.0.1/man/automount.8.in 2007-03-16 16:27:54.000000000 +0900
|
||||
@@ -49,6 +49,10 @@ Define a global macro substitution varia
|
||||
are over-ridden macro definitions of the same name specified in
|
||||
mount entries.
|
||||
.TP
|
||||
+.I "\-r, \-\-random-replicated-selection"
|
||||
+Enables the use of ramdom selection when choosing a host from a
|
||||
+list of replicated servers.
|
||||
+.TP
|
||||
.I "\-V, \-\-version"
|
||||
Display the version number, then exit.
|
||||
.SH ARGUMENTS
|
||||
49
autofs.spec
49
autofs.spec
@ -3,34 +3,13 @@
|
||||
#
|
||||
Summary: A tool for automatically mounting and unmounting filesystems
|
||||
Name: autofs
|
||||
Version: 5.0.1
|
||||
Release: 16
|
||||
Version: 5.0.2
|
||||
Release: 1
|
||||
Epoch: 1
|
||||
License: GPL
|
||||
Group: System Environment/Daemons
|
||||
URL: http://wiki.autofs.net/
|
||||
Source: ftp://ftp.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}.tar.bz2
|
||||
Patch1: autofs-5.0.1-check-user-info-return.patch
|
||||
Patch2: autofs-5.0.1-hosts-simple-fail.patch
|
||||
Patch3: autofs-5.0.1-export-check-network-fix-2.patch
|
||||
Patch4: autofs-5.0.1-check-mtab-updated.patch
|
||||
Patch5: autofs-5.0.1-file-map-allow-white-space-only-line.patch
|
||||
Patch6: autofs-5.0.1-network_match-fix.patch
|
||||
Patch7: autofs-5.0.1-drop-default-prefix-from-config.patch
|
||||
Patch8: autofs-5.0.1-random-selection.patch
|
||||
Patch9: autofs-5.0.1-bad-cast.patch
|
||||
Patch10: autofs-5.0.1-fix-browse-dir-create.patch
|
||||
Patch11: autofs-5.0.1-map-update-source-only.patch
|
||||
Patch12: autofs-5.0.1-null-domain-fix.patch
|
||||
Patch13: autofs-5.0.1-conf-append-global.patch
|
||||
Patch14: autofs-5.0.1-cmd-global-options.patch
|
||||
Patch15: autofs-5.0.1-localfs-label-check.patch
|
||||
Patch16: autofs-5.0.1-disable-exports-check.patch
|
||||
Patch17: autofs-5.0.1-cmd-global-options-fix.patch
|
||||
Patch18: autofs-5.0.1-allow-dot-in-master-macro.patch
|
||||
Patch19: autofs-5.0.1-correct-logic-test-wild-lookup.patch
|
||||
Patch20: autofs-5.0.1-alarm-deadlock.patch
|
||||
Patch21: autofs-5.0.1-add-ldaps-support.patch
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel
|
||||
Conflicts: kernel < 2.6.17
|
||||
@ -72,27 +51,6 @@ inkludera nätfilsystem, CD-ROM, floppydiskar, och så vidare.
|
||||
%prep
|
||||
%setup -q
|
||||
echo %{version}-%{release} > .version
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
|
||||
%build
|
||||
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
|
||||
@ -145,6 +103,9 @@ fi
|
||||
%{_libdir}/autofs/
|
||||
|
||||
%changelog
|
||||
* Mon Jun 18 2007 Ian Kent <ikent@redhat.com> - 5.0.2-1
|
||||
- Update to upstream release 5.0.2.
|
||||
|
||||
* Tue Jun 12 2007 Ian Kent <ikent@redhat.com> - 5.0.1-16
|
||||
- add ldaps support.
|
||||
- note: it's no longer possible to have multiple hosts in an ldap map spec.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user