* Mon Jul 4 2011 Ian Kent <ikent@redhat.com> - 1:5.0.6-1
- update source to 5.0.6. - fix ipv6 name for lookup fix. - add dir map-type patch.
This commit is contained in:
parent
567618736c
commit
8903773e97
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
autofs-5.0.5.tar.bz2
|
||||
/autofs-5.0.6.tar.gz
|
||||
|
||||
@ -1,172 +0,0 @@
|
||||
autofs-5.0.4 - add mount wait parameter
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Often delays when trying to mount from a server that is not reponding
|
||||
for some reason are undesirable. To try and prevent these delays we
|
||||
provide a configuration setting to limit the time that we wait for
|
||||
our spawned mount(8) process to complete before sending it a SIGTERM
|
||||
signal. This patch adds a configuration parameter to allow us to
|
||||
request we limit the time we wait for mount(8) to complete before
|
||||
send it a TERM signal.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/spawn.c | 3 ++-
|
||||
include/defaults.h | 2 ++
|
||||
lib/defaults.c | 13 +++++++++++++
|
||||
man/auto.master.5.in | 7 +++++++
|
||||
redhat/autofs.sysconfig.in | 9 +++++++++
|
||||
samples/autofs.conf.default.in | 9 +++++++++
|
||||
7 files changed, 43 insertions(+), 1 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 5adcca5..fadb229 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -2,6 +2,7 @@
|
||||
-----------------------
|
||||
- fix included map read fail handling.
|
||||
- refactor ldap sasl bind handling.
|
||||
+- add mount wait timeout parameter.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/daemon/spawn.c b/daemon/spawn.c
|
||||
index e02d926..db356d4 100644
|
||||
--- a/daemon/spawn.c
|
||||
+++ b/daemon/spawn.c
|
||||
@@ -305,6 +305,7 @@ int spawn_mount(unsigned logopt, ...)
|
||||
unsigned int options;
|
||||
unsigned int retries = MTAB_LOCK_RETRIES;
|
||||
int update_mtab = 1, ret, printed = 0;
|
||||
+ unsigned int wait = defaults_get_mount_wait();
|
||||
char buf[PATH_MAX];
|
||||
|
||||
/* If we use mount locking we can't validate the location */
|
||||
@@ -355,7 +356,7 @@ int spawn_mount(unsigned logopt, ...)
|
||||
va_end(arg);
|
||||
|
||||
while (retries--) {
|
||||
- ret = do_spawn(logopt, -1, options, prog, (const char **) argv);
|
||||
+ ret = do_spawn(logopt, wait, options, prog, (const char **) argv);
|
||||
if (ret & MTAB_NOTUPDATED) {
|
||||
struct timespec tm = {3, 0};
|
||||
|
||||
diff --git a/include/defaults.h b/include/defaults.h
|
||||
index 9bf16e5..cda2174 100644
|
||||
--- a/include/defaults.h
|
||||
+++ b/include/defaults.h
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#define DEFAULT_TIMEOUT 600
|
||||
#define DEFAULT_NEGATIVE_TIMEOUT 60
|
||||
+#define DEFAULT_MOUNT_WAIT -1
|
||||
#define DEFAULT_UMOUNT_WAIT 12
|
||||
#define DEFAULT_BROWSE_MODE 1
|
||||
#define DEFAULT_LOGGING 0
|
||||
@@ -64,6 +65,7 @@ struct ldap_searchdn *defaults_get_searchdns(void);
|
||||
void defaults_free_searchdns(struct ldap_searchdn *);
|
||||
unsigned int defaults_get_mount_nfs_default_proto(void);
|
||||
unsigned int defaults_get_append_options(void);
|
||||
+unsigned int defaults_get_mount_wait(void);
|
||||
unsigned int defaults_get_umount_wait(void);
|
||||
const char *defaults_get_auth_conf_file(void);
|
||||
unsigned int defaults_get_map_hash_table_size(void);
|
||||
diff --git a/lib/defaults.c b/lib/defaults.c
|
||||
index 17164bd..2204b18 100644
|
||||
--- a/lib/defaults.c
|
||||
+++ b/lib/defaults.c
|
||||
@@ -47,6 +47,7 @@
|
||||
|
||||
#define ENV_MOUNT_NFS_DEFAULT_PROTOCOL "MOUNT_NFS_DEFAULT_PROTOCOL"
|
||||
#define ENV_APPEND_OPTIONS "APPEND_OPTIONS"
|
||||
+#define ENV_MOUNT_WAIT "MOUNT_WAIT"
|
||||
#define ENV_UMOUNT_WAIT "UMOUNT_WAIT"
|
||||
#define ENV_AUTH_CONF_FILE "AUTH_CONF_FILE"
|
||||
|
||||
@@ -325,6 +326,7 @@ unsigned int defaults_read_config(unsigned int to_syslog)
|
||||
check_set_config_value(key, ENV_NAME_ENTRY_ATTR, value, to_syslog) ||
|
||||
check_set_config_value(key, ENV_NAME_VALUE_ATTR, value, to_syslog) ||
|
||||
check_set_config_value(key, ENV_APPEND_OPTIONS, value, to_syslog) ||
|
||||
+ check_set_config_value(key, ENV_MOUNT_WAIT, value, to_syslog) ||
|
||||
check_set_config_value(key, ENV_UMOUNT_WAIT, value, to_syslog) ||
|
||||
check_set_config_value(key, ENV_AUTH_CONF_FILE, value, to_syslog) ||
|
||||
check_set_config_value(key, ENV_MAP_HASH_TABLE_SIZE, value, to_syslog) ||
|
||||
@@ -667,6 +669,17 @@ unsigned int defaults_get_append_options(void)
|
||||
return res;
|
||||
}
|
||||
|
||||
+unsigned int defaults_get_mount_wait(void)
|
||||
+{
|
||||
+ long wait;
|
||||
+
|
||||
+ wait = get_env_number(ENV_MOUNT_WAIT);
|
||||
+ if (wait < 0)
|
||||
+ wait = DEFAULT_MOUNT_WAIT;
|
||||
+
|
||||
+ return (unsigned int) wait;
|
||||
+}
|
||||
+
|
||||
unsigned int defaults_get_umount_wait(void)
|
||||
{
|
||||
long wait;
|
||||
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
|
||||
index 71c4402..792035f 100644
|
||||
--- a/man/auto.master.5.in
|
||||
+++ b/man/auto.master.5.in
|
||||
@@ -174,6 +174,13 @@ Set the default timeout for caching failed key lookups (program default
|
||||
60). If the equivalent command line option is given it will override this
|
||||
setting.
|
||||
.TP
|
||||
+.B MOUNT_WAIT
|
||||
+Set the default time to wait for a response from a spawned mount(8)
|
||||
+before sending it a SIGTERM. Note that we still need to wait for the
|
||||
+RPC layer to timeout before the sub-process exits so this isn't ideal
|
||||
+but it is the best we can do. The default is to wait until mount(8)
|
||||
+returns without intervention.
|
||||
+.TP
|
||||
.B UMOUNT_WAIT
|
||||
Set the default time to wait for a response from a spawned umount(8)
|
||||
before sending it a SIGTERM. Note that we still need to wait for the
|
||||
diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in
|
||||
index 37448ea..c72cd2b 100644
|
||||
--- a/redhat/autofs.sysconfig.in
|
||||
+++ b/redhat/autofs.sysconfig.in
|
||||
@@ -14,6 +14,15 @@ TIMEOUT=300
|
||||
#
|
||||
#NEGATIVE_TIMEOUT=60
|
||||
#
|
||||
+# MOUNT_WAIT - time to wait for a response from umount(8).
|
||||
+# Setting this timeout can cause problems when
|
||||
+# mount would otherwise wait for a server that
|
||||
+# is temporarily unavailable, such as when it's
|
||||
+# restarting. The defailt of waiting for mount(8)
|
||||
+# usually results in a wait of around 3 minutes.
|
||||
+#
|
||||
+#MOUNT_WAIT=-1
|
||||
+#
|
||||
# UMOUNT_WAIT - time to wait for a response from umount(8).
|
||||
#
|
||||
#UMOUNT_WAIT=12
|
||||
diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
|
||||
index 7dee5fd..b87c4d0 100644
|
||||
--- a/samples/autofs.conf.default.in
|
||||
+++ b/samples/autofs.conf.default.in
|
||||
@@ -14,6 +14,15 @@ TIMEOUT=300
|
||||
#
|
||||
#NEGATIVE_TIMEOUT=60
|
||||
#
|
||||
+# MOUNT_WAIT - time to wait for a response from umount(8).
|
||||
+# Setting this timeout can cause problems when
|
||||
+# mount would otherwise wait for a server that
|
||||
+# is temporarily unavailable, such as when it's
|
||||
+# restarting. The defailt of waiting for mount(8)
|
||||
+# usually results in a wait of around 3 minutes.
|
||||
+#
|
||||
+#MOUNT_WAIT=-1
|
||||
+#
|
||||
# UMOUNT_WAIT - time to wait for a response from umount(8).
|
||||
#
|
||||
#UMOUNT_WAIT=12
|
||||
@ -1,44 +0,0 @@
|
||||
autofs-5.0.5 - always read file maps mount lookup map read fix
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
If, during a mount lookup, a file map is found to have changed and the
|
||||
browse option is not being used, the file map won't be refreshed, even
|
||||
though file maps should always be read into the cache.
|
||||
|
||||
A previous change for the "always read file maps" optimization moved
|
||||
the check for the browse option into the map module read function so
|
||||
checking for this in send_map_update_request() is not needed and
|
||||
causes nobrowse file maps to not be read if they have changed. This
|
||||
isn't quite optimal as there will be a partial read of the file map
|
||||
to satisfy the lookup and a full read of the map done by the queued
|
||||
update request. I don't think anything can be done about that though.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/master.c | 3 ---
|
||||
2 files changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -49,6 +49,7 @@
|
||||
- remove ERR_remove_state() openssl call.
|
||||
- fix init script restart option.
|
||||
- fix init script status privilege error.
|
||||
+- always read file maps mount lookup map read fix.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/lib/master.c
|
||||
+++ autofs-5.0.5/lib/master.c
|
||||
@@ -489,9 +489,6 @@ void send_map_update_request(struct auto
|
||||
struct map_source *map;
|
||||
int status, need_update = 0;
|
||||
|
||||
- if (!(ap->flags & MOUNT_FLAG_GHOST))
|
||||
- return;
|
||||
-
|
||||
status = pthread_mutex_lock(&instance_mutex);
|
||||
if (status)
|
||||
fatal(status);
|
||||
@ -1,246 +0,0 @@
|
||||
autofs-5.0.5 - add autofs_ldap_auth.conf man page
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
|
||||
---
|
||||
|
||||
CHANGELOG | 1
|
||||
man/auto.master.5.in | 3 +
|
||||
man/autofs.5 | 1
|
||||
man/autofs.8.in | 1
|
||||
man/autofs_ldap_auth.conf.5.in | 93 +++++++++++++++++++++++++++++++++++++++++
|
||||
man/automount.8 | 1
|
||||
samples/autofs_ldap_auth.conf | 64 ----------------------------
|
||||
7 files changed, 101 insertions(+), 63 deletions(-)
|
||||
create mode 100644 man/autofs_ldap_auth.conf.5.in
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -29,6 +29,7 @@
|
||||
- add locality as valid ldap master map attribute fix.
|
||||
- add simple bind authentication.
|
||||
- fix master map source server unavailable handling.
|
||||
+- add autofs_ldap_auth.conf man page.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/man/auto.master.5.in
|
||||
+++ autofs-5.0.5/man/auto.master.5.in
|
||||
@@ -365,6 +365,8 @@ and set the location of the client certi
|
||||
in the per-user configuration. The location of these files and the configuration
|
||||
entry requirements is system dependent so the documentation for your
|
||||
installation will need to be consulted to get further information.
|
||||
+.P
|
||||
+See \fBautofs_ldap_auth.conf\fP(5) for more information.
|
||||
.SH EXAMPLE
|
||||
.sp
|
||||
.RS +.2i
|
||||
@@ -399,6 +401,7 @@ configuration will be used to locate the
|
||||
.BR automount (8),
|
||||
.BR autofs (5),
|
||||
.BR autofs (8).
|
||||
+.BR autofs_ldap_auth.conf (5)
|
||||
.SH AUTHOR
|
||||
This manual page was written by Christoph Lameter <chris@waterf.org>,
|
||||
for the Dean GNU/Linux system. Edited by <hpa@transmeta.com> and
|
||||
--- autofs-5.0.5.orig/man/autofs.5
|
||||
+++ autofs-5.0.5/man/autofs.5
|
||||
@@ -229,6 +229,7 @@ and LDAP only.
|
||||
.BR auto.master (5),
|
||||
.BR autofs (8),
|
||||
.BR mount (8).
|
||||
+.BR autofs_ldap_auth.conf (5)
|
||||
.SH AUTHOR
|
||||
This manual page was written by Christoph Lameter <chris@waterf.org>,
|
||||
for the Debian GNU/Linux system. Edited by H. Peter Avian
|
||||
--- autofs-5.0.5.orig/man/autofs.8.in
|
||||
+++ autofs-5.0.5/man/autofs.8.in
|
||||
@@ -50,6 +50,7 @@ will display the status of,
|
||||
.BR automount (8),
|
||||
.BR autofs (5),
|
||||
.BR auto.master (5).
|
||||
+.BR autofs_ldap_auth.conf (5)
|
||||
.SH AUTHOR
|
||||
This manual page was written by Christoph Lameter <chris@waterf.org>,
|
||||
for the Debi GNU/Linux system. Edited by H. Peter Anvin
|
||||
--- /dev/null
|
||||
+++ autofs-5.0.5/man/autofs_ldap_auth.conf.5.in
|
||||
@@ -0,0 +1,93 @@
|
||||
+.\" t
|
||||
+.TH AUTOFS_LDAP_AUTH.CONF 5 "19 Feb 2010"
|
||||
+.SH NAME
|
||||
+autofs_ldap_auth.conf \- autofs LDAP authentication configuration
|
||||
+.SH "DESCRIPTION"
|
||||
+LDAP authenticated binds, TLS encrypted connections and certification
|
||||
+may be used by setting appropriate values in the autofs authentication
|
||||
+configuration file and configuring the LDAP client with appropriate
|
||||
+settings. The default location of this file is
|
||||
+.nh
|
||||
+.BR @@autofsmapdir@@/autofs_ldap_auth.conf .
|
||||
+.hy
|
||||
+If this file exists it will be used to establish whether TLS or authentication
|
||||
+should be used.
|
||||
+.P
|
||||
+An example of this file is:
|
||||
+.sp
|
||||
+.RS +.2i
|
||||
+.ta 1.0i
|
||||
+.nf
|
||||
+<?xml version="1.0" ?>
|
||||
+<autofs_ldap_sasl_conf
|
||||
+ usetls="yes"
|
||||
+ tlsrequired="no"
|
||||
+ authrequired="no"
|
||||
+ authtype="DIGEST-MD5"
|
||||
+ user="xyz"
|
||||
+ secret="abc"
|
||||
+/>
|
||||
+.fi
|
||||
+.RE
|
||||
+.sp
|
||||
+If TLS encryption is to be used the location of the Certificate Authority
|
||||
+certificate must be set within the LDAP client configuration in
|
||||
+order to validate the server certificate. If, in addition, a certified
|
||||
+connection is to be used then the client certificate and private key file
|
||||
+locations must also be configured within the LDAP client.
|
||||
+.SH "OPTIONS"
|
||||
+This files contains a single XML element, as shown in the example above, with
|
||||
+several attributes.
|
||||
+.TP
|
||||
+The possible attributes are:
|
||||
+.TP
|
||||
+\fBusetls="yes"|"no"\fP
|
||||
+Determines whether an encrypted connection to the ldap server
|
||||
+should be attempted.
|
||||
+.TP
|
||||
+\fBtlsrequired="yes"|"no"\fP
|
||||
+This flag tells whether the ldap connection must be encrypted. If set to "yes",
|
||||
+the automounter will fail to start if an encrypted connection cannot be
|
||||
+established.
|
||||
+.TP
|
||||
+\fBauthrequired="yes"|"no"|"autodetect"|"simple"\fP
|
||||
+This option tells whether an authenticated connection to the ldap server is
|
||||
+required in order to perform ldap queries. If the flag is set to yes, only
|
||||
+sasl authenticated connections will be allowed. If it is set to no then
|
||||
+authentication is not needed for ldap server connections. If it is set to
|
||||
+autodetect then the ldap server will be queried to establish a suitable sasl
|
||||
+authentication mechanism. If no suitable mechanism can be found, connections
|
||||
+to the ldap server are made without authentication. Finally, if it is set to
|
||||
+simple, then simple authentication will be used instead of SASL.
|
||||
+.TP
|
||||
+\fBauthtype="GSSAPI"|"LOGIN"|"PLAIN"|"ANONYMOUS"|"DIGEST-MD5"\fP
|
||||
+This attribute can be used to specify a preferred authentication mechanism.
|
||||
+ In normal operations, the automounter will attempt to authenticate to the
|
||||
+ldap server using the list of supportedSASLmechanisms obtained from the
|
||||
+directory server. Explicitly setting the authtype will bypass this selection
|
||||
+and only try the mechanism specified.
|
||||
+.TP
|
||||
+\fBuser="<username>"\fP
|
||||
+This attribute holds the authentication identity used by authentication
|
||||
+mechanisms that require it. Legal values for this attribute include any
|
||||
+printable characters that can be used by the selected authentication
|
||||
+mechanism.
|
||||
+.TP
|
||||
+\fBsecret="<password>"\fP
|
||||
+This attribute holds the secret used by authentication mechanisms that
|
||||
+require it. Legal values for this attribute include any printable
|
||||
+characters that can be used by the selected authentication mechanism.
|
||||
+.TP
|
||||
+\fBclientprinc="<GSSAPI client principal>"\fP
|
||||
+When using GSSAPI authentication, this attribute is consulted to determine
|
||||
+the principal name to use when authenticating to the directory server. By
|
||||
+default, this will be set to "autofsclient/<fqdn>@<REALM>.
|
||||
+.TP
|
||||
+\fBcredentialcache="<external credential cache path>"\fP
|
||||
+When using GSSAPI authentication, this attribute can be used to specify an
|
||||
+externally configured credential cache that is used during authentication.
|
||||
+By default, autofs will setup a memory based credential cache.
|
||||
+.SH "SEE ALSO"
|
||||
+.BR auto.master (5),
|
||||
+.SH AUTHOR
|
||||
+This manual page was written by Ian Kent <raven@themaw.net>.
|
||||
--- autofs-5.0.5.orig/man/automount.8
|
||||
+++ autofs-5.0.5/man/automount.8
|
||||
@@ -152,6 +152,7 @@ constructed has been detached from the m
|
||||
.BR autofs (8),
|
||||
.BR auto.master (5),
|
||||
.BR mount (8).
|
||||
+.BR autofs_ldap_auth.conf (5)
|
||||
.SH BUGS
|
||||
Don't know, I've fixed everything I know about.
|
||||
|
||||
--- autofs-5.0.5.orig/samples/autofs_ldap_auth.conf
|
||||
+++ autofs-5.0.5/samples/autofs_ldap_auth.conf
|
||||
@@ -1,69 +1,7 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!--
|
||||
This files contains a single entry with multiple attributes tied to it.
|
||||
-The attributes are:
|
||||
-
|
||||
-usetls - Determines whether an encrypted connection to the ldap server
|
||||
- should be attempted. Legal values for the entry are:
|
||||
- "yes"
|
||||
- "no"
|
||||
-
|
||||
-tlsrequired - This flag tells whether the ldap connection must be
|
||||
- encrypted. If set to "yes", the automounter will fail to start
|
||||
- if an encrypted connection cannot be established. Legal values
|
||||
- for this option include:
|
||||
- "yes"
|
||||
- "no"
|
||||
-
|
||||
-authrequired - This option tells whether an authenticated connection to
|
||||
- the ldap server is required in order to perform ldap queries.
|
||||
- If the flag is set to yes, only sasl authenticated connections
|
||||
- will be allowed. If it is set to no then authentication is not
|
||||
- needed for ldap server connections. If it is set to autodetect
|
||||
- then the ldap server will be queried to establish a suitable
|
||||
- sasl authentication mechanism. If no suitable mechanism can be
|
||||
- found, connections to the ldap server are made without
|
||||
- authentication. Finally, if it is set to simple, then simple
|
||||
- authentication will be used instead of SASL.
|
||||
-
|
||||
- Legal values for this option include:
|
||||
- "yes"
|
||||
- "no"
|
||||
- "autodetect"
|
||||
- "simple"
|
||||
-
|
||||
-authtype - This attribute can be used to specify a preferred
|
||||
- authentication mechanism. In normal operations, the
|
||||
- automounter will attempt to authenticate to the ldap server
|
||||
- using the list of supportedSASLmechanisms obtained from the
|
||||
- directory server. Explicitly setting the authtype will bypass
|
||||
- this selection and only try the mechanism specified. Legal
|
||||
- values for this attribute include:
|
||||
- "GSSAPI"
|
||||
- "LOGIN"
|
||||
- "PLAIN"
|
||||
- "ANONYMOUS"
|
||||
- "DIGEST-MD5"
|
||||
-
|
||||
-user - This attribute holds the authentication identity used by
|
||||
- authentication mechanisms that require it. Legal values for
|
||||
- this attribute include any printable characters that can be
|
||||
- used by the selected authentication mechanism.
|
||||
-
|
||||
-secret - This attribute holds the secret used by authentication
|
||||
- mechanisms that require it. Legal values for this attribute
|
||||
- include any printable characters that can be used by the
|
||||
- selected authentication mechanism.
|
||||
-
|
||||
-clientprinc - When using GSSAPI authentication, this attribute is
|
||||
- consulted to determine the principal name to use when
|
||||
- authenticating to the directory server. By default, this will
|
||||
- be set to "autofsclient/<fqdn>@<REALM>.
|
||||
-
|
||||
-credentialcache - When using GSSAPI authentication, this attribute
|
||||
- can be used to specify an externally configured credential
|
||||
- cache that is used during authentication. By default, autofs
|
||||
- will setup a memory based credential cache.
|
||||
+See autofs_ldap_auth.conf(5) for more information.
|
||||
-->
|
||||
|
||||
<autofs_ldap_sasl_conf
|
||||
@ -1,354 +0,0 @@
|
||||
autofs-5.0.5 - add dump maps option
|
||||
|
||||
From: Ondrej Valousek <webserv@s3group.cz>
|
||||
|
||||
Modified by Ian Kent <raven@themaw.net>
|
||||
---
|
||||
|
||||
CHANGELOG | 1
|
||||
daemon/automount.c | 52 +++++++++++++++------
|
||||
include/log.h | 1
|
||||
include/master.h | 1
|
||||
lib/log.c | 14 ++++-
|
||||
lib/master.c | 126 +++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
man/automount.8 | 3 +
|
||||
7 files changed, 180 insertions(+), 18 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -53,6 +53,7 @@
|
||||
- fix direct map not updating on reread.
|
||||
- add external bind method.
|
||||
- fix add simple bind auth.
|
||||
+- add option to dump configured automount maps.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/daemon/automount.c
|
||||
+++ autofs-5.0.5/daemon/automount.c
|
||||
@@ -1664,6 +1664,7 @@ static void usage(void)
|
||||
" -f --foreground do not fork into background\n"
|
||||
" -r --random-multimount-selection\n"
|
||||
" use ramdom replicated server selection\n"
|
||||
+ " -m --dumpmaps dump automounter maps and exit\n"
|
||||
" -n --negative-timeout n\n"
|
||||
" set the timeout for failed key lookups.\n"
|
||||
" -O --global-options\n"
|
||||
@@ -1813,7 +1814,7 @@ int main(int argc, char *argv[])
|
||||
int res, opt, status;
|
||||
int logpri = -1;
|
||||
unsigned ghost, logging, daemon_check;
|
||||
- unsigned foreground, have_global_options;
|
||||
+ unsigned dumpmaps, foreground, have_global_options;
|
||||
time_t timeout;
|
||||
time_t age = time(NULL);
|
||||
struct rlimit rlim;
|
||||
@@ -1827,6 +1828,7 @@ int main(int argc, char *argv[])
|
||||
{"foreground", 0, 0, 'f'},
|
||||
{"random-multimount-selection", 0, 0, 'r'},
|
||||
{"negative-timeout", 1, 0, 'n'},
|
||||
+ {"dumpmaps", 0, 0, 'm'},
|
||||
{"global-options", 1, 0, 'O'},
|
||||
{"version", 0, 0, 'V'},
|
||||
{"set-log-priority", 1, 0, 'l'},
|
||||
@@ -1857,10 +1859,11 @@ int main(int argc, char *argv[])
|
||||
global_options = NULL;
|
||||
have_global_options = 0;
|
||||
foreground = 0;
|
||||
+ dumpmaps = 0;
|
||||
daemon_check = 1;
|
||||
|
||||
opterr = 0;
|
||||
- while ((opt = getopt_long(argc, argv, "+hp:t:vdD:fVrO:l:n:CF", long_options, NULL)) != EOF) {
|
||||
+ while ((opt = getopt_long(argc, argv, "+hp:t:vmdD:fVrO:l:n:CF", long_options, NULL)) != EOF) {
|
||||
switch (opt) {
|
||||
case 'h':
|
||||
usage();
|
||||
@@ -1902,6 +1905,10 @@ int main(int argc, char *argv[])
|
||||
global_negative_timeout = getnumopt(optarg, opt);
|
||||
break;
|
||||
|
||||
+ case 'm':
|
||||
+ dumpmaps = 1;
|
||||
+ break;
|
||||
+
|
||||
case 'O':
|
||||
if (!have_global_options) {
|
||||
global_options = strdup(optarg);
|
||||
@@ -1988,7 +1995,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
- if (!query_kproto_ver() || get_kver_major() < 5) {
|
||||
+ /* Don't need the kernel module just to look at the configured maps */
|
||||
+ if (!dumpmaps && (!query_kproto_ver() || get_kver_major() < 5)) {
|
||||
fprintf(stderr,
|
||||
"%s: test mount forbidden or "
|
||||
"incorrect kernel protocol version, "
|
||||
@@ -2001,34 +2009,50 @@ int main(int argc, char *argv[])
|
||||
rlim.rlim_max = MAX_OPEN_FILES;
|
||||
res = setrlimit(RLIMIT_NOFILE, &rlim);
|
||||
if (res)
|
||||
- warn(logging,
|
||||
- "can't increase open file limit - continuing");
|
||||
+ printf("%s: can't increase open file limit - continuing",
|
||||
+ argv[0]);
|
||||
|
||||
#if ENABLE_CORES
|
||||
rlim.rlim_cur = RLIM_INFINITY;
|
||||
rlim.rlim_max = RLIM_INFINITY;
|
||||
res = setrlimit(RLIMIT_CORE, &rlim);
|
||||
if (res)
|
||||
- warn(logging,
|
||||
- "can't increase core file limit - continuing");
|
||||
+ printf("%s: can't increase core file limit - continuing",
|
||||
+ argv[0]);
|
||||
#endif
|
||||
|
||||
- become_daemon(foreground, daemon_check);
|
||||
-
|
||||
if (argc == 0)
|
||||
master_list = master_new(NULL, timeout, ghost);
|
||||
else
|
||||
master_list = master_new(argv[0], timeout, ghost);
|
||||
|
||||
if (!master_list) {
|
||||
- logerr("%s: can't create master map %s",
|
||||
- program, argv[0]);
|
||||
- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
|
||||
- close(start_pipefd[1]);
|
||||
- release_flag_file();
|
||||
+ printf("%s: can't create master map %s", program, argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+ if (dumpmaps) {
|
||||
+ struct mapent_cache *nc;
|
||||
+
|
||||
+ open_log();
|
||||
+
|
||||
+ master_init_scan();
|
||||
+
|
||||
+ nc = cache_init_null_cache(master_list);
|
||||
+ if (!nc) {
|
||||
+ printf("%s: failed to init null map cache for %s",
|
||||
+ master_list->name, argv[0]);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ master_list->nc = nc;
|
||||
+
|
||||
+ lookup_nss_read_master(master_list, 0);
|
||||
+ master_show_mounts(master_list);
|
||||
+ exit(0);
|
||||
+ }
|
||||
+
|
||||
+ become_daemon(foreground, daemon_check);
|
||||
+
|
||||
if (pthread_attr_init(&th_attr)) {
|
||||
logerr("%s: failed to init thread attribute struct!",
|
||||
program);
|
||||
--- autofs-5.0.5.orig/include/log.h
|
||||
+++ autofs-5.0.5/include/log.h
|
||||
@@ -35,6 +35,7 @@ extern void set_log_verbose_ap(struct au
|
||||
extern void set_log_debug_ap(struct autofs_point *ap);
|
||||
extern void set_mnt_logging(unsigned global_logopt);
|
||||
|
||||
+extern void open_log(void);
|
||||
extern void log_to_syslog(void);
|
||||
extern void log_to_stderr(void);
|
||||
|
||||
--- autofs-5.0.5.orig/include/master.h
|
||||
+++ autofs-5.0.5/include/master.h
|
||||
@@ -110,6 +110,7 @@ int master_submount_list_empty(struct au
|
||||
int master_notify_submount(struct autofs_point *, const char *path, enum states);
|
||||
void master_notify_state_change(struct master *, int);
|
||||
int master_mount_mounts(struct master *, time_t, int);
|
||||
+int master_show_mounts(struct master *);
|
||||
extern inline unsigned int master_get_logopt(void);
|
||||
int master_list_empty(struct master *);
|
||||
int master_done(struct master *);
|
||||
--- autofs-5.0.5.orig/lib/log.c
|
||||
+++ autofs-5.0.5/lib/log.c
|
||||
@@ -193,17 +193,23 @@ void logmsg(const char *msg, ...)
|
||||
return;
|
||||
}
|
||||
|
||||
-void log_to_syslog(void)
|
||||
+void open_log(void)
|
||||
{
|
||||
- char buf[MAX_ERR_BUF];
|
||||
- int nullfd;
|
||||
-
|
||||
if (!syslog_open) {
|
||||
syslog_open = 1;
|
||||
openlog("automount", LOG_PID, LOG_DAEMON);
|
||||
}
|
||||
|
||||
logging_to_syslog = 1;
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+void log_to_syslog(void)
|
||||
+{
|
||||
+ char buf[MAX_ERR_BUF];
|
||||
+ int nullfd;
|
||||
+
|
||||
+ open_log();
|
||||
|
||||
/* Redirect all our file descriptors to /dev/null */
|
||||
nullfd = open("/dev/null", O_RDWR);
|
||||
--- autofs-5.0.5.orig/lib/master.c
|
||||
+++ autofs-5.0.5/lib/master.c
|
||||
@@ -30,6 +30,7 @@
|
||||
/* The root of the map entry tree */
|
||||
struct master *master_list = NULL;
|
||||
|
||||
+extern const char *global_options;
|
||||
extern long global_negative_timeout;
|
||||
|
||||
/* Attribute to create a joinable thread */
|
||||
@@ -1189,6 +1190,131 @@ int master_mount_mounts(struct master *m
|
||||
return 1;
|
||||
}
|
||||
|
||||
+/* The nss source instances end up in reverse order. */
|
||||
+static void list_source_instances(struct map_source *source, struct map_source *instance)
|
||||
+{
|
||||
+ if (!source || !instance) {
|
||||
+ printf("none");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (instance->next)
|
||||
+ list_source_instances(source, instance->next);
|
||||
+
|
||||
+ /*
|
||||
+ * For convienience we map nss instance type "files" to "file".
|
||||
+ * Check for that and report corrected instance type.
|
||||
+ */
|
||||
+ if (strcmp(instance->type, "file"))
|
||||
+ printf("%s ", instance->type);
|
||||
+ else {
|
||||
+ if (source->argv && *(source->argv[0]) != '/')
|
||||
+ printf("files ");
|
||||
+ else
|
||||
+ printf("%s ", instance->type);
|
||||
+ }
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+int master_show_mounts(struct master *master)
|
||||
+{
|
||||
+ struct list_head *p, *head;
|
||||
+
|
||||
+ printf("\nautofs dump map information\n"
|
||||
+ "===========================\n\n");
|
||||
+
|
||||
+ printf("global options: ");
|
||||
+ if (!global_options)
|
||||
+ printf("none configured\n");
|
||||
+ else {
|
||||
+ printf("%s\n", global_options);
|
||||
+ unsigned int append_options = defaults_get_append_options();
|
||||
+ const char *append = append_options ? "will" : "will not";
|
||||
+ printf("global options %s be appended to map entries\n", append);
|
||||
+ }
|
||||
+
|
||||
+ if (list_empty(&master->mounts)) {
|
||||
+ printf("no master map entries found\n\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ head = &master->mounts;
|
||||
+ p = head->next;
|
||||
+ while (p != head) {
|
||||
+ struct map_source *source;
|
||||
+ struct master_mapent *this;
|
||||
+ struct autofs_point *ap;
|
||||
+ time_t now = time(NULL);
|
||||
+ int i;
|
||||
+
|
||||
+ this = list_entry(p, struct master_mapent, list);
|
||||
+ p = p->next;
|
||||
+
|
||||
+ ap = this->ap;
|
||||
+
|
||||
+ printf("\nMount point: %s\n", ap->path);
|
||||
+ printf("\nsource(s):\n");
|
||||
+
|
||||
+ /* Read the map content into the cache */
|
||||
+ if (lookup_nss_read_map(ap, NULL, now))
|
||||
+ lookup_prune_cache(ap, now);
|
||||
+ else {
|
||||
+ printf(" failed to read map\n\n");
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (!this->maps) {
|
||||
+ printf(" no map sources found\n\n");
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ source = this->maps;
|
||||
+ while (source) {
|
||||
+ struct mapent *me;
|
||||
+
|
||||
+ if (source->type)
|
||||
+ printf("\n type: %s\n", source->type);
|
||||
+ else {
|
||||
+ printf("\n instance type(s): ");
|
||||
+ list_source_instances(source, source->instance);
|
||||
+ printf("\n");
|
||||
+ }
|
||||
+
|
||||
+ if (source->argc >= 1) {
|
||||
+ i = 0;
|
||||
+ if (source->argv[0] && *source->argv[0] != '-') {
|
||||
+ printf(" map: %s\n", source->argv[0]);
|
||||
+ i = 1;
|
||||
+ }
|
||||
+ if (source->argc > 1) {
|
||||
+ printf(" arguments: ");
|
||||
+ for (; i < source->argc; i++)
|
||||
+ printf("%s ", source->argv[i]);
|
||||
+ printf("\n");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ printf("\n");
|
||||
+
|
||||
+ me = cache_lookup_first(source->mc);
|
||||
+ if (!me)
|
||||
+ printf(" no keys found in map\n");
|
||||
+ else {
|
||||
+ do {
|
||||
+ printf(" %s | %s\n", me->key, me->mapent);
|
||||
+ } while ((me = cache_lookup_next(source->mc, me)));
|
||||
+ }
|
||||
+
|
||||
+ source = source->next;
|
||||
+ }
|
||||
+
|
||||
+ printf("\n");
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
int master_list_empty(struct master *master)
|
||||
{
|
||||
int res = 0;
|
||||
--- autofs-5.0.5.orig/man/automount.8
|
||||
+++ autofs-5.0.5/man/automount.8
|
||||
@@ -57,6 +57,9 @@ Run the daemon in the forground and log
|
||||
Enables the use of ramdom selection when choosing a host from a
|
||||
list of replicated servers.
|
||||
.TP
|
||||
+.I "\-m, \-\-dumpmaps"
|
||||
+Dump configured automounter maps, then exit.
|
||||
+.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
|
||||
@ -1,404 +0,0 @@
|
||||
autofs-5.0.5 - add external bind method
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Add sasl external bind handler.
|
||||
---
|
||||
|
||||
CHANGELOG | 1
|
||||
include/lookup_ldap.h | 7 ++
|
||||
man/autofs_ldap_auth.conf.5.in | 24 +++++++-
|
||||
modules/Makefile | 5 +
|
||||
modules/cyrus-sasl-extern.c | 117 +++++++++++++++++++++++++++++++++++++++++
|
||||
modules/cyrus-sasl.c | 20 +++++++
|
||||
modules/lookup_ldap.c | 78 ++++++++++++++++++++++-----
|
||||
7 files changed, 234 insertions(+), 18 deletions(-)
|
||||
create mode 100644 modules/cyrus-sasl-extern.c
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -51,6 +51,7 @@
|
||||
- fix init script status privilege error.
|
||||
- always read file maps mount lookup map read fix.
|
||||
- fix direct map not updating on reread.
|
||||
+- add external bind method.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/include/lookup_ldap.h
|
||||
+++ autofs-5.0.5/include/lookup_ldap.h
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <krb5.h>
|
||||
#endif
|
||||
|
||||
+#include "list.h"
|
||||
#include "dclist.h"
|
||||
|
||||
struct ldap_schema {
|
||||
@@ -76,9 +77,13 @@ struct lookup_context {
|
||||
int kinit_done;
|
||||
int kinit_successful;
|
||||
#ifdef WITH_SASL
|
||||
+ /* Kerberos */
|
||||
krb5_context krb5ctxt;
|
||||
krb5_ccache krb5_ccache;
|
||||
sasl_conn_t *sasl_conn;
|
||||
+ /* SASL external */
|
||||
+ char *extern_cert;
|
||||
+ char *extern_key;
|
||||
#endif
|
||||
/* keytab file name needs to be added */
|
||||
|
||||
@@ -111,6 +116,8 @@ int autofs_sasl_bind(unsigned logopt, LD
|
||||
void autofs_sasl_unbind(struct lookup_context *ctxt);
|
||||
void autofs_sasl_dispose(struct lookup_context *ctxt);
|
||||
void autofs_sasl_done(void);
|
||||
+/* cyrus-sasl-extern */
|
||||
+int do_sasl_extern(LDAP *ldap, struct lookup_context *ctxt);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
--- autofs-5.0.5.orig/man/autofs_ldap_auth.conf.5.in
|
||||
+++ autofs-5.0.5/man/autofs_ldap_auth.conf.5.in
|
||||
@@ -60,12 +60,30 @@ authentication mechanism. If no suitabl
|
||||
to the ldap server are made without authentication. Finally, if it is set to
|
||||
simple, then simple authentication will be used instead of SASL.
|
||||
.TP
|
||||
-\fBauthtype="GSSAPI"|"LOGIN"|"PLAIN"|"ANONYMOUS"|"DIGEST-MD5"\fP
|
||||
+\fBauthtype="GSSAPI"|"LOGIN"|"PLAIN"|"ANONYMOUS"|"DIGEST-MD5|EXTERNAL"\fP
|
||||
This attribute can be used to specify a preferred authentication mechanism.
|
||||
- In normal operations, the automounter will attempt to authenticate to the
|
||||
+In normal operations, the automounter will attempt to authenticate to the
|
||||
ldap server using the list of supportedSASLmechanisms obtained from the
|
||||
directory server. Explicitly setting the authtype will bypass this selection
|
||||
-and only try the mechanism specified.
|
||||
+and only try the mechanism specified. The EXTERNAL mechanism may be used to
|
||||
+authenticate using a client certificate and requires that authrequired
|
||||
+set to "yes" if using SSL or usetls, tlsrequired and authrequired all set to
|
||||
+"yes" if using TLS, in addition to authtype being set to EXTERNAL.
|
||||
+.sp
|
||||
+If using authtype EXTERNAL two additional configuration entries are
|
||||
+required:
|
||||
+.sp
|
||||
+\fBexternal_cert="<client certificate path>"\fP
|
||||
+.sp
|
||||
+This specifies the path of the file containing the client certificate.
|
||||
+.sp
|
||||
+\fBexternal_key="<client certificate key path>"\fP
|
||||
+.sp
|
||||
+This specifies the path of the file containing the client certificate key.
|
||||
+.sp
|
||||
+These two configuration entries are mandatory when using the EXTERNAL method
|
||||
+as the HOME environment variable cannot be assumed to be set or, if it is,
|
||||
+to be set to the location we expect.
|
||||
.TP
|
||||
\fBuser="<username>"\fP
|
||||
This attribute holds the authentication identity used by authentication
|
||||
--- autofs-5.0.5.orig/modules/Makefile
|
||||
+++ autofs-5.0.5/modules/Makefile
|
||||
@@ -41,7 +41,7 @@ ifeq ($(LDAP), 1)
|
||||
SRCS += lookup_ldap.c
|
||||
MODS += lookup_ldap.so
|
||||
ifeq ($(SASL), 1)
|
||||
- SASL_OBJ = cyrus-sasl.o
|
||||
+ SASL_OBJ = cyrus-sasl.o cyrus-sasl-extern.o
|
||||
LDAP_FLAGS += $(SASL_FLAGS) $(XML_FLAGS) $(KRB5_FLAGS) -DLDAP_THREAD_SAFE
|
||||
LIBLDAP += $(LIBSASL) $(XML_LIBS) $(KRB5_LIBS)
|
||||
endif
|
||||
@@ -92,6 +92,9 @@ lookup_hesiod.so: lookup_hesiod.c
|
||||
cyrus-sasl.o: cyrus-sasl.c
|
||||
$(CC) $(CFLAGS) $(LDAP_FLAGS) -c $<
|
||||
|
||||
+cyrus-sasl-extern.o: cyrus-sasl-extern.c
|
||||
+ $(CC) $(CFLAGS) $(LDAP_FLAGS) -c $<
|
||||
+
|
||||
lookup_ldap.so: lookup_ldap.c dclist.o $(SASL_OBJ)
|
||||
$(CC) $(SOLDFLAGS) $(CFLAGS) $(LDAP_FLAGS) -o lookup_ldap.so \
|
||||
lookup_ldap.c dclist.o $(SASL_OBJ) \
|
||||
--- /dev/null
|
||||
+++ autofs-5.0.5/modules/cyrus-sasl-extern.c
|
||||
@@ -0,0 +1,117 @@
|
||||
+/*
|
||||
+ * cyrus-sasl-extern.c - Module for Cyrus sasl external authentication.
|
||||
+ *
|
||||
+ * Copyright 2010 Ian Kent <raven@themaw.net>
|
||||
+ * Copyright 2010 Red Hat, Inc.
|
||||
+ * All rights reserved.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
|
||||
+ * USA; either version 2 of the License, or (at your option) any later
|
||||
+ * version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ */
|
||||
+
|
||||
+#include "config.h"
|
||||
+
|
||||
+#ifdef WITH_SASL
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sasl/sasl.h>
|
||||
+#include <ldap.h>
|
||||
+#include <ldap_cdefs.h>
|
||||
+#include <lber_types.h>
|
||||
+
|
||||
+#include "lookup_ldap.h"
|
||||
+
|
||||
+struct values {
|
||||
+ char *mech;
|
||||
+ char *realm;
|
||||
+ char *authcid;
|
||||
+ char *authzid;
|
||||
+ char *password;
|
||||
+ char **resps;
|
||||
+ int nresps;
|
||||
+};
|
||||
+
|
||||
+static int interaction(unsigned flags, sasl_interact_t *interact, void *values)
|
||||
+{
|
||||
+ const char *val = interact->defresult;
|
||||
+ struct values *vals = values;
|
||||
+
|
||||
+ switch(interact->id) {
|
||||
+ case SASL_CB_GETREALM:
|
||||
+ if (values)
|
||||
+ val = vals->realm;
|
||||
+ break;
|
||||
+
|
||||
+ case SASL_CB_AUTHNAME:
|
||||
+ if (values)
|
||||
+ val = vals->authcid;
|
||||
+ break;
|
||||
+
|
||||
+ case SASL_CB_PASS:
|
||||
+ if (values)
|
||||
+ val = vals->password;
|
||||
+ break;
|
||||
+
|
||||
+ case SASL_CB_USER:
|
||||
+ if (values)
|
||||
+ val = vals->authzid;
|
||||
+ break;
|
||||
+
|
||||
+ case SASL_CB_NOECHOPROMPT:
|
||||
+ case SASL_CB_ECHOPROMPT:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (val && !*val)
|
||||
+ val = NULL;
|
||||
+
|
||||
+ if (val || interact->id == SASL_CB_USER) {
|
||||
+ interact->result = (val && *val) ? val : "";
|
||||
+ interact->len = strlen(interact->result);
|
||||
+ }
|
||||
+
|
||||
+ return LDAP_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+int sasl_extern_interact(LDAP *ldap, unsigned flags, void *values, void *list)
|
||||
+{
|
||||
+ sasl_interact_t *interact = list;
|
||||
+
|
||||
+ if (!ldap)
|
||||
+ return LDAP_PARAM_ERROR;
|
||||
+
|
||||
+ while (interact->id != SASL_CB_LIST_END) {
|
||||
+ int rc = interaction(flags, interact, values);
|
||||
+ if (rc)
|
||||
+ return rc;
|
||||
+ interact++;
|
||||
+ }
|
||||
+
|
||||
+ return LDAP_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+int do_sasl_extern(LDAP *ldap, struct lookup_context *ctxt)
|
||||
+{
|
||||
+ int flags = LDAP_SASL_QUIET;
|
||||
+ char *mech = ctxt->sasl_mech;
|
||||
+ struct values values;
|
||||
+ int rc;
|
||||
+
|
||||
+ memset(&values, 0, sizeof(struct values));
|
||||
+ values.mech = mech;
|
||||
+
|
||||
+ rc = ldap_sasl_interactive_bind_s(ldap, NULL, mech, NULL, NULL,
|
||||
+ flags, sasl_extern_interact, &values);
|
||||
+ return rc;
|
||||
+}
|
||||
+#endif
|
||||
--- autofs-5.0.5.orig/modules/cyrus-sasl.c
|
||||
+++ autofs-5.0.5/modules/cyrus-sasl.c
|
||||
@@ -875,6 +875,26 @@ autofs_sasl_bind(unsigned logopt, LDAP *
|
||||
if (ctxt->sasl_conn)
|
||||
return 0;
|
||||
|
||||
+ if (ctxt->sasl_mech && !strncmp(ctxt->sasl_mech, "EXTERNAL", 8)) {
|
||||
+ int result;
|
||||
+
|
||||
+ debug(logopt,
|
||||
+ "Attempting sasl bind with mechanism %s",
|
||||
+ ctxt->sasl_mech);
|
||||
+
|
||||
+ result = do_sasl_extern(ldap, ctxt);
|
||||
+ if (result)
|
||||
+ debug(logopt,
|
||||
+ "Failed to authenticate with mech %s",
|
||||
+ ctxt->sasl_mech);
|
||||
+ else
|
||||
+ debug(logopt,
|
||||
+ "sasl bind with mechanism %s succeeded",
|
||||
+ ctxt->sasl_mech);
|
||||
+
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
sasl_auth_id = ctxt->user;
|
||||
sasl_auth_secret = ctxt->secret;
|
||||
|
||||
--- autofs-5.0.5.orig/modules/lookup_ldap.c
|
||||
+++ autofs-5.0.5/modules/lookup_ldap.c
|
||||
@@ -41,6 +41,9 @@
|
||||
|
||||
int lookup_version = AUTOFS_LOOKUP_VERSION; /* Required by protocol */
|
||||
|
||||
+#define ENV_LDAPTLS_CERT "LDAPTLS_CERT"
|
||||
+#define ENV_LDAPTLS_KEY "LDAPTLS_KEY"
|
||||
+
|
||||
static struct ldap_schema common_schema[] = {
|
||||
{"nisMap", "nisMapName", "nisObject", "cn", "nisMapEntry"},
|
||||
{"automountMap", "ou", "automount", "cn", "automountInformation"},
|
||||
@@ -61,6 +64,16 @@ struct ldap_search_params {
|
||||
|
||||
static int decode_percent_hack(const char *, char **);
|
||||
|
||||
+static int set_env(unsigned logopt, const char *name, const char *val)
|
||||
+{
|
||||
+ int ret = setenv(name, val, 1);
|
||||
+ if (ret == -1) {
|
||||
+ error(logopt, "failed to set config value for %s", name);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
#ifndef HAVE_LDAP_CREATE_PAGE_CONTROL
|
||||
int ldap_create_page_control(LDAP *ldap, ber_int_t pagesize,
|
||||
struct berval *cookie, char isCritical,
|
||||
@@ -578,13 +591,17 @@ static LDAP *do_connect(unsigned logopt,
|
||||
{
|
||||
LDAP *ldap;
|
||||
|
||||
- ldap = init_ldap_connection(logopt, uri, ctxt);
|
||||
- if (!ldap)
|
||||
- return NULL;
|
||||
+ if (ctxt->extern_cert && ctxt->extern_key) {
|
||||
+ set_env(logopt, ENV_LDAPTLS_CERT, ctxt->extern_cert);
|
||||
+ set_env(logopt, ENV_LDAPTLS_KEY, ctxt->extern_key);
|
||||
+ }
|
||||
|
||||
- if (!do_bind(logopt, ldap, uri, ctxt)) {
|
||||
- unbind_ldap_connection(logopt, ldap, ctxt);
|
||||
- return NULL;
|
||||
+ ldap = init_ldap_connection(logopt, uri, ctxt);
|
||||
+ if (ldap) {
|
||||
+ if (!do_bind(logopt, ldap, uri, ctxt)) {
|
||||
+ unbind_ldap_connection(logopt, ldap, ctxt);
|
||||
+ ldap = NULL;
|
||||
+ }
|
||||
}
|
||||
|
||||
return ldap;
|
||||
@@ -839,6 +856,7 @@ int parse_ldap_config(unsigned logopt, s
|
||||
xmlNodePtr root = NULL;
|
||||
char *authrequired, *auth_conf, *authtype;
|
||||
char *user = NULL, *secret = NULL;
|
||||
+ char *extern_cert = NULL, *extern_key = NULL;
|
||||
char *client_princ = NULL, *client_cc = NULL;
|
||||
char *usetls, *tlsrequired;
|
||||
|
||||
@@ -1023,6 +1041,26 @@ int parse_ldap_config(unsigned logopt, s
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
+ } else if (auth_required == LDAP_AUTH_REQUIRED &&
|
||||
+ (authtype && !strncmp(authtype, "EXTERNAL", 8))) {
|
||||
+ ret = get_property(logopt, root, "external_cert", &extern_cert);
|
||||
+ ret |= get_property(logopt, root, "external_key", &extern_key);
|
||||
+ /*
|
||||
+ * For EXTERNAL auth to function we need a client certificate
|
||||
+ * and and certificate key. The ca certificate used to verify
|
||||
+ * the server certificate must also be set correctly in the
|
||||
+ * global configuration as the connection must be encrypted
|
||||
+ * and the server and client certificates must have been
|
||||
+ * verified for the EXTERNAL method to be offerred by the
|
||||
+ * server. If the cert and key have not been set in the autofs
|
||||
+ * configuration they must be set in the ldap rc file.
|
||||
+ */
|
||||
+ if (ret != 0 || !extern_cert || !extern_key) {
|
||||
+ if (extern_cert)
|
||||
+ free(extern_cert);
|
||||
+ if (extern_key)
|
||||
+ free(extern_key);
|
||||
+ }
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1043,6 +1081,8 @@ int parse_ldap_config(unsigned logopt, s
|
||||
ctxt->secret = secret;
|
||||
ctxt->client_princ = client_princ;
|
||||
ctxt->client_cc = client_cc;
|
||||
+ ctxt->extern_cert = extern_cert;
|
||||
+ ctxt->extern_key = extern_key;
|
||||
|
||||
debug(logopt, MODPREFIX
|
||||
"ldap authentication configured with the following options:");
|
||||
@@ -1052,14 +1092,20 @@ int parse_ldap_config(unsigned logopt, s
|
||||
"auth_required: %u, "
|
||||
"sasl_mech: %s",
|
||||
use_tls, tls_required, auth_required, authtype);
|
||||
- debug(logopt, MODPREFIX
|
||||
- "user: %s, "
|
||||
- "secret: %s, "
|
||||
- "client principal: %s "
|
||||
- "credential cache: %s",
|
||||
- user, secret ? "specified" : "unspecified",
|
||||
- client_princ, client_cc);
|
||||
-
|
||||
+ if (authtype && !strncmp(authtype, "EXTERNAL", 8)) {
|
||||
+ debug(logopt, MODPREFIX "external cert: %s",
|
||||
+ extern_cert ? extern_cert : "ldap default");
|
||||
+ debug(logopt, MODPREFIX "external key: %s ",
|
||||
+ extern_key ? extern_key : "ldap default");
|
||||
+ } else {
|
||||
+ debug(logopt, MODPREFIX
|
||||
+ "user: %s, "
|
||||
+ "secret: %s, "
|
||||
+ "client principal: %s "
|
||||
+ "credential cache: %s",
|
||||
+ user, secret ? "specified" : "unspecified",
|
||||
+ client_princ, client_cc);
|
||||
+ }
|
||||
out:
|
||||
xmlFreeDoc(doc);
|
||||
|
||||
@@ -1326,6 +1372,10 @@ static void free_context(struct lookup_c
|
||||
defaults_free_searchdns(ctxt->sdns);
|
||||
if (ctxt->dclist)
|
||||
free_dclist(ctxt->dclist);
|
||||
+ if (ctxt->extern_cert)
|
||||
+ free(ctxt->extern_cert);
|
||||
+ if (ctxt->extern_key)
|
||||
+ free(ctxt->extern_key);
|
||||
free(ctxt);
|
||||
|
||||
return;
|
||||
@ -1,51 +0,0 @@
|
||||
autofs-5.0.5 - add locality as valid ldap master map attribute fix
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
A recent change enabled the use of the locality ("l") attribute in map name
|
||||
dns used in the master map.
|
||||
|
||||
When using an entry like:
|
||||
/mp yp:lnxhome
|
||||
|
||||
the l following the ":" would match a dn patern in the tokenizer leading
|
||||
to a syntax error. This has exposed a bug present for some time as, for
|
||||
the map entry syntax above, this could also happen if the map name started
|
||||
with another attribute, such as "cn" or "o".
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/master_tok.l | 4 ++--
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -26,6 +26,7 @@
|
||||
- fix get query dn failure.
|
||||
- fix ampersand escape in auto.smb.
|
||||
- add locality as valid ldap master map attribute.
|
||||
+- add locality as valid ldap master map attribute fix.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/lib/master_tok.l
|
||||
+++ autofs-5.0.5/lib/master_tok.l
|
||||
@@ -210,7 +210,7 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--
|
||||
}
|
||||
|
||||
{MTYPE} |
|
||||
- {MTYPE}/{DNSERVERSTR}{DNATTRSTR} |
|
||||
+ {MTYPE}/{DNSERVERSTR}{DNATTRSTR}= |
|
||||
{MTYPE}/{DNATTRSTR}= {
|
||||
tlen = master_leng - 1;
|
||||
if (bptr != buff && isblank(master_text[tlen])) {
|
||||
@@ -250,7 +250,7 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--
|
||||
yyless(0);
|
||||
}
|
||||
|
||||
- {DNSERVERSTR}{DNATTRSTR} {
|
||||
+ {DNSERVERSTR}{DNATTRSTR}= {
|
||||
BEGIN(DNSTR);
|
||||
yyless(0);
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
autofs-5.0.5 - add locality as valid ldap master map attribute
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The master map dn string parsing is quite strict so we will need to add
|
||||
allowable attributes as required. One such attribute is "l", the locality.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/master_tok.l | 3 ++-
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -25,6 +25,7 @@
|
||||
- add missing sasl mutex callbacks.
|
||||
- fix get query dn failure.
|
||||
- fix ampersand escape in auto.smb.
|
||||
+- add locality as valid ldap master map attribute.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/lib/master_tok.l
|
||||
+++ autofs-5.0.5/lib/master_tok.l
|
||||
@@ -110,7 +110,8 @@ AT_OU ([oO][[uU])
|
||||
AT_DC ([dD][[cC])
|
||||
AT_O ([oO])
|
||||
AT_C ([cC])
|
||||
-DNATTRSTR ({AT_CN}|{AT_NMN}|{AT_AMN}|{AT_OU}|{AT_DC}|{AT_O}|{AT_C})
|
||||
+AT_L ([lL])
|
||||
+DNATTRSTR ({AT_CN}|{AT_NMN}|{AT_AMN}|{AT_OU}|{AT_DC}|{AT_O}|{AT_C}|{AT_L})
|
||||
DNNAMESTR1 ([[:alnum:]_.\- ]+)
|
||||
DNNAMESTR2 ([[:alnum:]_.\-]+)
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
autofs-5.0.5 - add lsb force-reload and try-restart
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
LSB specifies two additional init script options, force-reload and
|
||||
try-restart. The force-reload option is supposed to do what restart
|
||||
does and does that. The try-restart option is essentially condrestart
|
||||
and is another option for that action. This change is made only to
|
||||
RedHat init script.
|
||||
---
|
||||
|
||||
redhat/autofs.init.in | 10 +++-------
|
||||
1 files changed, 3 insertions(+), 7 deletions(-)
|
||||
|
||||
|
||||
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
|
||||
index 05ab145..4a915ec 100644
|
||||
--- a/redhat/autofs.init.in
|
||||
+++ b/redhat/autofs.init.in
|
||||
@@ -173,7 +173,7 @@ case "$1" in
|
||||
status)
|
||||
status -p /var/run/autofs.pid -l autofs $prog
|
||||
;;
|
||||
- restart)
|
||||
+ restart|force-reload)
|
||||
restart
|
||||
;;
|
||||
forcerestart)
|
||||
@@ -183,19 +183,15 @@ case "$1" in
|
||||
reload)
|
||||
reload
|
||||
;;
|
||||
- condrestart)
|
||||
+ condrestart|try-restart)
|
||||
if [ -f /var/lock/subsys/autofs ]; then
|
||||
restart
|
||||
fi
|
||||
;;
|
||||
usage)
|
||||
- echo $"Usage: $0 {start|forcestart|stop|status|restart|forcerestart|reload|condrestart}"
|
||||
+ echo $"Usage: $0 {start|forcestart|stop|status|restart|force-reload|forcerestart|reload|condrestart|try-restart}"
|
||||
exit 0
|
||||
;;
|
||||
- try-restart|force-reload)
|
||||
- echo "$1 service action not supported"
|
||||
- exit 3
|
||||
- ;;
|
||||
*)
|
||||
echo "unknown, invalid or excess argument(s)"
|
||||
exit 2
|
||||
@ -1,98 +0,0 @@
|
||||
autofs-5.0.5 - add sasl mutex callbacks
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
We missed the fact that Cyrus SASL requires the user to provide mutex
|
||||
handling functions when being used in a threaded environment.
|
||||
|
||||
Original patch contributed by Kazuhiro Kikuchi (of Fujitsu), slightly
|
||||
modified by myself.
|
||||
---
|
||||
|
||||
CHANGELOG | 1
|
||||
modules/cyrus-sasl.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 58 insertions(+)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -22,6 +22,7 @@
|
||||
- fix disable timeout.
|
||||
- fix strdup() return value check (Leonardo Chiquitto).
|
||||
- fix reconnect get base dn.
|
||||
+- add missing sasl mutex callbacks.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/modules/cyrus-sasl.c
|
||||
+++ autofs-5.0.5/modules/cyrus-sasl.c
|
||||
@@ -944,12 +944,69 @@ void autofs_sasl_dispose(struct lookup_c
|
||||
}
|
||||
}
|
||||
|
||||
+static void *sasl_mutex_new(void)
|
||||
+{
|
||||
+ pthread_mutex_t* mutex;
|
||||
+
|
||||
+ mutex = malloc(sizeof(pthread_mutex_t));
|
||||
+ if (!mutex)
|
||||
+ return 0;
|
||||
+
|
||||
+ pthread_mutex_init(mutex, NULL);
|
||||
+
|
||||
+ return (void *) mutex;
|
||||
+}
|
||||
+
|
||||
+static int sasl_mutex_lock(void *mutex __attribute__((unused)))
|
||||
+{
|
||||
+ int rc;
|
||||
+
|
||||
+ if (!mutex)
|
||||
+ return SASL_FAIL;
|
||||
+
|
||||
+ rc = pthread_mutex_lock((pthread_mutex_t *) mutex);
|
||||
+
|
||||
+ return (rc==0 ? SASL_OK : SASL_FAIL);
|
||||
+}
|
||||
+
|
||||
+static int sasl_mutex_unlock(void *mutex __attribute__((unused)))
|
||||
+{
|
||||
+ int rc;
|
||||
+
|
||||
+ if (!mutex)
|
||||
+ return SASL_FAIL;
|
||||
+
|
||||
+ rc = pthread_mutex_unlock((pthread_mutex_t *) mutex);
|
||||
+
|
||||
+ return (rc==0 ? SASL_OK : SASL_FAIL);
|
||||
+}
|
||||
+
|
||||
+static void sasl_mutex_dispose(void *mutex __attribute__((unused)))
|
||||
+{
|
||||
+ int rc;
|
||||
+
|
||||
+ if (!mutex)
|
||||
+ return;
|
||||
+
|
||||
+ rc = pthread_mutex_destroy((pthread_mutex_t *) mutex);
|
||||
+ if (rc == 0)
|
||||
+ free(mutex);
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Initialize the sasl callbacks, which increments the global
|
||||
* use counter.
|
||||
*/
|
||||
int autofs_sasl_client_init(unsigned logopt)
|
||||
{
|
||||
+
|
||||
+ sasl_set_mutex(sasl_mutex_new,
|
||||
+ sasl_mutex_lock,
|
||||
+ sasl_mutex_unlock,
|
||||
+ sasl_mutex_dispose);
|
||||
+
|
||||
/* Start up Cyrus SASL--only needs to be done at library load. */
|
||||
if (sasl_client_init(callbacks) != SASL_OK) {
|
||||
error(logopt, "sasl_client_init failed");
|
||||
@ -1,124 +0,0 @@
|
||||
autofs-5.0.5 - add simple bind authentication
|
||||
|
||||
From: James Y Knight <foom@fuhm.net>
|
||||
|
||||
This patch adds the ability to do a simple bind against an LDAP server with
|
||||
the configured username and password.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
include/lookup_ldap.h | 1 +
|
||||
modules/lookup_ldap.c | 21 +++++++++++++--------
|
||||
samples/autofs_ldap_auth.conf | 15 +++++++++------
|
||||
4 files changed, 24 insertions(+), 14 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -27,6 +27,7 @@
|
||||
- fix ampersand escape in auto.smb.
|
||||
- add locality as valid ldap master map attribute.
|
||||
- add locality as valid ldap master map attribute fix.
|
||||
+- add simple bind authentication.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/include/lookup_ldap.h
|
||||
+++ autofs-5.0.5/include/lookup_ldap.h
|
||||
@@ -97,6 +97,7 @@ struct lookup_context {
|
||||
#define LDAP_AUTH_NOTREQUIRED 0x0001
|
||||
#define LDAP_AUTH_REQUIRED 0x0002
|
||||
#define LDAP_AUTH_AUTODETECT 0x0004
|
||||
+#define LDAP_AUTH_USESIMPLE 0x0008
|
||||
|
||||
/* lookup_ldap.c */
|
||||
LDAP *init_ldap_connection(unsigned logopt, const char *uri, struct lookup_context *ctxt);
|
||||
--- autofs-5.0.5.orig/modules/lookup_ldap.c
|
||||
+++ autofs-5.0.5/modules/lookup_ldap.c
|
||||
@@ -137,11 +137,13 @@ static void uris_mutex_unlock(struct loo
|
||||
return;
|
||||
}
|
||||
|
||||
-int bind_ldap_anonymous(unsigned logopt, LDAP *ldap, const char *uri, struct lookup_context *ctxt)
|
||||
+int bind_ldap_simple(unsigned logopt, LDAP *ldap, const char *uri, struct lookup_context *ctxt)
|
||||
{
|
||||
int rv;
|
||||
|
||||
- if (ctxt->version == 2)
|
||||
+ if (ctxt->auth_required == LDAP_AUTH_USESIMPLE)
|
||||
+ rv = ldap_simple_bind_s(ldap, ctxt->user, ctxt->secret);
|
||||
+ else if (ctxt->version == 2)
|
||||
rv = ldap_simple_bind_s(ldap, ctxt->base, NULL);
|
||||
else
|
||||
rv = ldap_simple_bind_s(ldap, NULL, NULL);
|
||||
@@ -517,12 +519,12 @@ static int do_bind(unsigned logopt, LDAP
|
||||
rv = autofs_sasl_bind(logopt, ldap, ctxt);
|
||||
debug(logopt, MODPREFIX "autofs_sasl_bind returned %d", rv);
|
||||
} else {
|
||||
- rv = bind_ldap_anonymous(logopt, ldap, uri, ctxt);
|
||||
- debug(logopt, MODPREFIX "ldap anonymous bind returned %d", rv);
|
||||
+ rv = bind_ldap_simple(logopt, ldap, uri, ctxt);
|
||||
+ debug(logopt, MODPREFIX "ldap simple bind returned %d", rv);
|
||||
}
|
||||
#else
|
||||
- rv = bind_ldap_anonymous(logopt, ldap, uri, ctxt);
|
||||
- debug(logopt, MODPREFIX "ldap anonymous bind returned %d", rv);
|
||||
+ rv = bind_ldap_simple(logopt, ldap, uri, ctxt);
|
||||
+ debug(logopt, MODPREFIX "ldap simple bind returned %d", rv);
|
||||
#endif
|
||||
|
||||
if (rv != 0)
|
||||
@@ -971,11 +973,13 @@ int parse_ldap_config(unsigned logopt, s
|
||||
auth_required = LDAP_AUTH_NOTREQUIRED;
|
||||
else if (!strcasecmp(authrequired, "autodetect"))
|
||||
auth_required = LDAP_AUTH_AUTODETECT;
|
||||
+ else if (!strcasecmp(authrequired, "simple"))
|
||||
+ auth_required = LDAP_AUTH_USESIMPLE;
|
||||
else {
|
||||
error(logopt,
|
||||
MODPREFIX
|
||||
"The authrequired property must have value "
|
||||
- "\"yes\", \"no\" or \"autodetect\".");
|
||||
+ "\"yes\", \"no\", \"autodetect\", or \"simple\".");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
@@ -991,7 +995,8 @@ int parse_ldap_config(unsigned logopt, s
|
||||
goto out;
|
||||
}
|
||||
|
||||
- if (authtype && authtype_requires_creds(authtype)) {
|
||||
+ if (auth_required == LDAP_AUTH_USESIMPLE ||
|
||||
+ (authtype && authtype_requires_creds(authtype))) {
|
||||
ret = get_property(logopt, root, "user", &user);
|
||||
ret |= get_property(logopt, root, "secret", &secret);
|
||||
if (ret != 0 || (!user || !secret)) {
|
||||
--- autofs-5.0.5.orig/samples/autofs_ldap_auth.conf
|
||||
+++ autofs-5.0.5/samples/autofs_ldap_auth.conf
|
||||
@@ -17,17 +17,20 @@ tlsrequired - This flag tells whether
|
||||
|
||||
authrequired - This option tells whether an authenticated connection to
|
||||
the ldap server is required in order to perform ldap queries.
|
||||
- If this flag is set to yes, then only authenticated connections
|
||||
+ If the flag is set to yes, only sasl authenticated connections
|
||||
will be allowed. If it is set to no then authentication is not
|
||||
- needed for ldap server connections. Finally, if it is set to
|
||||
- autodetect then the ldap server will be queried to establish
|
||||
- a suitable authentication mechanism. If no suitable mechanism
|
||||
- can be found, connections to the ldap server are made without
|
||||
- authentication.
|
||||
+ needed for ldap server connections. If it is set to autodetect
|
||||
+ then the ldap server will be queried to establish a suitable
|
||||
+ sasl authentication mechanism. If no suitable mechanism can be
|
||||
+ found, connections to the ldap server are made without
|
||||
+ authentication. Finally, if it is set to simple, then simple
|
||||
+ authentication will be used instead of SASL.
|
||||
+
|
||||
Legal values for this option include:
|
||||
"yes"
|
||||
"no"
|
||||
"autodetect"
|
||||
+ "simple"
|
||||
|
||||
authtype - This attribute can be used to specify a preferred
|
||||
authentication mechanism. In normal operations, the
|
||||
@ -1,113 +0,0 @@
|
||||
autofs-5.0.5 - auto adjust ldap page size
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When doing a paged LDAP request, if an LDAP server is configured with
|
||||
request size limits less than the size autofs requests the query fails
|
||||
with an LDAP_ADMINLIMIT_EXCEEDED. To fix this, when the error is returned
|
||||
halve the request size and try again until we get down to a ridiculously
|
||||
small size.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
modules/lookup_ldap.c | 32 ++++++++++++++++++++++++--------
|
||||
2 files changed, 25 insertions(+), 8 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -56,6 +56,7 @@
|
||||
- add option to dump configured automount maps.
|
||||
- use weight only for server selection.
|
||||
- fix isspace() wild card substition.
|
||||
+- auto adjust ldap page size.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/modules/lookup_ldap.c
|
||||
+++ autofs-5.0.5/modules/lookup_ldap.c
|
||||
@@ -55,6 +55,7 @@ struct ldap_search_params {
|
||||
LDAP *ldap;
|
||||
char *query, **attrs;
|
||||
struct berval *cookie;
|
||||
+ ber_int_t pageSize;
|
||||
int morePages;
|
||||
ber_int_t totalCount;
|
||||
LDAPMessage *result;
|
||||
@@ -1946,7 +1947,6 @@ static int do_paged_query(struct ldap_se
|
||||
struct autofs_point *ap = sp->ap;
|
||||
LDAPControl *pageControl=NULL, *controls[2] = { NULL, NULL };
|
||||
LDAPControl **returnedControls = NULL;
|
||||
- static ber_int_t pageSize = 1000;
|
||||
static char pagingCriticality = 'T';
|
||||
int rv, scope = LDAP_SCOPE_SUBTREE;
|
||||
|
||||
@@ -1959,7 +1959,8 @@ static int do_paged_query(struct ldap_se
|
||||
* Check for Size Limit exceeded and force run through loop
|
||||
* and requery using page control.
|
||||
*/
|
||||
- if (rv == LDAP_SIZELIMIT_EXCEEDED)
|
||||
+ if (rv == LDAP_SIZELIMIT_EXCEEDED ||
|
||||
+ rv == LDAP_ADMINLIMIT_EXCEEDED)
|
||||
sp->morePages = TRUE;
|
||||
else {
|
||||
debug(ap->logopt,
|
||||
@@ -1974,7 +1975,7 @@ do_paged:
|
||||
/* we need to use page controls so requery LDAP */
|
||||
debug(ap->logopt, MODPREFIX "geting page of results");
|
||||
|
||||
- rv = ldap_create_page_control(sp->ldap, pageSize, sp->cookie,
|
||||
+ rv = ldap_create_page_control(sp->ldap, sp->pageSize, sp->cookie,
|
||||
pagingCriticality, &pageControl);
|
||||
if (rv != LDAP_SUCCESS) {
|
||||
warn(ap->logopt, MODPREFIX "failed to create page control");
|
||||
@@ -1989,10 +1990,11 @@ do_paged:
|
||||
ctxt->qdn, scope, sp->query, sp->attrs,
|
||||
0, controls, NULL, NULL, 0, &sp->result);
|
||||
if ((rv != LDAP_SUCCESS) && (rv != LDAP_PARTIAL_RESULTS)) {
|
||||
- debug(ap->logopt,
|
||||
- MODPREFIX "query failed for %s: %s",
|
||||
- sp->query, ldap_err2string(rv));
|
||||
ldap_control_free(pageControl);
|
||||
+ if (rv != LDAP_ADMINLIMIT_EXCEEDED)
|
||||
+ debug(ap->logopt,
|
||||
+ MODPREFIX "query failed for %s: %s",
|
||||
+ sp->query, ldap_err2string(rv));
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -2347,18 +2349,32 @@ static int read_one_map(struct autofs_po
|
||||
MODPREFIX "searching for \"%s\" under \"%s\"", sp.query, ctxt->qdn);
|
||||
|
||||
sp.cookie = NULL;
|
||||
+ sp.pageSize = 1000;
|
||||
sp.morePages = FALSE;
|
||||
sp.totalCount = 0;
|
||||
sp.result = NULL;
|
||||
|
||||
do {
|
||||
rv = do_paged_query(&sp, ctxt);
|
||||
- if (rv == LDAP_SIZELIMIT_EXCEEDED)
|
||||
- {
|
||||
+ if (rv == LDAP_SIZELIMIT_EXCEEDED) {
|
||||
debug(ap->logopt, MODPREFIX "result size exceed");
|
||||
if (sp.result)
|
||||
ldap_msgfree(sp.result);
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
+ if (rv == LDAP_ADMINLIMIT_EXCEEDED) {
|
||||
+ if (sp.result)
|
||||
+ ldap_msgfree(sp.result);
|
||||
+ sp.pageSize = sp.pageSize / 2;
|
||||
+ if (sp.pageSize < 5) {
|
||||
+ debug(ap->logopt, MODPREFIX
|
||||
+ "administrative result size too small");
|
||||
+ unbind_ldap_connection(ap->logopt, sp.ldap, ctxt);
|
||||
+ *result_ldap = rv;
|
||||
+ free(sp.query);
|
||||
+ return NSS_STATUS_UNAVAIL;
|
||||
+ }
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1,199 +0,0 @@
|
||||
autofs-5.0.5 - check each dc server
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
We return a space separated list of dc servers from get_dc_list() but the
|
||||
GSSAPI code needs an individual server in the uri to function correctly.
|
||||
|
||||
Change the logic in find_server() and do_reconnect() to attempt a connection
|
||||
to each dc server individually.
|
||||
---
|
||||
|
||||
CHANGELOG | 1
|
||||
modules/lookup_ldap.c | 103 +++++++++++++++++++++++++++++---------------------
|
||||
2 files changed, 62 insertions(+), 42 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -40,6 +40,7 @@
|
||||
- fix null cache race.
|
||||
- fix cache_init() on source re-read.
|
||||
- fix mapent becomes negative during lookup.
|
||||
+- check each dc server individually.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/modules/lookup_ldap.c
|
||||
+++ autofs-5.0.5/modules/lookup_ldap.c
|
||||
@@ -615,23 +615,43 @@ static LDAP *connect_to_server(unsigned
|
||||
return ldap;
|
||||
}
|
||||
|
||||
+static LDAP *find_dc_server(unsigned logopt, const char *uri, struct lookup_context *ctxt)
|
||||
+{
|
||||
+ char *str, *tok, *ptr = NULL;
|
||||
+ LDAP *ldap = NULL;
|
||||
+
|
||||
+ str = strdup(uri);
|
||||
+ if (!str)
|
||||
+ return NULL;
|
||||
+
|
||||
+ tok = strtok_r(str, " ", &ptr);
|
||||
+ while (tok) {
|
||||
+ const char *this = (const char *) tok;
|
||||
+ debug(logopt, "trying server uri %s", this);
|
||||
+ ldap = connect_to_server(logopt, this, ctxt);
|
||||
+ if (ldap) {
|
||||
+ info(logopt, "connected to uri %s", this);
|
||||
+ free(str);
|
||||
+ return ldap;
|
||||
+ }
|
||||
+ tok = strtok_r(NULL, " ", &ptr);
|
||||
+ }
|
||||
+
|
||||
+ free(str);
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
static LDAP *find_server(unsigned logopt, struct lookup_context *ctxt)
|
||||
{
|
||||
LDAP *ldap = NULL;
|
||||
struct ldap_uri *this;
|
||||
struct list_head *p, *first;
|
||||
- struct dclist *dclist = NULL;
|
||||
+ struct dclist *dclist;
|
||||
char *uri = NULL;
|
||||
|
||||
uris_mutex_lock(ctxt);
|
||||
- if (ctxt->dclist) {
|
||||
- dclist = ctxt->dclist;
|
||||
- if (ctxt->dclist->expire < time(NULL)) {
|
||||
- free_dclist(ctxt->dclist);
|
||||
- ctxt->dclist = NULL;
|
||||
- dclist = NULL;
|
||||
- }
|
||||
- }
|
||||
+ dclist = ctxt->dclist;
|
||||
if (!ctxt->uri)
|
||||
first = ctxt->uris;
|
||||
else
|
||||
@@ -648,9 +668,16 @@ static LDAP *find_server(unsigned logopt
|
||||
continue;
|
||||
}
|
||||
this = list_entry(p, struct ldap_uri, list);
|
||||
- if (!strstr(this->uri, ":///"))
|
||||
+ if (!strstr(this->uri, ":///")) {
|
||||
uri = strdup(this->uri);
|
||||
- else {
|
||||
+ debug(logopt, "trying server uri %s", uri);
|
||||
+ ldap = connect_to_server(logopt, uri, ctxt);
|
||||
+ if (ldap) {
|
||||
+ info(logopt, "connected to uri %s", uri);
|
||||
+ free(uri);
|
||||
+ break;
|
||||
+ }
|
||||
+ } else {
|
||||
if (dclist)
|
||||
uri = strdup(dclist->uri);
|
||||
else {
|
||||
@@ -663,21 +690,11 @@ static LDAP *find_server(unsigned logopt
|
||||
dclist = tmp;
|
||||
uri = strdup(dclist->uri);
|
||||
}
|
||||
- }
|
||||
- if (!uri) {
|
||||
- if (dclist) {
|
||||
- free_dclist(dclist);
|
||||
- dclist = NULL;
|
||||
+ ldap = find_dc_server(logopt, uri, ctxt);
|
||||
+ if (ldap) {
|
||||
+ free(uri);
|
||||
+ break;
|
||||
}
|
||||
- p = p->next;
|
||||
- continue;
|
||||
- }
|
||||
- debug(logopt, "trying server uri %s", uri);
|
||||
- ldap = connect_to_server(logopt, uri, ctxt);
|
||||
- if (ldap) {
|
||||
- info(logopt, "connected to uri %s", uri);
|
||||
- free(uri);
|
||||
- break;
|
||||
}
|
||||
free(uri);
|
||||
uri = NULL;
|
||||
@@ -708,7 +725,7 @@ static LDAP *find_server(unsigned logopt
|
||||
|
||||
static LDAP *do_reconnect(unsigned logopt, struct lookup_context *ctxt)
|
||||
{
|
||||
- LDAP *ldap;
|
||||
+ LDAP *ldap = NULL;
|
||||
char *uri;
|
||||
|
||||
if (ctxt->server || !ctxt->uris) {
|
||||
@@ -723,25 +740,29 @@ static LDAP *do_reconnect(unsigned logop
|
||||
return ldap;
|
||||
}
|
||||
|
||||
+ if (ctxt->dclist) {
|
||||
+ ldap = find_dc_server(logopt, ctxt->dclist->uri, ctxt);
|
||||
+ if (ldap)
|
||||
+ return ldap;
|
||||
+ }
|
||||
+
|
||||
uris_mutex_lock(ctxt);
|
||||
- if (ctxt->dclist)
|
||||
- uri = strdup(ctxt->dclist->uri);
|
||||
- else if (ctxt->uri)
|
||||
- uri = strdup(ctxt->uri->uri);
|
||||
- else {
|
||||
+ if (ctxt->dclist) {
|
||||
+ if (!ldap || ctxt->dclist->expire < time(NULL)) {
|
||||
+ free_dclist(ctxt->dclist);
|
||||
+ ctxt->dclist = NULL;
|
||||
+ }
|
||||
+ /* Make sure we don't skip the domain spec */
|
||||
+ ctxt->uri = NULL;
|
||||
uris_mutex_unlock(ctxt);
|
||||
goto find_server;
|
||||
}
|
||||
uris_mutex_unlock(ctxt);
|
||||
|
||||
- if (!uri) {
|
||||
- char buf[MAX_ERR_BUF];
|
||||
- char *estr = strerror_r(errno, buf, sizeof(buf));
|
||||
- crit(logopt, MODPREFIX "strdup: %s", estr);
|
||||
- return NULL;
|
||||
- }
|
||||
+ if (!ctxt->uri)
|
||||
+ goto find_server;
|
||||
|
||||
- ldap = do_connect(logopt, uri, ctxt);
|
||||
+ ldap = do_connect(logopt, ctxt->uri->uri, ctxt);
|
||||
#ifdef WITH_SASL
|
||||
/*
|
||||
* Dispose of the sasl authentication connection and try the
|
||||
@@ -752,19 +773,17 @@ static LDAP *do_reconnect(unsigned logop
|
||||
ldap = connect_to_server(logopt, uri, ctxt);
|
||||
}
|
||||
#endif
|
||||
- free(uri);
|
||||
-
|
||||
if (ldap)
|
||||
return ldap;
|
||||
|
||||
/* Failed to connect, try to find a new server */
|
||||
|
||||
+find_server:
|
||||
#ifdef WITH_SASL
|
||||
autofs_sasl_dispose(ctxt);
|
||||
#endif
|
||||
|
||||
-find_server:
|
||||
- /* Current server failed connect, try the rest */
|
||||
+ /* Current server failed, try the rest or dc connection */
|
||||
ldap = find_server(logopt, ctxt);
|
||||
if (!ldap)
|
||||
error(logopt, MODPREFIX "failed to find available server");
|
||||
@ -1,113 +0,0 @@
|
||||
autofs-5.0.5 - check for path mount location in generic module
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Currently we check for dependent mounts in the mount location path
|
||||
for bind mounts and loopback mounts. But we can have the case where
|
||||
a mount other than a loopback mount uses a local path and is not a
|
||||
bind mount. In this case we need to check the local path for dependent
|
||||
mounts. To do this we can check the mount location prior to spawning
|
||||
the mount and if it starts with a "/" then it is a local path and
|
||||
the check is needed.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/spawn.c | 41 +++++++++++++++++++++++++++--------------
|
||||
2 files changed, 28 insertions(+), 14 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index cc2efab..8429e20 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -13,6 +13,7 @@
|
||||
- make documentation for set-log-priority clearer.
|
||||
- fix timeout in connect_nb().
|
||||
- fix pidof init script usage.
|
||||
+- check for path mount location in generic module.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/daemon/spawn.c b/daemon/spawn.c
|
||||
index db356d4..7c254d9 100644
|
||||
--- a/daemon/spawn.c
|
||||
+++ b/daemon/spawn.c
|
||||
@@ -154,22 +154,30 @@ static int do_spawn(unsigned logopt, unsigned int wait,
|
||||
|
||||
f = fork();
|
||||
if (f == 0) {
|
||||
+ char **pargv = (char **) argv;
|
||||
+ int loc = 0;
|
||||
+
|
||||
reset_signals();
|
||||
close(pipefd[0]);
|
||||
dup2(pipefd[1], STDOUT_FILENO);
|
||||
dup2(pipefd[1], STDERR_FILENO);
|
||||
close(pipefd[1]);
|
||||
|
||||
- /* Bind mount - check target exists */
|
||||
- if (use_access) {
|
||||
- char **pargv = (char **) argv;
|
||||
- int argc = 0;
|
||||
- pid_t pgrp = getpgrp();
|
||||
+ /* what to mount must always be second last */
|
||||
+ while (*pargv++)
|
||||
+ loc++;
|
||||
+ loc -= 2;
|
||||
|
||||
- /* what to mount must always be second last */
|
||||
- while (*pargv++)
|
||||
- argc++;
|
||||
- argc -= 2;
|
||||
+ /*
|
||||
+ * If the mount location starts with a "/" then it is
|
||||
+ * a local path. In this case it is a bind mount, a
|
||||
+ * loopback mount or a file system that uses a local
|
||||
+ * path so we need to check for dependent mounts.
|
||||
+ *
|
||||
+ * I hope host names are never allowed "/" as first char
|
||||
+ */
|
||||
+ if (use_access && *(argv[loc]) == '/') {
|
||||
+ pid_t pgrp = getpgrp();
|
||||
|
||||
/*
|
||||
* Pretend to be requesting user and set non-autofs
|
||||
@@ -182,7 +190,7 @@ static int do_spawn(unsigned logopt, unsigned int wait,
|
||||
setpgrp();
|
||||
|
||||
/* Trigger the recursive mount */
|
||||
- if (access(argv[argc], F_OK) == -1)
|
||||
+ if (access(argv[loc], F_OK) == -1)
|
||||
_exit(errno);
|
||||
|
||||
seteuid(0);
|
||||
@@ -312,7 +320,7 @@ int spawn_mount(unsigned logopt, ...)
|
||||
#ifdef ENABLE_MOUNT_LOCKING
|
||||
options = SPAWN_OPT_LOCK;
|
||||
#else
|
||||
- options = SPAWN_OPT_NONE;
|
||||
+ options = SPAWN_OPT_ACCESS;
|
||||
#endif
|
||||
|
||||
va_start(arg, logopt);
|
||||
@@ -344,12 +352,17 @@ int spawn_mount(unsigned logopt, ...)
|
||||
p = argv + 2;
|
||||
}
|
||||
while ((*p = va_arg(arg, char *))) {
|
||||
- if (options == SPAWN_OPT_NONE && !strcmp(*p, "-o")) {
|
||||
+ if (options == SPAWN_OPT_ACCESS && !strcmp(*p, "-t")) {
|
||||
*(++p) = va_arg(arg, char *);
|
||||
if (!*p)
|
||||
break;
|
||||
- if (strstr(*p, "loop"))
|
||||
- options = SPAWN_OPT_ACCESS;
|
||||
+ /*
|
||||
+ * A cifs mount location begins with a "/" but
|
||||
+ * is not a local path, so don't try to resolve
|
||||
+ * it. Mmmm ... does anyone use smbfs these days?
|
||||
+ */
|
||||
+ if (strstr(*p, "cifs"))
|
||||
+ options = SPAWN_OPT_NONE;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
autofs-5.0.5 - dont check null cache on expire
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When expiring an entry there is no need to check the null map
|
||||
entry cache. If we have a mount then it must have been done at
|
||||
some point when the entry was not a nulled so it still needs
|
||||
to be expired. Remove this check.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/automount.c | 9 ---------
|
||||
2 files changed, 1 insertion(+), 9 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -36,6 +36,7 @@
|
||||
- fix remount locking.
|
||||
- fix wildcard map entry match.
|
||||
- fix parse_sun() module init.
|
||||
+- dont check null cache on expire.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/daemon/automount.c
|
||||
+++ autofs-5.0.5/daemon/automount.c
|
||||
@@ -526,20 +526,11 @@ static int umount_subtree_mounts(struct
|
||||
it also tries to umount path itself */
|
||||
int umount_multi(struct autofs_point *ap, const char *path, int incl)
|
||||
{
|
||||
- struct mapent_cache *nc;
|
||||
int is_autofs_fs;
|
||||
int left;
|
||||
|
||||
debug(ap->logopt, "path %s incl %d", path, incl);
|
||||
|
||||
- nc = ap->entry->master->nc;
|
||||
- cache_readlock(nc);
|
||||
- if (cache_lookup_distinct(nc, path)) {
|
||||
- cache_unlock(nc);
|
||||
- return 0;
|
||||
- }
|
||||
- cache_unlock(nc);
|
||||
-
|
||||
is_autofs_fs = 0;
|
||||
if (master_find_submount(ap, path))
|
||||
is_autofs_fs = 1;
|
||||
@ -1,196 +0,0 @@
|
||||
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);
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
autofs-5.0.5 - dont fail mount on access fail
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
If we encounter a recursive autofs mount in the mount location
|
||||
path, and call access(2) to perform the mount, the mount may
|
||||
succeed but the access(2) call return a fail. In the case where
|
||||
there are multiple processes waiting on this mount they will all
|
||||
get the failure return which may be incorrect for other waiters.
|
||||
Ignoring the return code from the access(2) call and allowing the
|
||||
mount to go ahead anyway should give the VFS the chance to check
|
||||
the access for each individual process and so return an accurate
|
||||
retult.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/spawn.c | 12 +++++++++---
|
||||
2 files changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 8429e20..88bcc1b 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -14,6 +14,7 @@
|
||||
- fix timeout in connect_nb().
|
||||
- fix pidof init script usage.
|
||||
- check for path mount location in generic module.
|
||||
+- dont fail mount on access fail.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/daemon/spawn.c b/daemon/spawn.c
|
||||
index 7c254d9..285f4d7 100644
|
||||
--- a/daemon/spawn.c
|
||||
+++ b/daemon/spawn.c
|
||||
@@ -189,9 +189,15 @@ static int do_spawn(unsigned logopt, unsigned int wait,
|
||||
}
|
||||
setpgrp();
|
||||
|
||||
- /* Trigger the recursive mount */
|
||||
- if (access(argv[loc], F_OK) == -1)
|
||||
- _exit(errno);
|
||||
+ /*
|
||||
+ * Trigger the recursive mount.
|
||||
+ *
|
||||
+ * Ignore the access(2) return code as there may be
|
||||
+ * multiple waiters for this mount and we need to
|
||||
+ * let the VFS handle access returns to each
|
||||
+ * individual waiter.
|
||||
+ */
|
||||
+ access(argv[loc], F_OK);
|
||||
|
||||
seteuid(0);
|
||||
setegid(0);
|
||||
@ -1,117 +0,0 @@
|
||||
autofs-5.0.5 - don't hold lock for simple mounts
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
A map entry that depends on another map entry in the "same" map cannot
|
||||
be allowed in all cases. In particular, multi-mount entries must not
|
||||
change during mount operations so the internal map entry cache must
|
||||
remain locked during the mount. This is because, during the mount, we
|
||||
must consult the map and possibly update the internal cache entry to
|
||||
ensure we are using the most up to date mount information.
|
||||
|
||||
This isn't the case for non multi-mount map entries but autofs didn't
|
||||
allow for this, which is the issue this patch addresses.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
modules/parse_sun.c | 41 +++++++++++++++++------------------------
|
||||
2 files changed, 18 insertions(+), 24 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -32,6 +32,7 @@
|
||||
- add autofs_ldap_auth.conf man page.
|
||||
- fix random selection for host on different network.
|
||||
- make redhat init script more lsb compliant.
|
||||
+- don't hold lock for simple mounts.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/modules/parse_sun.c
|
||||
+++ autofs-5.0.5/modules/parse_sun.c
|
||||
@@ -1136,19 +1136,6 @@ static int mount_subtree(struct autofs_p
|
||||
|
||||
rv = 0;
|
||||
|
||||
- if (!me || !me->multi) {
|
||||
- int loclen = strlen(loc);
|
||||
- int namelen = strlen(name);
|
||||
- const char *root = ap->path;
|
||||
-
|
||||
- if (!strcmp(ap->path, "/-"))
|
||||
- root = name;
|
||||
-
|
||||
- rv = sun_mount(ap, root, name, namelen, loc, loclen, options, ctxt);
|
||||
-
|
||||
- goto done;
|
||||
- }
|
||||
-
|
||||
mm = me->multi;
|
||||
mm_key = mm->key;
|
||||
move = MOUNT_MOVE_NONE;
|
||||
@@ -1294,7 +1281,6 @@ static int mount_subtree(struct autofs_p
|
||||
if (rv > 0)
|
||||
return rv;
|
||||
|
||||
-done:
|
||||
/*
|
||||
* Convert fail on nonstrict, non-empty multi-mount
|
||||
* to success
|
||||
@@ -1622,17 +1608,25 @@ int parse_mount(struct autofs_point *ap,
|
||||
* it's already been parsed (above) and any option string
|
||||
* has already been stripped so just use the remainder.
|
||||
*/
|
||||
+ cache_readlock(mc);
|
||||
if (*name == '/' &&
|
||||
(me = cache_lookup_distinct(mc, name)) && me->multi) {
|
||||
loc = strdup(p);
|
||||
if (!loc) {
|
||||
free(options);
|
||||
+ cache_unlock(mc);
|
||||
warn(ap->logopt, MODPREFIX "out of memory");
|
||||
return 1;
|
||||
}
|
||||
- loclen = strlen(p);
|
||||
- goto mount_it;
|
||||
+ cache_multi_writelock(me);
|
||||
+ rv = mount_subtree(ap, me, name, loc, options, ctxt);
|
||||
+ cache_multi_unlock(me);
|
||||
+ cache_unlock(mc);
|
||||
+ free(loc);
|
||||
+ free(options);
|
||||
+ return rv;
|
||||
}
|
||||
+ cache_unlock(mc);
|
||||
|
||||
l = chunklen(p, check_colon(p));
|
||||
loc = dequote(p, l, ap->logopt);
|
||||
@@ -1716,21 +1710,20 @@ int parse_mount(struct autofs_point *ap,
|
||||
MODPREFIX "entry %s is empty!", name);
|
||||
return 1;
|
||||
}
|
||||
-mount_it:
|
||||
+
|
||||
debug(ap->logopt,
|
||||
MODPREFIX "core of entry: options=%s, loc=%.*s",
|
||||
options, loclen, loc);
|
||||
|
||||
- cache_readlock(mc);
|
||||
- cache_multi_writelock(me);
|
||||
-
|
||||
- rv = mount_subtree(ap, me, name, loc, options, ctxt);
|
||||
+ if (!strcmp(ap->path, "/-"))
|
||||
+ rv = sun_mount(ap, name, name, name_len,
|
||||
+ loc, loclen, options, ctxt);
|
||||
+ else
|
||||
+ rv = sun_mount(ap, ap->path, name, name_len,
|
||||
+ loc, loclen, options, ctxt);
|
||||
|
||||
free(loc);
|
||||
free(options);
|
||||
-
|
||||
- cache_multi_unlock(me);
|
||||
- cache_unlock(mc);
|
||||
pthread_setcancelstate(cur_state, NULL);
|
||||
}
|
||||
return rv;
|
||||
@ -1,39 +0,0 @@
|
||||
autofs-5.0.5 - don't use master_lex_destroy() to clear parse buffer
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Using master_lex_destroy() does not seem not to resolve the original
|
||||
problem it set out to solve in all cases. Change to using memset() to
|
||||
clear the buffer instead.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/master_tok.l | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index e37dadb..329b028 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -9,6 +9,7 @@
|
||||
- fix backwards #ifndef INET6.
|
||||
- fix stale initialization for file map instance.
|
||||
- add "preen" fsck for ext4 mounts.
|
||||
+- don't use master_lex_destroy() to clear parse buffer.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/lib/master_tok.l b/lib/master_tok.l
|
||||
index 373248b..be2ce10 100644
|
||||
--- a/lib/master_tok.l
|
||||
+++ b/lib/master_tok.l
|
||||
@@ -414,7 +414,7 @@ static void master_echo(void)
|
||||
|
||||
void master_set_scan_buffer(const char *buffer)
|
||||
{
|
||||
- master_lex_destroy();
|
||||
+ memset(buff, 0, sizeof(buff));
|
||||
optr = buff;
|
||||
|
||||
line = buffer;
|
||||
@ -1,486 +0,0 @@
|
||||
autofs-5.0.5 - expire thread use pending mutex
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Some time ago the mount request thread creation was changed to
|
||||
use its own mutex for its condition handling due to execution
|
||||
order problems under heavy mount request pressure. When there
|
||||
are a large number of master map entries we see the same problem
|
||||
with expire thread creation. This patch changes the expire thread
|
||||
creation to use the same approach as the mount thread creation.
|
||||
---
|
||||
|
||||
CHANGELOG | 1
|
||||
daemon/direct.c | 76 +++++++++++-----------------------------------------
|
||||
daemon/indirect.c | 76 +++++++++++-----------------------------------------
|
||||
include/automount.h | 41 ++++++++++++++++++++++++++++
|
||||
4 files changed, 76 insertions(+), 118 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -45,6 +45,7 @@
|
||||
- remove state machine timed wait.
|
||||
- remove extra read master map call.
|
||||
- fix error handing in do_mount_indirect().
|
||||
+- expire thread use pending mutex.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/daemon/direct.c
|
||||
+++ autofs-5.0.5/daemon/direct.c
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <sys/vfs.h>
|
||||
#include <sched.h>
|
||||
|
||||
+#define INCLUDE_PENDING_FUNCTIONS
|
||||
#include "automount.h"
|
||||
|
||||
/* Attribute to create detached thread */
|
||||
@@ -48,8 +49,6 @@ pthread_key_t key_mnt_direct_params;
|
||||
pthread_key_t key_mnt_offset_params;
|
||||
pthread_once_t key_mnt_params_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
-static pthread_mutex_t ea_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
-
|
||||
static void key_mnt_params_destroy(void *arg)
|
||||
{
|
||||
struct mnt_params *mp;
|
||||
@@ -952,17 +951,6 @@ void *expire_proc_direct(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static void pending_cond_destroy(void *arg)
|
||||
-{
|
||||
- struct pending_args *mt;
|
||||
- int status;
|
||||
-
|
||||
- mt = (struct pending_args *) arg;
|
||||
- status = pthread_cond_destroy(&mt->cond);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
-}
|
||||
-
|
||||
static void expire_send_fail(void *arg)
|
||||
{
|
||||
struct ioctl_ops *ops = get_ioctl_ops();
|
||||
@@ -972,19 +960,6 @@ static void expire_send_fail(void *arg)
|
||||
mt->ioctlfd, mt->wait_queue_token, -ENOENT);
|
||||
}
|
||||
|
||||
-static void free_pending_args(void *arg)
|
||||
-{
|
||||
- struct pending_args *mt = arg;
|
||||
- free(mt);
|
||||
-}
|
||||
-
|
||||
-static void expire_mutex_unlock(void *arg)
|
||||
-{
|
||||
- int status = pthread_mutex_unlock(&ea_mutex);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
-}
|
||||
-
|
||||
static void *do_expire_direct(void *arg)
|
||||
{
|
||||
struct ioctl_ops *ops = get_ioctl_ops();
|
||||
@@ -995,9 +970,7 @@ static void *do_expire_direct(void *arg)
|
||||
|
||||
args = (struct pending_args *) arg;
|
||||
|
||||
- status = pthread_mutex_lock(&ea_mutex);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
+ pending_mutex_lock(args);
|
||||
|
||||
memcpy(&mt, args, sizeof(struct pending_args));
|
||||
|
||||
@@ -1008,7 +981,7 @@ static void *do_expire_direct(void *arg)
|
||||
if (status)
|
||||
fatal(status);
|
||||
|
||||
- expire_mutex_unlock(NULL);
|
||||
+ pending_mutex_unlock(args);
|
||||
|
||||
pthread_cleanup_push(expire_send_fail, &mt);
|
||||
|
||||
@@ -1124,7 +1097,7 @@ int handle_packet_expire_direct(struct a
|
||||
if (status)
|
||||
fatal(status);
|
||||
|
||||
- status = pthread_mutex_lock(&ea_mutex);
|
||||
+ status = pthread_mutex_init(&mt->mutex, NULL);
|
||||
if (status)
|
||||
fatal(status);
|
||||
|
||||
@@ -1140,6 +1113,8 @@ int handle_packet_expire_direct(struct a
|
||||
debug(ap->logopt, "token %ld, name %s",
|
||||
(unsigned long) pkt->wait_queue_token, mt->name);
|
||||
|
||||
+ pending_mutex_lock(mt);
|
||||
+
|
||||
status = pthread_create(&thid, &th_attr_detached, do_expire_direct, mt);
|
||||
if (status) {
|
||||
error(ap->logopt, "expire thread create failed");
|
||||
@@ -1147,8 +1122,9 @@ int handle_packet_expire_direct(struct a
|
||||
mt->ioctlfd, pkt->wait_queue_token, -status);
|
||||
cache_unlock(mc);
|
||||
master_source_unlock(ap->entry);
|
||||
- expire_mutex_unlock(NULL);
|
||||
+ pending_mutex_unlock(mt);
|
||||
pending_cond_destroy(mt);
|
||||
+ pending_mutex_destroy(mt);
|
||||
free_pending_args(mt);
|
||||
pthread_setcancelstate(state, NULL);
|
||||
return 1;
|
||||
@@ -1158,8 +1134,9 @@ int handle_packet_expire_direct(struct a
|
||||
master_source_unlock(ap->entry);
|
||||
|
||||
pthread_cleanup_push(free_pending_args, mt);
|
||||
+ pthread_cleanup_push(pending_mutex_destroy, mt);
|
||||
pthread_cleanup_push(pending_cond_destroy, mt);
|
||||
- pthread_cleanup_push(expire_mutex_unlock, NULL);
|
||||
+ pthread_cleanup_push(pending_mutex_unlock, mt);
|
||||
pthread_setcancelstate(state, NULL);
|
||||
|
||||
mt->signaled = 0;
|
||||
@@ -1167,7 +1144,7 @@ int handle_packet_expire_direct(struct a
|
||||
gettimeofday(&now, NULL);
|
||||
wait.tv_sec = now.tv_sec + 2;
|
||||
wait.tv_nsec = now.tv_usec * 1000;
|
||||
- status = pthread_cond_wait(&mt->cond, &ea_mutex);
|
||||
+ status = pthread_cond_timedwait(&mt->cond, &mt->mutex, &wait);
|
||||
if (status && status != ETIMEDOUT)
|
||||
fatal(status);
|
||||
}
|
||||
@@ -1175,6 +1152,7 @@ int handle_packet_expire_direct(struct a
|
||||
pthread_cleanup_pop(1);
|
||||
pthread_cleanup_pop(1);
|
||||
pthread_cleanup_pop(1);
|
||||
+ pthread_cleanup_pop(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1188,22 +1166,6 @@ static void mount_send_fail(void *arg)
|
||||
ops->close(ap->logopt, mt->ioctlfd);
|
||||
}
|
||||
|
||||
-static void pending_mutex_destroy(void *arg)
|
||||
-{
|
||||
- struct pending_args *mt = (struct pending_args *) arg;
|
||||
- int status = pthread_mutex_destroy(&mt->mutex);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
-}
|
||||
-
|
||||
-static void mount_mutex_unlock(void *arg)
|
||||
-{
|
||||
- struct pending_args *mt = (struct pending_args *) arg;
|
||||
- int status = pthread_mutex_unlock(&mt->mutex);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
-}
|
||||
-
|
||||
static void *do_mount_direct(void *arg)
|
||||
{
|
||||
struct ioctl_ops *ops = get_ioctl_ops();
|
||||
@@ -1214,9 +1176,7 @@ static void *do_mount_direct(void *arg)
|
||||
|
||||
args = (struct pending_args *) arg;
|
||||
|
||||
- status = pthread_mutex_lock(&args->mutex);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
+ pending_mutex_lock(args);
|
||||
|
||||
memcpy(&mt, args, sizeof(struct pending_args));
|
||||
|
||||
@@ -1227,7 +1187,7 @@ static void *do_mount_direct(void *arg)
|
||||
if (status)
|
||||
fatal(status);
|
||||
|
||||
- mount_mutex_unlock(args);
|
||||
+ pending_mutex_unlock(args);
|
||||
|
||||
pthread_cleanup_push(mount_send_fail, &mt);
|
||||
|
||||
@@ -1434,9 +1394,7 @@ int handle_packet_missing_direct(struct
|
||||
if (status)
|
||||
fatal(status);
|
||||
|
||||
- status = pthread_mutex_lock(&mt->mutex);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
+ pending_mutex_lock(mt);
|
||||
|
||||
mt->ap = ap;
|
||||
mt->ioctlfd = ioctlfd;
|
||||
@@ -1458,7 +1416,7 @@ int handle_packet_missing_direct(struct
|
||||
cache_unlock(mc);
|
||||
master_source_unlock(ap->entry);
|
||||
master_mutex_unlock();
|
||||
- mount_mutex_unlock(mt);
|
||||
+ pending_mutex_unlock(mt);
|
||||
pending_cond_destroy(mt);
|
||||
pending_mutex_destroy(mt);
|
||||
free_pending_args(mt);
|
||||
@@ -1474,7 +1432,7 @@ int handle_packet_missing_direct(struct
|
||||
pthread_cleanup_push(free_pending_args, mt);
|
||||
pthread_cleanup_push(pending_mutex_destroy, mt);
|
||||
pthread_cleanup_push(pending_cond_destroy, mt);
|
||||
- pthread_cleanup_push(mount_mutex_unlock, mt);
|
||||
+ pthread_cleanup_push(pending_mutex_unlock, mt);
|
||||
pthread_setcancelstate(state, NULL);
|
||||
|
||||
mt->signaled = 0;
|
||||
--- autofs-5.0.5.orig/daemon/indirect.c
|
||||
+++ autofs-5.0.5/daemon/indirect.c
|
||||
@@ -34,13 +34,12 @@
|
||||
#include <sys/vfs.h>
|
||||
#include <sched.h>
|
||||
|
||||
+#define INCLUDE_PENDING_FUNCTIONS
|
||||
#include "automount.h"
|
||||
|
||||
/* Attribute to create detached thread */
|
||||
extern pthread_attr_t th_attr_detached;
|
||||
|
||||
-static pthread_mutex_t ea_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
-
|
||||
static int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts)
|
||||
{
|
||||
struct mnt_list *this;
|
||||
@@ -587,17 +586,6 @@ void *expire_proc_indirect(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static void pending_cond_destroy(void *arg)
|
||||
-{
|
||||
- struct pending_args *mt;
|
||||
- int status;
|
||||
-
|
||||
- mt = (struct pending_args *) arg;
|
||||
- status = pthread_cond_destroy(&mt->cond);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
-}
|
||||
-
|
||||
static void expire_send_fail(void *arg)
|
||||
{
|
||||
struct ioctl_ops *ops = get_ioctl_ops();
|
||||
@@ -607,19 +595,6 @@ static void expire_send_fail(void *arg)
|
||||
ap->ioctlfd, mt->wait_queue_token, -ENOENT);
|
||||
}
|
||||
|
||||
-static void free_pending_args(void *arg)
|
||||
-{
|
||||
- struct pending_args *mt = arg;
|
||||
- free(mt);
|
||||
-}
|
||||
-
|
||||
-static void expire_mutex_unlock(void *arg)
|
||||
-{
|
||||
- int status = pthread_mutex_unlock(&ea_mutex);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
-}
|
||||
-
|
||||
static void *do_expire_indirect(void *arg)
|
||||
{
|
||||
struct ioctl_ops *ops = get_ioctl_ops();
|
||||
@@ -629,9 +604,7 @@ static void *do_expire_indirect(void *ar
|
||||
|
||||
args = (struct pending_args *) arg;
|
||||
|
||||
- status = pthread_mutex_lock(&ea_mutex);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
+ pending_mutex_lock(args);
|
||||
|
||||
memcpy(&mt, args, sizeof(struct pending_args));
|
||||
|
||||
@@ -642,7 +615,7 @@ static void *do_expire_indirect(void *ar
|
||||
if (status)
|
||||
fatal(status);
|
||||
|
||||
- expire_mutex_unlock(NULL);
|
||||
+ pending_mutex_unlock(args);
|
||||
|
||||
pthread_cleanup_push(expire_send_fail, &mt);
|
||||
|
||||
@@ -690,7 +663,7 @@ int handle_packet_expire_indirect(struct
|
||||
if (status)
|
||||
fatal(status);
|
||||
|
||||
- status = pthread_mutex_lock(&ea_mutex);
|
||||
+ status = pthread_mutex_init(&mt->mutex, NULL);
|
||||
if (status)
|
||||
fatal(status);
|
||||
|
||||
@@ -700,21 +673,25 @@ int handle_packet_expire_indirect(struct
|
||||
mt->len = pkt->len;
|
||||
mt->wait_queue_token = pkt->wait_queue_token;
|
||||
|
||||
+ pending_mutex_lock(mt);
|
||||
+
|
||||
status = pthread_create(&thid, &th_attr_detached, do_expire_indirect, mt);
|
||||
if (status) {
|
||||
error(ap->logopt, "expire thread create failed");
|
||||
ops->send_fail(ap->logopt,
|
||||
ap->ioctlfd, pkt->wait_queue_token, -status);
|
||||
- expire_mutex_unlock(NULL);
|
||||
+ pending_mutex_unlock(mt);
|
||||
pending_cond_destroy(mt);
|
||||
+ pending_mutex_destroy(mt);
|
||||
free_pending_args(mt);
|
||||
pthread_setcancelstate(state, NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
pthread_cleanup_push(free_pending_args, mt);
|
||||
+ pthread_cleanup_push(pending_mutex_destroy, mt);
|
||||
pthread_cleanup_push(pending_cond_destroy, mt);
|
||||
- pthread_cleanup_push(expire_mutex_unlock, NULL);
|
||||
+ pthread_cleanup_push(pending_mutex_unlock, mt);
|
||||
pthread_setcancelstate(state, NULL);
|
||||
|
||||
mt->signaled = 0;
|
||||
@@ -722,7 +699,7 @@ int handle_packet_expire_indirect(struct
|
||||
gettimeofday(&now, NULL);
|
||||
wait.tv_sec = now.tv_sec + 2;
|
||||
wait.tv_nsec = now.tv_usec * 1000;
|
||||
- status = pthread_cond_timedwait(&mt->cond, &ea_mutex, &wait);
|
||||
+ status = pthread_cond_timedwait(&mt->cond, &mt->mutex, &wait);
|
||||
if (status && status != ETIMEDOUT)
|
||||
fatal(status);
|
||||
}
|
||||
@@ -730,6 +707,7 @@ int handle_packet_expire_indirect(struct
|
||||
pthread_cleanup_pop(1);
|
||||
pthread_cleanup_pop(1);
|
||||
pthread_cleanup_pop(1);
|
||||
+ pthread_cleanup_pop(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -743,22 +721,6 @@ static void mount_send_fail(void *arg)
|
||||
ap->ioctlfd, mt->wait_queue_token, -ENOENT);
|
||||
}
|
||||
|
||||
-static void pending_mutex_destroy(void *arg)
|
||||
-{
|
||||
- struct pending_args *mt = (struct pending_args *) arg;
|
||||
- int status = pthread_mutex_destroy(&mt->mutex);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
-}
|
||||
-
|
||||
-static void mount_mutex_unlock(void *arg)
|
||||
-{
|
||||
- struct pending_args *mt = (struct pending_args *) arg;
|
||||
- int status = pthread_mutex_unlock(&mt->mutex);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
-}
|
||||
-
|
||||
static void *do_mount_indirect(void *arg)
|
||||
{
|
||||
struct ioctl_ops *ops = get_ioctl_ops();
|
||||
@@ -770,9 +732,7 @@ static void *do_mount_indirect(void *arg
|
||||
|
||||
args = (struct pending_args *) arg;
|
||||
|
||||
- status = pthread_mutex_lock(&args->mutex);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
+ pending_mutex_lock(args);
|
||||
|
||||
memcpy(&mt, args, sizeof(struct pending_args));
|
||||
|
||||
@@ -783,7 +743,7 @@ static void *do_mount_indirect(void *arg
|
||||
if (status)
|
||||
fatal(status);
|
||||
|
||||
- mount_mutex_unlock(args);
|
||||
+ pending_mutex_unlock(args);
|
||||
|
||||
pthread_cleanup_push(mount_send_fail, &mt);
|
||||
|
||||
@@ -879,9 +839,7 @@ int handle_packet_missing_indirect(struc
|
||||
if (status)
|
||||
fatal(status);
|
||||
|
||||
- status = pthread_mutex_lock(&mt->mutex);
|
||||
- if (status)
|
||||
- fatal(status);
|
||||
+ pending_mutex_lock(mt);
|
||||
|
||||
mt->ap = ap;
|
||||
strncpy(mt->name, pkt->name, pkt->len);
|
||||
@@ -898,7 +856,7 @@ int handle_packet_missing_indirect(struc
|
||||
ops->send_fail(ap->logopt,
|
||||
ap->ioctlfd, pkt->wait_queue_token, -status);
|
||||
master_mutex_unlock();
|
||||
- mount_mutex_unlock(mt);
|
||||
+ pending_mutex_unlock(mt);
|
||||
pending_cond_destroy(mt);
|
||||
pending_mutex_destroy(mt);
|
||||
free_pending_args(mt);
|
||||
@@ -911,7 +869,7 @@ int handle_packet_missing_indirect(struc
|
||||
pthread_cleanup_push(free_pending_args, mt);
|
||||
pthread_cleanup_push(pending_mutex_destroy, mt);
|
||||
pthread_cleanup_push(pending_cond_destroy, mt);
|
||||
- pthread_cleanup_push(mount_mutex_unlock, mt);
|
||||
+ pthread_cleanup_push(pending_mutex_unlock, mt);
|
||||
pthread_setcancelstate(state, NULL);
|
||||
|
||||
mt->signaled = 0;
|
||||
--- autofs-5.0.5.orig/include/automount.h
|
||||
+++ autofs-5.0.5/include/automount.h
|
||||
@@ -375,6 +375,47 @@ struct pending_args {
|
||||
unsigned long wait_queue_token; /* Associated kernel wait token */
|
||||
};
|
||||
|
||||
+#ifdef INCLUDE_PENDING_FUNCTIONS
|
||||
+static void pending_cond_destroy(void *arg)
|
||||
+{
|
||||
+ struct pending_args *mt = (struct pending_args *) arg;
|
||||
+ int status;
|
||||
+ status = pthread_cond_destroy(&mt->cond);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+}
|
||||
+
|
||||
+static void pending_mutex_destroy(void *arg)
|
||||
+{
|
||||
+ struct pending_args *mt = (struct pending_args *) arg;
|
||||
+ int status = pthread_mutex_destroy(&mt->mutex);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+}
|
||||
+
|
||||
+static void free_pending_args(void *arg)
|
||||
+{
|
||||
+ struct pending_args *mt = (struct pending_args *) arg;
|
||||
+ free(mt);
|
||||
+}
|
||||
+
|
||||
+static void pending_mutex_lock(void *arg)
|
||||
+{
|
||||
+ struct pending_args *mt = (struct pending_args *) arg;
|
||||
+ int status = pthread_mutex_lock(&mt->mutex);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+}
|
||||
+
|
||||
+static void pending_mutex_unlock(void *arg)
|
||||
+{
|
||||
+ struct pending_args *mt = (struct pending_args *) arg;
|
||||
+ int status = pthread_mutex_unlock(&mt->mutex);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
struct thread_stdenv_vars {
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
@ -1,72 +0,0 @@
|
||||
autofs-5.0.5 - fix add simple bind auth
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Simple authentication should not require SASL.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
include/lookup_ldap.h | 5 +++++
|
||||
modules/cyrus-sasl.c | 1 -
|
||||
modules/lookup_ldap.c | 1 -
|
||||
4 files changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -52,6 +52,7 @@
|
||||
- always read file maps mount lookup map read fix.
|
||||
- fix direct map not updating on reread.
|
||||
- add external bind method.
|
||||
+- fix add simple bind auth.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/include/lookup_ldap.h
|
||||
+++ autofs-5.0.5/include/lookup_ldap.h
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef LOOKUP_LDAP_H
|
||||
#define LOOKUP_LDAP_H
|
||||
|
||||
+#include <ldap.h>
|
||||
+
|
||||
#ifdef WITH_SASL
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/evp.h>
|
||||
@@ -102,6 +104,8 @@ struct lookup_context {
|
||||
#define LDAP_AUTH_NOTREQUIRED 0x0001
|
||||
#define LDAP_AUTH_REQUIRED 0x0002
|
||||
#define LDAP_AUTH_AUTODETECT 0x0004
|
||||
+#endif
|
||||
+
|
||||
#define LDAP_AUTH_USESIMPLE 0x0008
|
||||
|
||||
/* lookup_ldap.c */
|
||||
@@ -109,6 +113,7 @@ LDAP *init_ldap_connection(unsigned logo
|
||||
int unbind_ldap_connection(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt);
|
||||
int authtype_requires_creds(const char *authtype);
|
||||
|
||||
+#ifdef WITH_SASL
|
||||
/* cyrus-sasl.c */
|
||||
int autofs_sasl_client_init(unsigned logopt);
|
||||
int autofs_sasl_init(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt);
|
||||
--- autofs-5.0.5.orig/modules/cyrus-sasl.c
|
||||
+++ autofs-5.0.5/modules/cyrus-sasl.c
|
||||
@@ -51,7 +51,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
-#include <ldap.h>
|
||||
#include <sasl/sasl.h>
|
||||
|
||||
#include "automount.h"
|
||||
--- autofs-5.0.5.orig/modules/lookup_ldap.c
|
||||
+++ autofs-5.0.5/modules/lookup_ldap.c
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <arpa/nameser.h>
|
||||
#include <resolv.h>
|
||||
#include <lber.h>
|
||||
-#include <ldap.h>
|
||||
|
||||
#define MODULE_LOOKUP
|
||||
#include "automount.h"
|
||||
@ -1,32 +0,0 @@
|
||||
autofs-5.0.5 - fix ampersand escape in auto.smb
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
CIFS share names containing an ampersand need to be escaped.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
samples/auto.smb | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -24,6 +24,7 @@
|
||||
- fix reconnect get base dn.
|
||||
- add missing sasl mutex callbacks.
|
||||
- fix get query dn failure.
|
||||
+- fix ampersand escape in auto.smb.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/samples/auto.smb
|
||||
+++ autofs-5.0.5/samples/auto.smb
|
||||
@@ -26,6 +26,7 @@ $SMBCLIENT -gNL $key 2>/dev/null| awk -v
|
||||
# Enclose mount dir and location in quotes
|
||||
# Double quote "$" in location as it is special
|
||||
gsub(/\$$/, "\\$", loc);
|
||||
+ gsub(/\&/,"\\\\&",loc)
|
||||
print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
|
||||
}
|
||||
END { if (!first) print "\n"; else exit 1 }
|
||||
@ -1,48 +0,0 @@
|
||||
autofs-5.0.5 - fix backwards #ifndef INET6
|
||||
|
||||
From: Jeff Moyer <jmoyer@redhat.com>
|
||||
|
||||
Fix reversed macro checks for INET6 in get_proximity().
|
||||
|
||||
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
modules/replicated.c | 4 ++--
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index b9b1602..7997d1d 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -6,6 +6,7 @@
|
||||
- special case cifs escapes.
|
||||
- fix compile fail with when LDAP is excluded.
|
||||
- more code analysis corrections (and fix a typo in an init script).
|
||||
+- fix backwards #ifndef INET6.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/modules/replicated.c b/modules/replicated.c
|
||||
index a66de9f..4cd3eb4 100644
|
||||
--- a/modules/replicated.c
|
||||
+++ b/modules/replicated.c
|
||||
@@ -231,7 +231,7 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
|
||||
break;
|
||||
|
||||
case AF_INET6:
|
||||
-#ifndef INET6
|
||||
+#ifdef INET6
|
||||
if (host_addr->sa_family == AF_INET)
|
||||
break;
|
||||
|
||||
@@ -313,7 +313,7 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
|
||||
break;
|
||||
|
||||
case AF_INET6:
|
||||
-#ifndef INET6
|
||||
+#ifdef INET6
|
||||
if (host_addr->sa_family == AF_INET)
|
||||
break;
|
||||
|
||||
@ -1,90 +0,0 @@
|
||||
autofs-5.0.5 - fix cache_init() on source re-read
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The master map entry cache is released and re-allocated for each
|
||||
map source upon master map re-read. This is done without holding
|
||||
the master map entry write lock and, when there are many master
|
||||
map entries, could lead to a race because other activities can be
|
||||
underway concurrently. In this case then we must either use
|
||||
additional expensive exclusive locking or not do the cache
|
||||
re-recreate.
|
||||
|
||||
So the question really becomes what do we have to gain by releasing
|
||||
and re-creating the cache since we spend a fairly significant amount
|
||||
of effort on pruning stale entries during ongoing operation already.
|
||||
|
||||
This patch moves the allocation of the map entry cache (belonging to
|
||||
the map source) into the function used to add the map source to the
|
||||
master map entry and does not release and re-create the cache if the
|
||||
source already exists for the given master map entry.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/master.c | 6 ++++++
|
||||
lib/master_parse.y | 10 ----------
|
||||
modules/mount_autofs.c | 8 --------
|
||||
4 files changed, 7 insertions(+), 18 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -38,6 +38,7 @@
|
||||
- fix parse_sun() module init.
|
||||
- dont check null cache on expire.
|
||||
- fix null cache race.
|
||||
+- fix cache_init() on source re-read.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/lib/master.c
|
||||
+++ autofs-5.0.5/lib/master.c
|
||||
@@ -188,6 +188,12 @@ master_add_map_source(struct master_mape
|
||||
source->argc = argc;
|
||||
source->argv = tmpargv;
|
||||
|
||||
+ source->mc = cache_init(entry->ap, source);
|
||||
+ if (!source->mc) {
|
||||
+ master_free_map_source(source, 0);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
master_source_writelock(entry);
|
||||
|
||||
if (!entry->maps) {
|
||||
--- autofs-5.0.5.orig/lib/master_parse.y
|
||||
+++ autofs-5.0.5/lib/master_parse.y
|
||||
@@ -830,16 +830,6 @@ int master_parse_entry(const char *buffe
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (!source->mc) {
|
||||
- source->mc = cache_init(entry->ap, source);
|
||||
- if (!source->mc) {
|
||||
- error(m_logopt, "failed to init source cache");
|
||||
- if (new)
|
||||
- master_free_mapent(new);
|
||||
- local_free_vars();
|
||||
- return 0;
|
||||
- }
|
||||
- }
|
||||
source->master_line = lineno;
|
||||
|
||||
entry->age = age;
|
||||
--- autofs-5.0.5.orig/modules/mount_autofs.c
|
||||
+++ autofs-5.0.5/modules/mount_autofs.c
|
||||
@@ -200,14 +200,6 @@ int mount_mount(struct autofs_point *ap,
|
||||
}
|
||||
free_map_type_info(info);
|
||||
|
||||
- source->mc = cache_init(entry->ap, source);
|
||||
- if (!source->mc) {
|
||||
- error(ap->logopt, MODPREFIX "failed to init source cache");
|
||||
- master_free_map_source(source, 0);
|
||||
- master_free_mapent(entry);
|
||||
- return 1;
|
||||
- }
|
||||
-
|
||||
mounts_mutex_lock(ap);
|
||||
|
||||
if (handle_mounts_startup_cond_init(&suc)) {
|
||||
@ -1,40 +0,0 @@
|
||||
autofs-5.0.5 - fix direct map not updating on reread
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
If the map type is explicitly specified for a map the map isn't
|
||||
properly updated when a re-read is requested. This is because
|
||||
the map stale flag is incorrectly cleared after after the lookup
|
||||
module reads the map instead of at the completion of the update
|
||||
procedure. The map stale flag should only be cleared if the map
|
||||
read fails for some reason, otherwise it is updated when the
|
||||
refresh is completed.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/lookup.c | 3 ++-
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -50,6 +50,7 @@
|
||||
- fix init script restart option.
|
||||
- fix init script status privilege error.
|
||||
- always read file maps mount lookup map read fix.
|
||||
+- fix direct map not updating on reread.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/daemon/lookup.c
|
||||
+++ autofs-5.0.5/daemon/lookup.c
|
||||
@@ -295,7 +295,8 @@ static int do_read_map(struct autofs_poi
|
||||
|
||||
status = lookup->lookup_read_map(ap, age, lookup->context);
|
||||
|
||||
- map->stale = 0;
|
||||
+ if (status != NSS_STATUS_SUCCESS)
|
||||
+ map->stale = 0;
|
||||
|
||||
/*
|
||||
* For maps that don't support enumeration return success
|
||||
@ -1,35 +0,0 @@
|
||||
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;
|
||||
@ -1,43 +0,0 @@
|
||||
autofs-5.0.5 - fix error handing in do_mount_indirect()
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
A couple of error returns in do_mount_indirect() fail to notify
|
||||
the kernel of request status before terminating.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/indirect.c | 4 ++++
|
||||
2 files changed, 5 insertions(+)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -44,6 +44,7 @@
|
||||
- fix negative cache included map lookup.
|
||||
- remove state machine timed wait.
|
||||
- remove extra read master map call.
|
||||
+- fix error handing in do_mount_indirect().
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/daemon/indirect.c
|
||||
+++ autofs-5.0.5/daemon/indirect.c
|
||||
@@ -792,6 +792,9 @@ static void *do_mount_indirect(void *arg
|
||||
len = ncat_path(buf, sizeof(buf), ap->path, mt.name, mt.len);
|
||||
if (!len) {
|
||||
crit(ap->logopt, "path to be mounted is to long");
|
||||
+ ops->send_fail(ap->logopt,
|
||||
+ ap->ioctlfd, mt.wait_queue_token,
|
||||
+ -ENAMETOOLONG);
|
||||
pthread_setcancelstate(state, NULL);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
@@ -800,6 +803,7 @@ static void *do_mount_indirect(void *arg
|
||||
if (status != -1 && !(S_ISDIR(st.st_mode) && st.st_dev == mt.dev)) {
|
||||
error(ap->logopt,
|
||||
"indirect trigger not valid or already mounted %s", buf);
|
||||
+ ops->send_ready(ap->logopt, ap->ioctlfd, mt.wait_queue_token);
|
||||
pthread_setcancelstate(state, NULL);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
autofs-5.0.3 - fix expire race
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
For multi-mounts, if a mount request comes in and does not complete
|
||||
before a concurrent expire autofs will not recognize that the tree
|
||||
has become busy which can lead to a partial expire leaving the
|
||||
multi-mount non-functional.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/mounts.c | 5 ++++-
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -59,6 +59,7 @@
|
||||
- auto adjust ldap page size.
|
||||
- fix prune cache valid check.
|
||||
- fix mountd vers retry.
|
||||
+- fix expire race.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/lib/mounts.c
|
||||
+++ autofs-5.0.5/lib/mounts.c
|
||||
@@ -1525,8 +1525,11 @@ int umount_multi_triggers(struct autofs_
|
||||
oe_base = oe->key + strlen(root);
|
||||
left += umount_multi_triggers(ap, oe, root, oe_base);
|
||||
|
||||
- if (oe->ioctlfd != -1)
|
||||
+ if (oe->ioctlfd != -1 ||
|
||||
+ is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) {
|
||||
left++;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (left)
|
||||
@ -1,208 +0,0 @@
|
||||
autofs-5.0.5 - fix ext4 fsck at mount
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Autofs performs a "preen" fsck at max mount count for ext2 and ext3, but not
|
||||
ext4.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
Makefile.conf.in | 3 ++
|
||||
configure | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
configure.in | 1 +
|
||||
include/config.h.in | 6 +++++
|
||||
modules/Makefile | 10 ++++++--
|
||||
modules/mount_ext2.c | 11 +++++----
|
||||
7 files changed, 88 insertions(+), 7 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 8b62370..e37dadb 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -8,6 +8,7 @@
|
||||
- more code analysis corrections (and fix a typo in an init script).
|
||||
- fix backwards #ifndef INET6.
|
||||
- fix stale initialization for file map instance.
|
||||
+- add "preen" fsck for ext4 mounts.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/Makefile.conf.in b/Makefile.conf.in
|
||||
index f0287c3..7670364 100644
|
||||
--- a/Makefile.conf.in
|
||||
+++ b/Makefile.conf.in
|
||||
@@ -44,6 +44,9 @@ EXT2FS = @HAVE_E2FSCK@
|
||||
# Support for calling e3fsck when mounting ext3 filesystems
|
||||
EXT3FS = @HAVE_E3FSCK@
|
||||
|
||||
+# Support for calling e4fsck when mounting ext4 filesystems
|
||||
+EXT4FS = @HAVE_E4FSCK@
|
||||
+
|
||||
LEX = @PATH_LEX@
|
||||
YACC = @PATH_YACC@
|
||||
RPCGEN = @PATH_RPCGEN@
|
||||
diff --git a/configure b/configure
|
||||
index 159f25f..f5b7d07 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -668,6 +668,8 @@ PATH_LEX
|
||||
LEX
|
||||
HAVE_MODPROBE
|
||||
MODPROBE
|
||||
+HAVE_E4FSCK
|
||||
+E4FSCK
|
||||
HAVE_E3FSCK
|
||||
E3FSCK
|
||||
HAVE_E2FSCK
|
||||
@@ -3407,6 +3409,67 @@ else
|
||||
HAVE_E3FSCK=0
|
||||
fi
|
||||
|
||||
+for ac_prog in fsck.ext4 e4fsck
|
||||
+do
|
||||
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
+set dummy $ac_prog; ac_word=$2
|
||||
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
+$as_echo_n "checking for $ac_word... " >&6; }
|
||||
+if test "${ac_cv_path_E4FSCK+set}" = set; then
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ case $E4FSCK in
|
||||
+ [\\/]* | ?:[\\/]*)
|
||||
+ ac_cv_path_E4FSCK="$E4FSCK" # Let the user override the test with a path.
|
||||
+ ;;
|
||||
+ *)
|
||||
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
+for as_dir in $searchpath
|
||||
+do
|
||||
+ IFS=$as_save_IFS
|
||||
+ test -z "$as_dir" && as_dir=.
|
||||
+ for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
+ ac_cv_path_E4FSCK="$as_dir/$ac_word$ac_exec_ext"
|
||||
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
+ break 2
|
||||
+ fi
|
||||
+done
|
||||
+done
|
||||
+IFS=$as_save_IFS
|
||||
+
|
||||
+ ;;
|
||||
+esac
|
||||
+fi
|
||||
+E4FSCK=$ac_cv_path_E4FSCK
|
||||
+if test -n "$E4FSCK"; then
|
||||
+ { $as_echo "$as_me:$LINENO: result: $E4FSCK" >&5
|
||||
+$as_echo "$E4FSCK" >&6; }
|
||||
+else
|
||||
+ { $as_echo "$as_me:$LINENO: result: no" >&5
|
||||
+$as_echo "no" >&6; }
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+ test -n "$E4FSCK" && break
|
||||
+done
|
||||
+
|
||||
+if test -n "$E4FSCK"; then
|
||||
+
|
||||
+cat >>confdefs.h <<\_ACEOF
|
||||
+#define HAVE_E4FSCK 1
|
||||
+_ACEOF
|
||||
+
|
||||
+
|
||||
+cat >>confdefs.h <<_ACEOF
|
||||
+#define PATH_E4FSCK "$E4FSCK"
|
||||
+_ACEOF
|
||||
+
|
||||
+ HAVE_E4FSCK=1
|
||||
+else
|
||||
+ HAVE_E4FSCK=0
|
||||
+fi
|
||||
+
|
||||
for ac_prog in modprobe
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
diff --git a/configure.in b/configure.in
|
||||
index f649a58..78085bd 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -131,6 +131,7 @@ AF_PATH_INCLUDE(MOUNT, mount, /bin/mount, $searchpath)
|
||||
AF_PATH_INCLUDE(UMOUNT, umount, /bin/umount, $searchpath)
|
||||
AF_PATH_INCLUDE(E2FSCK, fsck.ext2 e2fsck, , $searchpath)
|
||||
AF_PATH_INCLUDE(E3FSCK, fsck.ext3 e3fsck, , $searchpath)
|
||||
+AF_PATH_INCLUDE(E4FSCK, fsck.ext4 e4fsck, , $searchpath)
|
||||
AF_PATH_INCLUDE(MODPROBE, modprobe, , $searchpath)
|
||||
|
||||
AF_CHECK_PROG(LEX, flex lex, , $searchpath)
|
||||
diff --git a/include/config.h.in b/include/config.h.in
|
||||
index 39cfa4b..dece33f 100644
|
||||
--- a/include/config.h.in
|
||||
+++ b/include/config.h.in
|
||||
@@ -18,6 +18,9 @@
|
||||
/* define if you have E3FSCK */
|
||||
#undef HAVE_E3FSCK
|
||||
|
||||
+/* define if you have E4FSCK */
|
||||
+#undef HAVE_E4FSCK
|
||||
+
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
@@ -93,6 +96,9 @@
|
||||
/* define if you have E3FSCK */
|
||||
#undef PATH_E3FSCK
|
||||
|
||||
+/* define if you have E4FSCK */
|
||||
+#undef PATH_E4FSCK
|
||||
+
|
||||
/* define if you have LEX */
|
||||
#undef PATH_LEX
|
||||
|
||||
diff --git a/modules/Makefile b/modules/Makefile
|
||||
index 13b3bd8..0bb9464 100644
|
||||
--- a/modules/Makefile
|
||||
+++ b/modules/Makefile
|
||||
@@ -69,10 +69,16 @@ ifeq ($(EXT2FS), 1)
|
||||
ifeq ($(EXT3FS), 1)
|
||||
ln -fs mount_ext2.so $(INSTALLROOT)$(autofslibdir)/mount_ext3.so
|
||||
endif
|
||||
-else
|
||||
- ifeq ($(EXT3FS), 1)
|
||||
+ ifeq ($(EXT4FS), 1)
|
||||
+ ln -fs mount_ext2.so $(INSTALLROOT)$(autofslibdir)/mount_ext4.so
|
||||
+ endif
|
||||
+else ifeq ($(EXT3FS), 1)
|
||||
mv $(INSTALLROOT)$(autofslibdir)/mount_ext2.so $(INSTALLROOT)$(autofslibdir)/mount_ext3.so
|
||||
+ ifeq ($(EXT4FS), 1)
|
||||
+ ln -fs mount_ext3.so $(INSTALLROOT)$(autofslibdir)/mount_ext4.so
|
||||
endif
|
||||
+else ifeq ($(EXT4FS), 1)
|
||||
+ mv $(INSTALLROOT)$(autofslibdir)/mount_ext2.so $(INSTALLROOT)$(autofslibdir)/mount_ext4.so
|
||||
endif
|
||||
|
||||
#
|
||||
diff --git a/modules/mount_ext2.c b/modules/mount_ext2.c
|
||||
index 724a5fa..26d59d1 100644
|
||||
--- a/modules/mount_ext2.c
|
||||
+++ b/modules/mount_ext2.c
|
||||
@@ -83,13 +83,14 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
||||
ro = 1;
|
||||
}
|
||||
|
||||
+ fsck_prog = PATH_E2FSCK;
|
||||
#ifdef HAVE_E3FSCK
|
||||
- if (!strcmp(fstype,"ext3") || !strcmp(fstype,"auto"))
|
||||
+ if (!strcmp(fstype,"ext3"))
|
||||
fsck_prog = PATH_E3FSCK;
|
||||
- else
|
||||
- fsck_prog = PATH_E2FSCK;
|
||||
-#else
|
||||
- fsck_prog = PATH_E2FSCK;
|
||||
+#endif
|
||||
+#ifdef HAVE_E4FSCK
|
||||
+ if (!strcmp(fstype,"ext4"))
|
||||
+ fsck_prog = PATH_E4FSCK;
|
||||
#endif
|
||||
if (ro) {
|
||||
debug(ap->logopt,
|
||||
@ -1,28 +0,0 @@
|
||||
autofs-5.0.5 - fix "fix cache_init() on source re-read"
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Remove extra cache create call in master_add_map_source().
|
||||
---
|
||||
|
||||
lib/master.c | 6 ------
|
||||
1 files changed, 0 insertions(+), 6 deletions(-)
|
||||
|
||||
|
||||
diff --git a/lib/master.c b/lib/master.c
|
||||
index 03d8f77..12f2d22 100644
|
||||
--- a/lib/master.c
|
||||
+++ b/lib/master.c
|
||||
@@ -188,12 +188,6 @@ master_add_map_source(struct master_mapent *entry,
|
||||
source->argc = argc;
|
||||
source->argv = tmpargv;
|
||||
|
||||
- source->mc = cache_init(entry->ap, source);
|
||||
- if (!source->mc) {
|
||||
- master_free_map_source(source, 0);
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
master_source_writelock(entry);
|
||||
|
||||
if (!entry->maps) {
|
||||
@ -1,39 +0,0 @@
|
||||
autofs-5.0.5 - fix get query dn failure
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Recent changes to the LDAP connection logic can fail to retrieve a valid
|
||||
query dn upon LDAP connection.
|
||||
|
||||
If LDAP is being used to store autofs maps, the LDAP schema to be used
|
||||
for the maps is explicitly defined in the autofs configuration and no
|
||||
master map entries exist in LDAP autofs fails to try and retrieve a
|
||||
query dn, returning success instead of failure.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
modules/lookup_ldap.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -23,6 +23,7 @@
|
||||
- fix strdup() return value check (Leonardo Chiquitto).
|
||||
- fix reconnect get base dn.
|
||||
- add missing sasl mutex callbacks.
|
||||
+- fix get query dn failure.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/modules/lookup_ldap.c
|
||||
+++ autofs-5.0.5/modules/lookup_ldap.c
|
||||
@@ -556,7 +556,7 @@ static int do_bind(unsigned logopt, LDAP
|
||||
}
|
||||
}
|
||||
|
||||
- if (ctxt->schema && !need_base)
|
||||
+ if (ctxt->schema && ctxt->qdn && !need_base)
|
||||
return 1;
|
||||
|
||||
/*
|
||||
@ -1,44 +0,0 @@
|
||||
autofs-5.0.5 - fix included map read fail handling
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
If an included map read fails an error is returned and subsequent
|
||||
master map entries are not read. We should report the failure but
|
||||
we shouldn't stop reading the master map.
|
||||
---
|
||||
|
||||
CHANGELOG | 4 ++++
|
||||
modules/lookup_file.c | 7 -------
|
||||
2 files changed, 4 insertions(+), 7 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index e734cb3..674a48b 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -1,3 +1,7 @@
|
||||
+??/??/20?? autofs-5.0.6
|
||||
+-----------------------
|
||||
+- fix included map read fail handling.
|
||||
+
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
- fix dumb libxml2 check
|
||||
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
|
||||
index a4ca39d..e43ab2f 100644
|
||||
--- a/modules/lookup_file.c
|
||||
+++ b/modules/lookup_file.c
|
||||
@@ -438,13 +438,6 @@ int lookup_read_master(struct master *master, time_t age, void *context)
|
||||
MODPREFIX
|
||||
"failed to read included master map %s",
|
||||
master->name);
|
||||
- if (!master->recurse) {
|
||||
- master->name = save_name;
|
||||
- master->depth--;
|
||||
- master->recurse = 0;
|
||||
- fclose(f);
|
||||
- return NSS_STATUS_UNAVAIL;
|
||||
- }
|
||||
}
|
||||
master->depth--;
|
||||
master->recurse = 0;
|
||||
@ -1,78 +0,0 @@
|
||||
autofs-5.0.5 - fix isspace() wild card substition
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
If there are characters that match isspace() (such as \t, \n, etc.) in a
|
||||
passed map entry key and there is no space in the key these characters
|
||||
won't be properly preserved, leading to failed or incorrect mounts.
|
||||
|
||||
This is caused by an incorrect attempt at optimization, using a check
|
||||
to see if a space is present in the passed key and only then processing
|
||||
each character of the key individually, escaping any isspace() characters.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
modules/parse_sun.c | 40 +++++++++++++++++-----------------------
|
||||
2 files changed, 18 insertions(+), 23 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -55,6 +55,7 @@
|
||||
- fix add simple bind auth.
|
||||
- add option to dump configured automount maps.
|
||||
- use weight only for server selection.
|
||||
+- fix isspace() wild card substition.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/modules/parse_sun.c
|
||||
+++ autofs-5.0.5/modules/parse_sun.c
|
||||
@@ -161,30 +161,24 @@ int expandsunent(const char *src, char *
|
||||
case '&':
|
||||
l = strlen(key);
|
||||
/*
|
||||
- * In order to ensure that any spaces in the key
|
||||
- * re preserved, we need to escape them here.
|
||||
+ * In order to ensure that any isspace() characters
|
||||
+ * in the key are preserved, we need to escape them
|
||||
+ * here.
|
||||
*/
|
||||
- if (strchr(key, ' ')) {
|
||||
- const char *keyp = key;
|
||||
- while (*keyp) {
|
||||
- if (isspace(*keyp)) {
|
||||
- if (dst) {
|
||||
- *dst++ = '\\';
|
||||
- *dst++ = *keyp++;
|
||||
- } else
|
||||
- keyp++;
|
||||
- l++;
|
||||
- } else {
|
||||
- if (dst)
|
||||
- *dst++ = *keyp++;
|
||||
- else
|
||||
- keyp++;
|
||||
- }
|
||||
- }
|
||||
- } else {
|
||||
- if (dst) {
|
||||
- strcpy(dst, key);
|
||||
- dst += l;
|
||||
+ const char *keyp = key;
|
||||
+ while (*keyp) {
|
||||
+ if (isspace(*keyp)) {
|
||||
+ if (dst) {
|
||||
+ *dst++ = '\\';
|
||||
+ *dst++ = *keyp++;
|
||||
+ } else
|
||||
+ keyp++;
|
||||
+ l++;
|
||||
+ } else {
|
||||
+ if (dst)
|
||||
+ *dst++ = *keyp++;
|
||||
+ else
|
||||
+ keyp++;
|
||||
}
|
||||
}
|
||||
len += l;
|
||||
@ -1,79 +0,0 @@
|
||||
autofs-5.0.5 - fix libxml2 workaround configure
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The configure logic related to work around the libxml2 library
|
||||
reload issues is not quite right. The xml code is needed if
|
||||
ldap is used so it is sufficient to require inclusion of the
|
||||
workaround code if autofs is being built with LDAP support.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/Makefile | 2 --
|
||||
daemon/automount.c | 8 +++++---
|
||||
3 files changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 671c979..23351c8 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -4,6 +4,7 @@
|
||||
- refactor ldap sasl bind handling.
|
||||
- add mount wait timeout parameter.
|
||||
- special case cifs escapes.
|
||||
+- fix compile fail with when LDAP is excluded.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/daemon/Makefile b/daemon/Makefile
|
||||
index 371ec72..9e9d635 100644
|
||||
--- a/daemon/Makefile
|
||||
+++ b/daemon/Makefile
|
||||
@@ -23,10 +23,8 @@ LDFLAGS += -rdynamic
|
||||
LIBS = -ldl
|
||||
|
||||
ifeq ($(LDAP), 1)
|
||||
- ifeq ($(SASL), 1)
|
||||
CFLAGS += $(XML_FLAGS)
|
||||
LIBS += $(XML_LIBS)
|
||||
- endif
|
||||
endif
|
||||
|
||||
all: automount
|
||||
diff --git a/daemon/automount.c b/daemon/automount.c
|
||||
index 979ecd6..7c44d4b 100644
|
||||
--- a/daemon/automount.c
|
||||
+++ b/daemon/automount.c
|
||||
@@ -38,10 +38,12 @@
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include "automount.h"
|
||||
-#ifdef LIBXML2_WORKAROUND
|
||||
+#if defined(LIBXML2_WORKAROUND) || defined(TIRPC_WORKAROUND)
|
||||
#include <dlfcn.h>
|
||||
+#ifdef WITH_LDAP
|
||||
#include <libxml/parser.h>
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
const char *program; /* Initialized with argv[0] */
|
||||
const char *version = VERSION_STRING; /* Program version */
|
||||
@@ -2110,7 +2112,7 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
-#ifdef LIBXML2_WORKAROUND
|
||||
+#if defined(WITH_LDAP) && defined(LIBXML2_WORKAROUND)
|
||||
void *dh_xml2 = dlopen("libxml2.so", RTLD_NOW);
|
||||
if (!dh_xml2)
|
||||
dh_xml2 = dlopen("libxml2.so.2", RTLD_NOW);
|
||||
@@ -2158,7 +2160,7 @@ int main(int argc, char *argv[])
|
||||
if (dh_tirpc)
|
||||
dlclose(dh_tirpc);
|
||||
#endif
|
||||
-#ifdef LIBXML2_WORKAROUND
|
||||
+#if defined(WITH_LDAP) && defined( LIBXML2_WORKAROUND)
|
||||
if (dh_xml2) {
|
||||
xmlCleanupParser();
|
||||
dlclose(dh_xml2);
|
||||
@ -1,40 +0,0 @@
|
||||
autofs-5.0.5 - fix lsb service name in init script
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The "Provides:" in the init script header incorrectly uses $autofs
|
||||
instead of autofs. This isn't correct as using names starting with
|
||||
a $ is reserved for standards-defined facilities.
|
||||
---
|
||||
|
||||
redhat/autofs.init.in | 2 +-
|
||||
samples/rc.autofs.in | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
|
||||
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
|
||||
index 4a915ec..86b7eb4 100644
|
||||
--- a/redhat/autofs.init.in
|
||||
+++ b/redhat/autofs.init.in
|
||||
@@ -8,7 +8,7 @@
|
||||
# description: Automounts filesystems on demand
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
-# Provides: $autofs
|
||||
+# Provides: autofs
|
||||
# Required-Start: $network $ypbind
|
||||
# Required-Stop: $network $ypbind
|
||||
# Default-Start: 3 4 5
|
||||
diff --git a/samples/rc.autofs.in b/samples/rc.autofs.in
|
||||
index ae2e907..0306ef6 100644
|
||||
--- a/samples/rc.autofs.in
|
||||
+++ b/samples/rc.autofs.in
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
-# Provides: $autofs
|
||||
+# Provides: autofs
|
||||
# Required-Start: $network $ypbind
|
||||
# Required-Stop: $network $ypbind
|
||||
# Default-Start: 3 4 5
|
||||
@ -1,129 +0,0 @@
|
||||
autofs-5.0.5 - fix master map source server unavailable handling
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
If we get an NSS_STATUS_UNAVAIL from any server when trying to read
|
||||
the master map we have no choice but to not update mounted automounts
|
||||
because we can't know what entries may have come from the server that
|
||||
isn't avialable. So we leave everything the way it is and wait until
|
||||
the next re-read to update our mounts.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/automount.c | 5 +++--
|
||||
daemon/lookup.c | 9 +++++++++
|
||||
include/master.h | 1 +
|
||||
lib/master.c | 9 ++++++++-
|
||||
modules/lookup_file.c | 2 --
|
||||
6 files changed, 22 insertions(+), 5 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -28,6 +28,7 @@
|
||||
- add locality as valid ldap master map attribute.
|
||||
- add locality as valid ldap master map attribute fix.
|
||||
- add simple bind authentication.
|
||||
+- fix master map source server unavailable handling.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/daemon/automount.c
|
||||
+++ autofs-5.0.5/daemon/automount.c
|
||||
@@ -1478,7 +1478,6 @@ static void handle_mounts_cleanup(void *
|
||||
master_free_mapent_sources(ap->entry, 1);
|
||||
master_free_mapent(ap->entry);
|
||||
}
|
||||
- master_mutex_unlock();
|
||||
|
||||
if (clean) {
|
||||
if (rmdir(path) == -1) {
|
||||
@@ -1497,7 +1496,9 @@ static void handle_mounts_cleanup(void *
|
||||
*/
|
||||
if (!submount)
|
||||
pthread_kill(state_mach_thid, SIGTERM);
|
||||
-
|
||||
+
|
||||
+ master_mutex_unlock();
|
||||
+
|
||||
return;
|
||||
}
|
||||
|
||||
--- autofs-5.0.5.orig/daemon/lookup.c
|
||||
+++ autofs-5.0.5/daemon/lookup.c
|
||||
@@ -157,6 +157,9 @@ int lookup_nss_read_master(struct master
|
||||
result = do_read_master(master, "file", age);
|
||||
}
|
||||
|
||||
+ if (result == NSS_STATUS_UNAVAIL)
|
||||
+ master->read_fail = 1;
|
||||
+
|
||||
return !result;
|
||||
} else {
|
||||
char *name = master->name;
|
||||
@@ -194,6 +197,9 @@ int lookup_nss_read_master(struct master
|
||||
result = do_read_master(master, source, age);
|
||||
master->name = name;
|
||||
|
||||
+ if (result == NSS_STATUS_UNAVAIL)
|
||||
+ master->read_fail = 1;
|
||||
+
|
||||
return !result;
|
||||
}
|
||||
}
|
||||
@@ -248,6 +254,9 @@ int lookup_nss_read_master(struct master
|
||||
continue;
|
||||
}
|
||||
|
||||
+ if (result == NSS_STATUS_UNAVAIL)
|
||||
+ master->read_fail = 1;
|
||||
+
|
||||
status = check_nss_result(this, result);
|
||||
if (status >= 0) {
|
||||
free_sources(&nsslist);
|
||||
--- autofs-5.0.5.orig/include/master.h
|
||||
+++ autofs-5.0.5/include/master.h
|
||||
@@ -56,6 +56,7 @@ struct master {
|
||||
unsigned int recurse;
|
||||
unsigned int depth;
|
||||
unsigned int reading;
|
||||
+ unsigned int read_fail;
|
||||
unsigned int default_ghost;
|
||||
unsigned int default_logging;
|
||||
unsigned int default_timeout;
|
||||
--- autofs-5.0.5.orig/lib/master.c
|
||||
+++ autofs-5.0.5/lib/master.c
|
||||
@@ -794,6 +794,7 @@ struct master *master_new(const char *na
|
||||
master->recurse = 0;
|
||||
master->depth = 0;
|
||||
master->reading = 0;
|
||||
+ master->read_fail = 0;
|
||||
master->default_ghost = ghost;
|
||||
master->default_timeout = timeout;
|
||||
master->default_logging = defaults_get_logging();
|
||||
@@ -821,7 +822,13 @@ int master_read_master(struct master *ma
|
||||
master_init_scan();
|
||||
|
||||
lookup_nss_read_master(master, age);
|
||||
- master_mount_mounts(master, age, readall);
|
||||
+ if (!master->read_fail)
|
||||
+ master_mount_mounts(master, age, readall);
|
||||
+ else {
|
||||
+ master->read_fail = 0;
|
||||
+ if (!readall)
|
||||
+ master_mount_mounts(master, age, readall);
|
||||
+ }
|
||||
|
||||
master_mutex_lock();
|
||||
|
||||
--- autofs-5.0.5.orig/modules/lookup_file.c
|
||||
+++ autofs-5.0.5/modules/lookup_file.c
|
||||
@@ -656,8 +656,6 @@ int lookup_read_map(struct autofs_point
|
||||
if (!status) {
|
||||
warn(ap->logopt,
|
||||
"failed to read included map %s", key);
|
||||
- fclose(f);
|
||||
- return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
} else {
|
||||
char *s_key;
|
||||
@ -1,72 +0,0 @@
|
||||
autofs-5.0.5 - fix memory leak on reload
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When sending a signal to the automount daemon to re-load the maps a map
|
||||
entry cache is pre-allocated before checking if the entry already exists.
|
||||
If the master map entry was found to exist the pre-allocated cache was
|
||||
not being freed.
|
||||
|
||||
If there are a large number of entries in the master map and there are
|
||||
frequent re-load requests sent to the daemon the memory leak will cause
|
||||
the system to become unstable fairly quilkly.
|
||||
|
||||
Since the map entry cache (allocated for each map entry) is fairly large
|
||||
these days (and is configurable) pre-allocating it is no longer a cheap
|
||||
operation. This patch fixes the memory leak and only allocates a map
|
||||
entry cache if the entry does not already exist.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/master.c | 17 +++++++++++++++--
|
||||
2 files changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 20566a6..df2ec09 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -16,6 +16,7 @@
|
||||
- check for path mount location in generic module.
|
||||
- dont fail mount on access fail.
|
||||
- fix rpc fail on large export list.
|
||||
+- fix memory leak on reload.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/lib/master.c b/lib/master.c
|
||||
index 8455f40..83019aa 100644
|
||||
--- a/lib/master.c
|
||||
+++ b/lib/master.c
|
||||
@@ -190,9 +190,15 @@ master_add_map_source(struct master_mapent *entry,
|
||||
|
||||
master_source_writelock(entry);
|
||||
|
||||
- if (!entry->maps)
|
||||
+ if (!entry->maps) {
|
||||
+ source->mc = cache_init(entry->ap, source);
|
||||
+ if (!source->mc) {
|
||||
+ master_free_map_source(source, 0);
|
||||
+ master_source_unlock(entry);
|
||||
+ return NULL;
|
||||
+ }
|
||||
entry->maps = source;
|
||||
- else {
|
||||
+ } else {
|
||||
struct map_source *this, *last, *next;
|
||||
|
||||
/* Typically there only a few map sources */
|
||||
@@ -205,6 +211,13 @@ master_add_map_source(struct master_mapent *entry,
|
||||
return this;
|
||||
}
|
||||
|
||||
+ source->mc = cache_init(entry->ap, source);
|
||||
+ if (!source->mc) {
|
||||
+ master_free_map_source(source, 0);
|
||||
+ master_source_unlock(entry);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
last = NULL;
|
||||
next = entry->maps;
|
||||
while (next) {
|
||||
@ -1,81 +0,0 @@
|
||||
autofs-5.0.5 - fix mountd vers retry
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The autofs RPC function used to get the exports list from a host to
|
||||
be used by the hosts internal map did not try all potentially available
|
||||
mountd versions. This leads to a failure to get the export list when
|
||||
certain mountd protocol versions are disabled.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/rpc_subs.c | 26 +++++++++++++++++++++-----
|
||||
2 files changed, 22 insertions(+), 5 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -58,6 +58,7 @@
|
||||
- fix isspace() wild card substition.
|
||||
- auto adjust ldap page size.
|
||||
- fix prune cache valid check.
|
||||
+- fix mountd vers retry.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/lib/rpc_subs.c
|
||||
+++ autofs-5.0.5/lib/rpc_subs.c
|
||||
@@ -53,6 +53,12 @@
|
||||
/* Get numeric value of the n bits starting at position p */
|
||||
#define getbits(x, p, n) ((x >> (p + 1 - n)) & ~(~0 << n))
|
||||
|
||||
+static const rpcvers_t mount_vers[] = {
|
||||
+ MOUNTVERS_NFSV3,
|
||||
+ MOUNTVERS_POSIX,
|
||||
+ MOUNTVERS,
|
||||
+};
|
||||
+
|
||||
static int connect_nb(int, struct sockaddr *, socklen_t, struct timeval *);
|
||||
inline void dump_core(void);
|
||||
|
||||
@@ -846,6 +852,7 @@ static int rpc_get_exports_proto(struct
|
||||
enum clnt_stat status;
|
||||
int proto = info->proto->p_proto;
|
||||
unsigned int option = info->close_option;
|
||||
+ int vers_entry;
|
||||
|
||||
if (info->proto->p_proto == IPPROTO_UDP) {
|
||||
info->send_sz = UDPMSGSIZE;
|
||||
@@ -862,10 +869,19 @@ static int rpc_get_exports_proto(struct
|
||||
|
||||
client->cl_auth = authunix_create_default();
|
||||
|
||||
- status = clnt_call(client, MOUNTPROC_EXPORT,
|
||||
- (xdrproc_t) xdr_void, NULL,
|
||||
- (xdrproc_t) xdr_exports, (caddr_t) exp,
|
||||
- info->timeout);
|
||||
+ vers_entry = 0;
|
||||
+ while (1) {
|
||||
+ status = clnt_call(client, MOUNTPROC_EXPORT,
|
||||
+ (xdrproc_t) xdr_void, NULL,
|
||||
+ (xdrproc_t) xdr_exports, (caddr_t) exp,
|
||||
+ info->timeout);
|
||||
+ if (status != RPC_PROGVERSMISMATCH)
|
||||
+ break;
|
||||
+ if (++vers_entry > 2)
|
||||
+ break;
|
||||
+ CLNT_CONTROL(client, CLSET_VERS,
|
||||
+ (void *) &mount_vers[vers_entry]);
|
||||
+ }
|
||||
|
||||
/* Only play with the close options if we think it completed OK */
|
||||
if (proto == IPPROTO_TCP && status == RPC_SUCCESS) {
|
||||
@@ -934,7 +950,7 @@ exports rpc_get_exports(const char *host
|
||||
info.addr = NULL;
|
||||
info.addr_len = 0;
|
||||
info.program = MOUNTPROG;
|
||||
- info.version = MOUNTVERS;
|
||||
+ info.version = mount_vers[0];
|
||||
info.send_sz = 0;
|
||||
info.recv_sz = 0;
|
||||
info.timeout.tv_sec = seconds;
|
||||
@ -1,49 +0,0 @@
|
||||
autofs-5.0.5 - fix negative cache included map lookup
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
If we are looking up a mount from multiple included map sources we
|
||||
can't update the negative cache until we have looked at all sources.
|
||||
If we don't postpone the negative cache update we will get a false
|
||||
negative on a subsequent lookups.
|
||||
|
||||
Also clean up "not found" message.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/lookup.c | 6 +++++-
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -41,6 +41,7 @@
|
||||
- fix cache_init() on source re-read.
|
||||
- fix mapent becomes negative during lookup.
|
||||
- check each dc server individually.
|
||||
+- fix negative cache included map lookup.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/daemon/lookup.c
|
||||
+++ autofs-5.0.5/daemon/lookup.c
|
||||
@@ -813,6 +813,10 @@ static void update_negative_cache(struct
|
||||
struct map_source *map;
|
||||
struct mapent *me;
|
||||
|
||||
+ /* Don't update negative cache for included maps */
|
||||
+ if (source && source->depth)
|
||||
+ return;
|
||||
+
|
||||
/* Have we recorded the lookup fail for negative caching? */
|
||||
me = lookup_source_mapent(ap, name, LKP_DISTINCT);
|
||||
if (me)
|
||||
@@ -823,7 +827,7 @@ static void update_negative_cache(struct
|
||||
cache_unlock(me->mc);
|
||||
else {
|
||||
/* Notify only once after fail */
|
||||
- error(ap->logopt, "key \"%s\" not found in map.", name);
|
||||
+ logmsg("key \"%s\" not found in map source(s).", name);
|
||||
|
||||
/* Doesn't exist in any source, just add it somewhere */
|
||||
if (source)
|
||||
@ -1,187 +0,0 @@
|
||||
autofs-5.0.5 - fix null cache race
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The null map entry cache scope is across the entire master map but
|
||||
it is used by individual master map entries during master map re-read
|
||||
and subsequest updates resulting form it. The current null cache locking
|
||||
doesn't properly account for this.
|
||||
|
||||
To resolve this, when we re-read the master, map we need to block
|
||||
access to the null cache until the master map has been read and the
|
||||
null cache updated.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/automount.c | 4 +++-
|
||||
include/automount.h | 1 +
|
||||
lib/cache.c | 33 ++++++++++++++++++++++++++-------
|
||||
lib/master.c | 27 ++++++++++++++++++++-------
|
||||
lib/master_parse.y | 5 -----
|
||||
6 files changed, 51 insertions(+), 20 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -37,6 +37,7 @@
|
||||
- fix wildcard map entry match.
|
||||
- fix parse_sun() module init.
|
||||
- dont check null cache on expire.
|
||||
+- fix null cache race.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/daemon/automount.c
|
||||
+++ autofs-5.0.5/daemon/automount.c
|
||||
@@ -1273,14 +1273,16 @@ static int do_hup_signal(struct master *
|
||||
if (status)
|
||||
fatal(status);
|
||||
|
||||
+ master_mutex_lock();
|
||||
if (master->reading) {
|
||||
status = pthread_mutex_unlock(&mrc.mutex);
|
||||
if (status)
|
||||
fatal(status);
|
||||
+ master_mutex_unlock();
|
||||
return 1;
|
||||
}
|
||||
-
|
||||
master->reading = 1;
|
||||
+ master_mutex_unlock();
|
||||
|
||||
status = pthread_create(&thid, &th_attr_detached, do_read_master, NULL);
|
||||
if (status) {
|
||||
--- autofs-5.0.5.orig/include/automount.h
|
||||
+++ autofs-5.0.5/include/automount.h
|
||||
@@ -194,6 +194,7 @@ void cache_multi_writelock(struct mapent
|
||||
void cache_multi_unlock(struct mapent *me);
|
||||
int cache_delete_offset_list(struct mapent_cache *mc, const char *key);
|
||||
void cache_release(struct map_source *map);
|
||||
+void cache_clean_null_cache(struct mapent_cache *mc);
|
||||
void cache_release_null_cache(struct master *master);
|
||||
struct mapent *cache_enumerate(struct mapent_cache *mc, struct mapent *me);
|
||||
char *cache_get_offset(const char *prefix, char *offset, int start, struct list_head *head, struct list_head **pos);
|
||||
--- autofs-5.0.5.orig/lib/cache.c
|
||||
+++ autofs-5.0.5/lib/cache.c
|
||||
@@ -228,15 +228,38 @@ struct mapent_cache *cache_init(struct a
|
||||
return mc;
|
||||
}
|
||||
|
||||
+void cache_clean_null_cache(struct mapent_cache *mc)
|
||||
+{
|
||||
+ struct mapent *me, *next;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < mc->size; i++) {
|
||||
+ me = mc->hash[i];
|
||||
+ if (me == NULL)
|
||||
+ continue;
|
||||
+ next = me->next;
|
||||
+ free(me->key);
|
||||
+ if (me->mapent)
|
||||
+ free(me->mapent);
|
||||
+ free(me);
|
||||
+
|
||||
+ while (next != NULL) {
|
||||
+ me = next;
|
||||
+ next = me->next;
|
||||
+ free(me->key);
|
||||
+ free(me);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
struct mapent_cache *cache_init_null_cache(struct master *master)
|
||||
{
|
||||
struct mapent_cache *mc;
|
||||
unsigned int i;
|
||||
int status;
|
||||
|
||||
- if (master->nc)
|
||||
- cache_release_null_cache(master);
|
||||
-
|
||||
mc = malloc(sizeof(struct mapent_cache));
|
||||
if (!mc)
|
||||
return NULL;
|
||||
@@ -264,8 +287,6 @@ struct mapent_cache *cache_init_null_cac
|
||||
if (status)
|
||||
fatal(status);
|
||||
|
||||
- cache_writelock(mc);
|
||||
-
|
||||
for (i = 0; i < mc->size; i++) {
|
||||
mc->hash[i] = NULL;
|
||||
INIT_LIST_HEAD(&mc->ino_index[i]);
|
||||
@@ -274,8 +295,6 @@ struct mapent_cache *cache_init_null_cac
|
||||
mc->ap = NULL;
|
||||
mc->map = NULL;
|
||||
|
||||
- cache_unlock(mc);
|
||||
-
|
||||
return mc;
|
||||
}
|
||||
|
||||
--- autofs-5.0.5.orig/lib/master.c
|
||||
+++ autofs-5.0.5/lib/master.c
|
||||
@@ -811,15 +811,28 @@ int master_read_master(struct master *ma
|
||||
unsigned int logopt = master->logopt;
|
||||
struct mapent_cache *nc;
|
||||
|
||||
- nc = cache_init_null_cache(master);
|
||||
- if (!nc) {
|
||||
- error(logopt,
|
||||
- "failed to init null map cache for %s", master->name);
|
||||
- return 0;
|
||||
+ /*
|
||||
+ * We need to clear and re-populate the null map entry cache
|
||||
+ * before alowing anyone else to use it.
|
||||
+ */
|
||||
+ if (master->nc) {
|
||||
+ cache_writelock(master->nc);
|
||||
+ nc = master->nc;
|
||||
+ cache_clean_null_cache(nc);
|
||||
+ } else {
|
||||
+ nc = cache_init_null_cache(master);
|
||||
+ if (!nc) {
|
||||
+ error(logopt,
|
||||
+ "failed to init null map cache for %s",
|
||||
+ master->name);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ cache_writelock(nc);
|
||||
+ master->nc = nc;
|
||||
}
|
||||
- master->nc = nc;
|
||||
-
|
||||
master_init_scan();
|
||||
+ lookup_nss_read_master(master, age);
|
||||
+ cache_unlock(nc);
|
||||
|
||||
lookup_nss_read_master(master, age);
|
||||
if (!master->read_fail)
|
||||
--- autofs-5.0.5.orig/lib/master_parse.y
|
||||
+++ autofs-5.0.5/lib/master_parse.y
|
||||
@@ -741,21 +741,16 @@ int master_parse_entry(const char *buffe
|
||||
|
||||
/* Add null map entries to the null map cache */
|
||||
if (type && !strcmp(type, "null")) {
|
||||
- cache_writelock(nc);
|
||||
cache_update(nc, NULL, path, NULL, lineno);
|
||||
- cache_unlock(nc);
|
||||
local_free_vars();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Ignore all subsequent matching nulled entries */
|
||||
- cache_readlock(nc);
|
||||
if (cache_lookup_distinct(nc, path)) {
|
||||
- cache_unlock(nc);
|
||||
local_free_vars();
|
||||
return 1;
|
||||
}
|
||||
- cache_unlock(nc);
|
||||
|
||||
if (debug || verbose) {
|
||||
logopt = (debug ? LOGOPT_DEBUG : 0);
|
||||
@ -1,107 +0,0 @@
|
||||
autofs-5.0.5 - fix parse_sun() module init
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
In the parse sun module we pre-open the NFS mount module and cache
|
||||
the library handle because it is used so often. Since this is shared
|
||||
amonst all the master map entries multiple threads can race when
|
||||
accessing the instance counter, especially when there are many
|
||||
master map entries, leading to a double close on the mount library
|
||||
handle.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
modules/parse_sun.c | 37 ++++++++++++++++++++++++++++++-------
|
||||
2 files changed, 31 insertions(+), 7 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -35,6 +35,7 @@
|
||||
- don't hold lock for simple mounts.
|
||||
- fix remount locking.
|
||||
- fix wildcard map entry match.
|
||||
+- fix parse_sun() module init.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/modules/parse_sun.c
|
||||
+++ autofs-5.0.5/modules/parse_sun.c
|
||||
@@ -45,6 +45,22 @@ int parse_version = AUTOFS_PARSE_VERSION
|
||||
|
||||
static struct mount_mod *mount_nfs = NULL;
|
||||
static int init_ctr = 0;
|
||||
+static int macro_init_done = 0;
|
||||
+static pthread_mutex_t instance_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
+
|
||||
+static void instance_mutex_lock(void)
|
||||
+{
|
||||
+ int status = pthread_mutex_lock(&instance_mutex);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+}
|
||||
+
|
||||
+static void instance_mutex_unlock(void)
|
||||
+{
|
||||
+ int status = pthread_mutex_unlock(&instance_mutex);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+}
|
||||
|
||||
extern const char *global_options;
|
||||
|
||||
@@ -276,9 +292,12 @@ int parse_init(int argc, const char *con
|
||||
unsigned int append_options;
|
||||
|
||||
/* Get processor information for predefined escapes */
|
||||
-
|
||||
- if (!init_ctr)
|
||||
+ macro_lock();
|
||||
+ if (!macro_init_done) {
|
||||
+ macro_init_done = 1;
|
||||
macro_init();
|
||||
+ }
|
||||
+ macro_unlock();
|
||||
|
||||
/* Set up context and escape chain */
|
||||
|
||||
@@ -434,19 +453,21 @@ options_done:
|
||||
|
||||
/* We only need this once. NFS mounts are so common that we cache
|
||||
this module. */
|
||||
- if (!mount_nfs) {
|
||||
+ instance_mutex_lock();
|
||||
+ if (mount_nfs)
|
||||
+ init_ctr++;
|
||||
+ else {
|
||||
if ((mount_nfs = open_mount("nfs", MODPREFIX))) {
|
||||
init_ctr++;
|
||||
- return 0;
|
||||
} else {
|
||||
kill_context(ctxt);
|
||||
*context = NULL;
|
||||
+ instance_mutex_unlock();
|
||||
return 1;
|
||||
}
|
||||
- } else {
|
||||
- init_ctr++;
|
||||
- return 0;
|
||||
}
|
||||
+ instance_mutex_unlock();
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static const char *parse_options(const char *str, char **ret, unsigned int logopt)
|
||||
@@ -1734,10 +1755,12 @@ int parse_done(void *context)
|
||||
int rv = 0;
|
||||
struct parse_context *ctxt = (struct parse_context *) context;
|
||||
|
||||
+ instance_mutex_lock();
|
||||
if (--init_ctr == 0) {
|
||||
rv = close_mount(mount_nfs);
|
||||
mount_nfs = NULL;
|
||||
}
|
||||
+ instance_mutex_unlock();
|
||||
if (ctxt)
|
||||
kill_context(ctxt);
|
||||
|
||||
@ -1,91 +0,0 @@
|
||||
autofs-5.0.5 - fix pidof init script usage
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
For some reason, following an update, pidof doesn't return the pid
|
||||
of a running automount daemon when the path is used rather than just
|
||||
the name, probably to do with the inode of the daemon program changing.
|
||||
|
||||
So we change the init script to use just the program name rather than
|
||||
the path.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
redhat/autofs.init.in | 8 ++++----
|
||||
samples/rc.autofs.in | 8 ++++----
|
||||
3 files changed, 9 insertions(+), 8 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index dd093e2..cc2efab 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -12,6 +12,7 @@
|
||||
- don't use master_lex_destroy() to clear parse buffer.
|
||||
- make documentation for set-log-priority clearer.
|
||||
- fix timeout in connect_nb().
|
||||
+- fix pidof init script usage.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
|
||||
index 806302b..363e824 100644
|
||||
--- a/redhat/autofs.init.in
|
||||
+++ b/redhat/autofs.init.in
|
||||
@@ -101,14 +101,14 @@ function start() {
|
||||
function stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
count=0
|
||||
- while [ -n "`pidof $DAEMON`" -a $count -lt 15 ] ; do
|
||||
+ while [ -n "`pidof $prog`" -a $count -lt 15 ] ; do
|
||||
killproc $prog -TERM >& /dev/null
|
||||
RETVAL=$?
|
||||
- [ $RETVAL = 0 -a -z "`pidof $DAEMON`" ] || sleep 3
|
||||
+ [ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 3
|
||||
count=`expr $count + 1`
|
||||
done
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/autofs
|
||||
- if [ -n "`pidof $DAEMON`" ] ; then
|
||||
+ if [ -n "`pidof $prog`" ] ; then
|
||||
failure "$prog shutdown"
|
||||
else
|
||||
success "$prog shutdown"
|
||||
@@ -128,7 +128,7 @@ function reload() {
|
||||
RETVAL=1
|
||||
return $RETVAL
|
||||
fi
|
||||
- pid=`pidof $DAEMON`
|
||||
+ pid=`pidof $prog`
|
||||
if [ -z $pid ]; then
|
||||
echo $"$prog not running"
|
||||
RETVAL=1
|
||||
diff --git a/samples/rc.autofs.in b/samples/rc.autofs.in
|
||||
index b193a4e..ae2e907 100644
|
||||
--- a/samples/rc.autofs.in
|
||||
+++ b/samples/rc.autofs.in
|
||||
@@ -88,13 +88,13 @@ function start() {
|
||||
function stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
count=0
|
||||
- while [ -n "`pidof $DAEMON`" -a $count -lt 15 ] ; do
|
||||
+ while [ -n "`pidof $prog`" -a $count -lt 15 ] ; do
|
||||
killall -TERM $prog >& /dev/null
|
||||
RETVAL=$?
|
||||
- [ $RETVAL = 0 -a -z "`pidof $DAEMON`" ] || sleep 3
|
||||
+ [ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 3
|
||||
count=`expr $count + 1`
|
||||
done
|
||||
- if [ -z "`pidof $DAEMON`" ] ; then
|
||||
+ if [ -z "`pidof $prog`" ] ; then
|
||||
echo "done."
|
||||
else
|
||||
echo "failed."
|
||||
@@ -108,7 +108,7 @@ function restart() {
|
||||
}
|
||||
|
||||
function reload() {
|
||||
- pid=`pidof $DAEMON`
|
||||
+ pid=`pidof $prog`
|
||||
if [ -z $pid ]; then
|
||||
echo $"$prog not running"
|
||||
RETVAL=1
|
||||
@ -1,42 +0,0 @@
|
||||
autofs-5.0.5 - fix prune cache valid check
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
During a map reload, when pruning the cache we look for a valid map entry
|
||||
in another map. In lookup_prune_one_cache() There is a missing check for
|
||||
the entry being in the current map which causes the directory cleanup code
|
||||
from doing its job.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/lookup.c | 8 ++++++++
|
||||
2 files changed, 9 insertions(+)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -57,6 +57,7 @@
|
||||
- use weight only for server selection.
|
||||
- fix isspace() wild card substition.
|
||||
- auto adjust ldap page size.
|
||||
+- fix prune cache valid check.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/daemon/lookup.c
|
||||
+++ autofs-5.0.5/daemon/lookup.c
|
||||
@@ -1060,6 +1060,14 @@ void lookup_prune_one_cache(struct autof
|
||||
* cache entry.
|
||||
*/
|
||||
valid = lookup_source_valid_mapent(ap, key, LKP_DISTINCT);
|
||||
+ if (valid && valid->mc == mc) {
|
||||
+ /*
|
||||
+ * We've found a map entry that has been removed from
|
||||
+ * the current cache so it isn't really valid.
|
||||
+ */
|
||||
+ cache_unlock(valid->mc);
|
||||
+ valid = NULL;
|
||||
+ }
|
||||
if (!valid &&
|
||||
is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) {
|
||||
debug(ap->logopt,
|
||||
@ -1,137 +0,0 @@
|
||||
autofs-5.0.5 - fix random selection for host on different network
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When we select from a list of hosts from which we can mount the list
|
||||
is ordered by response time within proximity.
|
||||
|
||||
This is intended for normal selection but when using random selection
|
||||
if any hosts are on another network (and so considered further away)
|
||||
they will never be at the head of the list and so are unlikely to be
|
||||
used. This leads to a limited set of hosts being used for mounts which
|
||||
usually isn't what's required when the random selection option is used.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
include/replicated.h | 2 +-
|
||||
modules/mount_nfs.c | 2 +-
|
||||
modules/replicated.c | 28 ++++++++++++++++++++--------
|
||||
4 files changed, 23 insertions(+), 10 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -30,6 +30,7 @@
|
||||
- add simple bind authentication.
|
||||
- fix master map source server unavailable handling.
|
||||
- add autofs_ldap_auth.conf man page.
|
||||
+- fix random selection for host on different network.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/include/replicated.h
|
||||
+++ autofs-5.0.5/include/replicated.h
|
||||
@@ -64,7 +64,7 @@ struct host {
|
||||
|
||||
void seed_random(void);
|
||||
void free_host_list(struct host **);
|
||||
-int parse_location(unsigned, struct host **, const char *);
|
||||
+int parse_location(unsigned, struct host **, const char *, unsigned int);
|
||||
int prune_host_list(unsigned, struct host **, unsigned int, const char *, unsigned int);
|
||||
void dump_host_list(struct host *);
|
||||
|
||||
--- autofs-5.0.5.orig/modules/mount_nfs.c
|
||||
+++ autofs-5.0.5/modules/mount_nfs.c
|
||||
@@ -137,7 +137,7 @@ int mount_mount(struct autofs_point *ap,
|
||||
else if (mount_default_proto == 4)
|
||||
vers = vers | NFS4_VERS_MASK;
|
||||
|
||||
- if (!parse_location(ap->logopt, &hosts, what)) {
|
||||
+ if (!parse_location(ap->logopt, &hosts, what, random_selection)) {
|
||||
info(ap->logopt, MODPREFIX "no hosts available");
|
||||
return 1;
|
||||
}
|
||||
--- autofs-5.0.5.orig/modules/replicated.c
|
||||
+++ autofs-5.0.5/modules/replicated.c
|
||||
@@ -1041,13 +1041,23 @@ int prune_host_list(unsigned logopt, str
|
||||
|
||||
static int add_new_host(struct host **list,
|
||||
const char *host, unsigned int weight,
|
||||
- struct addrinfo *host_addr)
|
||||
+ struct addrinfo *host_addr,
|
||||
+ unsigned int random_selection)
|
||||
{
|
||||
struct host *new;
|
||||
unsigned int prx;
|
||||
int addr_len;
|
||||
|
||||
- prx = get_proximity(host_addr->ai_addr);
|
||||
+ /*
|
||||
+ * If we are using random selection we pretend all hosts are at
|
||||
+ * the same proximity so hosts further away don't get excluded.
|
||||
+ * We can't use PROXIMITY_LOCAL or we won't perform an RPC ping
|
||||
+ * to remove hosts that may be down.
|
||||
+ */
|
||||
+ if (random_selection)
|
||||
+ prx = PROXIMITY_SUBNET;
|
||||
+ else
|
||||
+ prx = get_proximity(host_addr->ai_addr);
|
||||
/*
|
||||
* If we tried to add an IPv6 address and we don't have IPv6
|
||||
* support return success in the hope of getting an IPv4
|
||||
@@ -1071,7 +1081,8 @@ static int add_new_host(struct host **li
|
||||
return 1;
|
||||
}
|
||||
|
||||
-static int add_host_addrs(struct host **list, const char *host, unsigned int weight)
|
||||
+static int add_host_addrs(struct host **list, const char *host,
|
||||
+ unsigned int weight, unsigned int random_selection)
|
||||
{
|
||||
struct addrinfo hints, *ni, *this;
|
||||
int ret;
|
||||
@@ -1087,7 +1098,7 @@ static int add_host_addrs(struct host **
|
||||
|
||||
this = ni;
|
||||
while (this) {
|
||||
- ret = add_new_host(list, host, weight, this);
|
||||
+ ret = add_new_host(list, host, weight, this, random_selection);
|
||||
if (!ret)
|
||||
break;
|
||||
this = this->ai_next;
|
||||
@@ -1110,7 +1121,7 @@ try_name:
|
||||
|
||||
this = ni;
|
||||
while (this) {
|
||||
- ret = add_new_host(list, host, weight, this);
|
||||
+ ret = add_new_host(list, host, weight, this, random_selection);
|
||||
if (!ret)
|
||||
break;
|
||||
this = this->ai_next;
|
||||
@@ -1197,7 +1208,8 @@ static char *seek_delim(const char *s)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-int parse_location(unsigned logopt, struct host **hosts, const char *list)
|
||||
+int parse_location(unsigned logopt, struct host **hosts,
|
||||
+ const char *list, unsigned int random_selection)
|
||||
{
|
||||
char *str, *p, *delim;
|
||||
unsigned int empty = 1;
|
||||
@@ -1252,7 +1264,7 @@ int parse_location(unsigned logopt, stru
|
||||
}
|
||||
|
||||
if (p != delim) {
|
||||
- if (!add_host_addrs(hosts, p, weight)) {
|
||||
+ if (!add_host_addrs(hosts, p, weight, random_selection)) {
|
||||
if (empty) {
|
||||
p = next;
|
||||
continue;
|
||||
@@ -1274,7 +1286,7 @@ int parse_location(unsigned logopt, stru
|
||||
*delim = '\0';
|
||||
next = delim + 1;
|
||||
|
||||
- if (!add_host_addrs(hosts, p, weight)) {
|
||||
+ if (!add_host_addrs(hosts, p, weight, random_selection)) {
|
||||
p = next;
|
||||
continue;
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
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;
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
autofs-5.0.5 - fix reconnect get base dn
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
If connect to an LDAP server but fail to find a valid query dn a
|
||||
subsequent reconnect succeeds without setting the schema fields
|
||||
used for constructing queries. A segfault then occurs when we try
|
||||
to construct a query using the schema values that should have been
|
||||
set during the query dn validation.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
modules/lookup_ldap.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -21,6 +21,7 @@
|
||||
- fix random selection option.
|
||||
- fix disable timeout.
|
||||
- fix strdup() return value check (Leonardo Chiquitto).
|
||||
+- fix reconnect get base dn.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/modules/lookup_ldap.c
|
||||
+++ autofs-5.0.5/modules/lookup_ldap.c
|
||||
@@ -556,7 +556,7 @@ static int do_bind(unsigned logopt, LDAP
|
||||
}
|
||||
}
|
||||
|
||||
- if (!need_base)
|
||||
+ if (ctxt->schema && !need_base)
|
||||
return 1;
|
||||
|
||||
/*
|
||||
@ -1,365 +0,0 @@
|
||||
autofs-5.0.5 - fix remount locking
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When autofs is restarted with active mounts it is possible, due
|
||||
to possible recursion when mounting multi-mount map entries, that
|
||||
a lookup module will take a write lock on the map entry cache
|
||||
when a read lock is alreay held.
|
||||
|
||||
Since, during the re-mount, we are still essentially running
|
||||
single threaded we need only take care to ensure we don't take
|
||||
the write lock.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
modules/lookup_file.c | 27 +++++++++++++++++----------
|
||||
modules/lookup_hosts.c | 24 +++++++++++++++---------
|
||||
modules/lookup_ldap.c | 24 ++++++++++++++++--------
|
||||
modules/lookup_nisplus.c | 29 ++++++++++++++++++-----------
|
||||
modules/lookup_program.c | 29 +++++++++++++++++++++--------
|
||||
modules/lookup_yp.c | 27 +++++++++++++++++----------
|
||||
7 files changed, 105 insertions(+), 56 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -33,6 +33,7 @@
|
||||
- fix random selection for host on different network.
|
||||
- make redhat init script more lsb compliant.
|
||||
- don't hold lock for simple mounts.
|
||||
+- fix remount locking.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/modules/lookup_file.c
|
||||
+++ autofs-5.0.5/modules/lookup_file.c
|
||||
@@ -871,7 +871,6 @@ static int check_map_indirect(struct aut
|
||||
if (ret == CHE_FAIL)
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
|
||||
- pthread_cleanup_push(cache_lock_cleanup, mc);
|
||||
cache_writelock(mc);
|
||||
exists = cache_lookup_distinct(mc, key);
|
||||
/* Not found in the map but found in the cache */
|
||||
@@ -882,7 +881,7 @@ static int check_map_indirect(struct aut
|
||||
exists->status = 0;
|
||||
}
|
||||
}
|
||||
- pthread_cleanup_pop(1);
|
||||
+ cache_unlock(mc);
|
||||
|
||||
if (ret == CHE_MISSING) {
|
||||
struct mapent *we;
|
||||
@@ -896,7 +895,6 @@ static int check_map_indirect(struct aut
|
||||
* Check for map change and update as needed for
|
||||
* following cache lookup.
|
||||
*/
|
||||
- pthread_cleanup_push(cache_lock_cleanup, mc);
|
||||
cache_writelock(mc);
|
||||
we = cache_lookup_distinct(mc, "*");
|
||||
if (we) {
|
||||
@@ -904,7 +902,7 @@ static int check_map_indirect(struct aut
|
||||
if (we->source == source && (wild & CHE_MISSING))
|
||||
cache_delete(mc, "*");
|
||||
}
|
||||
- pthread_cleanup_pop(1);
|
||||
+ cache_unlock(mc);
|
||||
|
||||
if (wild & (CHE_OK | CHE_UPDATED))
|
||||
return NSS_STATUS_SUCCESS;
|
||||
@@ -957,13 +955,22 @@ int lookup_mount(struct autofs_point *ap
|
||||
if (me->status >= time(NULL)) {
|
||||
cache_unlock(me->mc);
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
+ } else {
|
||||
+ struct mapent_cache *smc = me->mc;
|
||||
+ struct mapent *sme;
|
||||
+
|
||||
+ if (me->mapent)
|
||||
+ cache_unlock(smc);
|
||||
+ else {
|
||||
+ cache_unlock(smc);
|
||||
+ cache_writelock(smc);
|
||||
+ sme = cache_lookup_distinct(smc, key);
|
||||
+ /* Negative timeout expired for non-existent entry. */
|
||||
+ if (sme && !sme->mapent)
|
||||
+ cache_delete(smc, key);
|
||||
+ cache_unlock(smc);
|
||||
+ }
|
||||
}
|
||||
-
|
||||
- /* Negative timeout expired for non-existent entry. */
|
||||
- if (!me->mapent)
|
||||
- cache_delete(me->mc, key);
|
||||
-
|
||||
- cache_unlock(me->mc);
|
||||
}
|
||||
|
||||
/*
|
||||
--- autofs-5.0.5.orig/modules/lookup_hosts.c
|
||||
+++ autofs-5.0.5/modules/lookup_hosts.c
|
||||
@@ -146,19 +146,25 @@ int lookup_mount(struct autofs_point *ap
|
||||
/* Check if we recorded a mount fail for this key anywhere */
|
||||
me = lookup_source_mapent(ap, name, LKP_DISTINCT);
|
||||
if (me) {
|
||||
- struct mapent_cache *fmc = me->mc;
|
||||
-
|
||||
if (me->status >= time(NULL)) {
|
||||
- cache_unlock(fmc);
|
||||
+ cache_unlock(me->mc);
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
- }
|
||||
+ } else {
|
||||
+ struct mapent_cache *smc = me->mc;
|
||||
+ struct mapent *sme;
|
||||
|
||||
- if (!me->mapent) {
|
||||
- cache_delete(fmc, name);
|
||||
- me = NULL;
|
||||
+ if (me->mapent)
|
||||
+ cache_unlock(smc);
|
||||
+ else {
|
||||
+ cache_unlock(smc);
|
||||
+ cache_writelock(smc);
|
||||
+ sme = cache_lookup_distinct(smc, name);
|
||||
+ /* Negative timeout expired for non-existent entry. */
|
||||
+ if (sme && !sme->mapent)
|
||||
+ cache_delete(smc, name);
|
||||
+ cache_unlock(smc);
|
||||
+ }
|
||||
}
|
||||
-
|
||||
- cache_unlock(fmc);
|
||||
}
|
||||
|
||||
cache_readlock(mc);
|
||||
--- autofs-5.0.5.orig/modules/lookup_ldap.c
|
||||
+++ autofs-5.0.5/modules/lookup_ldap.c
|
||||
@@ -2681,7 +2681,6 @@ next:
|
||||
unbind_ldap_connection(ap->logopt, ldap, ctxt);
|
||||
|
||||
/* Failed to find wild entry, update cache if needed */
|
||||
- pthread_cleanup_push(cache_lock_cleanup, mc);
|
||||
cache_writelock(mc);
|
||||
we = cache_lookup_distinct(mc, "*");
|
||||
if (we) {
|
||||
@@ -2707,7 +2706,7 @@ next:
|
||||
}
|
||||
}
|
||||
}
|
||||
- pthread_cleanup_pop(1);
|
||||
+ cache_unlock(mc);
|
||||
free(query);
|
||||
|
||||
return ret;
|
||||
@@ -2817,13 +2816,22 @@ int lookup_mount(struct autofs_point *ap
|
||||
if (me->status >= time(NULL)) {
|
||||
cache_unlock(me->mc);
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
+ } else {
|
||||
+ struct mapent_cache *smc = me->mc;
|
||||
+ struct mapent *sme;
|
||||
+
|
||||
+ if (me->mapent)
|
||||
+ cache_unlock(smc);
|
||||
+ else {
|
||||
+ cache_unlock(smc);
|
||||
+ cache_writelock(smc);
|
||||
+ sme = cache_lookup_distinct(smc, key);
|
||||
+ /* Negative timeout expired for non-existent entry. */
|
||||
+ if (sme && !sme->mapent)
|
||||
+ cache_delete(smc, key);
|
||||
+ cache_unlock(smc);
|
||||
+ }
|
||||
}
|
||||
-
|
||||
- /* Negative timeout expired for non-existent entry. */
|
||||
- if (!me->mapent)
|
||||
- cache_delete(me->mc, key);
|
||||
-
|
||||
- cache_unlock(me->mc);
|
||||
}
|
||||
|
||||
/*
|
||||
--- autofs-5.0.5.orig/modules/lookup_nisplus.c
|
||||
+++ autofs-5.0.5/modules/lookup_nisplus.c
|
||||
@@ -421,7 +421,6 @@ static int check_map_indirect(struct aut
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
|
||||
- pthread_cleanup_push(cache_lock_cleanup, mc);
|
||||
cache_writelock(mc);
|
||||
t_last_read = ap->exp_runfreq + 1;
|
||||
me = cache_lookup_first(mc);
|
||||
@@ -442,8 +441,8 @@ static int check_map_indirect(struct aut
|
||||
exists->status = 0;
|
||||
}
|
||||
}
|
||||
- pthread_cleanup_pop(1);
|
||||
-
|
||||
+ cache_unlock(mc);
|
||||
+
|
||||
if (t_last_read > ap->exp_runfreq && ret & CHE_UPDATED)
|
||||
source->stale = 1;
|
||||
|
||||
@@ -459,7 +458,6 @@ static int check_map_indirect(struct aut
|
||||
* Check for map change and update as needed for
|
||||
* following cache lookup.
|
||||
*/
|
||||
- pthread_cleanup_push(cache_lock_cleanup, mc);
|
||||
cache_writelock(mc);
|
||||
we = cache_lookup_distinct(mc, "*");
|
||||
if (we) {
|
||||
@@ -473,7 +471,7 @@ static int check_map_indirect(struct aut
|
||||
if (wild & (CHE_OK | CHE_UPDATED))
|
||||
source->stale = 1;
|
||||
}
|
||||
- pthread_cleanup_pop(1);
|
||||
+ cache_unlock(mc);
|
||||
|
||||
if (wild & (CHE_UPDATED | CHE_OK))
|
||||
return NSS_STATUS_SUCCESS;
|
||||
@@ -516,13 +514,22 @@ int lookup_mount(struct autofs_point *ap
|
||||
if (me->status >= time(NULL)) {
|
||||
cache_unlock(me->mc);
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
- }
|
||||
-
|
||||
- /* Negative timeout expired for non-existent entry. */
|
||||
- if (!me->mapent)
|
||||
- cache_delete(me->mc, key);
|
||||
+ } else {
|
||||
+ struct mapent_cache *smc = me->mc;
|
||||
+ struct mapent *sme;
|
||||
|
||||
- cache_unlock(me->mc);
|
||||
+ if (me->mapent)
|
||||
+ cache_unlock(smc);
|
||||
+ else {
|
||||
+ cache_unlock(smc);
|
||||
+ cache_writelock(smc);
|
||||
+ sme = cache_lookup_distinct(smc, key);
|
||||
+ /* Negative timeout expired for non-existent entry. */
|
||||
+ if (sme && !sme->mapent)
|
||||
+ cache_delete(smc, key);
|
||||
+ cache_unlock(smc);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
/*
|
||||
--- autofs-5.0.5.orig/modules/lookup_program.c
|
||||
+++ autofs-5.0.5/modules/lookup_program.c
|
||||
@@ -135,17 +135,26 @@ int lookup_mount(struct autofs_point *ap
|
||||
if (me->status >= time(NULL)) {
|
||||
cache_unlock(me->mc);
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
- }
|
||||
-
|
||||
- /* Negative timeout expired for non-existent entry. */
|
||||
- if (!me->mapent)
|
||||
- cache_delete(me->mc, name);
|
||||
+ } else {
|
||||
+ struct mapent_cache *smc = me->mc;
|
||||
+ struct mapent *sme;
|
||||
|
||||
- cache_unlock(me->mc);
|
||||
+ if (me->mapent)
|
||||
+ cache_unlock(smc);
|
||||
+ else {
|
||||
+ cache_unlock(smc);
|
||||
+ cache_writelock(smc);
|
||||
+ sme = cache_lookup_distinct(smc, name);
|
||||
+ /* Negative timeout expired for non-existent entry. */
|
||||
+ if (sme && !sme->mapent)
|
||||
+ cache_delete(smc, name);
|
||||
+ cache_unlock(smc);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Catch installed direct offset triggers */
|
||||
- cache_writelock(mc);
|
||||
+ cache_readlock(mc);
|
||||
me = cache_lookup_distinct(mc, name);
|
||||
if (!me) {
|
||||
cache_unlock(mc);
|
||||
@@ -191,7 +200,11 @@ int lookup_mount(struct autofs_point *ap
|
||||
" key %s, returning fail", name);
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
- cache_delete(mc, name);
|
||||
+ cache_unlock(mc);
|
||||
+ cache_writelock(mc);
|
||||
+ me = cache_lookup_distinct(mc, name);
|
||||
+ if (me)
|
||||
+ cache_delete(mc, name);
|
||||
cache_unlock(mc);
|
||||
}
|
||||
}
|
||||
--- autofs-5.0.5.orig/modules/lookup_yp.c
|
||||
+++ autofs-5.0.5/modules/lookup_yp.c
|
||||
@@ -533,7 +533,6 @@ static int check_map_indirect(struct aut
|
||||
source->stale = 1;
|
||||
}
|
||||
|
||||
- pthread_cleanup_push(cache_lock_cleanup, mc);
|
||||
cache_writelock(mc);
|
||||
exists = cache_lookup_distinct(mc, key);
|
||||
/* Not found in the map but found in the cache */
|
||||
@@ -545,7 +544,7 @@ static int check_map_indirect(struct aut
|
||||
exists->status = 0;
|
||||
}
|
||||
}
|
||||
- pthread_cleanup_pop(1);
|
||||
+ cache_unlock(mc);
|
||||
|
||||
if (ret == CHE_MISSING) {
|
||||
struct mapent *we;
|
||||
@@ -559,7 +558,6 @@ static int check_map_indirect(struct aut
|
||||
* Check for map change and update as needed for
|
||||
* following cache lookup.
|
||||
*/
|
||||
- pthread_cleanup_push(cache_lock_cleanup, mc);
|
||||
cache_writelock(mc);
|
||||
we = cache_lookup_distinct(mc, "*");
|
||||
if (we) {
|
||||
@@ -573,7 +571,7 @@ static int check_map_indirect(struct aut
|
||||
if (wild & (CHE_OK | CHE_UPDATED))
|
||||
source->stale = 1;
|
||||
}
|
||||
- pthread_cleanup_pop(1);
|
||||
+ cache_unlock(mc);
|
||||
|
||||
if (wild & (CHE_OK | CHE_UPDATED))
|
||||
return NSS_STATUS_SUCCESS;
|
||||
@@ -616,13 +614,22 @@ int lookup_mount(struct autofs_point *ap
|
||||
if (me->status >= time(NULL)) {
|
||||
cache_unlock(me->mc);
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
- }
|
||||
-
|
||||
- /* Negative timeout expired for non-existent entry. */
|
||||
- if (!me->mapent)
|
||||
- cache_delete(me->mc, key);
|
||||
+ } else {
|
||||
+ struct mapent_cache *smc = me->mc;
|
||||
+ struct mapent *sme;
|
||||
|
||||
- cache_unlock(me->mc);
|
||||
+ if (me->mapent)
|
||||
+ cache_unlock(smc);
|
||||
+ else {
|
||||
+ cache_unlock(smc);
|
||||
+ cache_writelock(smc);
|
||||
+ sme = cache_lookup_distinct(smc, key);
|
||||
+ /* Negative timeout expired for non-existent entry. */
|
||||
+ if (sme && !sme->mapent)
|
||||
+ cache_delete(smc, key);
|
||||
+ cache_unlock(smc);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1,25 +0,0 @@
|
||||
autofs-5.0.5 - fix restart
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The recent LSB improvement change has introduced a problem with
|
||||
the restart action.
|
||||
---
|
||||
|
||||
redhat/autofs.init.in | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
|
||||
|
||||
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
|
||||
index 1e926ce..e2a4b78 100644
|
||||
--- a/redhat/autofs.init.in
|
||||
+++ b/redhat/autofs.init.in
|
||||
@@ -126,7 +126,7 @@ function stop() {
|
||||
}
|
||||
|
||||
function restart() {
|
||||
- status > /dev/null 2>&1
|
||||
+ status autofs > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
stop
|
||||
fi
|
||||
@ -1,142 +0,0 @@
|
||||
autofs-5.0.5 - fix rpc fail on large export list
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
If the export list on a server is larger than the UDP transport packet
|
||||
size the transfer will fail and autofs will try TCP instead, but there
|
||||
were some problems with the conversion to allow for IPv6 using libtirpc.
|
||||
|
||||
When creating the local socket for an RPC connection we incorrectly
|
||||
performed a connect instead of a bind to the ilocal TCP socket. Aslo the
|
||||
timed connect, which should be done before creating the RPC client was
|
||||
not being done, which can lead to lengthy timeouts.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/rpc_subs.c | 47 ++++++++++++++++++++++++-----------------------
|
||||
2 files changed, 25 insertions(+), 23 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 88bcc1b..20566a6 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -15,6 +15,7 @@
|
||||
- fix pidof init script usage.
|
||||
- check for path mount location in generic module.
|
||||
- dont fail mount on access fail.
|
||||
+- fix rpc fail on large export list.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
|
||||
index 628f0fc..3b11dce 100644
|
||||
--- a/lib/rpc_subs.c
|
||||
+++ b/lib/rpc_subs.c
|
||||
@@ -53,6 +53,7 @@
|
||||
/* Get numeric value of the n bits starting at position p */
|
||||
#define getbits(x, p, n) ((x >> (p + 1 - n)) & ~(~0 << n))
|
||||
|
||||
+static int connect_nb(int, struct sockaddr *, socklen_t, struct timeval *);
|
||||
inline void dump_core(void);
|
||||
|
||||
static CLIENT *rpc_clntudp_create(struct sockaddr *addr, struct conn_info *info, int *fd)
|
||||
@@ -97,11 +98,17 @@ static CLIENT *rpc_clnttcp_create(struct sockaddr *addr, struct conn_info *info,
|
||||
struct sockaddr_in *in4_raddr;
|
||||
struct sockaddr_in6 *in6_raddr;
|
||||
CLIENT *client = NULL;
|
||||
+ socklen_t slen;
|
||||
|
||||
switch (addr->sa_family) {
|
||||
case AF_INET:
|
||||
in4_raddr = (struct sockaddr_in *) addr;
|
||||
in4_raddr->sin_port = htons(info->port);
|
||||
+ slen = sizeof(struct sockaddr_in);
|
||||
+
|
||||
+ if (connect_nb(*fd, addr, slen, &info->timeout) < 0)
|
||||
+ break;
|
||||
+
|
||||
client = clnttcp_create(in4_raddr,
|
||||
info->program, info->version, fd,
|
||||
info->send_sz, info->recv_sz);
|
||||
@@ -114,6 +121,11 @@ static CLIENT *rpc_clnttcp_create(struct sockaddr *addr, struct conn_info *info,
|
||||
#else
|
||||
in6_raddr = (struct sockaddr_in6 *) addr;
|
||||
in6_raddr->sin6_port = htons(info->port);
|
||||
+ slen = sizeof(struct sockaddr_in6);
|
||||
+
|
||||
+ if (connect_nb(*fd, addr, slen, &info->timeout) < 0)
|
||||
+ break;
|
||||
+
|
||||
client = clnttcp6_create(in6_raddr,
|
||||
info->program, info->version, fd,
|
||||
info->send_sz, info->recv_sz);
|
||||
@@ -260,32 +272,21 @@ static CLIENT *rpc_do_create_client(struct sockaddr *addr, struct conn_info *inf
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ if (!info->client) {
|
||||
+ *fd = open_sock(addr->sa_family, type, proto);
|
||||
+ if (*fd < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (bind(*fd, laddr, slen) < 0)
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
switch (info->proto->p_proto) {
|
||||
case IPPROTO_UDP:
|
||||
- if (!info->client) {
|
||||
- *fd = open_sock(addr->sa_family, type, proto);
|
||||
- if (*fd < 0)
|
||||
- return NULL;
|
||||
-
|
||||
- if (bind(*fd, laddr, slen) < 0) {
|
||||
- close(*fd);
|
||||
- return NULL;
|
||||
- }
|
||||
- }
|
||||
client = rpc_clntudp_create(addr, info, fd);
|
||||
break;
|
||||
|
||||
case IPPROTO_TCP:
|
||||
- if (!info->client) {
|
||||
- *fd = open_sock(addr->sa_family, type, proto);
|
||||
- if (*fd < 0)
|
||||
- return NULL;
|
||||
-
|
||||
- if (connect_nb(*fd, laddr, slen, &info->timeout) < 0) {
|
||||
- close(*fd);
|
||||
- return NULL;
|
||||
- }
|
||||
- }
|
||||
client = rpc_clnttcp_create(addr, info, fd);
|
||||
break;
|
||||
|
||||
@@ -327,7 +328,7 @@ static CLIENT *create_udp_client(struct conn_info *info)
|
||||
if (client)
|
||||
goto done;
|
||||
|
||||
- if (!info->client) {
|
||||
+ if (!info->client && fd != RPC_ANYSOCK) {
|
||||
close(fd);
|
||||
fd = RPC_ANYSOCK;
|
||||
}
|
||||
@@ -352,7 +353,7 @@ static CLIENT *create_udp_client(struct conn_info *info)
|
||||
if (client)
|
||||
break;
|
||||
|
||||
- if (!info->client) {
|
||||
+ if (!info->client && fd != RPC_ANYSOCK) {
|
||||
close(fd);
|
||||
fd = RPC_ANYSOCK;
|
||||
}
|
||||
@@ -477,7 +478,7 @@ static CLIENT *create_tcp_client(struct conn_info *info)
|
||||
if (client)
|
||||
break;
|
||||
|
||||
- if (!info->client) {
|
||||
+ if (!info->client && fd != RPC_ANYSOCK) {
|
||||
close(fd);
|
||||
fd = RPC_ANYSOCK;
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
autofs-5.0.5 - fix stale initialization for file map instance
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Somehow, during the changes to minimize reading of file maps, an error
|
||||
of not initializing a field of the map source instance structure got
|
||||
through undetected. This has the effect of preventing all file map
|
||||
lookups, following the first one, to fail.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/lookup.c | 1 +
|
||||
2 files changed, 2 insertions(+), 0 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 7997d1d..8b62370 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -7,6 +7,7 @@
|
||||
- fix compile fail with when LDAP is excluded.
|
||||
- more code analysis corrections (and fix a typo in an init script).
|
||||
- fix backwards #ifndef INET6.
|
||||
+- fix stale initialization for file map instance.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/daemon/lookup.c b/daemon/lookup.c
|
||||
index 9d5a5c8..665ada0 100644
|
||||
--- a/daemon/lookup.c
|
||||
+++ b/daemon/lookup.c
|
||||
@@ -398,6 +398,7 @@ static enum nsswitch_status read_map_source(struct nss_source *this,
|
||||
tmap.instance = map->instance;
|
||||
tmap.recurse = map->recurse;
|
||||
tmap.depth = map->depth;
|
||||
+ tmap.stale = map->stale;
|
||||
tmap.argc = 0;
|
||||
tmap.argv = NULL;
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
autofs-5.0.5 - fix status privilege error
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The recent LSB init init script change prevent normal users from using
|
||||
the status init script action. Maybe the (very poor) specification is
|
||||
wrong or I misread it, in either case this behaviour is unacceptable.
|
||||
---
|
||||
|
||||
CHANGELOG | 2 ++
|
||||
redhat/autofs.init.in | 2 +-
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -47,6 +47,8 @@
|
||||
- fix error handing in do_mount_indirect().
|
||||
- expire thread use pending mutex.
|
||||
- remove ERR_remove_state() openssl call.
|
||||
+- fix init script restart option.
|
||||
+- fix init script status privilege error.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/redhat/autofs.init.in
|
||||
+++ autofs-5.0.5/redhat/autofs.init.in
|
||||
@@ -154,7 +154,7 @@ function reload() {
|
||||
RETVAL=0
|
||||
|
||||
# Only the root user may change the service status
|
||||
-if [ `id -u` -ne 0 ]; then
|
||||
+if [ `id -u` -ne 0 ] && [ "$1" != "status" ]; then
|
||||
echo "insufficient privilege to change service status"
|
||||
exit 4
|
||||
fi
|
||||
@ -1,38 +0,0 @@
|
||||
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;
|
||||
@ -1,43 +0,0 @@
|
||||
autofs-5.0.5 - fix submount shutdown wait
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When expiring a mount that has submounts we determine if a submount is
|
||||
still in use by its state being other than ST_SHUTDOWN. But a submount
|
||||
that is in the process of exiting could also be in one of the states
|
||||
ST_SHUTDOWN_PENDING or ST_SHUTDOWN_FORCE, in which case we should also
|
||||
continue to wait for the submount entry to be removed from the list or
|
||||
for it to reach another state.
|
||||
---
|
||||
|
||||
lib/master.c | 9 ++++++---
|
||||
1 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
|
||||
diff --git a/lib/master.c b/lib/master.c
|
||||
index ad3aa77..95bd3fb 100644
|
||||
--- a/lib/master.c
|
||||
+++ b/lib/master.c
|
||||
@@ -905,8 +905,9 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state
|
||||
st_wait_task(this, state, 0);
|
||||
|
||||
/*
|
||||
- * If our submount gets to state ST_SHUTDOWN we need to
|
||||
- * wait until it goes away or changes to ST_READY.
|
||||
+ * If our submount gets to state ST_SHUTDOWN, ST_SHUTDOWN_PENDING or
|
||||
+ * ST_SHUTDOWN_FORCE we need to wait until it goes away or changes
|
||||
+ * to ST_READY.
|
||||
*/
|
||||
mounts_mutex_lock(ap);
|
||||
st_mutex_lock();
|
||||
@@ -914,7 +915,9 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state
|
||||
struct timespec t = { 0, 300000000 };
|
||||
struct timespec r;
|
||||
|
||||
- if (this->state != ST_SHUTDOWN) {
|
||||
+ if (this->state != ST_SHUTDOWN &&
|
||||
+ this->state != ST_SHUTDOWN_PENDING &&
|
||||
+ this->state != ST_SHUTDOWN_FORCE) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
@ -1,44 +0,0 @@
|
||||
autofs-5.0.5 - fix timeout in connect_nb()
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When changing the timed wait from using select(2) to poll(2) in
|
||||
connect_nb(), to overcome the 1024 file handle limit of select(),
|
||||
the wait timeout was not converted from seconds to milliseconds.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/rpc_subs.c | 7 +++++++
|
||||
2 files changed, 8 insertions(+), 0 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index ccf2d32..dd093e2 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -11,6 +11,7 @@
|
||||
- add "preen" fsck for ext4 mounts.
|
||||
- don't use master_lex_destroy() to clear parse buffer.
|
||||
- make documentation for set-log-priority clearer.
|
||||
+- fix timeout in connect_nb().
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
|
||||
index cafc775..628f0fc 100644
|
||||
--- a/lib/rpc_subs.c
|
||||
+++ b/lib/rpc_subs.c
|
||||
@@ -161,6 +161,13 @@ static int connect_nb(int fd, struct sockaddr *addr, socklen_t len, struct timev
|
||||
if (ret == 0)
|
||||
goto done;
|
||||
|
||||
+ if (timeout != -1) {
|
||||
+ if (timeout >= (INT_MAX - 1)/1000)
|
||||
+ timeout = INT_MAX - 1;
|
||||
+ else
|
||||
+ timeout = timeout * 1000;
|
||||
+ }
|
||||
+
|
||||
pfd[0].fd = fd;
|
||||
pfd[0].events = POLLOUT;
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
autofs-5.0.5 - fix wildcard map entry match
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
In some cases we can get a key string that includes a '*' at the start.
|
||||
This causes an incorrect comparison in the cache library routines and can
|
||||
lead to a segmentation fault.
|
||||
|
||||
This patch enures that the key length is also considered when checking the
|
||||
wildcard key entry.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/lookup.c | 4 ++--
|
||||
lib/cache.c | 2 +-
|
||||
3 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -34,6 +34,7 @@
|
||||
- make redhat init script more lsb compliant.
|
||||
- don't hold lock for simple mounts.
|
||||
- fix remount locking.
|
||||
+- fix wildcard map entry match.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/daemon/lookup.c
|
||||
+++ autofs-5.0.5/daemon/lookup.c
|
||||
@@ -600,7 +600,7 @@ int lookup_ghost(struct autofs_point *ap
|
||||
cache_readlock(mc);
|
||||
me = cache_enumerate(mc, NULL);
|
||||
while (me) {
|
||||
- if (*me->key == '*')
|
||||
+ if (!strcmp(me->key, "*"))
|
||||
goto next;
|
||||
|
||||
if (*me->key == '/') {
|
||||
@@ -1035,7 +1035,7 @@ void lookup_prune_one_cache(struct autof
|
||||
|
||||
key = strdup(me->key);
|
||||
me = cache_enumerate(mc, me);
|
||||
- if (!key || *key == '*') {
|
||||
+ if (!key || !strcmp(key, "*")) {
|
||||
if (key)
|
||||
free(key);
|
||||
continue;
|
||||
--- autofs-5.0.5.orig/lib/cache.c
|
||||
+++ autofs-5.0.5/lib/cache.c
|
||||
@@ -719,7 +719,7 @@ int cache_update(struct mapent_cache *mc
|
||||
me = cache_lookup(mc, key);
|
||||
while (me && me->source != ms)
|
||||
me = cache_lookup_key_next(me);
|
||||
- if (!me || (*me->key == '*' && *key != '*')) {
|
||||
+ if (!me || (!strcmp(me->key, "*") && strcmp(key, "*"))) {
|
||||
ret = cache_add(mc, ms, key, mapent, age);
|
||||
if (!ret) {
|
||||
debug(logopt, "failed for %s", key);
|
||||
@ -1,204 +0,0 @@
|
||||
autofs-5.0.5 - include krb5 library
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Since the Cyrus SASL module calls Kerberos directly we should be
|
||||
linking against the Kerberos librarys.
|
||||
---
|
||||
|
||||
Makefile.conf.in | 2 ++
|
||||
aclocal.m4 | 19 +++++++++++++++
|
||||
configure | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
configure.in | 5 +++-
|
||||
modules/Makefile | 4 ++-
|
||||
5 files changed, 93 insertions(+), 4 deletions(-)
|
||||
|
||||
|
||||
diff --git a/Makefile.conf.in b/Makefile.conf.in
|
||||
index 7670364..80093c1 100644
|
||||
--- a/Makefile.conf.in
|
||||
+++ b/Makefile.conf.in
|
||||
@@ -31,6 +31,8 @@ XML_FLAGS = @XML_FLAGS@
|
||||
SASL = @HAVE_SASL@
|
||||
LIBSASL= @LIBSASL@
|
||||
SASL_FLAGS = @SASL_FLAGS@
|
||||
+KRB5_LIBS=@KRB5_LIBS@
|
||||
+KRB5_FLAGS=@KRB5_FLAGS@
|
||||
|
||||
# NIS+ support: yes (1) no (0)
|
||||
NISPLUS = @HAVE_NISPLUS@
|
||||
diff --git a/aclocal.m4 b/aclocal.m4
|
||||
index e7f1a30..750a159 100644
|
||||
--- a/aclocal.m4
|
||||
+++ b/aclocal.m4
|
||||
@@ -215,6 +215,25 @@ else
|
||||
fi])
|
||||
|
||||
dnl --------------------------------------------------------------------------
|
||||
+dnl AF_CHECK_KRB5
|
||||
+dnl
|
||||
+dnl Check for Kerberos 5
|
||||
+dnl --------------------------------------------------------------------------
|
||||
+AC_DEFUN([AF_CHECK_KRB5],
|
||||
+[AC_PATH_PROGS(KRB5_CONFIG, krb5-config, no)
|
||||
+AC_MSG_CHECKING(for Kerberos library)
|
||||
+if test "$KRB5_CONFIG" = "no"
|
||||
+then
|
||||
+ AC_MSG_RESULT(no)
|
||||
+ HAVE_KRB5=0
|
||||
+else
|
||||
+ AC_MSG_RESULT(yes)
|
||||
+ HAVE_KRB5=1
|
||||
+ KRB5_LIBS=`$KRB5_CONFIG --libs`
|
||||
+ KRB5_FLAGS=`$KRB5_CONFIG --cflags`
|
||||
+fi])
|
||||
+
|
||||
+dnl --------------------------------------------------------------------------
|
||||
dnl AF_CHECK_LIBHESIOD
|
||||
dnl
|
||||
dnl Check for lib hesiod
|
||||
diff --git a/configure b/configure
|
||||
index f5b7d07..352b0d6 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -640,6 +640,8 @@ ac_subst_vars='LTLIBOBJS
|
||||
LIBOBJS
|
||||
DAEMON_LDFLAGS
|
||||
DAEMON_CFLAGS
|
||||
+KRB5_FLAGS
|
||||
+KRB5_LIBS
|
||||
LIBSASL
|
||||
HAVE_SASL
|
||||
SASL_FLAGS
|
||||
@@ -657,6 +659,7 @@ LIBHESIOD
|
||||
HAVE_HESIOD
|
||||
LIBRESOLV
|
||||
LIBNSL
|
||||
+KRB5_CONFIG
|
||||
XML_CONFIG
|
||||
PATH_RPCGEN
|
||||
RPCGEN
|
||||
@@ -3786,7 +3789,7 @@ $as_echo "no" >&6; }
|
||||
fi
|
||||
fi
|
||||
|
||||
-# LDAP SASL auth need libxml
|
||||
+# LDAP SASL auth needs libxml and Kerberos
|
||||
for ac_prog in xml2-config
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
@@ -3864,6 +3867,66 @@ _ACEOF
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
+for ac_prog in krb5-config
|
||||
+do
|
||||
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
+set dummy $ac_prog; ac_word=$2
|
||||
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
+$as_echo_n "checking for $ac_word... " >&6; }
|
||||
+if test "${ac_cv_path_KRB5_CONFIG+set}" = set; then
|
||||
+ $as_echo_n "(cached) " >&6
|
||||
+else
|
||||
+ case $KRB5_CONFIG in
|
||||
+ [\\/]* | ?:[\\/]*)
|
||||
+ ac_cv_path_KRB5_CONFIG="$KRB5_CONFIG" # Let the user override the test with a path.
|
||||
+ ;;
|
||||
+ *)
|
||||
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
+for as_dir in $PATH
|
||||
+do
|
||||
+ IFS=$as_save_IFS
|
||||
+ test -z "$as_dir" && as_dir=.
|
||||
+ for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
+ ac_cv_path_KRB5_CONFIG="$as_dir/$ac_word$ac_exec_ext"
|
||||
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
+ break 2
|
||||
+ fi
|
||||
+done
|
||||
+done
|
||||
+IFS=$as_save_IFS
|
||||
+
|
||||
+ ;;
|
||||
+esac
|
||||
+fi
|
||||
+KRB5_CONFIG=$ac_cv_path_KRB5_CONFIG
|
||||
+if test -n "$KRB5_CONFIG"; then
|
||||
+ { $as_echo "$as_me:$LINENO: result: $KRB5_CONFIG" >&5
|
||||
+$as_echo "$KRB5_CONFIG" >&6; }
|
||||
+else
|
||||
+ { $as_echo "$as_me:$LINENO: result: no" >&5
|
||||
+$as_echo "no" >&6; }
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+ test -n "$KRB5_CONFIG" && break
|
||||
+done
|
||||
+test -n "$KRB5_CONFIG" || KRB5_CONFIG="no"
|
||||
+
|
||||
+{ $as_echo "$as_me:$LINENO: checking for Kerberos library" >&5
|
||||
+$as_echo_n "checking for Kerberos library... " >&6; }
|
||||
+if test "$KRB5_CONFIG" = "no"
|
||||
+then
|
||||
+ { $as_echo "$as_me:$LINENO: result: no" >&5
|
||||
+$as_echo "no" >&6; }
|
||||
+ HAVE_KRB5=0
|
||||
+else
|
||||
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
|
||||
+$as_echo "yes" >&6; }
|
||||
+ HAVE_KRB5=1
|
||||
+ KRB5_LIBS=`$KRB5_CONFIG --libs`
|
||||
+ KRB5_FLAGS=`$KRB5_CONFIG --cflags`
|
||||
+fi
|
||||
|
||||
#
|
||||
# glibc/libc 6 new libraries
|
||||
@@ -5241,6 +5304,8 @@ fi
|
||||
|
||||
|
||||
|
||||
+
|
||||
+
|
||||
LDFLAGS="${AF_tmp_ldflags}"
|
||||
|
||||
#
|
||||
diff --git a/configure.in b/configure.in
|
||||
index 78085bd..233edab 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -145,8 +145,9 @@ AF_CHECK_PROG(RPCGEN, rpcgen, , $searchpath)
|
||||
#
|
||||
AF_SLOPPY_MOUNT()
|
||||
|
||||
-# LDAP SASL auth need libxml
|
||||
+# LDAP SASL auth needs libxml and Kerberos
|
||||
AF_CHECK_LIBXML()
|
||||
+AF_CHECK_KRB5()
|
||||
|
||||
#
|
||||
# glibc/libc 6 new libraries
|
||||
@@ -275,6 +276,8 @@ AC_SUBST(XML_LIBS)
|
||||
AC_SUBST(SASL_FLAGS)
|
||||
AC_SUBST(HAVE_SASL)
|
||||
AC_SUBST(LIBSASL)
|
||||
+AC_SUBST(KRB5_LIBS)
|
||||
+AC_SUBST(KRB5_FLAGS)
|
||||
LDFLAGS="${AF_tmp_ldflags}"
|
||||
|
||||
#
|
||||
diff --git a/modules/Makefile b/modules/Makefile
|
||||
index 0bb9464..164d412 100644
|
||||
--- a/modules/Makefile
|
||||
+++ b/modules/Makefile
|
||||
@@ -42,8 +42,8 @@ ifeq ($(LDAP), 1)
|
||||
MODS += lookup_ldap.so
|
||||
ifeq ($(SASL), 1)
|
||||
SASL_OBJ = cyrus-sasl.o
|
||||
- LDAP_FLAGS += $(SASL_FLAGS) $(XML_FLAGS) -DLDAP_THREAD_SAFE
|
||||
- LIBLDAP += $(LIBSASL) $(XML_LIBS)
|
||||
+ LDAP_FLAGS += $(SASL_FLAGS) $(XML_FLAGS) $(KRB5_FLAGS) -DLDAP_THREAD_SAFE
|
||||
+ LIBLDAP += $(LIBSASL) $(XML_LIBS) $(KRB5_LIBS)
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
autofs-5.0.5 - make documentation for set-log-priority clearer
|
||||
|
||||
From: Jeff Moyer <jmoyer@redhat.com>
|
||||
|
||||
It is not apparent from the documentation of the --set-log-priority
|
||||
option that the option can be used to change the log priority of the
|
||||
damon while it is running. This patch tries to fix that.
|
||||
|
||||
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
man/automount.8 | 4 +++-
|
||||
2 files changed, 4 insertions(+), 1 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 329b028..ccf2d32 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -10,6 +10,7 @@
|
||||
- fix stale initialization for file map instance.
|
||||
- add "preen" fsck for ext4 mounts.
|
||||
- don't use master_lex_destroy() to clear parse buffer.
|
||||
+- make documentation for set-log-priority clearer.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/man/automount.8 b/man/automount.8
|
||||
index 9fcaaf4..d9a45c2 100644
|
||||
--- a/man/automount.8
|
||||
+++ b/man/automount.8
|
||||
@@ -77,7 +77,9 @@ changes. For example, if verbose logging is set in the configuration then
|
||||
attempting to set logging to basic logging, by using alert, crit, err
|
||||
or emerg won't stop the verbose logging. However, setting logging to debug
|
||||
will lead to everything (debug logging) being logged witch can then also
|
||||
-be disabled, returning the daemon to verbose logging.
|
||||
+be disabled, returning the daemon to verbose logging. This option can be
|
||||
+specified to change the logging priority of an already running automount
|
||||
+process.
|
||||
.P
|
||||
The \fIpath\fP argument corresponds to the automounted
|
||||
path name as specified in the master map.
|
||||
@ -1,25 +0,0 @@
|
||||
autofs-5.0.5 - make nfs4 default for RedHat replicated selection configuration
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
We know for sure that RHEL-6 and later is set to mount NFSv4 as default and
|
||||
fall back to earlier NFS versions if it can't mount as NFSv4. So set our
|
||||
default for replicated mount probing to start at NFSv4 instead of v3.
|
||||
---
|
||||
|
||||
redhat/autofs.sysconfig.in | 1 +
|
||||
1 files changed, 1 insertions(+), 0 deletions(-)
|
||||
|
||||
|
||||
diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in
|
||||
index c72cd2b..a46335d 100644
|
||||
--- a/redhat/autofs.sysconfig.in
|
||||
+++ b/redhat/autofs.sysconfig.in
|
||||
@@ -40,6 +40,7 @@ BROWSE_MODE="no"
|
||||
# used for single host map entries.
|
||||
#
|
||||
#MOUNT_NFS_DEFAULT_PROTOCOL=3
|
||||
+MOUNT_NFS_DEFAULT_PROTOCOL=4
|
||||
#
|
||||
# APPEND_OPTIONS - append to global options instead of replace.
|
||||
#
|
||||
@ -1,112 +0,0 @@
|
||||
autofs-5.0.5 - make redhat init script more lsb compliant
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
redhat/autofs.init.in | 39 ++++++++++++++++++++++++++++++++-------
|
||||
2 files changed, 33 insertions(+), 7 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -31,6 +31,7 @@
|
||||
- fix master map source server unavailable handling.
|
||||
- add autofs_ldap_auth.conf man page.
|
||||
- fix random selection for host on different network.
|
||||
+- make redhat init script more lsb compliant.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/redhat/autofs.init.in
|
||||
+++ autofs-5.0.5/redhat/autofs.init.in
|
||||
@@ -86,14 +86,18 @@ function start() {
|
||||
fi
|
||||
|
||||
echo -n $"Starting $prog: "
|
||||
- $prog $OPTIONS
|
||||
+ $prog $OPTIONS --pid-file /var/run/autofs.pid
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -eq 0 ] ; then
|
||||
success "$prog startup"
|
||||
else
|
||||
failure "$prog startup"
|
||||
fi
|
||||
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/autofs
|
||||
+ if [ $RETVAL -eq 0 ]; then
|
||||
+ touch /var/lock/subsys/autofs
|
||||
+ else
|
||||
+ RETVAL=1
|
||||
+ fi
|
||||
echo
|
||||
return $RETVAL
|
||||
}
|
||||
@@ -107,7 +111,11 @@ function stop() {
|
||||
[ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 3
|
||||
count=`expr $count + 1`
|
||||
done
|
||||
- [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/autofs
|
||||
+ if [ $RETVAL -eq 0 ]; then
|
||||
+ rm -f /var/lock/subsys/autofs
|
||||
+ else
|
||||
+ RETVAL=1
|
||||
+ fi
|
||||
if [ -n "`pidof $prog`" ] ; then
|
||||
failure "$prog shutdown"
|
||||
else
|
||||
@@ -118,7 +126,10 @@ function stop() {
|
||||
}
|
||||
|
||||
function restart() {
|
||||
- stop
|
||||
+ status > /dev/null 2>&1
|
||||
+ if [ $? -eq 0 ]; then
|
||||
+ stop
|
||||
+ fi
|
||||
start
|
||||
}
|
||||
|
||||
@@ -142,6 +153,12 @@ function reload() {
|
||||
|
||||
RETVAL=0
|
||||
|
||||
+# Only the root user may change the service status
|
||||
+if [ `id -u` -ne 0 ]; then
|
||||
+ echo "insufficient privilege to change service status"
|
||||
+ exit 4
|
||||
+fi
|
||||
+
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
@@ -154,7 +171,7 @@ case "$1" in
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
- status $prog
|
||||
+ status -p /var/run/autofs.pid -l autofs $prog
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
@@ -171,9 +188,17 @@ case "$1" in
|
||||
restart
|
||||
fi
|
||||
;;
|
||||
- *)
|
||||
+ usage)
|
||||
echo $"Usage: $0 {start|forcestart|stop|status|restart|forcerestart|reload|condrestart}"
|
||||
- exit 1;
|
||||
+ exit 0
|
||||
+ ;;
|
||||
+ try-restart|force-reload)
|
||||
+ echo "$1 service action not supported"
|
||||
+ exit 3
|
||||
+ ;;
|
||||
+ *)
|
||||
+ echo "unknown, invalid or excess argument(s)"
|
||||
+ exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -1,94 +0,0 @@
|
||||
autofs-5.0.5 - Make "verbose" mode a little less verbose
|
||||
|
||||
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
|
||||
|
||||
Remove some log message duplication for verbose logging.
|
||||
---
|
||||
|
||||
daemon/automount.c | 2 +-
|
||||
daemon/lookup.c | 2 +-
|
||||
modules/mount_changer.c | 2 +-
|
||||
modules/mount_ext2.c | 2 +-
|
||||
modules/mount_generic.c | 2 +-
|
||||
modules/mount_nfs.c | 2 +-
|
||||
6 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
|
||||
diff --git a/daemon/automount.c b/daemon/automount.c
|
||||
index 206734b..9939a25 100644
|
||||
--- a/daemon/automount.c
|
||||
+++ b/daemon/automount.c
|
||||
@@ -512,7 +512,7 @@ static int umount_subtree_mounts(struct autofs_point *ap, const char *path, unsi
|
||||
* it already to ensure it's ok to remove any offset triggers.
|
||||
*/
|
||||
if (!is_mm_root && is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) {
|
||||
- info(ap->logopt, "unmounting dir = %s", path);
|
||||
+ debug(ap->logopt, "unmounting dir = %s", path);
|
||||
if (umount_ent(ap, path)) {
|
||||
warn(ap->logopt, "could not umount dir %s", path);
|
||||
left++;
|
||||
diff --git a/daemon/lookup.c b/daemon/lookup.c
|
||||
index f5d9da8..a4bd07f 100644
|
||||
--- a/daemon/lookup.c
|
||||
+++ b/daemon/lookup.c
|
||||
@@ -688,7 +688,7 @@ static int lookup_name_file_source_instance(struct autofs_point *ap, struct map_
|
||||
char *type, *format;
|
||||
|
||||
if (stat(map->argv[0], &st) == -1) {
|
||||
- warn(ap->logopt, "file map not found");
|
||||
+ debug(ap->logopt, "file map not found");
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
}
|
||||
|
||||
diff --git a/modules/mount_changer.c b/modules/mount_changer.c
|
||||
index f4d82dd..d7bfa09 100644
|
||||
--- a/modules/mount_changer.c
|
||||
+++ b/modules/mount_changer.c
|
||||
@@ -129,7 +129,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
- info(ap->logopt, MODPREFIX "mounted %s type %s on %s",
|
||||
+ debug(ap->logopt, MODPREFIX "mounted %s type %s on %s",
|
||||
what, fstype, fullpath);
|
||||
return 0;
|
||||
}
|
||||
diff --git a/modules/mount_ext2.c b/modules/mount_ext2.c
|
||||
index 26d59d1..1edf347 100644
|
||||
--- a/modules/mount_ext2.c
|
||||
+++ b/modules/mount_ext2.c
|
||||
@@ -140,7 +140,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
- info(ap->logopt,
|
||||
+ debug(ap->logopt,
|
||||
MODPREFIX "mounted %s type %s on %s",
|
||||
what, fstype, fullpath);
|
||||
return 0;
|
||||
diff --git a/modules/mount_generic.c b/modules/mount_generic.c
|
||||
index da85d1a..79e3d32 100644
|
||||
--- a/modules/mount_generic.c
|
||||
+++ b/modules/mount_generic.c
|
||||
@@ -122,7 +122,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
- info(ap->logopt, MODPREFIX "mounted %s type %s on %s",
|
||||
+ debug(ap->logopt, MODPREFIX "mounted %s type %s on %s",
|
||||
loc, fstype, fullpath);
|
||||
free(loc);
|
||||
return 0;
|
||||
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
|
||||
index 21e1929..9110eba 100644
|
||||
--- a/modules/mount_nfs.c
|
||||
+++ b/modules/mount_nfs.c
|
||||
@@ -251,7 +251,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
- info(ap->logopt, MODPREFIX "mounted %s on %s", loc, fullpath);
|
||||
+ debug(ap->logopt, MODPREFIX "mounted %s on %s", loc, fullpath);
|
||||
free(loc);
|
||||
free_host_list(&hosts);
|
||||
return 0;
|
||||
@ -1,73 +0,0 @@
|
||||
autofs-5.0.5 - mapent becomes negative during lookup
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
During a mount request it is possible for a mapent to become negative
|
||||
between the time it is checked on entry and when we fetch the mount
|
||||
location information. This is because we drop the cache lock after
|
||||
the initial check and take it back again before getting the location
|
||||
information.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
modules/lookup_file.c | 2 +-
|
||||
modules/lookup_ldap.c | 2 +-
|
||||
modules/lookup_nisplus.c | 2 +-
|
||||
modules/lookup_yp.c | 2 +-
|
||||
5 files changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -39,6 +39,7 @@
|
||||
- dont check null cache on expire.
|
||||
- fix null cache race.
|
||||
- fix cache_init() on source re-read.
|
||||
+- fix mapent becomes negative during lookup.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/modules/lookup_file.c
|
||||
+++ autofs-5.0.5/modules/lookup_file.c
|
||||
@@ -1047,7 +1047,7 @@ do_cache_lookup:
|
||||
if (!me)
|
||||
me = cache_lookup_distinct(mc, "*");
|
||||
}
|
||||
- if (me && (me->source == source || *me->key == '/')) {
|
||||
+ if (me && me->mapent && (me->source == source || *me->key == '/')) {
|
||||
pthread_cleanup_push(cache_lock_cleanup, mc);
|
||||
strcpy(mapent_buf, me->mapent);
|
||||
mapent = mapent_buf;
|
||||
--- autofs-5.0.5.orig/modules/lookup_ldap.c
|
||||
+++ autofs-5.0.5/modules/lookup_ldap.c
|
||||
@@ -2872,7 +2872,7 @@ int lookup_mount(struct autofs_point *ap
|
||||
if (!me)
|
||||
me = cache_lookup_distinct(mc, "*");
|
||||
}
|
||||
- if (me && (me->source == source || *me->key == '/')) {
|
||||
+ if (me && me->mapent && (me->source == source || *me->key == '/')) {
|
||||
strcpy(mapent_buf, me->mapent);
|
||||
mapent = mapent_buf;
|
||||
}
|
||||
--- autofs-5.0.5.orig/modules/lookup_nisplus.c
|
||||
+++ autofs-5.0.5/modules/lookup_nisplus.c
|
||||
@@ -569,7 +569,7 @@ int lookup_mount(struct autofs_point *ap
|
||||
if (!me)
|
||||
me = cache_lookup_distinct(mc, "*");
|
||||
}
|
||||
- if (me && (me->source == source || *me->key == '/')) {
|
||||
+ if (me && me->mapent && (me->source == source || *me->key == '/')) {
|
||||
mapent_len = strlen(me->mapent);
|
||||
mapent = malloc(mapent_len + 1);
|
||||
strcpy(mapent, me->mapent);
|
||||
--- autofs-5.0.5.orig/modules/lookup_yp.c
|
||||
+++ autofs-5.0.5/modules/lookup_yp.c
|
||||
@@ -670,7 +670,7 @@ int lookup_mount(struct autofs_point *ap
|
||||
if (!me)
|
||||
me = cache_lookup_distinct(mc, "*");
|
||||
}
|
||||
- if (me && (me->source == source || *me->key == '/')) {
|
||||
+ if (me && me->mapent && (me->source == source || *me->key == '/')) {
|
||||
mapent_len = strlen(me->mapent);
|
||||
mapent = alloca(mapent_len + 1);
|
||||
strcpy(mapent, me->mapent);
|
||||
@ -1,241 +0,0 @@
|
||||
autofs-5.0.5 - more code analysis corrections (and fix a typo in an init script)
|
||||
|
||||
From: Jeff Moyer <jmoyer@redhat.com>
|
||||
|
||||
- fix an obvious type in Redhat init script.
|
||||
- don't call ldap_msgfree when result pointer is null.
|
||||
- check return of ldap_parse_result as pointers will be invalid on fail.
|
||||
- get rid of a bogus assignment in defaults_free_searchdns.
|
||||
- get rid of unused optlen variable in parse_sun.c.
|
||||
- check return status of stat(2) in do_mount_direct().
|
||||
- get rid of unused name variable in master_add_map_source().
|
||||
- check return from ops->askumount() in expire_cleanup().
|
||||
- in mount_autofs.c:mount_mount(), don't increment val since we never
|
||||
look at it again.
|
||||
- in autofs_sasl_dispose() ctxt must always be valid or we would have
|
||||
a much bigger problem.
|
||||
- in st_start_handler() and alarm_start_handler() it is possible for
|
||||
pthread_attr_destroy() to be called with a NULL pointer.
|
||||
- we could end up with a non-null result pointer after a failed call to
|
||||
ldap_search_s(), well maybe, so check for it anyway.
|
||||
|
||||
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/direct.c | 2 +-
|
||||
daemon/state.c | 5 +++--
|
||||
lib/alarm.c | 3 ++-
|
||||
lib/defaults.c | 1 -
|
||||
lib/master.c | 6 +-----
|
||||
modules/cyrus-sasl.c | 2 +-
|
||||
modules/lookup_ldap.c | 13 +++++++++++--
|
||||
modules/mount_autofs.c | 2 +-
|
||||
modules/parse_sun.c | 3 +--
|
||||
redhat/autofs.init.in | 2 +-
|
||||
11 files changed, 23 insertions(+), 17 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 23351c8..b9b1602 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -5,6 +5,7 @@
|
||||
- add mount wait timeout parameter.
|
||||
- special case cifs escapes.
|
||||
- fix compile fail with when LDAP is excluded.
|
||||
+- more code analysis corrections (and fix a typo in an init script).
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/daemon/direct.c b/daemon/direct.c
|
||||
index 0c78627..9b4e57b 100644
|
||||
--- a/daemon/direct.c
|
||||
+++ b/daemon/direct.c
|
||||
@@ -1245,7 +1245,7 @@ static void *do_mount_direct(void *arg)
|
||||
}
|
||||
|
||||
status = stat(mt.name, &st);
|
||||
- if (!S_ISDIR(st.st_mode) || st.st_dev != mt.dev) {
|
||||
+ if (status != 0 || !S_ISDIR(st.st_mode) || st.st_dev != mt.dev) {
|
||||
error(ap->logopt,
|
||||
"direct trigger not valid or already mounted %s",
|
||||
mt.name);
|
||||
diff --git a/daemon/state.c b/daemon/state.c
|
||||
index 71af46a..27bc6de 100644
|
||||
--- a/daemon/state.c
|
||||
+++ b/daemon/state.c
|
||||
@@ -160,7 +160,7 @@ void expire_cleanup(void *arg)
|
||||
* been signaled to shutdown.
|
||||
*/
|
||||
rv = ops->askumount(ap->logopt, ap->ioctlfd, &idle);
|
||||
- if (!idle && !ap->shutdown) {
|
||||
+ if (!rv && !idle && !ap->shutdown) {
|
||||
next = ST_READY;
|
||||
if (!ap->submount)
|
||||
alarm_add(ap, ap->exp_runfreq);
|
||||
@@ -1198,7 +1198,8 @@ int st_start_handler(void)
|
||||
|
||||
status = pthread_create(&thid, pattrs, st_queue_handler, NULL);
|
||||
|
||||
- pthread_attr_destroy(pattrs);
|
||||
+ if (pattrs)
|
||||
+ pthread_attr_destroy(pattrs);
|
||||
|
||||
return !status;
|
||||
}
|
||||
diff --git a/lib/alarm.c b/lib/alarm.c
|
||||
index 46df38a..f403d8f 100755
|
||||
--- a/lib/alarm.c
|
||||
+++ b/lib/alarm.c
|
||||
@@ -239,7 +239,8 @@ int alarm_start_handler(void)
|
||||
|
||||
status = pthread_create(&thid, pattrs, alarm_handler, NULL);
|
||||
|
||||
- pthread_attr_destroy(pattrs);
|
||||
+ if (pattrs)
|
||||
+ pthread_attr_destroy(pattrs);
|
||||
|
||||
return !status;
|
||||
}
|
||||
diff --git a/lib/defaults.c b/lib/defaults.c
|
||||
index 2204b18..cb8354d 100644
|
||||
--- a/lib/defaults.c
|
||||
+++ b/lib/defaults.c
|
||||
@@ -534,7 +534,6 @@ void defaults_free_searchdns(struct ldap_searchdn *sdn)
|
||||
struct ldap_searchdn *this = sdn;
|
||||
struct ldap_searchdn *next;
|
||||
|
||||
- next = this;
|
||||
while (this) {
|
||||
next = this->next;
|
||||
free(this->basedn);
|
||||
diff --git a/lib/master.c b/lib/master.c
|
||||
index e43f835..8455f40 100644
|
||||
--- a/lib/master.c
|
||||
+++ b/lib/master.c
|
||||
@@ -152,7 +152,7 @@ master_add_map_source(struct master_mapent *entry,
|
||||
{
|
||||
struct map_source *source;
|
||||
char *ntype, *nformat;
|
||||
- const char **tmpargv, *name = NULL;
|
||||
+ const char **tmpargv;
|
||||
|
||||
source = malloc(sizeof(struct map_source));
|
||||
if (!source)
|
||||
@@ -188,10 +188,6 @@ master_add_map_source(struct master_mapent *entry,
|
||||
source->argc = argc;
|
||||
source->argv = tmpargv;
|
||||
|
||||
- /* Can be NULL for "hosts" map */
|
||||
- if (argv)
|
||||
- name = argv[0];
|
||||
-
|
||||
master_source_writelock(entry);
|
||||
|
||||
if (!entry->maps)
|
||||
diff --git a/modules/cyrus-sasl.c b/modules/cyrus-sasl.c
|
||||
index 828143e..92e2226 100644
|
||||
--- a/modules/cyrus-sasl.c
|
||||
+++ b/modules/cyrus-sasl.c
|
||||
@@ -911,7 +911,7 @@ void autofs_sasl_dispose(struct lookup_context *ctxt)
|
||||
{
|
||||
int status, ret;
|
||||
|
||||
- if (ctxt && ctxt->sasl_conn) {
|
||||
+ if (ctxt->sasl_conn) {
|
||||
sasl_dispose(&ctxt->sasl_conn);
|
||||
ctxt->sasl_conn = NULL;
|
||||
}
|
||||
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
|
||||
index f1fb9ce..d8bd169 100644
|
||||
--- a/modules/lookup_ldap.c
|
||||
+++ b/modules/lookup_ldap.c
|
||||
@@ -389,13 +389,16 @@ static int get_query_dn(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt
|
||||
error(logopt,
|
||||
MODPREFIX "query failed for search dn %s: %s",
|
||||
this->basedn, ldap_err2string(rv));
|
||||
+ if (result) {
|
||||
+ ldap_msgfree(result);
|
||||
+ result = NULL;
|
||||
+ }
|
||||
}
|
||||
|
||||
this = this->next;
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
- ldap_msgfree(result);
|
||||
error(logopt,
|
||||
MODPREFIX "failed to find query dn under search base dns");
|
||||
free(query);
|
||||
@@ -1954,6 +1957,12 @@ do_paged:
|
||||
sp->cookie = NULL;
|
||||
}
|
||||
|
||||
+ if (rv != LDAP_SUCCESS) {
|
||||
+ debug(ap->logopt,
|
||||
+ MODPREFIX "ldap_parse_result failed with %d", rv);
|
||||
+ goto out_free;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* Parse the page control returned to get the cookie and
|
||||
* determine whether there are more pages.
|
||||
@@ -1970,8 +1979,8 @@ do_paged:
|
||||
if (returnedControls)
|
||||
ldap_controls_free(returnedControls);
|
||||
|
||||
+out_free:
|
||||
ldap_control_free(pageControl);
|
||||
-
|
||||
return rv;
|
||||
}
|
||||
|
||||
diff --git a/modules/mount_autofs.c b/modules/mount_autofs.c
|
||||
index afb1859..2a5d860 100644
|
||||
--- a/modules/mount_autofs.c
|
||||
+++ b/modules/mount_autofs.c
|
||||
@@ -119,7 +119,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
|
||||
else if (strncmp(cp, "timeout=", 8) == 0) {
|
||||
char *val = strchr(cp, '=');
|
||||
unsigned tout;
|
||||
- if (val++) {
|
||||
+ if (val) {
|
||||
int ret = sscanf(cp, "timeout=%u", &tout);
|
||||
if (ret)
|
||||
timeout = tout;
|
||||
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
|
||||
index db36ae2..921daf4 100644
|
||||
--- a/modules/parse_sun.c
|
||||
+++ b/modules/parse_sun.c
|
||||
@@ -1334,7 +1334,7 @@ int parse_mount(struct autofs_point *ap, const char *name,
|
||||
char *pmapent, *options;
|
||||
const char *p;
|
||||
int mapent_len, rv = 0;
|
||||
- int optlen, cur_state;
|
||||
+ int cur_state;
|
||||
int slashify = ctxt->slashify_colons;
|
||||
unsigned int append_options;
|
||||
|
||||
@@ -1389,7 +1389,6 @@ int parse_mount(struct autofs_point *ap, const char *name,
|
||||
logerr(MODPREFIX "strdup: %s", estr);
|
||||
return 1;
|
||||
}
|
||||
- optlen = strlen(options);
|
||||
|
||||
p = skipspace(pmapent);
|
||||
|
||||
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
|
||||
index fded1d8..806302b 100644
|
||||
--- a/redhat/autofs.init.in
|
||||
+++ b/redhat/autofs.init.in
|
||||
@@ -172,7 +172,7 @@ case "$1" in
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
- echo $"Usage: $0 {start|forcestart|stop|status|restart|orcerestart|reload|condrestart}"
|
||||
+ echo $"Usage: $0 {start|forcestart|stop|status|restart|forcerestart|reload|condrestart}"
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
@ -1,223 +0,0 @@
|
||||
autofs-5.0.5 - refactor ldap sasl bind
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
During the sasl authentication (and possible authentication method
|
||||
selection) we establish a connection and then dispose of it and then
|
||||
authenticate again. This is a little inefficient but some servers
|
||||
don't like a second authentication using the same LDAP handle and
|
||||
authentication fails when it should succeed. We should use the
|
||||
authentication connection once we get it and not perform another
|
||||
later.
|
||||
|
||||
Also fixed with this patch. If a server returns a set of
|
||||
authentication mechanisms that all require authentication, then the
|
||||
connection pointer is returned to the caller uninitialized (reported
|
||||
and fix provided by Jeff Moyer).
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
modules/cyrus-sasl.c | 55 ++++++++++++++++++---------------------------
|
||||
modules/lookup_ldap.c | 60 -------------------------------------------------
|
||||
3 files changed, 23 insertions(+), 93 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 674a48b..5adcca5 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -1,6 +1,7 @@
|
||||
??/??/20?? autofs-5.0.6
|
||||
-----------------------
|
||||
- fix included map read fail handling.
|
||||
+- refactor ldap sasl bind handling.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/modules/cyrus-sasl.c b/modules/cyrus-sasl.c
|
||||
index 04001d0..828143e 100644
|
||||
--- a/modules/cyrus-sasl.c
|
||||
+++ b/modules/cyrus-sasl.c
|
||||
@@ -87,8 +87,8 @@ static sasl_callback_t callbacks[] = {
|
||||
{ SASL_CB_LIST_END, NULL, NULL },
|
||||
};
|
||||
|
||||
-static char *sasl_auth_id, *sasl_auth_secret;
|
||||
-sasl_secret_t *sasl_secret;
|
||||
+static char *sasl_auth_id = NULL;
|
||||
+static char *sasl_auth_secret = NULL;
|
||||
|
||||
static int
|
||||
sasl_log_func(void *context, int level, const char *message)
|
||||
@@ -798,7 +798,7 @@ sasl_bind_mech(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt, const c
|
||||
sasl_conn_t *
|
||||
sasl_choose_mech(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt)
|
||||
{
|
||||
- sasl_conn_t *conn;
|
||||
+ sasl_conn_t *conn = NULL;
|
||||
int authenticated;
|
||||
int i;
|
||||
char **mechanisms;
|
||||
@@ -845,22 +845,6 @@ sasl_choose_mech(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt)
|
||||
return conn;
|
||||
}
|
||||
|
||||
-int
|
||||
-autofs_sasl_bind(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt)
|
||||
-{
|
||||
- sasl_conn_t *conn;
|
||||
-
|
||||
- if (!ctxt->sasl_mech)
|
||||
- return -1;
|
||||
-
|
||||
- conn = sasl_bind_mech(logopt, ldap, ctxt, ctxt->sasl_mech);
|
||||
- if (!conn)
|
||||
- return -1;
|
||||
-
|
||||
- ctxt->sasl_conn = conn;
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
/*
|
||||
* Routine called when unbinding an ldap connection.
|
||||
*/
|
||||
@@ -883,35 +867,40 @@ autofs_sasl_unbind(struct lookup_context *ctxt)
|
||||
* -1 - Failure
|
||||
*/
|
||||
int
|
||||
-autofs_sasl_init(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt)
|
||||
+autofs_sasl_bind(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt)
|
||||
{
|
||||
- sasl_conn_t *conn;
|
||||
+ sasl_conn_t *conn = NULL;
|
||||
+
|
||||
+ /* If we already have a connection use it */
|
||||
+ if (ctxt->sasl_conn)
|
||||
+ return 0;
|
||||
|
||||
sasl_auth_id = ctxt->user;
|
||||
sasl_auth_secret = ctxt->secret;
|
||||
|
||||
+ if (ctxt->auth_required & LDAP_AUTH_AUTODETECT) {
|
||||
+ if (ctxt->sasl_mech) {
|
||||
+ free(ctxt->sasl_mech);
|
||||
+ ctxt->sasl_mech = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* If LDAP_AUTH_AUTODETECT is set, it means that there was no
|
||||
* mechanism specified in the configuration file or auto
|
||||
* selection has been requested, so try to auto-select an
|
||||
* auth mechanism.
|
||||
*/
|
||||
- if (!(ctxt->auth_required & LDAP_AUTH_AUTODETECT))
|
||||
+ if (ctxt->sasl_mech)
|
||||
conn = sasl_bind_mech(logopt, ldap, ctxt, ctxt->sasl_mech);
|
||||
- else {
|
||||
- if (ctxt->sasl_mech) {
|
||||
- free(ctxt->sasl_mech);
|
||||
- ctxt->sasl_mech = NULL;
|
||||
- }
|
||||
+ else
|
||||
conn = sasl_choose_mech(logopt, ldap, ctxt);
|
||||
- }
|
||||
|
||||
- if (conn) {
|
||||
- sasl_dispose(&conn);
|
||||
- return 0;
|
||||
- }
|
||||
+ if (!conn)
|
||||
+ return -1;
|
||||
|
||||
- return -1;
|
||||
+ ctxt->sasl_conn = conn;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
|
||||
index 2ecf5fe..f1fb9ce 100644
|
||||
--- a/modules/lookup_ldap.c
|
||||
+++ b/modules/lookup_ldap.c
|
||||
@@ -59,7 +59,6 @@ struct ldap_search_params {
|
||||
time_t age;
|
||||
};
|
||||
|
||||
-static LDAP *auth_init(unsigned logopt, const char *, struct lookup_context *);
|
||||
static int decode_percent_hack(const char *, char **);
|
||||
|
||||
#ifndef HAVE_LDAP_CREATE_PAGE_CONTROL
|
||||
@@ -600,33 +599,6 @@ static LDAP *connect_to_server(unsigned logopt, const char *uri, struct lookup_c
|
||||
{
|
||||
LDAP *ldap;
|
||||
|
||||
-#ifdef WITH_SASL
|
||||
- /*
|
||||
- * Determine which authentication mechanism to use if we require
|
||||
- * authentication.
|
||||
- */
|
||||
- if (ctxt->auth_required & (LDAP_AUTH_REQUIRED|LDAP_AUTH_AUTODETECT)) {
|
||||
- ldap = auth_init(logopt, uri, ctxt);
|
||||
- if (!ldap && ctxt->auth_required & LDAP_AUTH_AUTODETECT)
|
||||
- info(logopt,
|
||||
- "no authentication mechanisms auto detected.");
|
||||
- if (!ldap) {
|
||||
- error(logopt, MODPREFIX
|
||||
- "cannot initialize authentication setup");
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- if (!do_bind(logopt, ldap, uri, ctxt)) {
|
||||
- unbind_ldap_connection(logopt, ldap, ctxt);
|
||||
- autofs_sasl_dispose(ctxt);
|
||||
- error(logopt, MODPREFIX "cannot bind to server");
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- return ldap;
|
||||
- }
|
||||
-#endif
|
||||
-
|
||||
ldap = do_connect(logopt, uri, ctxt);
|
||||
if (!ldap) {
|
||||
warn(logopt,
|
||||
@@ -1074,38 +1046,6 @@ out:
|
||||
|
||||
return ret;
|
||||
}
|
||||
-
|
||||
-/*
|
||||
- * Reads in the xml configuration file and parses out the relevant
|
||||
- * information. If there is no configuration file, then we fall back to
|
||||
- * trying all supported authentication mechanisms until one works.
|
||||
- *
|
||||
- * Returns ldap connection on success, with authtype, user and secret
|
||||
- * filled in as appropriate. Returns NULL on failre.
|
||||
- */
|
||||
-static LDAP *auth_init(unsigned logopt, const char *uri, struct lookup_context *ctxt)
|
||||
-{
|
||||
- int ret;
|
||||
- LDAP *ldap;
|
||||
-
|
||||
- ldap = init_ldap_connection(logopt, uri, ctxt);
|
||||
- if (!ldap)
|
||||
- return NULL;
|
||||
-
|
||||
- /*
|
||||
- * Initialize the sasl library. It is okay if user and secret
|
||||
- * are NULL, here.
|
||||
- *
|
||||
- * The autofs_sasl_init routine will figure out which mechamism
|
||||
- * to use. If kerberos is used, it will also take care to initialize
|
||||
- * the credential cache and the client and service principals.
|
||||
- */
|
||||
- ret = autofs_sasl_init(logopt, ldap, ctxt);
|
||||
- if (ret)
|
||||
- return NULL;
|
||||
-
|
||||
- return ldap;
|
||||
-}
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -1,44 +0,0 @@
|
||||
autofs-5.0.5 - remove ERR_remove_state() openssl call
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
autofs should never have had to use ERR_remove_state() so remove that call.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
modules/lookup_ldap.c | 12 +-----------
|
||||
2 files changed, 2 insertions(+), 11 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -46,6 +46,7 @@
|
||||
- remove extra read master map call.
|
||||
- fix error handing in do_mount_indirect().
|
||||
- expire thread use pending mutex.
|
||||
+- remove ERR_remove_state() openssl call.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/modules/lookup_ldap.c
|
||||
+++ autofs-5.0.5/modules/lookup_ldap.c
|
||||
@@ -169,18 +169,8 @@ int unbind_ldap_connection(unsigned logo
|
||||
int rv;
|
||||
|
||||
#ifdef WITH_SASL
|
||||
- /*
|
||||
- * The OpenSSL library can't handle having its message and error
|
||||
- * string database loaded multiple times and segfaults if the
|
||||
- * TLS environment is not reset at the right times. As there
|
||||
- * is no ldap_stop_tls call in the openldap library we have
|
||||
- * to do the job ourselves, here and in lookup_done when the
|
||||
- * module is closed.
|
||||
- */
|
||||
- if (ctxt->use_tls == LDAP_TLS_RELEASE) {
|
||||
- ERR_remove_state(0);
|
||||
+ if (ctxt->use_tls == LDAP_TLS_RELEASE)
|
||||
ctxt->use_tls = LDAP_TLS_INIT;
|
||||
- }
|
||||
autofs_sasl_unbind(ctxt);
|
||||
#endif
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
autofs-5.0.5 - remove extra read master map call
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Fix a mistake with a recent patch where a call to lookup_read_master()
|
||||
which should have been removed wasn't.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/master.c | 1 -
|
||||
2 files changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -43,6 +43,7 @@
|
||||
- check each dc server individually.
|
||||
- fix negative cache included map lookup.
|
||||
- remove state machine timed wait.
|
||||
+- remove extra read master map call.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/lib/master.c
|
||||
+++ autofs-5.0.5/lib/master.c
|
||||
@@ -840,7 +840,6 @@ int master_read_master(struct master *ma
|
||||
lookup_nss_read_master(master, age);
|
||||
cache_unlock(nc);
|
||||
|
||||
- lookup_nss_read_master(master, age);
|
||||
if (!master->read_fail)
|
||||
master_mount_mounts(master, age, readall);
|
||||
else {
|
||||
@ -1,114 +0,0 @@
|
||||
autofs-5.0.5 - remove state machine timed wait
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
We are seeing a problem using timed waits when running under KVM.
|
||||
|
||||
Using timed condition waits in the state machine (and in some other
|
||||
places) has been used because of observed task throughput problems
|
||||
in the past. Also, we've seen condition waits not reacting to signals
|
||||
occassionaly.
|
||||
|
||||
But now we are seeing problems with the setup of the wait time within
|
||||
KVM VMs causing the condition wait to go into a tight loop using
|
||||
excessive CPU.
|
||||
|
||||
Changing the state queue handler to not use timed waits appears to
|
||||
not have the previously observed throughput problems, hopefully we
|
||||
won't see lost signals either.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/state.c | 30 +++++++-----------------------
|
||||
2 files changed, 8 insertions(+), 23 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -42,6 +42,7 @@
|
||||
- fix mapent becomes negative during lookup.
|
||||
- check each dc server individually.
|
||||
- fix negative cache included map lookup.
|
||||
+- remove state machine timed wait.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/daemon/state.c
|
||||
+++ autofs-5.0.5/daemon/state.c
|
||||
@@ -197,11 +197,11 @@ void expire_cleanup(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
+ st_set_done(ap);
|
||||
+
|
||||
if (next != ST_INVAL)
|
||||
__st_add_task(ap, next);
|
||||
|
||||
- st_set_done(ap);
|
||||
-
|
||||
st_mutex_unlock();
|
||||
|
||||
return;
|
||||
@@ -332,11 +332,10 @@ static void do_readmap_cleanup(void *arg
|
||||
st_mutex_lock();
|
||||
|
||||
ap->readmap_thread = 0;
|
||||
- st_ready(ap);
|
||||
st_set_done(ap);
|
||||
-
|
||||
if (!ap->submount)
|
||||
alarm_add(ap, ap->exp_runfreq);
|
||||
+ st_ready(ap);
|
||||
|
||||
st_mutex_unlock();
|
||||
|
||||
@@ -1060,8 +1059,6 @@ static void *st_queue_handler(void *arg)
|
||||
{
|
||||
struct list_head *head;
|
||||
struct list_head *p;
|
||||
- struct timespec wait;
|
||||
- struct timeval now;
|
||||
int status, ret;
|
||||
|
||||
st_mutex_lock();
|
||||
@@ -1072,17 +1069,11 @@ static void *st_queue_handler(void *arg)
|
||||
* entry is added.
|
||||
*/
|
||||
head = &state_queue;
|
||||
- gettimeofday(&now, NULL);
|
||||
- wait.tv_sec = now.tv_sec + 1;
|
||||
- wait.tv_nsec = now.tv_usec * 1000;
|
||||
|
||||
while (list_empty(head)) {
|
||||
- status = pthread_cond_timedwait(&cond, &mutex, &wait);
|
||||
- if (status) {
|
||||
- if (status == ETIMEDOUT)
|
||||
- break;
|
||||
+ status = pthread_cond_wait(&cond, &mutex);
|
||||
+ if (status)
|
||||
fatal(status);
|
||||
- }
|
||||
}
|
||||
|
||||
p = head->next;
|
||||
@@ -1108,18 +1099,11 @@ static void *st_queue_handler(void *arg)
|
||||
}
|
||||
|
||||
while (1) {
|
||||
- gettimeofday(&now, NULL);
|
||||
- wait.tv_sec = now.tv_sec + 1;
|
||||
- wait.tv_nsec = now.tv_usec * 1000;
|
||||
-
|
||||
signaled = 0;
|
||||
while (!signaled) {
|
||||
- status = pthread_cond_timedwait(&cond, &mutex, &wait);
|
||||
- if (status) {
|
||||
- if (status == ETIMEDOUT)
|
||||
- break;
|
||||
+ status = pthread_cond_wait(&cond, &mutex);
|
||||
+ if (status)
|
||||
fatal(status);
|
||||
- }
|
||||
}
|
||||
|
||||
head = &state_queue;
|
||||
@ -1,791 +0,0 @@
|
||||
autofs-5.0.5 - replace GPLv3 code
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The code to get SRV records from DNS was taken from Samba.
|
||||
Samba is a GPLv3 licensed work which forces autofs to GPLv3.
|
||||
|
||||
I don't know enough about GPLv3 to know if that is a good thing
|
||||
but I also don't like autofs being forced to GPLv3 because one
|
||||
of the copyright holders won't grant permission to use the code
|
||||
under a GPLv2 license.
|
||||
---
|
||||
|
||||
CHANGELOG | 1
|
||||
modules/dclist.c | 592 +++++++++++++++++--------------------------------------
|
||||
2 files changed, 193 insertions(+), 400 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -60,6 +60,7 @@
|
||||
- fix prune cache valid check.
|
||||
- fix mountd vers retry.
|
||||
- fix expire race.
|
||||
+- replace GPLv3 code.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/modules/dclist.c
|
||||
+++ autofs-5.0.5/modules/dclist.c
|
||||
@@ -1,19 +1,10 @@
|
||||
/*
|
||||
- * Copyright 2009 Ian Kent <raven@themaw.net>
|
||||
- * Copyright 2009 Red Hat, Inc.
|
||||
- *
|
||||
- * This module was apapted from code contained in the Samba distribution
|
||||
- * file source/libads/dns.c which contained the following copyright
|
||||
- * information:
|
||||
- *
|
||||
- * Unix SMB/CIFS implementation.
|
||||
- * DNS utility library
|
||||
- * Copyright (C) Gerald (Jerry) Carter 2006.
|
||||
- * Copyright (C) Jeremy Allison 2007.
|
||||
+ * Copyright 2011 Ian Kent <raven@themaw.net>
|
||||
+ * Copyright 2011 Red Hat, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
- * the Free Software Foundation; either version 3 of the License, or
|
||||
+ * the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
@@ -25,7 +16,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
+#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
+#include <arpa/inet.h>
|
||||
#include <arpa/nameser.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -39,80 +32,21 @@
|
||||
#include "automount.h"
|
||||
#include "dclist.h"
|
||||
|
||||
-#define MAX_DNS_PACKET_SIZE 0xffff
|
||||
-#define MAX_DNS_NAME_LENGTH MAXHOSTNAMELEN
|
||||
-/* The longest time we will cache dns srv records */
|
||||
-#define MAX_TTL (60*60*1) /* 1 hours */
|
||||
-
|
||||
-#ifdef NS_HFIXEDSZ /* Bind 8/9 interface */
|
||||
-#if !defined(C_IN) /* AIX 5.3 already defines C_IN */
|
||||
-# define C_IN ns_c_in
|
||||
-#endif
|
||||
-#if !defined(T_A) /* AIX 5.3 already defines T_A */
|
||||
-# define T_A ns_t_a
|
||||
-#endif
|
||||
-
|
||||
-# define T_SRV ns_t_srv
|
||||
-#if !defined(T_NS) /* AIX 5.3 already defines T_NS */
|
||||
-# define T_NS ns_t_ns
|
||||
-#endif
|
||||
-#else
|
||||
-# ifdef HFIXEDSZ
|
||||
-# define NS_HFIXEDSZ HFIXEDSZ
|
||||
-# else
|
||||
-# define NS_HFIXEDSZ sizeof(HEADER)
|
||||
-# endif /* HFIXEDSZ */
|
||||
-# ifdef PACKETSZ
|
||||
-# define NS_PACKETSZ PACKETSZ
|
||||
-# else /* 512 is usually the default */
|
||||
-# define NS_PACKETSZ 512
|
||||
-# endif /* PACKETSZ */
|
||||
-# define T_SRV 33
|
||||
-#endif
|
||||
-
|
||||
-#define SVAL(buf, pos) (*(const uint16_t *)((const char *)(buf) + (pos)))
|
||||
-#define IVAL(buf, pos) (*(const uint32_t *)((const char *)(buf) + (pos)))
|
||||
-
|
||||
-#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
-#define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
|
||||
-#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16)))
|
||||
-#else
|
||||
-#define SREV(x) (x)
|
||||
-#define IREV(x) (x)
|
||||
-#endif
|
||||
-
|
||||
-#define RSVAL(buf, pos) SREV(SVAL(buf, pos))
|
||||
-#define RIVAL(buf, pos) IREV(IVAL(buf, pos))
|
||||
-
|
||||
-#define QSORT_CAST (int (*)(const void *, const void *))
|
||||
-
|
||||
-/* DNS query section in replies */
|
||||
-
|
||||
-struct dns_query {
|
||||
- const char *hostname;
|
||||
- uint16_t type;
|
||||
- uint16_t in_class;
|
||||
-};
|
||||
-
|
||||
-/* DNS RR record in reply */
|
||||
+#define MAX_TTL (60*60) /* 1 hour */
|
||||
|
||||
-struct dns_rr {
|
||||
- const char *hostname;
|
||||
- uint16_t type;
|
||||
- uint16_t in_class;
|
||||
- uint32_t ttl;
|
||||
- uint16_t rdatalen;
|
||||
- uint8_t *rdata;
|
||||
+struct rr {
|
||||
+ unsigned int type;
|
||||
+ unsigned int class;
|
||||
+ unsigned long ttl;
|
||||
+ unsigned int len;
|
||||
};
|
||||
|
||||
-/* SRV records */
|
||||
-
|
||||
-struct dns_rr_srv {
|
||||
- const char *hostname;
|
||||
- uint16_t priority;
|
||||
- uint16_t weight;
|
||||
- uint16_t port;
|
||||
- uint32_t ttl;
|
||||
+struct srv_rr {
|
||||
+ const char *name;
|
||||
+ unsigned int priority;
|
||||
+ unsigned int weight;
|
||||
+ unsigned int port;
|
||||
+ unsigned long ttl;
|
||||
};
|
||||
|
||||
static pthread_mutex_t dclist_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
@@ -133,374 +67,224 @@ static void dclist_mutex_unlock(void)
|
||||
return;
|
||||
}
|
||||
|
||||
-static int dns_parse_query(unsigned int logopt,
|
||||
- uint8_t *start, uint8_t *end,
|
||||
- uint8_t **ptr, struct dns_query *q)
|
||||
+static int do_srv_query(unsigned int logopt, char *name, u_char **packet)
|
||||
{
|
||||
- uint8_t *p = *ptr;
|
||||
- char hostname[MAX_DNS_NAME_LENGTH];
|
||||
- char buf[MAX_ERR_BUF];
|
||||
- int namelen;
|
||||
-
|
||||
- if (!start || !end || !q || !*ptr)
|
||||
- return 0;
|
||||
+ unsigned int len = PACKETSZ;
|
||||
+ unsigned int last_len = len;
|
||||
+ char ebuf[MAX_ERR_BUF];
|
||||
+ u_char *buf;
|
||||
+
|
||||
+ while (1) {
|
||||
+ buf = malloc(last_len);
|
||||
+ if (!buf) {
|
||||
+ char *estr = strerror_r(errno, ebuf, MAX_ERR_BUF);
|
||||
+ error(logopt, "malloc: %s", estr);
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
- memset(q, 0, sizeof(*q));
|
||||
+ len = res_query(name, C_IN, T_SRV, buf, last_len);
|
||||
+ if (len < 0) {
|
||||
+ char *estr = strerror_r(errno, ebuf, MAX_ERR_BUF);
|
||||
+ error(logopt, "Failed to resolve %s (%s)", name, estr);
|
||||
+ free(buf);
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
- /* See RFC 1035 for details. If this fails, then return. */
|
||||
+ if (len == last_len) {
|
||||
+ /* These shouldn't too large, bump by PACKETSZ only */
|
||||
+ last_len += PACKETSZ;
|
||||
+ free(buf);
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
- namelen = dn_expand(start, end, p, hostname, sizeof(hostname));
|
||||
- if (namelen < 0) {
|
||||
- error(logopt, "failed to expand query hostname");
|
||||
- return 0;
|
||||
+ break;
|
||||
}
|
||||
|
||||
- p += namelen;
|
||||
- q->hostname = strdup(hostname);
|
||||
- if (!q) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- error(logopt, "strdup: %s", estr);
|
||||
- return 0;
|
||||
- }
|
||||
+ *packet = buf;
|
||||
|
||||
- /* check that we have space remaining */
|
||||
+ return len;
|
||||
+}
|
||||
|
||||
- if (p + 4 > end) {
|
||||
- error(logopt, "insufficient buffer space for result");
|
||||
- free((void *) q->hostname);
|
||||
- return 0;
|
||||
- }
|
||||
+static int get_name_len(u_char *buffer, u_char *start, u_char *end)
|
||||
+{
|
||||
+ char tmp[MAXDNAME];
|
||||
+ return dn_expand(buffer, end, start, tmp, MAXDNAME);
|
||||
+}
|
||||
|
||||
- q->type = RSVAL(p, 0);
|
||||
- q->in_class = RSVAL(p, 2);
|
||||
- p += 4;
|
||||
+static int get_data_offset(u_char *buffer,
|
||||
+ u_char *start, u_char *end,
|
||||
+ struct rr *rr)
|
||||
+{
|
||||
+ u_char *cp = start;
|
||||
+ int name_len;
|
||||
|
||||
- *ptr = p;
|
||||
+ name_len = get_name_len(buffer, start, end);
|
||||
+ if (name_len < 0)
|
||||
+ return -1;
|
||||
+ cp += name_len;
|
||||
|
||||
- return 1;
|
||||
+ GETSHORT(rr->type, cp);
|
||||
+ GETSHORT(rr->class, cp);
|
||||
+ GETLONG(rr->ttl, cp);
|
||||
+ GETSHORT(rr->len, cp);
|
||||
+
|
||||
+ return (cp - start);
|
||||
}
|
||||
|
||||
-static int dns_parse_rr(unsigned int logopt,
|
||||
- uint8_t *start, uint8_t *end,
|
||||
- uint8_t **ptr, struct dns_rr *rr)
|
||||
+static struct srv_rr *parse_srv_rr(unsigned int logopt,
|
||||
+ u_char *buffer, u_char *start, u_char *end,
|
||||
+ struct rr *rr, struct srv_rr *srv)
|
||||
{
|
||||
- uint8_t *p = *ptr;
|
||||
- char hostname[MAX_DNS_NAME_LENGTH];
|
||||
- char buf[MAX_ERR_BUF];
|
||||
- int namelen;
|
||||
-
|
||||
- if (!start || !end || !rr || !*ptr)
|
||||
- return 0;
|
||||
-
|
||||
- memset(rr, 0, sizeof(*rr));
|
||||
+ u_char *cp = start;
|
||||
+ char ebuf[MAX_ERR_BUF];
|
||||
+ char tmp[MAXDNAME];
|
||||
+ int len;
|
||||
|
||||
- /* pull the name from the answer */
|
||||
+ GETSHORT(srv->priority, cp);
|
||||
+ GETSHORT(srv->weight, cp);
|
||||
+ GETSHORT(srv->port, cp);
|
||||
+ srv->ttl = rr->ttl;
|
||||
|
||||
- namelen = dn_expand(start, end, p, hostname, sizeof(hostname));
|
||||
- if (namelen < 0) {
|
||||
- error(logopt, "failed to expand query hostname");
|
||||
- return 0;
|
||||
+ len = dn_expand(buffer, end, cp, tmp, MAXDNAME);
|
||||
+ if (len < 0) {
|
||||
+ error(logopt, "failed to expand name");
|
||||
+ return NULL;
|
||||
}
|
||||
- p += namelen;
|
||||
- rr->hostname = strdup(hostname);
|
||||
- if (!rr->hostname) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ srv->name = strdup(tmp);
|
||||
+ if (!srv->name) {
|
||||
+ char *estr = strerror_r(errno, ebuf, MAX_ERR_BUF);
|
||||
error(logopt, "strdup: %s", estr);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- /* check that we have space remaining */
|
||||
-
|
||||
- if (p + 10 > end) {
|
||||
- error(logopt, "insufficient buffer space for result");
|
||||
- free((void *) rr->hostname);
|
||||
- return 0;
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
- /* pull some values and then skip onto the string */
|
||||
-
|
||||
- rr->type = RSVAL(p, 0);
|
||||
- rr->in_class = RSVAL(p, 2);
|
||||
- rr->ttl = RIVAL(p, 4);
|
||||
- rr->rdatalen = RSVAL(p, 8);
|
||||
+ return srv;
|
||||
+}
|
||||
|
||||
- p += 10;
|
||||
+static int cmp(struct srv_rr *a, struct srv_rr *b)
|
||||
+{
|
||||
+ if (a->priority < b->priority)
|
||||
+ return -1;
|
||||
|
||||
- /* sanity check the available space */
|
||||
+ if (a->priority > b->priority)
|
||||
+ return 1;
|
||||
|
||||
- if (p + rr->rdatalen > end) {
|
||||
- error(logopt, "insufficient buffer space for data");
|
||||
- free((void *) rr->hostname);
|
||||
+ if (!a->weight || a->weight == b->weight)
|
||||
return 0;
|
||||
- }
|
||||
|
||||
- /* save a point to the rdata for this section */
|
||||
-
|
||||
- rr->rdata = p;
|
||||
- p += rr->rdatalen;
|
||||
-
|
||||
- *ptr = p;
|
||||
+ if (a->weight > b->weight)
|
||||
+ return -1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
-static int dns_parse_rr_srv(unsigned int logopt,
|
||||
- uint8_t *start, uint8_t *end,
|
||||
- uint8_t **ptr, struct dns_rr_srv *srv)
|
||||
-{
|
||||
- struct dns_rr rr;
|
||||
- uint8_t *p;
|
||||
- char dcname[MAX_DNS_NAME_LENGTH];
|
||||
- char buf[MAX_ERR_BUF];
|
||||
- int namelen;
|
||||
-
|
||||
- if (!start || !end || !srv || !*ptr)
|
||||
- return 0;
|
||||
-
|
||||
- /* Parse the RR entry. Coming out of the this, ptr is at the beginning
|
||||
- of the next record */
|
||||
-
|
||||
- if (!dns_parse_rr(logopt, start, end, ptr, &rr)) {
|
||||
- error(logopt, "Failed to parse RR record");
|
||||
- return 0;
|
||||
- }
|
||||
+static void free_srv_rrs(struct srv_rr *dcs, unsigned int count)
|
||||
+{
|
||||
+ int i;
|
||||
|
||||
- if (rr.type != T_SRV) {
|
||||
- error(logopt, "Bad answer type (%d)", rr.type);
|
||||
- return 0;
|
||||
+ for (i = 0; i < count; i++) {
|
||||
+ if (dcs[i].name)
|
||||
+ free((void *) dcs[i].name);
|
||||
}
|
||||
+ free(dcs);
|
||||
+}
|
||||
|
||||
- p = rr.rdata;
|
||||
+int get_srv_rrs(unsigned int logopt,
|
||||
+ char *name, struct srv_rr **dcs, unsigned int *dcs_count)
|
||||
+{
|
||||
+ struct srv_rr *srvs;
|
||||
+ unsigned int srv_num;
|
||||
+ HEADER *header;
|
||||
+ u_char *packet;
|
||||
+ u_char *start;
|
||||
+ u_char *end;
|
||||
+ unsigned int count;
|
||||
+ int i, len;
|
||||
+ char ebuf[MAX_ERR_BUF];
|
||||
|
||||
- srv->priority = RSVAL(p, 0);
|
||||
- srv->weight = RSVAL(p, 2);
|
||||
- srv->port = RSVAL(p, 4);
|
||||
- srv->ttl = rr.ttl;
|
||||
-
|
||||
- p += 6;
|
||||
-
|
||||
- namelen = dn_expand(start, end, p, dcname, sizeof(dcname));
|
||||
- if (namelen < 0) {
|
||||
- error(logopt, "Failed to expand dcname");
|
||||
+ len = do_srv_query(logopt, name, &packet);
|
||||
+ if (len < 0)
|
||||
return 0;
|
||||
- }
|
||||
|
||||
- srv->hostname = strdup(dcname);
|
||||
- if (!srv->hostname) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- error(logopt, "strdup: %s", estr);
|
||||
- return 0;
|
||||
- }
|
||||
+ header = (HEADER *) packet;
|
||||
+ start = packet + sizeof(HEADER);
|
||||
+ end = packet + len;
|
||||
|
||||
- debug(logopt, "Parsed %s [%u, %u, %u]",
|
||||
- srv->hostname, srv->priority, srv->weight, srv->port);
|
||||
+ srvs = NULL;
|
||||
+ srv_num = 0;
|
||||
|
||||
- return 1;
|
||||
-}
|
||||
-
|
||||
-/*********************************************************************
|
||||
- Sort SRV record list based on weight and priority. See RFC 2782.
|
||||
-*********************************************************************/
|
||||
-
|
||||
-static int dnssrvcmp(struct dns_rr_srv *a, struct dns_rr_srv *b)
|
||||
-{
|
||||
- if (a->priority == b->priority) {
|
||||
- /* randomize entries with an equal weight and priority */
|
||||
- if (a->weight == b->weight)
|
||||
- return 0;
|
||||
-
|
||||
- /* higher weights should be sorted lower */
|
||||
- if (a->weight > b->weight)
|
||||
- return -1;
|
||||
- else
|
||||
- return 1;
|
||||
+ /* Skip over question */
|
||||
+ len = get_name_len(packet, start, end);
|
||||
+ if (len < 0) {
|
||||
+ error(logopt, "failed to get name length");
|
||||
+ goto error_out;
|
||||
}
|
||||
|
||||
- if (a->priority < b->priority)
|
||||
- return -1;
|
||||
+ start += len + QFIXEDSZ;
|
||||
|
||||
- return 1;
|
||||
-}
|
||||
+ count = ntohs(header->ancount);
|
||||
|
||||
-#define DNS_FAILED_WAITTIME 30
|
||||
+ debug(logopt, "%d records returned in the answer section", count);
|
||||
|
||||
-static int dns_send_req(unsigned int logopt,
|
||||
- const char *name, int q_type, uint8_t **rbuf,
|
||||
- int *resp_length)
|
||||
-{
|
||||
- uint8_t *buffer = NULL;
|
||||
- size_t buf_len = 0;
|
||||
- int resp_len = NS_PACKETSZ;
|
||||
- static time_t last_dns_check = 0;
|
||||
- static unsigned int last_dns_status = 0;
|
||||
- time_t now = time(NULL);
|
||||
- char buf[MAX_ERR_BUF];
|
||||
+ if (count <= 0) {
|
||||
+ error(logopt, "no records found in answers section");
|
||||
+ goto error_out;
|
||||
+ }
|
||||
|
||||
- /* Try to prevent bursts of DNS lookups if the server is down */
|
||||
+ srvs = malloc(sizeof(struct srv_rr) * count);
|
||||
+ if (!srvs) {
|
||||
+ char *estr = strerror_r(errno, ebuf, MAX_ERR_BUF);
|
||||
+ error(logopt, "malloc: %s", estr);
|
||||
+ goto error_out;
|
||||
+ }
|
||||
+ memset(srvs, 0, sizeof(struct srv_rr) * count);
|
||||
|
||||
- /* Protect against large clock changes */
|
||||
+ srv_num = 0;
|
||||
+ for (i = 0; i < count && (start < end); i++) {
|
||||
+ unsigned int data_offset;
|
||||
+ struct srv_rr srv;
|
||||
+ struct srv_rr *psrv;
|
||||
+ struct rr rr;
|
||||
|
||||
- if (last_dns_check > now)
|
||||
- last_dns_check = 0;
|
||||
+ memset(&rr, 0, sizeof(struct rr));
|
||||
|
||||
- /* IF we had a DNS timeout or a bad server and we are still
|
||||
- in the 30 second cache window, just return the previous
|
||||
- status and save the network timeout. */
|
||||
-
|
||||
- if ((last_dns_status == ETIMEDOUT ||
|
||||
- last_dns_status == ECONNREFUSED) &&
|
||||
- ((last_dns_check + DNS_FAILED_WAITTIME) > now)) {
|
||||
- char *estr = strerror_r(last_dns_status, buf, MAX_ERR_BUF);
|
||||
- debug(logopt, "Returning cached status (%s)", estr);
|
||||
- return last_dns_status;
|
||||
- }
|
||||
-
|
||||
- /* Send the Query */
|
||||
- do {
|
||||
- if (buffer)
|
||||
- free(buffer);
|
||||
-
|
||||
- buf_len = resp_len * sizeof(uint8_t);
|
||||
-
|
||||
- if (buf_len) {
|
||||
- buffer = malloc(buf_len);
|
||||
- if (!buffer) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- error(logopt, "malloc: %s", estr);
|
||||
- last_dns_status = ENOMEM;
|
||||
- last_dns_check = time(NULL);
|
||||
- return last_dns_status;
|
||||
- }
|
||||
+ data_offset = get_data_offset(packet, start, end, &rr);
|
||||
+ if (data_offset <= 0) {
|
||||
+ error(logopt, "failed to get start of data");
|
||||
+ goto error_out;
|
||||
}
|
||||
+ start += data_offset;
|
||||
|
||||
- resp_len = res_query(name, C_IN, q_type, buffer, buf_len);
|
||||
- if (resp_len < 0) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- error(logopt, "Failed to resolve %s (%s)", name, estr);
|
||||
- free(buffer);
|
||||
- last_dns_status = ENOENT;
|
||||
- last_dns_check = time(NULL);
|
||||
- return last_dns_status;
|
||||
- }
|
||||
-
|
||||
- /* On AIX, Solaris, and possibly some older glibc systems (e.g. SLES8)
|
||||
- truncated replies never give back a resp_len > buflen
|
||||
- which ends up causing DNS resolve failures on large tcp DNS replies */
|
||||
-
|
||||
- if (buf_len == resp_len) {
|
||||
- if (resp_len == MAX_DNS_PACKET_SIZE) {
|
||||
- error(logopt,
|
||||
- "DNS reply too large when resolving %s",
|
||||
- name);
|
||||
- free(buffer);
|
||||
- last_dns_status = EMSGSIZE;
|
||||
- last_dns_check = time(NULL);
|
||||
- return last_dns_status;
|
||||
- }
|
||||
+ if (rr.type != T_SRV)
|
||||
+ continue;
|
||||
|
||||
- resp_len = MIN(resp_len * 2, MAX_DNS_PACKET_SIZE);
|
||||
+ psrv = parse_srv_rr(logopt, packet, start, end, &rr, &srv);
|
||||
+ if (psrv) {
|
||||
+ memcpy(&srvs[srv_num], psrv, sizeof(struct srv_rr));
|
||||
+ srv_num++;
|
||||
}
|
||||
- } while (buf_len < resp_len && resp_len <= MAX_DNS_PACKET_SIZE);
|
||||
-
|
||||
- *rbuf = buffer;
|
||||
- *resp_length = resp_len;
|
||||
-
|
||||
- last_dns_check = time(NULL);
|
||||
- last_dns_status = 0;
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static int dns_lookup_srv(unsigned int logopt, const char *name,
|
||||
- struct dns_rr_srv **dclist, int *numdcs)
|
||||
-{
|
||||
- uint8_t *buffer = NULL;
|
||||
- int resp_len = 0;
|
||||
- struct dns_rr_srv *dcs = NULL;
|
||||
- int query_count, answer_count;
|
||||
- uint8_t *p = buffer;
|
||||
- int rrnum;
|
||||
- int idx = 0;
|
||||
- char buf[MAX_ERR_BUF];
|
||||
- int ret;
|
||||
-
|
||||
- if (!name || !dclist)
|
||||
- return -EINVAL;
|
||||
-
|
||||
- /* Send the request. May have to loop several times in case
|
||||
- of large replies */
|
||||
-
|
||||
- ret = dns_send_req(logopt, name, T_SRV, &buffer, &resp_len);
|
||||
- if (ret) {
|
||||
- error(logopt, "Failed to send DNS query");
|
||||
- return ret;
|
||||
- }
|
||||
- p = buffer;
|
||||
-
|
||||
- /* For some insane reason, the ns_initparse() et. al. routines are only
|
||||
- available in libresolv.a, and not the shared lib. Who knows why....
|
||||
- So we have to parse the DNS reply ourselves */
|
||||
-
|
||||
- /* Pull the answer RR's count from the header.
|
||||
- * Use the NMB ordering macros */
|
||||
-
|
||||
- query_count = RSVAL(p, 4);
|
||||
- answer_count = RSVAL(p, 6);
|
||||
-
|
||||
- debug(logopt,
|
||||
- "%d records returned in the answer section.",
|
||||
- answer_count);
|
||||
|
||||
- if (answer_count) {
|
||||
- dcs = malloc(sizeof(struct dns_rr_srv) * answer_count);
|
||||
- if (!dcs) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- error(logopt, "malloc: %s", estr);
|
||||
- free(buffer);
|
||||
- return ENOMEM;
|
||||
- }
|
||||
+ start += rr.len;
|
||||
}
|
||||
+ free(packet);
|
||||
|
||||
- /* now skip the header */
|
||||
-
|
||||
- p += NS_HFIXEDSZ;
|
||||
-
|
||||
- /* parse the query section */
|
||||
-
|
||||
- for (rrnum = 0; rrnum < query_count; rrnum++) {
|
||||
- struct dns_query q;
|
||||
-
|
||||
- ret = dns_parse_query(logopt, buffer, buffer+resp_len, &p, &q);
|
||||
- if (!ret) {
|
||||
- error(logopt,
|
||||
- "Failed to parse query record [%d]", rrnum);
|
||||
- free(buffer);
|
||||
- free(dcs);
|
||||
- return EBADMSG;
|
||||
- }
|
||||
+ if (!srv_num) {
|
||||
+ error(logopt, "no srv resource records found");
|
||||
+ goto error_srvs;
|
||||
}
|
||||
|
||||
- /* now we are at the answer section */
|
||||
+ qsort(srvs, srv_num, sizeof(struct srv_rr),
|
||||
+ (int (*)(const void *, const void *)) cmp);
|
||||
|
||||
- for (rrnum = 0; rrnum < answer_count; rrnum++) {
|
||||
- ret = dns_parse_rr_srv(logopt,
|
||||
- buffer, buffer+resp_len,
|
||||
- &p, &dcs[rrnum]);
|
||||
- if (!ret) {
|
||||
- error(logopt,
|
||||
- "Failed to parse answer record [%d]", rrnum);
|
||||
- free(buffer);
|
||||
- free(dcs);
|
||||
- return EBADMSG;
|
||||
- }
|
||||
- }
|
||||
- idx = rrnum;
|
||||
+ *dcs = srvs;
|
||||
+ *dcs_count = srv_num;
|
||||
|
||||
- qsort(dcs, idx, sizeof(struct dns_rr_srv), QSORT_CAST dnssrvcmp);
|
||||
-
|
||||
- *dclist = dcs;
|
||||
- *numdcs = idx;
|
||||
+ return 1;
|
||||
|
||||
+error_out:
|
||||
+ free(packet);
|
||||
+error_srvs:
|
||||
+ if (srvs)
|
||||
+ free_srv_rrs(srvs, srv_num);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -553,14 +337,14 @@ void free_dclist(struct dclist *dclist)
|
||||
static char *getdnsdomainname(unsigned int logopt)
|
||||
{
|
||||
struct addrinfo hints, *ni;
|
||||
- char name[MAX_DNS_NAME_LENGTH + 1];
|
||||
+ char name[MAXDNAME + 1];
|
||||
char buf[MAX_ERR_BUF];
|
||||
char *dnsdomain = NULL;
|
||||
char *ptr;
|
||||
int ret;
|
||||
|
||||
memset(name, 0, sizeof(name));
|
||||
- if (gethostname(name, MAX_DNS_NAME_LENGTH) == -1) {
|
||||
+ if (gethostname(name, MAXDNAME) == -1) {
|
||||
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
error(logopt, "gethostname: %s", estr);
|
||||
return NULL;
|
||||
@@ -593,14 +377,12 @@ struct dclist *get_dc_list(unsigned int
|
||||
{
|
||||
LDAPURLDesc *ludlist = NULL;
|
||||
LDAPURLDesc **ludp;
|
||||
- struct dns_rr_srv *dcs;
|
||||
unsigned int min_ttl = MAX_TTL;
|
||||
struct dclist *dclist = NULL;;
|
||||
char buf[MAX_ERR_BUF];
|
||||
char *dn_uri, *esc_uri;
|
||||
char *domain;
|
||||
char *list;
|
||||
- int numdcs;
|
||||
int ret;
|
||||
|
||||
if (strcmp(uri, "ldap:///") && strcmp(uri, "ldaps:///")) {
|
||||
@@ -679,6 +461,8 @@ struct dclist *get_dc_list(unsigned int
|
||||
list = NULL;
|
||||
for (ludp = &ludlist; *ludp != NULL;) {
|
||||
LDAPURLDesc *lud = *ludp;
|
||||
+ struct srv_rr *dcs = NULL;
|
||||
+ unsigned int numdcs = 0;
|
||||
size_t req_len, len;
|
||||
char *request = NULL;
|
||||
char *tmp;
|
||||
@@ -716,7 +500,7 @@ struct dclist *get_dc_list(unsigned int
|
||||
}
|
||||
|
||||
dclist_mutex_lock();
|
||||
- if (dns_lookup_srv(logopt, request, &dcs, &numdcs)) {
|
||||
+ if (!get_srv_rrs(logopt, request, &dcs, &numdcs)) {
|
||||
error(logopt,
|
||||
"DNS SRV query failed for domain %s", domain);
|
||||
dclist_mutex_unlock();
|
||||
@@ -733,7 +517,7 @@ struct dclist *get_dc_list(unsigned int
|
||||
for (i = 0; i < numdcs; i++) {
|
||||
if (dcs[i].ttl > 0 && dcs[i].ttl < min_ttl)
|
||||
min_ttl = dcs[i].ttl;
|
||||
- len += strlen(dcs[i].hostname);
|
||||
+ len += strlen(dcs[i].name);
|
||||
if (dcs[i].port > 0)
|
||||
len += sizeof(":65535");
|
||||
}
|
||||
@@ -742,6 +526,8 @@ struct dclist *get_dc_list(unsigned int
|
||||
if (!tmp) {
|
||||
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
error(logopt, "realloc: %s", estr);
|
||||
+ if (dcs)
|
||||
+ free_srv_rrs(dcs, numdcs);
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
@@ -755,13 +541,15 @@ struct dclist *get_dc_list(unsigned int
|
||||
strcat(tmp, " ");
|
||||
strcat(tmp, lud->lud_scheme);
|
||||
strcat(tmp, "://");
|
||||
- strcat(tmp, dcs[i].hostname);
|
||||
+ strcat(tmp, dcs[i].name);
|
||||
if (dcs[i].port > 0) {
|
||||
char port[7];
|
||||
ret = snprintf(port, 7, ":%d", dcs[i].port);
|
||||
if (ret > 6) {
|
||||
error(logopt,
|
||||
"invalid port: %u", dcs[i].port);
|
||||
+ if (dcs)
|
||||
+ free_srv_rrs(dcs, numdcs);
|
||||
goto out_error;
|
||||
}
|
||||
strcat(tmp, port);
|
||||
@@ -771,10 +559,14 @@ struct dclist *get_dc_list(unsigned int
|
||||
|
||||
*ludp = lud->lud_next;
|
||||
ber_memfree(domain);
|
||||
+ free_srv_rrs(dcs, numdcs);
|
||||
}
|
||||
|
||||
ldap_free_urldesc(ludlist);
|
||||
|
||||
+ if (!list)
|
||||
+ goto out_error;
|
||||
+
|
||||
dclist->expire = time(NULL) + min_ttl;
|
||||
dclist->uri = list;
|
||||
|
||||
@ -1,99 +0,0 @@
|
||||
autofs-5.0.5 - special case cifs escapes
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Since "\" is a valid seperator for cifs shares it can't be used to escape
|
||||
characters in the share name passed to mount.cifs. So we have no choice
|
||||
but to require that the seperator we use is "/" and de-quote the string
|
||||
before sending it to mount.cifs.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
modules/mount_generic.c | 36 ++++++++++++++++++++++++++++++------
|
||||
2 files changed, 31 insertions(+), 6 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index fadb229..671c979 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -3,6 +3,7 @@
|
||||
- fix included map read fail handling.
|
||||
- refactor ldap sasl bind handling.
|
||||
- add mount wait timeout parameter.
|
||||
+- special case cifs escapes.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
diff --git a/modules/mount_generic.c b/modules/mount_generic.c
|
||||
index 8edad8b..da85d1a 100644
|
||||
--- a/modules/mount_generic.c
|
||||
+++ b/modules/mount_generic.c
|
||||
@@ -39,6 +39,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
||||
{
|
||||
char fullpath[PATH_MAX];
|
||||
char buf[MAX_ERR_BUF];
|
||||
+ char *loc;
|
||||
int err;
|
||||
int len, status, existed = 1;
|
||||
|
||||
@@ -74,22 +75,44 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
||||
if (!status)
|
||||
existed = 0;
|
||||
|
||||
+ /*
|
||||
+ * Special case quoting for cifs share names.
|
||||
+ *
|
||||
+ * Since "\" is a valid seperator for cifs shares it can't be
|
||||
+ * used to escape characters in the share name passed to
|
||||
+ * mount.cifs. So we have no choice but to require that the
|
||||
+ * seperator we use is "/" and de-quote the string before
|
||||
+ * sending it to mount.cifs.
|
||||
+ */
|
||||
+ loc = NULL;
|
||||
+ if (strcmp(fstype, "cifs"))
|
||||
+ loc = strdup(what);
|
||||
+ else
|
||||
+ loc = dequote(what, strlen(what), ap->logopt);
|
||||
+ if (!loc) {
|
||||
+ error(ap->logopt,
|
||||
+ MODPREFIX "failed to alloc buffer for mount location");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
if (options && options[0]) {
|
||||
debug(ap->logopt,
|
||||
MODPREFIX "calling mount -t %s " SLOPPY "-o %s %s %s",
|
||||
- fstype, options, what, fullpath);
|
||||
+ fstype, options, loc, fullpath);
|
||||
|
||||
err = spawn_mount(ap->logopt, "-t", fstype,
|
||||
- SLOPPYOPT "-o", options, what, fullpath, NULL);
|
||||
+ SLOPPYOPT "-o", options, loc, fullpath, NULL);
|
||||
} else {
|
||||
debug(ap->logopt, MODPREFIX "calling mount -t %s %s %s",
|
||||
- fstype, what, fullpath);
|
||||
- err = spawn_mount(ap->logopt, "-t", fstype, what, fullpath, NULL);
|
||||
+ fstype, loc, fullpath);
|
||||
+ err = spawn_mount(ap->logopt, "-t", fstype, loc, fullpath, NULL);
|
||||
}
|
||||
|
||||
if (err) {
|
||||
info(ap->logopt, MODPREFIX "failed to mount %s (type %s) on %s",
|
||||
- what, fstype, fullpath);
|
||||
+ loc, fstype, fullpath);
|
||||
+
|
||||
+ free(loc);
|
||||
|
||||
if (ap->type != LKP_INDIRECT)
|
||||
return 1;
|
||||
@@ -100,7 +123,8 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
||||
return 1;
|
||||
} else {
|
||||
info(ap->logopt, MODPREFIX "mounted %s type %s on %s",
|
||||
- what, fstype, fullpath);
|
||||
+ loc, fstype, fullpath);
|
||||
+ free(loc);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -1,568 +0,0 @@
|
||||
autofs-5.0.5 - use weight only for server selection
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When using weighted server names in map entries the server response
|
||||
time is also taken into consideration when selecting a server for
|
||||
the target of the mount. In some cases people need to be able to
|
||||
rely on selection strictly by weight. We add pseudo option
|
||||
"--use-weight-only" that can be used in with master map entries
|
||||
or with individual map entries to provide for this. For individual
|
||||
map entries the option "no-use-weight-only" can also be used to
|
||||
override the master map option.
|
||||
---
|
||||
|
||||
CHANGELOG | 1
|
||||
daemon/automount.c | 8 ++---
|
||||
include/automount.h | 3 ++
|
||||
include/replicated.h | 3 +-
|
||||
lib/master_parse.y | 12 ++++++--
|
||||
lib/master_tok.l | 1
|
||||
man/auto.master.5.in | 6 ++++
|
||||
man/autofs.5 | 7 ++++
|
||||
modules/mount_nfs.c | 15 ++++++----
|
||||
modules/parse_sun.c | 36 +++++++++++++++++++++---
|
||||
modules/replicated.c | 76 ++++++++++++++++++++++++++++++---------------------
|
||||
11 files changed, 120 insertions(+), 48 deletions(-)
|
||||
|
||||
|
||||
--- autofs-5.0.5.orig/CHANGELOG
|
||||
+++ autofs-5.0.5/CHANGELOG
|
||||
@@ -54,6 +54,7 @@
|
||||
- add external bind method.
|
||||
- fix add simple bind auth.
|
||||
- add option to dump configured automount maps.
|
||||
+- use weight only for server selection.
|
||||
|
||||
03/09/2009 autofs-5.0.5
|
||||
-----------------------
|
||||
--- autofs-5.0.5.orig/daemon/automount.c
|
||||
+++ autofs-5.0.5/daemon/automount.c
|
||||
@@ -57,8 +57,8 @@ const char *fifodir = AUTOFS_FIFO_DIR "/
|
||||
const char *global_options; /* Global option, from command line */
|
||||
|
||||
static char *pid_file = NULL; /* File in which to keep pid */
|
||||
-unsigned int global_random_selection; /* use random policy when selecting
|
||||
- * which multi-mount host to mount */
|
||||
+unsigned int global_selection_options;
|
||||
+
|
||||
long global_negative_timeout = -1;
|
||||
int do_force_unlink = 0; /* Forceably unlink mount tree at startup */
|
||||
|
||||
@@ -1855,7 +1855,7 @@ int main(int argc, char *argv[])
|
||||
timeout = defaults_get_timeout();
|
||||
ghost = defaults_get_browse_mode();
|
||||
logging = defaults_get_logging();
|
||||
- global_random_selection = 0;
|
||||
+ global_selection_options = 0;
|
||||
global_options = NULL;
|
||||
have_global_options = 0;
|
||||
foreground = 0;
|
||||
@@ -1898,7 +1898,7 @@ int main(int argc, char *argv[])
|
||||
exit(0);
|
||||
|
||||
case 'r':
|
||||
- global_random_selection = 1;
|
||||
+ global_selection_options |= MOUNT_FLAG_RANDOM_SELECT;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
--- autofs-5.0.5.orig/include/automount.h
|
||||
+++ autofs-5.0.5/include/automount.h
|
||||
@@ -443,6 +443,9 @@ struct kernel_mod_version {
|
||||
/* Mount being re-mounted */
|
||||
#define MOUNT_FLAG_REMOUNT 0x0008
|
||||
|
||||
+/* Use server weight only for selection */
|
||||
+#define MOUNT_FLAG_USE_WEIGHT_ONLY 0x0010
|
||||
+
|
||||
struct autofs_point {
|
||||
pthread_t thid;
|
||||
char *path; /* Mount point name */
|
||||
--- autofs-5.0.5.orig/include/replicated.h
|
||||
+++ autofs-5.0.5/include/replicated.h
|
||||
@@ -56,6 +56,7 @@ struct host {
|
||||
size_t addr_len;
|
||||
char *path;
|
||||
unsigned int version;
|
||||
+ unsigned int options;
|
||||
unsigned int proximity;
|
||||
unsigned int weight;
|
||||
unsigned long cost;
|
||||
@@ -65,7 +66,7 @@ struct host {
|
||||
void seed_random(void);
|
||||
void free_host_list(struct host **);
|
||||
int parse_location(unsigned, struct host **, const char *, unsigned int);
|
||||
-int prune_host_list(unsigned, struct host **, unsigned int, const char *, unsigned int);
|
||||
+int prune_host_list(unsigned, struct host **, unsigned int, const char *);
|
||||
void dump_host_list(struct host *);
|
||||
|
||||
#endif
|
||||
--- autofs-5.0.5.orig/lib/master_parse.y
|
||||
+++ autofs-5.0.5/lib/master_parse.y
|
||||
@@ -58,8 +58,9 @@ static char *format;
|
||||
static long timeout;
|
||||
static long negative_timeout;
|
||||
static unsigned ghost;
|
||||
-extern unsigned global_random_selection;
|
||||
+extern unsigned global_selection_options;
|
||||
static unsigned random_selection;
|
||||
+static unsigned use_weight;
|
||||
static char **tmp_argv;
|
||||
static int tmp_argc;
|
||||
static char **local_argv;
|
||||
@@ -98,7 +99,7 @@ static int master_fprintf(FILE *, char *
|
||||
%token COMMENT
|
||||
%token MAP
|
||||
%token OPT_TIMEOUT OPT_NTIMEOUT OPT_NOGHOST OPT_GHOST OPT_VERBOSE
|
||||
-%token OPT_DEBUG OPT_RANDOM
|
||||
+%token OPT_DEBUG OPT_RANDOM OPT_USE_WEIGHT
|
||||
%token COLON COMMA NL DDASH
|
||||
%type <strtype> map
|
||||
%type <strtype> options
|
||||
@@ -181,6 +182,7 @@ line:
|
||||
| PATH OPTION { master_notify($2); YYABORT; }
|
||||
| PATH NILL { master_notify($2); YYABORT; }
|
||||
| PATH OPT_RANDOM { master_notify($1); YYABORT; }
|
||||
+ | PATH OPT_USE_WEIGHT { master_notify($1); YYABORT; }
|
||||
| PATH OPT_DEBUG { master_notify($1); YYABORT; }
|
||||
| PATH OPT_TIMEOUT { master_notify($1); YYABORT; }
|
||||
| PATH OPT_GHOST { master_notify($1); YYABORT; }
|
||||
@@ -558,6 +560,7 @@ daemon_option: OPT_TIMEOUT NUMBER { time
|
||||
| OPT_VERBOSE { verbose = 1; }
|
||||
| OPT_DEBUG { debug = 1; }
|
||||
| OPT_RANDOM { random_selection = 1; }
|
||||
+ | OPT_USE_WEIGHT { use_weight = 1; }
|
||||
;
|
||||
|
||||
mount_option: OPTION
|
||||
@@ -622,7 +625,8 @@ static void local_init_vars(void)
|
||||
timeout = -1;
|
||||
negative_timeout = 0;
|
||||
ghost = defaults_get_browse_mode();
|
||||
- random_selection = global_random_selection;
|
||||
+ random_selection = global_selection_options & MOUNT_FLAG_RANDOM_SELECT;
|
||||
+ use_weight = 0;
|
||||
tmp_argv = NULL;
|
||||
tmp_argc = 0;
|
||||
local_argv = NULL;
|
||||
@@ -808,6 +812,8 @@ int master_parse_entry(const char *buffe
|
||||
}
|
||||
if (random_selection)
|
||||
entry->ap->flags |= MOUNT_FLAG_RANDOM_SELECT;
|
||||
+ if (use_weight)
|
||||
+ entry->ap->flags |= MOUNT_FLAG_USE_WEIGHT_ONLY;
|
||||
if (negative_timeout)
|
||||
entry->ap->negative_timeout = negative_timeout;
|
||||
|
||||
--- autofs-5.0.5.orig/lib/master_tok.l
|
||||
+++ autofs-5.0.5/lib/master_tok.l
|
||||
@@ -363,6 +363,7 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--
|
||||
-g|--ghost|-?browse { return(OPT_GHOST); }
|
||||
-v|--verbose { return(OPT_VERBOSE); }
|
||||
-d|--debug { return(OPT_DEBUG); }
|
||||
+ -w|--use-weight-only { return(OPT_USE_WEIGHT); }
|
||||
-r|--random-multimount-selection { return(OPT_RANDOM); }
|
||||
|
||||
{OPTWS}","{OPTWS} { return(COMMA); }
|
||||
--- autofs-5.0.5.orig/man/auto.master.5.in
|
||||
+++ autofs-5.0.5/man/auto.master.5.in
|
||||
@@ -153,6 +153,12 @@ list of replicated servers. This option
|
||||
only, overriding the global setting that may be specified on the
|
||||
command line.
|
||||
.TP
|
||||
+.I "\-w, \-\-use-weight-only"
|
||||
+Use only specified weights for server selection where more than one
|
||||
+server is specified in the map entry. If no server weights are given
|
||||
+then each available server will be tried in the order listed, within
|
||||
+proximity.
|
||||
+.TP
|
||||
.I "\-n, \-\-negative\-timeout <seconds>"
|
||||
Set the timeout for caching failed key lookups. This option can be
|
||||
used to override the global default given either on the command line
|
||||
--- autofs-5.0.5.orig/man/autofs.5
|
||||
+++ autofs-5.0.5/man/autofs.5
|
||||
@@ -49,6 +49,13 @@ is used to treat errors when mounting fi
|
||||
multiple file systems should be mounted (`multi-mounts'). If this option
|
||||
is given, no file system is mounted at all if at least one file system
|
||||
can't be mounted.
|
||||
+.I -use-weight-only
|
||||
+is used to make the weight the sole factor in selecting a server when multiple
|
||||
+servers are present in a map entry.
|
||||
+and
|
||||
+.I -no-use-weight-only
|
||||
+can be used to negate the option if it is present in the master map entry
|
||||
+for the map but is not wanted for the given mount.
|
||||
|
||||
.SS location
|
||||
The location specifies from where the file system is to be mounted. In the
|
||||
--- autofs-5.0.5.orig/modules/mount_nfs.c
|
||||
+++ autofs-5.0.5/modules/mount_nfs.c
|
||||
@@ -63,7 +63,8 @@ int mount_mount(struct autofs_point *ap,
|
||||
struct host *this, *hosts = NULL;
|
||||
unsigned int mount_default_proto, vers;
|
||||
char *nfsoptions = NULL;
|
||||
- unsigned int random_selection = ap->flags & MOUNT_FLAG_RANDOM_SELECT;
|
||||
+ unsigned int flags = ap->flags &
|
||||
+ (MOUNT_FLAG_RANDOM_SELECT | MOUNT_FLAG_USE_WEIGHT_ONLY);
|
||||
int len, status, err, existed = 1;
|
||||
int nosymlink = 0;
|
||||
int ro = 0; /* Set if mount bind should be read-only */
|
||||
@@ -112,9 +113,13 @@ int mount_mount(struct autofs_point *ap,
|
||||
while (*comma == ' ' || *comma == '\t')
|
||||
end--;
|
||||
|
||||
- if (strncmp("nosymlink", cp, end - cp + 1) == 0)
|
||||
+ if (strncmp("nosymlink", cp, end - cp + 1) == 0) {
|
||||
nosymlink = 1;
|
||||
- else {
|
||||
+ } else if (strncmp("no-use-weight-only", cp, end - cp + 1) == 0) {
|
||||
+ flags &= ~MOUNT_FLAG_USE_WEIGHT_ONLY;
|
||||
+ } else if (strncmp("use-weight-only", cp, end - cp + 1) == 0) {
|
||||
+ flags |= MOUNT_FLAG_USE_WEIGHT_ONLY;
|
||||
+ } else {
|
||||
/* Check for options that also make sense
|
||||
with bind mounts */
|
||||
if (strncmp("ro", cp, end - cp + 1) == 0)
|
||||
@@ -137,11 +142,11 @@ int mount_mount(struct autofs_point *ap,
|
||||
else if (mount_default_proto == 4)
|
||||
vers = vers | NFS4_VERS_MASK;
|
||||
|
||||
- if (!parse_location(ap->logopt, &hosts, what, random_selection)) {
|
||||
+ if (!parse_location(ap->logopt, &hosts, what, flags)) {
|
||||
info(ap->logopt, MODPREFIX "no hosts available");
|
||||
return 1;
|
||||
}
|
||||
- prune_host_list(ap->logopt, &hosts, vers, nfsoptions, random_selection);
|
||||
+ prune_host_list(ap->logopt, &hosts, vers, nfsoptions);
|
||||
|
||||
if (!hosts) {
|
||||
info(ap->logopt, MODPREFIX "no hosts available");
|
||||
--- autofs-5.0.5.orig/modules/parse_sun.c
|
||||
+++ autofs-5.0.5/modules/parse_sun.c
|
||||
@@ -529,6 +529,7 @@ static int sun_mount(struct autofs_point
|
||||
{
|
||||
char *fstype = "nfs"; /* Default filesystem type */
|
||||
int nonstrict = 1;
|
||||
+ int use_weight_only = ap->flags & MOUNT_FLAG_USE_WEIGHT_ONLY;
|
||||
int rv, cur_state;
|
||||
char *mountpoint;
|
||||
char *what;
|
||||
@@ -575,6 +576,10 @@ static int sun_mount(struct autofs_point
|
||||
memcpy(np, cp, comma - cp + 1);
|
||||
np += comma - cp + 1;
|
||||
}
|
||||
+ } else if (strncmp("no-use-weight-only", cp, 18) == 0) {
|
||||
+ use_weight_only = -1;
|
||||
+ } else if (strncmp("use-weight-only", cp, 15) == 0) {
|
||||
+ use_weight_only = MOUNT_FLAG_USE_WEIGHT_ONLY;
|
||||
} else if (strncmp("bg", cp, 2) == 0 ||
|
||||
strncmp("nofg", cp, 4) == 0) {
|
||||
continue;
|
||||
@@ -593,11 +598,10 @@ static int sun_mount(struct autofs_point
|
||||
options = noptions;
|
||||
}
|
||||
|
||||
-
|
||||
if (!strcmp(fstype, "autofs") && ctxt->macros) {
|
||||
char *noptions = NULL;
|
||||
|
||||
- if (!options) {
|
||||
+ if (!options || *options == '\0') {
|
||||
noptions = alloca(strlen(ctxt->macros) + 1);
|
||||
*noptions = '\0';
|
||||
} else {
|
||||
@@ -610,7 +614,7 @@ static int sun_mount(struct autofs_point
|
||||
}
|
||||
}
|
||||
|
||||
- if (noptions) {
|
||||
+ if (noptions && *noptions != '\0') {
|
||||
strcat(noptions, ctxt->macros);
|
||||
options = noptions;
|
||||
} else {
|
||||
@@ -624,7 +628,7 @@ static int sun_mount(struct autofs_point
|
||||
|
||||
type = ap->entry->maps->type;
|
||||
if (type && !strcmp(type, "hosts")) {
|
||||
- if (options) {
|
||||
+ if (options && *options != '\0') {
|
||||
int len = strlen(options);
|
||||
int suid = strstr(options, "suid") ? 0 : 7;
|
||||
int dev = strstr(options, "dev") ? 0 : 6;
|
||||
@@ -669,6 +673,30 @@ static int sun_mount(struct autofs_point
|
||||
memcpy(what, loc, loclen);
|
||||
what[loclen] = '\0';
|
||||
|
||||
+ /* Add back "[no-]use-weight-only" for NFS mounts only */
|
||||
+ if (use_weight_only) {
|
||||
+ char *tmp;
|
||||
+ int len;
|
||||
+
|
||||
+ if (options && *options != '\0') {
|
||||
+ len = strlen(options) + 19;
|
||||
+ tmp = alloca(len);
|
||||
+ strcpy(tmp, options);
|
||||
+ strcat(tmp, ",");
|
||||
+ if (use_weight_only == MOUNT_FLAG_USE_WEIGHT_ONLY)
|
||||
+ strcat(tmp, "use-weight-only");
|
||||
+ else
|
||||
+ strcat(tmp, "no-use-weight-only");
|
||||
+ } else {
|
||||
+ tmp = alloca(19);
|
||||
+ if (use_weight_only == MOUNT_FLAG_USE_WEIGHT_ONLY)
|
||||
+ strcpy(tmp, "use-weight-only");
|
||||
+ else
|
||||
+ strcpy(tmp, "no-use-weight-only");
|
||||
+ }
|
||||
+ options = tmp;
|
||||
+ }
|
||||
+
|
||||
debug(ap->logopt, MODPREFIX
|
||||
"mounting root %s, mountpoint %s, "
|
||||
"what %s, fstype %s, options %s",
|
||||
--- autofs-5.0.5.orig/modules/replicated.c
|
||||
+++ autofs-5.0.5/modules/replicated.c
|
||||
@@ -351,7 +351,8 @@ static unsigned int get_proximity(struct
|
||||
|
||||
static struct host *new_host(const char *name,
|
||||
struct sockaddr *addr, size_t addr_len,
|
||||
- unsigned int proximity, unsigned int weight)
|
||||
+ unsigned int proximity, unsigned int weight,
|
||||
+ unsigned int options)
|
||||
{
|
||||
struct host *new;
|
||||
struct sockaddr *tmp2;
|
||||
@@ -385,6 +386,7 @@ static struct host *new_host(const char
|
||||
new->addr = tmp2;
|
||||
new->proximity = proximity;
|
||||
new->weight = weight;
|
||||
+ new->options = options;
|
||||
|
||||
return new;
|
||||
}
|
||||
@@ -519,9 +521,11 @@ static unsigned short get_port_option(co
|
||||
static unsigned int get_nfs_info(unsigned logopt, struct host *host,
|
||||
struct conn_info *pm_info, struct conn_info *rpc_info,
|
||||
const char *proto, unsigned int version,
|
||||
- const char *options, unsigned int random_selection)
|
||||
+ const char *options)
|
||||
{
|
||||
char *have_port_opt = options ? strstr(options, "port=") : NULL;
|
||||
+ unsigned int random_selection = host->options & MOUNT_FLAG_RANDOM_SELECT;
|
||||
+ unsigned int use_weight_only = host->options & MOUNT_FLAG_USE_WEIGHT_ONLY;
|
||||
struct pmap parms;
|
||||
struct timeval start, end;
|
||||
struct timezone tz;
|
||||
@@ -675,7 +679,10 @@ done_ver:
|
||||
* Average response time to 7 significant places as
|
||||
* integral type.
|
||||
*/
|
||||
- host->cost = (unsigned long) ((taken * 1000000) / count);
|
||||
+ if (use_weight_only)
|
||||
+ host->cost = 1;
|
||||
+ else
|
||||
+ host->cost = (unsigned long) ((taken * 1000000) / count);
|
||||
|
||||
/* Allow for user bias */
|
||||
if (host->weight)
|
||||
@@ -689,8 +696,7 @@ done_ver:
|
||||
}
|
||||
|
||||
static int get_vers_and_cost(unsigned logopt, struct host *host,
|
||||
- unsigned int version, const char *options,
|
||||
- unsigned int random_selection)
|
||||
+ unsigned int version, const char *options)
|
||||
{
|
||||
struct conn_info pm_info, rpc_info;
|
||||
time_t timeout = RPC_TIMEOUT;
|
||||
@@ -717,8 +723,7 @@ static int get_vers_and_cost(unsigned lo
|
||||
|
||||
if (version & UDP_REQUESTED) {
|
||||
supported = get_nfs_info(logopt, host,
|
||||
- &pm_info, &rpc_info, "udp", vers,
|
||||
- options, random_selection);
|
||||
+ &pm_info, &rpc_info, "udp", vers, options);
|
||||
if (supported) {
|
||||
ret = 1;
|
||||
host->version |= (supported << 8);
|
||||
@@ -727,8 +732,7 @@ static int get_vers_and_cost(unsigned lo
|
||||
|
||||
if (version & TCP_REQUESTED) {
|
||||
supported = get_nfs_info(logopt, host,
|
||||
- &pm_info, &rpc_info, "tcp", vers,
|
||||
- options, random_selection);
|
||||
+ &pm_info, &rpc_info, "tcp", vers, options);
|
||||
if (supported) {
|
||||
ret = 1;
|
||||
host->version |= supported;
|
||||
@@ -739,10 +743,11 @@ static int get_vers_and_cost(unsigned lo
|
||||
}
|
||||
|
||||
static int get_supported_ver_and_cost(unsigned logopt, struct host *host,
|
||||
- unsigned int version, const char *options,
|
||||
- unsigned int random_selection)
|
||||
+ unsigned int version, const char *options)
|
||||
{
|
||||
char *have_port_opt = options ? strstr(options, "port=") : NULL;
|
||||
+ unsigned int random_selection = host->options & MOUNT_FLAG_RANDOM_SELECT;
|
||||
+ unsigned int use_weight_only = host->options & MOUNT_FLAG_USE_WEIGHT_ONLY;
|
||||
struct conn_info pm_info, rpc_info;
|
||||
struct pmap parms;
|
||||
const char *proto;
|
||||
@@ -855,7 +860,10 @@ done:
|
||||
|
||||
if (status) {
|
||||
/* Response time to 7 significant places as integral type. */
|
||||
- host->cost = (unsigned long) (taken * 1000000);
|
||||
+ if (use_weight_only)
|
||||
+ host->cost = 1;
|
||||
+ else
|
||||
+ host->cost = (unsigned long) (taken * 1000000);
|
||||
|
||||
/* Allow for user bias */
|
||||
if (host->weight)
|
||||
@@ -870,8 +878,7 @@ done:
|
||||
}
|
||||
|
||||
int prune_host_list(unsigned logopt, struct host **list,
|
||||
- unsigned int vers, const char *options,
|
||||
- unsigned int random_selection)
|
||||
+ unsigned int vers, const char *options)
|
||||
{
|
||||
struct host *this, *last, *first;
|
||||
struct host *new = NULL;
|
||||
@@ -892,6 +899,7 @@ int prune_host_list(unsigned logopt, str
|
||||
this = first;
|
||||
while (this && this->proximity == PROXIMITY_LOCAL)
|
||||
this = this->next;
|
||||
+ first = this;
|
||||
|
||||
/*
|
||||
* Check for either a list containing only proximity local hosts
|
||||
@@ -903,8 +911,6 @@ int prune_host_list(unsigned logopt, str
|
||||
return 1;
|
||||
|
||||
proximity = this->proximity;
|
||||
- first = this;
|
||||
- this = first;
|
||||
while (this) {
|
||||
struct host *next = this->next;
|
||||
|
||||
@@ -912,8 +918,7 @@ int prune_host_list(unsigned logopt, str
|
||||
break;
|
||||
|
||||
if (this->name) {
|
||||
- status = get_vers_and_cost(logopt, this, vers,
|
||||
- options, random_selection);
|
||||
+ status = get_vers_and_cost(logopt, this, vers, options);
|
||||
if (!status) {
|
||||
if (this == first) {
|
||||
first = next;
|
||||
@@ -1022,8 +1027,7 @@ int prune_host_list(unsigned logopt, str
|
||||
add_host(&new, this);
|
||||
} else {
|
||||
status = get_supported_ver_and_cost(logopt, this,
|
||||
- selected_version, options,
|
||||
- random_selection);
|
||||
+ selected_version, options);
|
||||
if (status) {
|
||||
this->version = selected_version;
|
||||
remove_host(list, this);
|
||||
@@ -1041,8 +1045,7 @@ int prune_host_list(unsigned logopt, str
|
||||
|
||||
static int add_new_host(struct host **list,
|
||||
const char *host, unsigned int weight,
|
||||
- struct addrinfo *host_addr,
|
||||
- unsigned int random_selection)
|
||||
+ struct addrinfo *host_addr, unsigned int options)
|
||||
{
|
||||
struct host *new;
|
||||
unsigned int prx;
|
||||
@@ -1054,10 +1057,21 @@ static int add_new_host(struct host **li
|
||||
* We can't use PROXIMITY_LOCAL or we won't perform an RPC ping
|
||||
* to remove hosts that may be down.
|
||||
*/
|
||||
- if (random_selection)
|
||||
+ if (options & MOUNT_FLAG_RANDOM_SELECT)
|
||||
prx = PROXIMITY_SUBNET;
|
||||
- else
|
||||
+ else {
|
||||
prx = get_proximity(host_addr->ai_addr);
|
||||
+ /*
|
||||
+ * If we want the weight to be the determining factor
|
||||
+ * when selecting a host then all hosts must have the
|
||||
+ * same proximity. However, if this is the local machine
|
||||
+ * it should always be used since it is certainly available.
|
||||
+ */
|
||||
+ if (prx != PROXIMITY_LOCAL &&
|
||||
+ (options & MOUNT_FLAG_USE_WEIGHT_ONLY))
|
||||
+ prx = PROXIMITY_SUBNET;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* If we tried to add an IPv6 address and we don't have IPv6
|
||||
* support return success in the hope of getting an IPv4
|
||||
@@ -1069,7 +1083,7 @@ static int add_new_host(struct host **li
|
||||
return 0;
|
||||
|
||||
addr_len = sizeof(struct sockaddr);
|
||||
- new = new_host(host, host_addr->ai_addr, addr_len, prx, weight);
|
||||
+ new = new_host(host, host_addr->ai_addr, addr_len, prx, weight, options);
|
||||
if (!new)
|
||||
return 0;
|
||||
|
||||
@@ -1082,7 +1096,7 @@ static int add_new_host(struct host **li
|
||||
}
|
||||
|
||||
static int add_host_addrs(struct host **list, const char *host,
|
||||
- unsigned int weight, unsigned int random_selection)
|
||||
+ unsigned int weight, unsigned int options)
|
||||
{
|
||||
struct addrinfo hints, *ni, *this;
|
||||
int ret;
|
||||
@@ -1098,7 +1112,7 @@ static int add_host_addrs(struct host **
|
||||
|
||||
this = ni;
|
||||
while (this) {
|
||||
- ret = add_new_host(list, host, weight, this, random_selection);
|
||||
+ ret = add_new_host(list, host, weight, this, options);
|
||||
if (!ret)
|
||||
break;
|
||||
this = this->ai_next;
|
||||
@@ -1121,7 +1135,7 @@ try_name:
|
||||
|
||||
this = ni;
|
||||
while (this) {
|
||||
- ret = add_new_host(list, host, weight, this, random_selection);
|
||||
+ ret = add_new_host(list, host, weight, this, options);
|
||||
if (!ret)
|
||||
break;
|
||||
this = this->ai_next;
|
||||
@@ -1209,7 +1223,7 @@ static char *seek_delim(const char *s)
|
||||
}
|
||||
|
||||
int parse_location(unsigned logopt, struct host **hosts,
|
||||
- const char *list, unsigned int random_selection)
|
||||
+ const char *list, unsigned int options)
|
||||
{
|
||||
char *str, *p, *delim;
|
||||
unsigned int empty = 1;
|
||||
@@ -1264,7 +1278,7 @@ int parse_location(unsigned logopt, stru
|
||||
}
|
||||
|
||||
if (p != delim) {
|
||||
- if (!add_host_addrs(hosts, p, weight, random_selection)) {
|
||||
+ if (!add_host_addrs(hosts, p, weight, options)) {
|
||||
if (empty) {
|
||||
p = next;
|
||||
continue;
|
||||
@@ -1286,7 +1300,7 @@ int parse_location(unsigned logopt, stru
|
||||
*delim = '\0';
|
||||
next = delim + 1;
|
||||
|
||||
- if (!add_host_addrs(hosts, p, weight, random_selection)) {
|
||||
+ if (!add_host_addrs(hosts, p, weight, options)) {
|
||||
p = next;
|
||||
continue;
|
||||
}
|
||||
380
autofs-5.0.6-add-dir-map-type.patch
Normal file
380
autofs-5.0.6-add-dir-map-type.patch
Normal file
@ -0,0 +1,380 @@
|
||||
autofs-5.0.5 - dir map-type patch v2
|
||||
|
||||
From: Masatake YAMATO <yamato@redhat.com>
|
||||
|
||||
This is the second post of "dir map-type" patch.
|
||||
|
||||
Changes since last post:
|
||||
|
||||
- Don't use auto. as prefix for included map.
|
||||
Use .autofs suffix instead. Suggested by Steve Linn.
|
||||
|
||||
- Use scandir instead of using opendir/readdir/closedir.
|
||||
|
||||
|
||||
What is dir map-type?
|
||||
|
||||
|
||||
`dir' map-type is for including files under a directory into master
|
||||
map.
|
||||
`file' map-type can be used for including a file with + notation like:
|
||||
|
||||
+/etc/auto.mine
|
||||
|
||||
in auto.master. However, for specifying a new file to be included you
|
||||
have to edit auto.master file. Editing is also needed when you want to
|
||||
remove the included file. When you have to do this with your shell
|
||||
script you may have to use sed or awk.
|
||||
|
||||
`dir' map-type permits you adding new master map entries with cp
|
||||
command and removing the entries with rm command. `dir' map-type is
|
||||
inspired from /etc/httpd/conf.d and /etc/modprobe.d.
|
||||
|
||||
`dir' map-type can be used for included files under a directory
|
||||
(e.g. /etc/auto.master.d) with + notation like:
|
||||
|
||||
+dir:/etc/auto.master.d
|
||||
|
||||
in auto.master. With this notation /etc/auto.master.d/*.autofs files
|
||||
are included except a file which name is started with ".". With the
|
||||
name of the file you can control whether a file under the directory is
|
||||
included or not: the file which name ends with ".autofs" is included.
|
||||
|
||||
|
||||
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
|
||||
---
|
||||
|
||||
autofs.spec | 2
|
||||
daemon/lookup.c | 3 -
|
||||
man/auto.master.5.in | 10 ++
|
||||
modules/Makefile | 6 +
|
||||
modules/lookup_dir.c | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
samples/auto.master | 4 +
|
||||
6 files changed, 239 insertions(+), 5 deletions(-)
|
||||
create mode 100644 modules/lookup_dir.c
|
||||
|
||||
|
||||
diff --git a/autofs.spec b/autofs.spec
|
||||
index 91d4f8b..82edd1e 100644
|
||||
--- a/autofs.spec
|
||||
+++ b/autofs.spec
|
||||
@@ -67,6 +67,7 @@ mkdir -p -m755 $RPM_BUILD_ROOT%{_sbindir}
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir}/autofs
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/{man5,man8}
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT/etc/sysconfig
|
||||
+mkdir -p -m755 $RPM_BUILD_ROOT/etc/auto.master.d
|
||||
|
||||
make install mandir=%{_mandir} initdir=/etc/rc.d/init.d INSTALLROOT=$RPM_BUILD_ROOT
|
||||
make -C redhat
|
||||
@@ -104,6 +105,7 @@ fi
|
||||
%dir %{_libdir}/autofs
|
||||
%{_libdir}/autofs/*
|
||||
%{_mandir}/*/*
|
||||
+%dir /etc/auto.master.d
|
||||
|
||||
%changelog
|
||||
* Tue Jun 3 2011 Ian Kent <raven@themaw.net>
|
||||
diff --git a/daemon/lookup.c b/daemon/lookup.c
|
||||
index 958d8cc..098588c 100644
|
||||
--- a/daemon/lookup.c
|
||||
+++ b/daemon/lookup.c
|
||||
@@ -176,7 +176,8 @@ int lookup_nss_read_master(struct master *master, time_t age)
|
||||
!strncmp(name, "nis:", 4) ||
|
||||
!strncmp(name, "nisplus:", 8) ||
|
||||
!strncmp(name, "ldap:", 5) ||
|
||||
- !strncmp(name, "ldaps:", 6)) {
|
||||
+ !strncmp(name, "ldaps:", 6) ||
|
||||
+ !strncmp(name, "dir:", 4)) {
|
||||
strncpy(source, name, tmp - name);
|
||||
|
||||
/*
|
||||
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
|
||||
index de692d2..fff9943 100644
|
||||
--- a/man/auto.master.5.in
|
||||
+++ b/man/auto.master.5.in
|
||||
@@ -107,6 +107,14 @@ appropriate certificate must be configured in the LDAP client.
|
||||
.B multi
|
||||
This map type allows the specification of multiple maps separated
|
||||
by "--". These maps are searched in order to resolve key lookups.
|
||||
+.TP
|
||||
+.B dir
|
||||
+This map type can be used at
|
||||
+.BR +
|
||||
+master map including notation. The contents of files under given directory are included
|
||||
+to the master map. The name of file to be included must be ended with ".autofs". A file
|
||||
+will be ignored if its name is not ended with the suffix. In addition a dot file, a file
|
||||
+which name is started with "." is also ignored.
|
||||
.RE
|
||||
.TP
|
||||
\fBformat\fP
|
||||
@@ -118,7 +126,7 @@ left unspecified, it defaults to \fBsun\fP for all map types except
|
||||
.TP
|
||||
\fBmap\fP
|
||||
Name of the map to use. This is an absolute UNIX pathname
|
||||
-for maps of types \fBfile\fP or \fBprogram\fP, and the name of a database
|
||||
+for maps of types \fBfile\fP, \fBdir\fP, or \fBprogram\fP, and the name of a database
|
||||
in the case for maps of type \fByp\fP, \fBnisplus\fP, or \fBhesiod\fP or
|
||||
the \fBdn\fP of an LDAP entry for maps of type \fBldap\fP.
|
||||
.TP
|
||||
diff --git a/modules/Makefile b/modules/Makefile
|
||||
index a35c0a5..6090127 100644
|
||||
--- a/modules/Makefile
|
||||
+++ b/modules/Makefile
|
||||
@@ -5,14 +5,14 @@
|
||||
-include ../Makefile.conf
|
||||
include ../Makefile.rules
|
||||
|
||||
-SRCS := lookup_yp.c lookup_file.c lookup_program.c lookup_userhome.c \
|
||||
- lookup_multi.c lookup_hosts.c \
|
||||
+SRCS := lookup_yp.c lookup_file.c lookup_program.c lookup_userhome.c \
|
||||
+ lookup_multi.c lookup_hosts.c lookup_dir.c \
|
||||
parse_sun.c \
|
||||
mount_generic.c mount_nfs.c mount_afs.c mount_autofs.c \
|
||||
mount_changer.c mount_bind.c
|
||||
|
||||
MODS := lookup_yp.so lookup_file.so lookup_program.so lookup_userhome.so \
|
||||
- lookup_multi.so lookup_hosts.so \
|
||||
+ lookup_multi.so lookup_hosts.so lookup_dir.so \
|
||||
parse_sun.so \
|
||||
mount_generic.so mount_nfs.so mount_afs.so mount_autofs.so \
|
||||
mount_changer.so mount_bind.so
|
||||
diff --git a/modules/lookup_dir.c b/modules/lookup_dir.c
|
||||
new file mode 100644
|
||||
index 0000000..658cc29
|
||||
--- /dev/null
|
||||
+++ b/modules/lookup_dir.c
|
||||
@@ -0,0 +1,219 @@
|
||||
+/* ----------------------------------------------------------------------- *
|
||||
+ *
|
||||
+ * lookup_dir.c - module for including master files in a directory.
|
||||
+ *
|
||||
+ * Copyright 2011 Red Hat, Inc. All rights reserved.
|
||||
+ * Copyright 2011 Masatake YAMATO <yamato@redhat.com>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
|
||||
+ * USA; either version 2 of the License, or (at your option) any later
|
||||
+ * version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * ----------------------------------------------------------------------- */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <malloc.h>
|
||||
+#include <pwd.h>
|
||||
+#include <string.h>
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <dirent.h>
|
||||
+
|
||||
+
|
||||
+#define MODULE_LOOKUP
|
||||
+#include "automount.h"
|
||||
+#include "nsswitch.h"
|
||||
+
|
||||
+#define MODPREFIX "lookup(dir): "
|
||||
+
|
||||
+#define MAX_INCLUDE_DEPTH 16
|
||||
+
|
||||
+#define AUTOFS_DIR_EXT ".autofs"
|
||||
+#define AUTOFS_DIR_EXTSIZ (sizeof(AUTOFS_DIR_EXT) - 1)
|
||||
+
|
||||
+struct lookup_context {
|
||||
+ const char *mapname;
|
||||
+};
|
||||
+
|
||||
+int lookup_version = AUTOFS_LOOKUP_VERSION; /* Required by protocol */
|
||||
+
|
||||
+
|
||||
+int lookup_init(const char *mapfmt, int argc, const char *const *argv, void **context)
|
||||
+{
|
||||
+ struct lookup_context *ctxt;
|
||||
+ char buf[MAX_ERR_BUF];
|
||||
+ struct stat st;
|
||||
+
|
||||
+ *context = NULL;
|
||||
+ ctxt = malloc(sizeof(struct lookup_context));
|
||||
+ if (!ctxt) {
|
||||
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ logerr(MODPREFIX "malloc: %s", estr);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ if (argc < 1) {
|
||||
+ free(ctxt);
|
||||
+ logerr(MODPREFIX "No map name");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ ctxt->mapname = argv[0];
|
||||
+
|
||||
+ if (ctxt->mapname[0] != '/') {
|
||||
+ free(ctxt);
|
||||
+ logmsg(MODPREFIX
|
||||
+ "dir map %s is not an absolute pathname", argv[0]);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ if (access(ctxt->mapname, R_OK)) {
|
||||
+ free(ctxt);
|
||||
+ warn(LOGOPT_NONE, MODPREFIX
|
||||
+ "dir map %s missing or not readable", argv[0]);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ if (stat(ctxt->mapname, &st)) {
|
||||
+ free(ctxt);
|
||||
+ warn(LOGOPT_NONE, MODPREFIX
|
||||
+ "dir map %s, could not stat", argv[0]);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ if ( (!S_ISDIR(st.st_mode)) && (!S_ISLNK(st.st_mode)) ) {
|
||||
+ free(ctxt);
|
||||
+ warn(LOGOPT_NONE, MODPREFIX
|
||||
+ "dir map %s, is not a directory", argv[0]);
|
||||
+ }
|
||||
+
|
||||
+ *context = ctxt;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int acceptable_dirent_p(const struct dirent *e)
|
||||
+{
|
||||
+ size_t namesz;
|
||||
+
|
||||
+
|
||||
+ if (!(e->d_type == DT_REG || e->d_type == DT_LNK))
|
||||
+ return 0;
|
||||
+
|
||||
+ namesz = strlen(e->d_name);
|
||||
+ if (!namesz)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (e->d_name[0] == '.')
|
||||
+ return 0;
|
||||
+
|
||||
+ if (namesz < AUTOFS_DIR_EXTSIZ + 1 ||
|
||||
+ strcmp(e->d_name + (namesz - AUTOFS_DIR_EXTSIZ),
|
||||
+ AUTOFS_DIR_EXT))
|
||||
+ return 0;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int include_file(struct master *master, time_t age, struct lookup_context* ctxt, struct dirent *e)
|
||||
+{
|
||||
+ unsigned int logopt = master->logopt;
|
||||
+ char included_path[PATH_MAX + 1];
|
||||
+ int included_path_len;
|
||||
+ char *save_name;
|
||||
+ int status;
|
||||
+
|
||||
+ included_path_len = snprintf(included_path,
|
||||
+ PATH_MAX + 1,
|
||||
+ "%s/%s",
|
||||
+ ctxt->mapname,
|
||||
+ e->d_name);
|
||||
+ if (included_path_len > PATH_MAX)
|
||||
+ return NSS_STATUS_NOTFOUND;
|
||||
+
|
||||
+ save_name = master->name;
|
||||
+ master->name = included_path;
|
||||
+
|
||||
+ master->depth++;
|
||||
+ debug(logopt, MODPREFIX "include: %s", master->name);
|
||||
+ status = lookup_nss_read_master(master, age);
|
||||
+ if (!status) {
|
||||
+ warn(logopt,
|
||||
+ MODPREFIX
|
||||
+ "failed to read included master map %s",
|
||||
+ master->name);
|
||||
+ }
|
||||
+ master->depth--;
|
||||
+
|
||||
+ master->name = save_name;
|
||||
+ return NSS_STATUS_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int lookup_read_master(struct master *master, time_t age, void *context)
|
||||
+{
|
||||
+ int n, i;
|
||||
+ struct dirent **namelist = NULL;
|
||||
+ struct lookup_context *ctxt = (struct lookup_context *) context;
|
||||
+ unsigned int logopt = master->logopt;
|
||||
+ char buf[MAX_ERR_BUF];
|
||||
+
|
||||
+
|
||||
+ if (master->depth > MAX_INCLUDE_DEPTH) {
|
||||
+ error(logopt, MODPREFIX
|
||||
+ "maximum include depth exceeded %s", master->name);
|
||||
+ return NSS_STATUS_UNAVAIL;
|
||||
+ }
|
||||
+
|
||||
+ debug(logopt, MODPREFIX "scandir: %s", ctxt->mapname);
|
||||
+ n = scandir(ctxt->mapname, &namelist, acceptable_dirent_p, versionsort);
|
||||
+ if (n < 0) {
|
||||
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+
|
||||
+ error(logopt,
|
||||
+ MODPREFIX "could not scan master map dir %s: %s",
|
||||
+ ctxt->mapname,
|
||||
+ estr);
|
||||
+ return NSS_STATUS_UNAVAIL;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < n; i++) {
|
||||
+ struct dirent *e = namelist[i];
|
||||
+
|
||||
+ include_file(master, age, ctxt, e);
|
||||
+ free(e);
|
||||
+ }
|
||||
+ free(namelist);
|
||||
+
|
||||
+ return NSS_STATUS_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
|
||||
+{
|
||||
+ ap->entry->current = NULL;
|
||||
+ master_source_current_signal(ap->entry);
|
||||
+ return NSS_STATUS_UNKNOWN;
|
||||
+}
|
||||
+
|
||||
+int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *context)
|
||||
+{
|
||||
+ ap->entry->current = NULL;
|
||||
+ master_source_current_signal(ap->entry);
|
||||
+ return NSS_STATUS_UNKNOWN;
|
||||
+}
|
||||
+
|
||||
+int lookup_done(void *context)
|
||||
+{
|
||||
+ struct lookup_context *ctxt = (struct lookup_context *) context;
|
||||
+
|
||||
+ free(ctxt);
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/samples/auto.master b/samples/auto.master
|
||||
index 9fe5609..72f086c 100644
|
||||
--- a/samples/auto.master
|
||||
+++ b/samples/auto.master
|
||||
@@ -12,6 +12,10 @@
|
||||
#
|
||||
/net -hosts
|
||||
#
|
||||
+# Include /etc/auto.master.d/*.autofs
|
||||
+#
|
||||
++dir:/etc/auto.master.d
|
||||
+#
|
||||
# Include central master map if it can be found using
|
||||
# nsswitch sources.
|
||||
#
|
||||
79
autofs-5.0.6-fix-ipv6-name-for-lookup-fix.patch
Normal file
79
autofs-5.0.6-fix-ipv6-name-for-lookup-fix.patch
Normal file
@ -0,0 +1,79 @@
|
||||
autofs-5.0.6 - fix ipv6 name for lookup fix
|
||||
|
||||
From: Ian Kent <ikent@redhat.com>
|
||||
|
||||
Fix an error in the recent ipv6 name for lookup patch.
|
||||
|
||||
Reported by Leonardo Chiquitto who provided a patch to resolve the
|
||||
problem. The patch below is a slightly modified version of his patch.
|
||||
---
|
||||
|
||||
CHANGELOG | 4 ++++
|
||||
modules/replicated.c | 13 ++++++++-----
|
||||
2 files changed, 12 insertions(+), 5 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 849a38c..e5dfa83 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -1,3 +1,7 @@
|
||||
+??/??/20?? autofs-5.0.7
|
||||
+=======================
|
||||
+- fix ipv6 name for lookup fix.
|
||||
+
|
||||
28/06/2011 autofs-5.0.6
|
||||
-----------------------
|
||||
- fix included map read fail handling.
|
||||
diff --git a/modules/replicated.c b/modules/replicated.c
|
||||
index 7f2b892..a10a817 100644
|
||||
--- a/modules/replicated.c
|
||||
+++ b/modules/replicated.c
|
||||
@@ -1111,7 +1111,8 @@ static int add_host_addrs(struct host **list, const char *host,
|
||||
unsigned int weight, unsigned int options)
|
||||
{
|
||||
struct addrinfo hints, *ni, *this;
|
||||
- char *name = strdup(host);
|
||||
+ char *n_ptr;
|
||||
+ char *name = n_ptr = strdup(host);
|
||||
int len;
|
||||
char buf[MAX_ERR_BUF];
|
||||
int rr = 0;
|
||||
@@ -1125,15 +1126,17 @@ static int add_host_addrs(struct host **list, const char *host,
|
||||
}
|
||||
len = strlen(name);
|
||||
|
||||
- if (name[0] == '[' && name[--len] == ']')
|
||||
+ if (name[0] == '[' && name[--len] == ']') {
|
||||
name[len] = '\0';
|
||||
+ name++;
|
||||
+ }
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
|
||||
- ret = getaddrinfo(name + 1, NULL, &hints, &ni);
|
||||
+ ret = getaddrinfo(name, NULL, &hints, &ni);
|
||||
if (ret)
|
||||
goto try_name;
|
||||
|
||||
@@ -1153,7 +1156,7 @@ try_name:
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
|
||||
- ret = getaddrinfo(name + 1, NULL, &hints, &ni);
|
||||
+ ret = getaddrinfo(name, NULL, &hints, &ni);
|
||||
if (ret) {
|
||||
error(LOGOPT_ANY, "hostname lookup failed: %s",
|
||||
gai_strerror(ret));
|
||||
@@ -1172,7 +1175,7 @@ try_name:
|
||||
}
|
||||
freeaddrinfo(ni);
|
||||
done:
|
||||
- free(name);
|
||||
+ free(n_ptr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
145
autofs.spec
145
autofs.spec
@ -3,80 +3,14 @@
|
||||
#
|
||||
Summary: A tool for automatically mounting and unmounting filesystems
|
||||
Name: autofs
|
||||
Version: 5.0.5
|
||||
Release: 38%{?dist}
|
||||
Version: 5.0.6
|
||||
Release: 1%{?dist}
|
||||
Epoch: 1
|
||||
License: GPLv2+
|
||||
Group: System Environment/Daemons
|
||||
Source: ftp://ftp.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}.tar.bz2
|
||||
Patch1: autofs-5.0.5-fix-included-map-read-fail-handling.patch
|
||||
Patch2: autofs-5.0.5-refactor-ldap-sasl-bind.patch
|
||||
Patch3: autofs-5.0.4-add-mount-wait-parameter.patch
|
||||
Patch4: autofs-5.0.5-special-case-cifs-escapes.patch
|
||||
Patch5: autofs-5.0.5-fix-libxml2-workaround-configure.patch
|
||||
Patch6: autofs-5.0.5-more-code-analysis-corrections.patch
|
||||
Patch7: autofs-5.0.5-fix-backwards-ifndef-INET6.patch
|
||||
Patch8: autofs-5.0.5-fix-stale-init-for-file-map-instance.patch
|
||||
Patch9: autofs-5.0.5-fix-ext4-fsck-at-mount.patch
|
||||
Patch10: autofs-5.0.5-dont-use-master_lex_destroy-to-clear-parse-buffer.patch
|
||||
Patch11: autofs-5.0.5-make-documentation-for-set-log-priority-clearer.patch
|
||||
Patch12: autofs-5.0.5-fix-timeout-in-connect_nb.patch
|
||||
Patch13: autofs-5.0.5-fix-pidof-init-script-usage.patch
|
||||
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
|
||||
Patch22: autofs-5.0.5-fix-reconnect-get-base-dn.patch
|
||||
Patch23: autofs-5.0.5-add-sasl-mutex-callbacks.patch
|
||||
Patch24: autofs-5.0.5-fix-get-qdn-fail.patch
|
||||
Patch25: autofs-5.0.5-fix-ampersand-escape-in-auto-smb.patch
|
||||
Patch26: autofs-5.0.5-add-locality-as-valid-ldap-master-map-attribute.patch
|
||||
Patch27: autofs-5.0.5-add-locality-as-valid-ldap-master-map-attribute-fix.patch
|
||||
Patch28: autofs-5.0.5-make-nfs4-default-for-redhat-replicated-selection.patch
|
||||
Patch29: autofs-5.0.5-add-simple-bind-auth.patch
|
||||
Patch30: autofs-5.0.5-fix-master-map-source-server-unavialable-handling.patch
|
||||
Patch31: autofs-5.0.5-add-autofs_ldap_auth_conf-man-page.patch
|
||||
Patch32: autofs-5.0.5-fix-random-selection-for-host-on-different-network.patch
|
||||
Patch33: autofs-5.0.5-make-redhat-init-script-more-lsb-compliant.patch
|
||||
Patch34: autofs-5.0.5-dont-hold-lock-for-simple-mounts.patch
|
||||
Patch35: autofs-5.0.5-fix-remount-locking.patch
|
||||
Patch36: autofs-5.0.5-fix-wildcard-map-entry-match.patch
|
||||
Patch37: autofs-5.0.5-fix-parse_sun-module-init.patch
|
||||
Patch38: autofs-5.0.5-dont-check-null-cache-on-expire.patch
|
||||
Patch39: autofs-5.0.5-fix-null-cache-race.patch
|
||||
Patch40: autofs-5.0.5-fix-cache_init-on-source-re-read.patch
|
||||
Patch41: autofs-5.0.5-mapent-becomes-negative-during-lookup.patch
|
||||
Patch42: autofs-5.0.5-check-each-dc-server.patch
|
||||
Patch43: autofs-5.0.5-fix-negative-cache-included-map-lookup.patch
|
||||
Patch44: autofs-5.0.5-remove-state-machine-timed-wait.patch
|
||||
Patch45: autofs-5.0.5-remove-extra-read-master-map-call.patch
|
||||
Patch46: autofs-5.0.5-fix-fix-cache_init-on-source-re-read.patch
|
||||
Patch47: autofs-5.0.5-fix-error-handing-in-do_mount_indirect.patch
|
||||
Patch48: autofs-5.0.5-expire-thread-use-pending-mutex.patch
|
||||
Patch49: autofs-5.0.5-include-krb5-library.patch
|
||||
Patch50: autofs-5.0.5-make-verbose-mode-a-little-less-verbose.patch
|
||||
Patch51: autofs-5.0.5-remove-ERR_remove_state-openssl-call.patch
|
||||
Patch52: autofs-5.0.5-fix-restart.patch
|
||||
Patch53: autofs-5.0.5-fix-status-privilege-error.patch
|
||||
Patch54: autofs-5.0.4-always-read-file-maps-mount-lookup-map-read-fix.patch
|
||||
Patch55: autofs-5.0.5-fix-direct-map-not-updating-on-reread.patch
|
||||
Patch56: autofs-5.0.5-add-external-bind-method.patch
|
||||
Patch57: autofs-5.0.5-fix-add-simple-bind-auth.patch
|
||||
Patch58: autofs-5.0.5-add-dump-maps-option.patch
|
||||
Patch59: autofs-5.0.5-fix-submount-shutdown-wait.patch
|
||||
Patch60: autofs-5.0.5-use-weight-only-for-server-selection.patch
|
||||
Patch61: autofs-5.0.5-fix-isspace-wild-card-substition.patch
|
||||
Patch62: autofs-5.0.5-auto-adjust-ldap-page-size.patch
|
||||
Patch63: autofs-5.0.5-fix-prune-cache-valid-check.patch
|
||||
Patch64: autofs-5.0.5-fix-mountd-vers-retry.patch
|
||||
Patch65: autofs-5.0.5-fix-expire-race.patch
|
||||
Patch66: autofs-5.0.5-add-lsb-force-reload-and-try-restart.patch
|
||||
Patch67: autofs-5.0.5-replace-gplv3-code.patch
|
||||
Patch68: autofs-5.0.5-fix-lsb-service-name-in-init-script.patch
|
||||
Patch1: autofs-5.0.6-fix-ipv6-name-for-lookup-fix.patch
|
||||
Patch2: autofs-5.0.5-add-dir-map-type.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
|
||||
Conflicts: cyrus-sasl-lib < 2.1.23-9
|
||||
@ -121,72 +55,6 @@ inkludera nätfilsystem, CD-ROM, floppydiskar, och så vidare.
|
||||
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
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
%patch25 -p1
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%patch28 -p1
|
||||
%patch29 -p1
|
||||
%patch30 -p1
|
||||
%patch31 -p1
|
||||
%patch32 -p1
|
||||
%patch33 -p1
|
||||
%patch34 -p1
|
||||
%patch35 -p1
|
||||
%patch36 -p1
|
||||
%patch37 -p1
|
||||
%patch38 -p1
|
||||
%patch39 -p1
|
||||
%patch40 -p1
|
||||
%patch41 -p1
|
||||
%patch42 -p1
|
||||
%patch43 -p1
|
||||
%patch44 -p1
|
||||
%patch45 -p1
|
||||
%patch46 -p1
|
||||
%patch47 -p1
|
||||
%patch48 -p1
|
||||
%patch49 -p1
|
||||
%patch50 -p1
|
||||
%patch51 -p1
|
||||
%patch52 -p1
|
||||
%patch53 -p1
|
||||
%patch54 -p1
|
||||
%patch55 -p1
|
||||
%patch56 -p1
|
||||
%patch57 -p1
|
||||
%patch58 -p1
|
||||
%patch59 -p1
|
||||
%patch60 -p1
|
||||
%patch61 -p1
|
||||
%patch62 -p1
|
||||
%patch63 -p1
|
||||
%patch64 -p1
|
||||
%patch65 -p1
|
||||
%patch66 -p1
|
||||
%patch67 -p1
|
||||
%patch68 -p1
|
||||
|
||||
%build
|
||||
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
|
||||
@ -239,6 +107,11 @@ fi
|
||||
%{_libdir}/autofs/
|
||||
|
||||
%changelog
|
||||
* Mon Jul 4 2011 Ian Kent <ikent@redhat.com> - 1:5.0.6-1
|
||||
- update source to 5.0.6.
|
||||
- fix ipv6 name for lookup fix.
|
||||
- add dir map-type patch.
|
||||
|
||||
* Tue Jun 14 2011 Ian Kent <ikent@redhat.com> - 1:5.0.5-38
|
||||
- fix lsb service name in init script (bz692963).
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user