- dont connect at ldap lookup module init.
- fix random selection option. - fix disable timeout. - fix strdup() return value check.
This commit is contained in:
parent
89523c070a
commit
80cd8f58aa
196
autofs-5.0.5-dont-connect-at-ldap-lookup-module-init.patch
Normal file
196
autofs-5.0.5-dont-connect-at-ldap-lookup-module-init.patch
Normal file
@ -0,0 +1,196 @@
|
||||
autofs-5.0.5 - dont connect at ldap lookup module init
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When using LDAP as a map source and no server is available at
|
||||
startup autofs will fiail to mount autofs mounts because it
|
||||
cannot read the mount maps.
|
||||
|
||||
For the case were the master map is available (for example as
|
||||
a file map) indirect autofs mounts should still be able to
|
||||
continue but the LDAP lookup module unnecessarily tryes to
|
||||
connect a an LDAP server and returns a fail if it can't
|
||||
connect causing the autofs mount to not complete.
|
||||
|
||||
If no server is available to obtain the mount information and
|
||||
an entry for a requested mount has not been seen before then
|
||||
mount requests will fail. But, if an entry has previously been
|
||||
seen autofs will use that while the server is unavailable.
|
||||
|
||||
If an autofs indirect mount uses the browse option and no
|
||||
server is available at startup the map cannot be read so no
|
||||
mount point directories will be created (and the mount will
|
||||
behave as though the browse option was not present). A HUP
|
||||
signal can be issued to make autofs read the map and create
|
||||
the map mount point directores. Or the next access to a mount
|
||||
point that isn't already in the cache but in the map on the
|
||||
server will trigger a map re-read.
|
||||
---
|
||||
|
||||
CHANGELOG | 1
|
||||
daemon/lookup.c | 7 ++++-
|
||||
modules/lookup_ldap.c | 61 +++++++++++++++++---------------------------------
|
||||
3 files changed, 28 insertions(+), 41 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -17,6 +17,7 @@
|
||||
- dont fail mount on access fail.
|
||||
- fix rpc fail on large export list.
|
||||
- fix memory leak on reload.
|
||||
+- dont connect at ldap lookup module init.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/daemon/lookup.c
|
||||
+++ autofs-5.0.5/daemon/lookup.c
|
||||
@@ -292,8 +292,13 @@ static int do_read_map(struct autofs_poi
|
||||
* For maps that don't support enumeration return success
|
||||
* and do whatever we must to have autofs function with an
|
||||
* empty map entry cache.
|
||||
+ *
|
||||
+ * For indirect maps that use the browse option, when the
|
||||
+ * server is unavailable continue as best we can with
|
||||
+ * whatever we have in the cache, if anything.
|
||||
*/
|
||||
- if (status == NSS_STATUS_UNKNOWN)
|
||||
+ if (status == NSS_STATUS_UNKNOWN ||
|
||||
+ (ap->type == LKP_INDIRECT && status == NSS_STATUS_UNAVAIL))
|
||||
return NSS_STATUS_SUCCESS;
|
||||
|
||||
return status;
|
||||
--- autofs-5.0.5.orig/modules/lookup_ldap.c
|
||||
+++ autofs-5.0.5/modules/lookup_ldap.c
|
||||
@@ -724,8 +724,12 @@ static LDAP *do_reconnect(unsigned logop
|
||||
uris_mutex_lock(ctxt);
|
||||
if (ctxt->dclist)
|
||||
uri = strdup(ctxt->dclist->uri);
|
||||
- else
|
||||
+ else if (ctxt->uri)
|
||||
uri = strdup(ctxt->uri->uri);
|
||||
+ else {
|
||||
+ uris_mutex_unlock(ctxt);
|
||||
+ goto find_server;
|
||||
+ }
|
||||
uris_mutex_unlock(ctxt);
|
||||
|
||||
if (!uri) {
|
||||
@@ -757,6 +761,7 @@ static LDAP *do_reconnect(unsigned logop
|
||||
autofs_sasl_dispose(ctxt);
|
||||
#endif
|
||||
|
||||
+find_server:
|
||||
/* Current server failed connect, try the rest */
|
||||
ldap = find_server(logopt, ctxt);
|
||||
if (!ldap)
|
||||
@@ -1342,7 +1347,6 @@ int lookup_init(const char *mapfmt, int
|
||||
{
|
||||
struct lookup_context *ctxt;
|
||||
char buf[MAX_ERR_BUF];
|
||||
- LDAP *ldap = NULL;
|
||||
int ret;
|
||||
|
||||
*context = NULL;
|
||||
@@ -1416,23 +1420,6 @@ int lookup_init(const char *mapfmt, int
|
||||
}
|
||||
#endif
|
||||
|
||||
- if (ctxt->server || !ctxt->uris) {
|
||||
- ldap = connect_to_server(LOGOPT_NONE, ctxt->server, ctxt);
|
||||
- if (!ldap) {
|
||||
- free_context(ctxt);
|
||||
- return 1;
|
||||
- }
|
||||
- } else {
|
||||
- ldap = find_server(LOGOPT_NONE, ctxt);
|
||||
- if (!ldap) {
|
||||
- free_context(ctxt);
|
||||
- error(LOGOPT_ANY, MODPREFIX
|
||||
- "failed to find available server");
|
||||
- return 1;
|
||||
- }
|
||||
- }
|
||||
- unbind_ldap_connection(LOGOPT_ANY, ldap, ctxt);
|
||||
-
|
||||
/* Open the parser, if we can. */
|
||||
ctxt->parse = open_parse(mapfmt, MODPREFIX, argc - 1, argv + 1);
|
||||
if (!ctxt->parse) {
|
||||
@@ -1463,6 +1450,11 @@ int lookup_read_master(struct master *ma
|
||||
int scope = LDAP_SCOPE_SUBTREE;
|
||||
LDAP *ldap;
|
||||
|
||||
+ /* Initialize the LDAP context. */
|
||||
+ ldap = do_reconnect(logopt, ctxt);
|
||||
+ if (!ldap)
|
||||
+ return NSS_STATUS_UNAVAIL;
|
||||
+
|
||||
class = ctxt->schema->entry_class;
|
||||
entry = ctxt->schema->entry_attr;
|
||||
info = ctxt->schema->value_attr;
|
||||
@@ -1486,13 +1478,6 @@ int lookup_read_master(struct master *ma
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
- /* Initialize the LDAP context. */
|
||||
- ldap = do_reconnect(logopt, ctxt);
|
||||
- if (!ldap) {
|
||||
- free(query);
|
||||
- return NSS_STATUS_UNAVAIL;
|
||||
- }
|
||||
-
|
||||
/* Look around. */
|
||||
debug(logopt,
|
||||
MODPREFIX "searching for \"%s\" under \"%s\"", query, ctxt->qdn);
|
||||
@@ -2264,6 +2249,11 @@ static int read_one_map(struct autofs_po
|
||||
sp.ap = ap;
|
||||
sp.age = age;
|
||||
|
||||
+ /* Initialize the LDAP context. */
|
||||
+ sp.ldap = do_reconnect(ap->logopt, ctxt);
|
||||
+ if (!sp.ldap)
|
||||
+ return NSS_STATUS_UNAVAIL;
|
||||
+
|
||||
class = ctxt->schema->entry_class;
|
||||
entry = ctxt->schema->entry_attr;
|
||||
info = ctxt->schema->value_attr;
|
||||
@@ -2289,13 +2279,6 @@ static int read_one_map(struct autofs_po
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
- /* Initialize the LDAP context. */
|
||||
- sp.ldap = do_reconnect(ap->logopt, ctxt);
|
||||
- if (!sp.ldap) {
|
||||
- free(sp.query);
|
||||
- return NSS_STATUS_UNAVAIL;
|
||||
- }
|
||||
-
|
||||
/* Look around. */
|
||||
debug(ap->logopt,
|
||||
MODPREFIX "searching for \"%s\" under \"%s\"", sp.query, ctxt->qdn);
|
||||
@@ -2401,6 +2384,11 @@ static int lookup_one(struct autofs_poin
|
||||
return CHE_FAIL;
|
||||
}
|
||||
|
||||
+ /* Initialize the LDAP context. */
|
||||
+ ldap = do_reconnect(ap->logopt, ctxt);
|
||||
+ if (!ldap)
|
||||
+ return CHE_UNAVAIL;
|
||||
+
|
||||
class = ctxt->schema->entry_class;
|
||||
entry = ctxt->schema->entry_attr;
|
||||
info = ctxt->schema->value_attr;
|
||||
@@ -2479,13 +2467,6 @@ static int lookup_one(struct autofs_poin
|
||||
return CHE_FAIL;
|
||||
}
|
||||
|
||||
- /* Initialize the LDAP context. */
|
||||
- ldap = do_reconnect(ap->logopt, ctxt);
|
||||
- if (!ldap) {
|
||||
- free(query);
|
||||
- return CHE_UNAVAIL;
|
||||
- }
|
||||
-
|
||||
debug(ap->logopt,
|
||||
MODPREFIX "searching for \"%s\" under \"%s\"", query, ctxt->qdn);
|
||||
|
35
autofs-5.0.5-fix-disable-timeout.patch
Normal file
35
autofs-5.0.5-fix-disable-timeout.patch
Normal file
@ -0,0 +1,35 @@
|
||||
autofs-5.0.5 - fix disable timeout
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Using a timeout of zero should disable expires but instead causes
|
||||
the alarm handler to fire constant expires.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/alarm.c | 3 +++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -19,6 +19,7 @@
|
||||
- fix memory leak on reload.
|
||||
- dont connect at ldap lookup module init.
|
||||
- fix random selection option.
|
||||
+- fix disable timeout.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/lib/alarm.c
|
||||
+++ autofs-5.0.5/lib/alarm.c
|
||||
@@ -67,6 +67,9 @@ int alarm_add(struct autofs_point *ap, t
|
||||
unsigned int empty = 1;
|
||||
int status;
|
||||
|
||||
+ if (!seconds)
|
||||
+ return 1;
|
||||
+
|
||||
new = malloc(sizeof(struct alarm));
|
||||
if (!new)
|
||||
return 0;
|
35
autofs-5.0.5-fix-random-selection-option.patch
Normal file
35
autofs-5.0.5-fix-random-selection-option.patch
Normal file
@ -0,0 +1,35 @@
|
||||
autofs-5.0.5 - fix random selection option
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When parsing the master map we fail to check if the random selection
|
||||
option has been seen and set the random selection option unconditionally.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/master_parse.y | 3 ++-
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -18,6 +18,7 @@
|
||||
- fix rpc fail on large export list.
|
||||
- fix memory leak on reload.
|
||||
- dont connect at ldap lookup module init.
|
||||
+- fix random selection option.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/lib/master_parse.y
|
||||
+++ autofs-5.0.5/lib/master_parse.y
|
||||
@@ -811,7 +811,8 @@ int master_parse_entry(const char *buffe
|
||||
ops->timeout(ap->logopt, ap->ioctlfd, &tout);
|
||||
}
|
||||
}
|
||||
- entry->ap->flags |= MOUNT_FLAG_RANDOM_SELECT;
|
||||
+ if (random_selection)
|
||||
+ entry->ap->flags |= MOUNT_FLAG_RANDOM_SELECT;
|
||||
if (negative_timeout)
|
||||
entry->ap->negative_timeout = negative_timeout;
|
||||
|
38
autofs-5.0.5-fix-strdup-return-value-check.patch
Normal file
38
autofs-5.0.5-fix-strdup-return-value-check.patch
Normal file
@ -0,0 +1,38 @@
|
||||
autofs-5.0.5 - fix strdup() return value check
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Patch posted by Leonardo Chiquitto.
|
||||
|
||||
Fix copy and paste error when checking strdup() return value, originally
|
||||
reported by David Binderman in:
|
||||
|
||||
http://bugzilla.novell.com/show_bug.cgi?id=523348
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/defaults.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -20,6 +20,7 @@
|
||||
- dont connect at ldap lookup module init.
|
||||
- fix random selection option.
|
||||
- fix disable timeout.
|
||||
+- fix strdup() return value check (Leonardo Chiquitto).
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/lib/defaults.c
|
||||
+++ autofs-5.0.5/lib/defaults.c
|
||||
@@ -65,7 +65,7 @@ static char *get_env_string(const char *
|
||||
return NULL;
|
||||
|
||||
res = strdup(val);
|
||||
- if (!val)
|
||||
+ if (!res)
|
||||
return NULL;
|
||||
|
||||
return res;
|
16
autofs.spec
16
autofs.spec
@ -4,7 +4,7 @@
|
||||
Summary: A tool for automatically mounting and unmounting filesystems
|
||||
Name: autofs
|
||||
Version: 5.0.5
|
||||
Release: 16%{?dist}
|
||||
Release: 17%{?dist}
|
||||
Epoch: 1
|
||||
License: GPLv2+
|
||||
Group: System Environment/Daemons
|
||||
@ -27,6 +27,10 @@ Patch14: autofs-5.0.5-check-for-path-mount-location-in-generic-module.patch
|
||||
Patch15: autofs-5.0.5-dont-fail-mount-on-access-fail.patch
|
||||
Patch16: autofs-5.0.5-fix-rpc-large-export-list.patch
|
||||
Patch17: autofs-5.0.5-fix-memory-leak-on-reload.patch
|
||||
Patch18: autofs-5.0.5-dont-connect-at-ldap-lookup-module-init.patch
|
||||
Patch19: autofs-5.0.5-fix-random-selection-option.patch
|
||||
Patch20: autofs-5.0.5-fix-disable-timeout.patch
|
||||
Patch21: autofs-5.0.5-fix-strdup-return-value-check.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 module-init-tools util-linux nfs-utils e2fsprogs libtirpc-devel
|
||||
Requires: kernel >= 2.6.17
|
||||
@ -85,6 +89,10 @@ echo %{version}-%{release} > .version
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
|
||||
%build
|
||||
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
|
||||
@ -137,6 +145,12 @@ fi
|
||||
%{_libdir}/autofs/
|
||||
|
||||
%changelog
|
||||
* Mon Feb 1 2010 Ian Kent <kpnt@redhat.com> - 1:5.0.5-17
|
||||
- dont connect at ldap lookup module init.
|
||||
- fix random selection option.
|
||||
- fix disable timeout.
|
||||
- fix strdup() return value check.
|
||||
|
||||
* Tue Dec 8 2009 Ian Kent <kpnt@redhat.com> - 1:5.0.5-16
|
||||
- fix memory leak on reload (bz545137).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user