- update with latest upstream patches.

This commit is contained in:
Ian Kent 2013-01-21 12:01:58 +08:00
parent f26c577cb6
commit 7bcbae00da
11 changed files with 1544 additions and 1 deletions

View File

@ -0,0 +1,69 @@
autofs-5.0.7 - don't schedule new alarms after readmap
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
Currently, a new alarm is scheduled every time the daemon receives
a SIGHUP (map re-read) or SIGUSR1 (forced expiration). Besides that,
map re-reads started on demand when a map is found to be outdated
also generate a new alarm.
Once added, these alarms are never deleted and hence increase the
number of times the daemon wakes up to run the expiration procedure.
After a couple of months, in setups with many mount points, it's
normal to see automount waking up every second to handle the
expiration timer.
This patch removes the alarm scheduling from the readmap cleanup
routine and makes sure the alarm is re-added after the expiration
process only when it was not triggered by SIGUSR1.
I couldn't think of any use case to justify keeping these alarms:
it's critical to have the alarm ticking every timeout/4 seconds,
but more than one periodic alarm running doesn't seem to make
sense.
---
CHANGELOG | 1 +
daemon/state.c | 6 +-----
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index c9be73e..4cf5621 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -22,6 +22,7 @@
- fix init script status return.
- fix use get_proximity() without libtirpc.
- don't use dirent d_type to filter out files in scandir()
+- don't schedule new alarms after readmap.
25/07/2012 autofs-5.0.7
=======================
diff --git a/daemon/state.c b/daemon/state.c
index b451c56..6e23022 100644
--- a/daemon/state.c
+++ b/daemon/state.c
@@ -144,7 +144,7 @@ void expire_cleanup(void *arg)
ap->submount = 2;
}
- if (!ap->submount)
+ if (ap->state == ST_EXPIRE && !ap->submount)
alarm_add(ap, ap->exp_runfreq);
/* FALLTHROUGH */
@@ -330,13 +330,9 @@ static void do_readmap_cleanup(void *arg)
ap = ra->ap;
st_mutex_lock();
-
ap->readmap_thread = 0;
st_set_done(ap);
- if (!ap->submount)
- alarm_add(ap, ap->exp_runfreq);
st_ready(ap);
-
st_mutex_unlock();
free(ra);

View File

@ -0,0 +1,41 @@
autofs-5.0.7 - don't use dirent d_type to filter out files in scandir()
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
The "d_type" field of a dirent structure is not filled in by all
file systems (XFS being one example), so we can't rely on it to
check file types.
---
CHANGELOG | 1 +
modules/lookup_dir.c | 4 ----
2 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 460bd27..c9be73e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -21,6 +21,7 @@
- fix submount offset delete.
- fix init script status return.
- fix use get_proximity() without libtirpc.
+- don't use dirent d_type to filter out files in scandir()
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/lookup_dir.c b/modules/lookup_dir.c
index 658cc29..33901c0 100644
--- a/modules/lookup_dir.c
+++ b/modules/lookup_dir.c
@@ -103,10 +103,6 @@ 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;

View File

@ -0,0 +1,39 @@
autofs-5.0.7 - fix init script status return
From: Ian Kent <ikent@redhat.com>
The patch that added the piddir to configure to fix incorrect init
script status() function returns failed to actually return the value
to the user.
---
CHANGELOG | 1 +
redhat/autofs.init.in | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 76c1f73..5bcb1af 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -19,6 +19,7 @@
- Allow nsswitch.conf to not contain "automount:" lines.
- fix nobind man page description.
- fix submount offset delete.
+- fix init script status return.
25/07/2012 autofs-5.0.7
=======================
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
index fe18b3e..9d008ff 100644
--- a/redhat/autofs.init.in
+++ b/redhat/autofs.init.in
@@ -172,7 +172,7 @@ RETVAL=0
case "$1" in
status)
status -p @@autofspiddir@@/autofs.pid -l autofs $prog
- exit 0;
+ exit $?;
;;
usage)
usage_message

View File

@ -0,0 +1,45 @@
autofs-5.0.7 - fix submount offset delete
From: Ian Kent <ikent@redhat.com>
As part of the implementation to allow for limited update of
the internal hosts map by using a HUP signal some code that
deleted any offset entries from the cache on lookup was removed
as it appeared to not be needed.
There is however a case where it is needed to avoid a duplicate
cache entry failure on lookup.
---
CHANGELOG | 1 +
daemon/automount.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 7eb7235..76c1f73 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -18,6 +18,7 @@
- fix map entry duplicate offset detection.
- Allow nsswitch.conf to not contain "automount:" lines.
- fix nobind man page description.
+- fix submount offset delete.
25/07/2012 autofs-5.0.7
=======================
diff --git a/daemon/automount.c b/daemon/automount.c
index e56f9e1..4a3eb3d 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -544,8 +544,8 @@ int umount_multi(struct autofs_point *ap, const char *path, int incl)
* If we are a submount we need to umount any offsets our
* parent may have mounted over top of us.
*/
- /*if (ap->submount)
- left += umount_subtree_mounts(ap->parent, path, is_autofs_fs);*/
+ if (ap->submount)
+ left += umount_subtree_mounts(ap->parent, path, is_autofs_fs);
left += umount_subtree_mounts(ap, path, is_autofs_fs);

View File

@ -0,0 +1,54 @@
autofs-5.0.7 - fix use get_proximity() without libtirpc
From: Ian Kent <raven@themaw.net>
If autofs is not using libtirpc and there are any configured IPv6
interfaces then get_proximity() will fail with PROXIMITY_UNSUPPORTED.
In this case when checking interfaces the IPv6 interfaces need to be
ignored.
---
CHANGELOG | 1 +
modules/replicated.c | 8 ++------
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 5bcb1af..460bd27 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -20,6 +20,7 @@
- fix nobind man page description.
- fix submount offset delete.
- fix init script status return.
+- fix use get_proximity() without libtirpc.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/replicated.c b/modules/replicated.c
index bd6003b..6b96320 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -184,9 +184,7 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
break;
case AF_INET6:
-#ifndef WITH_LIBTIRPC
- return PROXIMITY_UNSUPPORTED;
-#else
+#ifdef WITH_LIBTIRPC
if (host_addr->sa_family == AF_INET)
break;
if6_addr = (struct sockaddr_in6 *) this->ifa_addr;
@@ -251,9 +249,7 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
break;
case AF_INET6:
-#ifndef WITH_LIBTIRPC
- return PROXIMITY_UNSUPPORTED;
-#else
+#ifdef WITH_LIBTIRPC
if (host_addr->sa_family == AF_INET)
break;
if6_addr = (struct sockaddr_in6 *) this->ifa_addr;

View File

@ -0,0 +1,448 @@
autofs-5.0.7 - lib/defaults.c: use WITH_LDAP conditional around LDAP types
From: Chris Packham <chris.packham@alliedtelesis.co.nz>
Wrap the inclusion of lookup_ldap.h and functions that use ldap_uri or
ldap_schema with the WITH_LDAP conditional. WITH_LDAP is set by the
configure step when LDAP support is not desired. This also allows
compilation on a system that doesn't have any LDAP libraries.
---
CHANGELOG | 1
include/defaults.h | 14 +-
include/lookup_ldap.h | 1
lib/defaults.c | 325 +++++++++++++++++++++++++------------------------
modules/lookup_ldap.c | 1
5 files changed, 175 insertions(+), 167 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index ba1d65b..1130db6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -24,6 +24,7 @@
- don't use dirent d_type to filter out files in scandir()
- don't schedule new alarms after readmap.
- use numeric protocol ids instead of protoent structs.
+- lib/defaults.c: use WITH_LDAP conditional around LDAP types.
25/07/2012 autofs-5.0.7
=======================
diff --git a/include/defaults.h b/include/defaults.h
index cda2174..871e14b 100644
--- a/include/defaults.h
+++ b/include/defaults.h
@@ -44,8 +44,16 @@
#define DEFAULT_MAP_HASH_TABLE_SIZE 1024
+#ifdef WITH_LDAP
struct ldap_schema;
struct ldap_searchdn;
+void defaults_free_uris(struct list_head *);
+struct list_head *defaults_get_uris(void);
+struct ldap_schema *defaults_get_default_schema(void);
+void defaults_free_searchdns(struct ldap_searchdn *);
+struct ldap_searchdn *defaults_get_searchdns(void);
+struct ldap_schema *defaults_get_schema(void);
+#endif
unsigned int defaults_read_config(unsigned int);
const char *defaults_get_master_map(void);
@@ -57,12 +65,6 @@ unsigned int defaults_get_logging(void);
const char *defaults_get_ldap_server(void);
unsigned int defaults_get_ldap_timeout(void);
unsigned int defaults_get_ldap_network_timeout(void);
-struct list_head *defaults_get_uris(void);
-void defaults_free_uris(struct list_head *);
-struct ldap_schema *defaults_get_default_schema(void);
-struct ldap_schema *defaults_get_schema(void);
-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);
diff --git a/include/lookup_ldap.h b/include/lookup_ldap.h
index e441a61..9a4ce73 100644
--- a/include/lookup_ldap.h
+++ b/include/lookup_ldap.h
@@ -8,7 +8,6 @@
#include <openssl/evp.h>
#include <openssl/err.h>
#include <sasl/sasl.h>
-#include <libxml/tree.h>
#include <krb5.h>
#endif
diff --git a/lib/defaults.c b/lib/defaults.c
index 5ce71b7..ae1162f 100644
--- a/lib/defaults.c
+++ b/lib/defaults.c
@@ -17,9 +17,12 @@
#include <ctype.h>
#include <string.h>
+#include "config.h"
#include "list.h"
#include "defaults.h"
+#ifdef WITH_LDAP
#include "lookup_ldap.h"
+#endif
#include "log.h"
#include "automount.h"
@@ -197,6 +200,7 @@ static int parse_line(char *line, char **res, char **value)
return 1;
}
+#ifdef WITH_LDAP
void defaults_free_uris(struct list_head *list)
{
struct list_head *next;
@@ -290,166 +294,6 @@ struct list_head *defaults_get_uris(void)
return list;
}
-/*
- * Read config env variables and check they have been set.
- *
- * This simple minded routine assumes the config file
- * is valid bourne shell script without spaces around "="
- * and that it has valid values.
- */
-unsigned int defaults_read_config(unsigned int to_syslog)
-{
- FILE *f;
- char buf[MAX_LINE_LEN];
- char *res;
-
- f = open_fopen_r(DEFAULTS_CONFIG_FILE);
- if (!f)
- return 0;
-
- while ((res = fgets(buf, MAX_LINE_LEN, f))) {
- char *key, *value;
-
- if (!parse_line(res, &key, &value))
- continue;
-
- if (check_set_config_value(key, ENV_NAME_MASTER_MAP, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_TIMEOUT, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_NEGATIVE_TIMEOUT, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_BROWSE_MODE, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_LOGGING, value, to_syslog) ||
- check_set_config_value(key, ENV_LDAP_TIMEOUT, value, to_syslog) ||
- check_set_config_value(key, ENV_LDAP_NETWORK_TIMEOUT, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_MAP_OBJ_CLASS, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_ENTRY_OBJ_CLASS, value, to_syslog) ||
- check_set_config_value(key, ENV_NAME_MAP_ATTR, value, 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) ||
- check_set_config_value(key, ENV_MOUNT_NFS_DEFAULT_PROTOCOL, value, to_syslog))
- ;
- }
-
- if (!feof(f) || ferror(f)) {
- if (!to_syslog) {
- fprintf(stderr,
- "fgets returned error %d while reading %s\n",
- ferror(f), DEFAULTS_CONFIG_FILE);
- } else {
- logmsg("fgets returned error %d while reading %s",
- ferror(f), DEFAULTS_CONFIG_FILE);
- }
- fclose(f);
- return 0;
- }
-
- fclose(f);
- return 1;
-}
-
-const char *defaults_get_master_map(void)
-{
- char *master;
-
- master = get_env_string(ENV_NAME_MASTER_MAP);
- if (!master)
- return strdup(default_master_map_name);
-
- return (const char *) master;
-}
-
-int defaults_master_set(void)
-{
- char *val = getenv(ENV_NAME_MASTER_MAP);
- if (!val)
- return 0;
-
- return 1;
-}
-
-unsigned int defaults_get_timeout(void)
-{
- long timeout;
-
- timeout = get_env_number(ENV_NAME_TIMEOUT);
- if (timeout < 0)
- timeout = DEFAULT_TIMEOUT;
-
- return (unsigned int) timeout;
-}
-
-unsigned int defaults_get_negative_timeout(void)
-{
- long n_timeout;
-
- n_timeout = get_env_number(ENV_NAME_NEGATIVE_TIMEOUT);
- if (n_timeout <= 0)
- n_timeout = DEFAULT_NEGATIVE_TIMEOUT;
-
- return (unsigned int) n_timeout;
-}
-
-unsigned int defaults_get_browse_mode(void)
-{
- int res;
-
- res = get_env_yesno(ENV_NAME_BROWSE_MODE);
- if (res < 0)
- res = DEFAULT_BROWSE_MODE;
-
- return res;
-}
-
-unsigned int defaults_get_logging(void)
-{
- char *res;
- unsigned int logging = DEFAULT_LOGGING;
-
- res = get_env_string(ENV_NAME_LOGGING);
- if (!res)
- return logging;
-
- if (!strcasecmp(res, "none"))
- logging = DEFAULT_LOGGING;
- else {
- if (!strcasecmp(res, "verbose"))
- logging |= LOGOPT_VERBOSE;
-
- if (!strcasecmp(res, "debug"))
- logging |= LOGOPT_DEBUG;
- }
-
- free(res);
-
- return logging;
-}
-
-unsigned int defaults_get_ldap_timeout(void)
-{
- int res;
-
- res = get_env_number(ENV_LDAP_TIMEOUT);
- if (res < 0)
- res = DEFAULT_LDAP_TIMEOUT;
-
- return res;
-}
-
-unsigned int defaults_get_ldap_network_timeout(void)
-{
- int res;
-
- res = get_env_number(ENV_LDAP_NETWORK_TIMEOUT);
- if (res < 0)
- res = DEFAULT_LDAP_NETWORK_TIMEOUT;
-
- return res;
-}
-
struct ldap_schema *defaults_get_default_schema(void)
{
struct ldap_schema *schema;
@@ -645,6 +489,167 @@ struct ldap_schema *defaults_get_schema(void)
return schema;
}
+#endif
+
+/*
+ * Read config env variables and check they have been set.
+ *
+ * This simple minded routine assumes the config file
+ * is valid bourne shell script without spaces around "="
+ * and that it has valid values.
+ */
+unsigned int defaults_read_config(unsigned int to_syslog)
+{
+ FILE *f;
+ char buf[MAX_LINE_LEN];
+ char *res;
+
+ f = open_fopen_r(DEFAULTS_CONFIG_FILE);
+ if (!f)
+ return 0;
+
+ while ((res = fgets(buf, MAX_LINE_LEN, f))) {
+ char *key, *value;
+
+ if (!parse_line(res, &key, &value))
+ continue;
+
+ if (check_set_config_value(key, ENV_NAME_MASTER_MAP, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_TIMEOUT, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_NEGATIVE_TIMEOUT, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_BROWSE_MODE, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_LOGGING, value, to_syslog) ||
+ check_set_config_value(key, ENV_LDAP_TIMEOUT, value, to_syslog) ||
+ check_set_config_value(key, ENV_LDAP_NETWORK_TIMEOUT, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_MAP_OBJ_CLASS, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_ENTRY_OBJ_CLASS, value, to_syslog) ||
+ check_set_config_value(key, ENV_NAME_MAP_ATTR, value, 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) ||
+ check_set_config_value(key, ENV_MOUNT_NFS_DEFAULT_PROTOCOL, value, to_syslog))
+ ;
+ }
+
+ if (!feof(f) || ferror(f)) {
+ if (!to_syslog) {
+ fprintf(stderr,
+ "fgets returned error %d while reading %s\n",
+ ferror(f), DEFAULTS_CONFIG_FILE);
+ } else {
+ logmsg("fgets returned error %d while reading %s",
+ ferror(f), DEFAULTS_CONFIG_FILE);
+ }
+ fclose(f);
+ return 0;
+ }
+
+ fclose(f);
+ return 1;
+}
+
+const char *defaults_get_master_map(void)
+{
+ char *master;
+
+ master = get_env_string(ENV_NAME_MASTER_MAP);
+ if (!master)
+ return strdup(default_master_map_name);
+
+ return (const char *) master;
+}
+
+int defaults_master_set(void)
+{
+ char *val = getenv(ENV_NAME_MASTER_MAP);
+ if (!val)
+ return 0;
+
+ return 1;
+}
+
+unsigned int defaults_get_timeout(void)
+{
+ long timeout;
+
+ timeout = get_env_number(ENV_NAME_TIMEOUT);
+ if (timeout < 0)
+ timeout = DEFAULT_TIMEOUT;
+
+ return (unsigned int) timeout;
+}
+
+unsigned int defaults_get_negative_timeout(void)
+{
+ long n_timeout;
+
+ n_timeout = get_env_number(ENV_NAME_NEGATIVE_TIMEOUT);
+ if (n_timeout <= 0)
+ n_timeout = DEFAULT_NEGATIVE_TIMEOUT;
+
+ return (unsigned int) n_timeout;
+}
+
+unsigned int defaults_get_browse_mode(void)
+{
+ int res;
+
+ res = get_env_yesno(ENV_NAME_BROWSE_MODE);
+ if (res < 0)
+ res = DEFAULT_BROWSE_MODE;
+
+ return res;
+}
+
+unsigned int defaults_get_logging(void)
+{
+ char *res;
+ unsigned int logging = DEFAULT_LOGGING;
+
+ res = get_env_string(ENV_NAME_LOGGING);
+ if (!res)
+ return logging;
+
+ if (!strcasecmp(res, "none"))
+ logging = DEFAULT_LOGGING;
+ else {
+ if (!strcasecmp(res, "verbose"))
+ logging |= LOGOPT_VERBOSE;
+
+ if (!strcasecmp(res, "debug"))
+ logging |= LOGOPT_DEBUG;
+ }
+
+ free(res);
+
+ return logging;
+}
+
+unsigned int defaults_get_ldap_timeout(void)
+{
+ int res;
+
+ res = get_env_number(ENV_LDAP_TIMEOUT);
+ if (res < 0)
+ res = DEFAULT_LDAP_TIMEOUT;
+
+ return res;
+}
+
+unsigned int defaults_get_ldap_network_timeout(void)
+{
+ int res;
+
+ res = get_env_number(ENV_LDAP_NETWORK_TIMEOUT);
+ if (res < 0)
+ res = DEFAULT_LDAP_NETWORK_TIMEOUT;
+
+ return res;
+}
unsigned int defaults_get_mount_nfs_default_proto(void)
{
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 3bc4dc5..431e50d 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -28,6 +28,7 @@
#include <arpa/nameser.h>
#include <resolv.h>
#include <lber.h>
+#include <libxml/tree.h>
#define MODULE_LOOKUP
#include "automount.h"

View File

@ -0,0 +1,156 @@
autofs-5.0.7 - make yellow pages support optional
From: Chris Packham <chris.packham@alliedtelesis.co.nz>
If rpcsvc/ypclnt.h is not available don't compile in Yellow Pages
support.
---
CHANGELOG | 1 +
Makefile.conf.in | 3 +++
configure | 16 ++++++++++++++++
configure.in | 9 +++++++++
include/config.h.in | 3 +++
lib/rpc_subs.c | 1 -
modules/Makefile | 9 +++++++--
7 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 1130db6..ed17163 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -25,6 +25,7 @@
- don't schedule new alarms after readmap.
- use numeric protocol ids instead of protoent structs.
- lib/defaults.c: use WITH_LDAP conditional around LDAP types.
+- make yellow pages support optional.
25/07/2012 autofs-5.0.7
=======================
diff --git a/Makefile.conf.in b/Makefile.conf.in
index 802318b..3766d45 100644
--- a/Makefile.conf.in
+++ b/Makefile.conf.in
@@ -43,6 +43,9 @@ NISPLUS = @HAVE_NISPLUS@
# SMBFS support: yes (1) no (0)
SMBFS = @HAVE_SMBMOUNT@
+# YellowPages support: yes (1) no (0)
+YPCLNT = @HAVE_YPCLNT@
+
# Support for calling e2fsck when mounting ext2 filesystems
EXT2FS = @HAVE_E2FSCK@
diff --git a/configure b/configure
index 3722a46..cf6428c 100755
--- a/configure
+++ b/configure
@@ -614,6 +614,7 @@ XML_FLAGS
LIBLDAP
HAVE_LDAP
LDAP_FLAGS
+HAVE_YPCLNT
HAVE_NISPLUS
EGREP
GREP
@@ -4575,6 +4576,21 @@ fi
+# YellowPages support?
+HAVE_YPCLNT=0
+ac_fn_c_check_header_mongrel "$LINENO" "rpcsvc/ypclnt.h" "ac_cv_header_rpcsvc_ypclnt_h" "$ac_includes_default"
+if test "x$ac_cv_header_rpcsvc_ypclnt_h" = xyes; then :
+ HAVE_YPCLNT=1
+fi
+
+
+
+if test "$HAVE_YPCLNT" = "1"; then
+
+$as_echo "#define HAVE_YPCLNT 1" >>confdefs.h
+
+fi
+
#
# OpenLDAP support? Expect that this may have a special directory...
#
diff --git a/configure.in b/configure.in
index 90bda62..363c376 100644
--- a/configure.in
+++ b/configure.in
@@ -213,6 +213,15 @@ HAVE_NISPLUS=0
AC_CHECK_HEADER(rpcsvc/nis.h, HAVE_NISPLUS=1)
AC_SUBST(HAVE_NISPLUS)
+# YellowPages support?
+HAVE_YPCLNT=0
+AC_CHECK_HEADER([rpcsvc/ypclnt.h], HAVE_YPCLNT=1)
+AC_SUBST(HAVE_YPCLNT)
+if test "$HAVE_YPCLNT" = "1"; then
+ AC_DEFINE(HAVE_YPCLNT, 1,
+ [Define if using YellowPages])
+fi
+
#
# OpenLDAP support? Expect that this may have a special directory...
#
diff --git a/include/config.h.in b/include/config.h.in
index 9bdf98a..7f1c5b5 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -72,6 +72,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define if using YellowPages */
+#undef HAVE_YPCLNT
+
/* Use libxml2 tsd usage workaround */
#undef LIBXML2_WORKAROUND
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
index ad1d557..718caf9 100644
--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -27,7 +27,6 @@
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <rpcsvc/ypclnt.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <ctype.h>
diff --git a/modules/Makefile b/modules/Makefile
index 939da7c..c5deb24 100644
--- a/modules/Makefile
+++ b/modules/Makefile
@@ -5,13 +5,13 @@
-include ../Makefile.conf
include ../Makefile.rules
-SRCS := lookup_yp.c lookup_file.c lookup_program.c lookup_userhome.c \
+SRCS := 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 \
+MODS := lookup_file.so lookup_program.so lookup_userhome.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 \
@@ -37,6 +37,11 @@ ifeq ($(NISPLUS), 1)
MODS += lookup_nisplus.so
endif
+ifeq ($(YPCLNT), 1)
+ SRCS += lookup_yp.c
+ MODS += lookup_yp.so
+endif
+
ifeq ($(LDAP), 1)
SRCS += lookup_ldap.c
MODS += lookup_ldap.so

View File

@ -0,0 +1,39 @@
autofs-5.0.7 - modules/replicated.c: use sin6_addr.s6_addr32
From: Chris Packham <chris.packham@alliedtelesis.co.nz>
The exported in6.h kernel header provides a convenience macro s6_addr32
for accessing the 32bit words of an ipv6 address. Use this instead of
__in6_u.__u6_addr32.
---
CHANGELOG | 1 +
modules/replicated.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index ed17163..4eaa9f9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -26,6 +26,7 @@
- use numeric protocol ids instead of protoent structs.
- lib/defaults.c: use WITH_LDAP conditional around LDAP types.
- make yellow pages support optional.
+- modules/replicated.c: use sin6_addr.s6_addr32.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/replicated.c b/modules/replicated.c
index dbd5513..26f64b8 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -1146,7 +1146,7 @@ try_name:
rr4++;
} else if (this->ai_family == AF_INET6) {
struct sockaddr_in6 *addr = (struct sockaddr_in6 *) this->ai_addr;
- if (!IN6_IS_ADDR_LOOPBACK(addr->sin6_addr.__in6_u.__u6_addr32))
+ if (!IN6_IS_ADDR_LOOPBACK(addr->sin6_addr.s6_addr32))
rr6++;
}
this = this->ai_next;

View File

@ -0,0 +1,471 @@
autofs-5.0.7 - use numeric protocol ids instead of protoent structs
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
The function getprotobyname() is not reentrant, so we can't call
it simultaneously from multiple threads. Instead of switching to
the reentrant version which adds more complexity to the code,
lets use numeric protocol IDs instead of protoent structures.
---
CHANGELOG | 1 +
include/rpc_subs.h | 4 +--
lib/rpc_subs.c | 80 ++++++++++++++++++--------------------------------
modules/replicated.c | 42 +++++++++++---------------
4 files changed, 50 insertions(+), 77 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 4cf5621..ba1d65b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -23,6 +23,7 @@
- fix use get_proximity() without libtirpc.
- don't use dirent d_type to filter out files in scandir()
- don't schedule new alarms after readmap.
+- use numeric protocol ids instead of protoent structs.
25/07/2012 autofs-5.0.7
=======================
diff --git a/include/rpc_subs.h b/include/rpc_subs.h
index ca474d9..b6d59f9 100644
--- a/include/rpc_subs.h
+++ b/include/rpc_subs.h
@@ -54,7 +54,7 @@ struct conn_info {
unsigned short port;
unsigned long program;
unsigned long version;
- struct protoent *proto;
+ int proto;
unsigned int send_sz;
unsigned int recv_sz;
struct timeval timeout;
@@ -66,7 +66,7 @@ int rpc_udp_getclient(struct conn_info *, unsigned int, unsigned int);
void rpc_destroy_udp_client(struct conn_info *);
int rpc_tcp_getclient(struct conn_info *, unsigned int, unsigned int);
void rpc_destroy_tcp_client(struct conn_info *);
-int rpc_portmap_getclient(struct conn_info *, const char *, struct sockaddr *, size_t, const char *, unsigned int);
+int rpc_portmap_getclient(struct conn_info *, const char *, struct sockaddr *, size_t, int, unsigned int);
int rpc_portmap_getport(struct conn_info *, struct pmap *, unsigned short *);
int rpc_ping_proto(struct conn_info *);
int rpc_ping(const char *, long, long, unsigned int);
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
index d33a3c4..ad1d557 100644
--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -170,7 +170,7 @@ static int rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, i
*client = NULL;
- proto = info->proto->p_proto;
+ proto = info->proto;
if (proto == IPPROTO_UDP)
type = SOCK_DGRAM;
else
@@ -201,7 +201,7 @@ static int rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, i
in4_raddr = (struct sockaddr_in *) addr;
in4_raddr->sin_port = htons(info->port);
- switch (info->proto->p_proto) {
+ switch (info->proto) {
case IPPROTO_UDP:
clnt = clntudp_bufcreate(in4_raddr,
info->program, info->version,
@@ -241,7 +241,7 @@ static int rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, i
*client = NULL;
- proto = info->proto->p_proto;
+ proto = info->proto;
if (proto == IPPROTO_UDP)
type = SOCK_DGRAM;
else
@@ -292,11 +292,11 @@ static int rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, i
nb_addr.maxlen = nb_addr.len = slen;
nb_addr.buf = addr;
- if (info->proto->p_proto == IPPROTO_UDP)
+ if (info->proto == IPPROTO_UDP)
clnt = clnt_dg_create(*fd, &nb_addr,
info->program, info->version,
info->send_sz, info->recv_sz);
- else if (info->proto->p_proto == IPPROTO_TCP) {
+ else if (info->proto == IPPROTO_TCP) {
ret = connect_nb(*fd, addr, slen, &info->timeout);
if (ret < 0)
return ret;
@@ -355,7 +355,7 @@ static int create_client(struct conn_info *info, CLIENT **client)
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_ADDRCONFIG;
hints.ai_family = AF_UNSPEC;
- if (info->proto->p_proto == IPPROTO_UDP)
+ if (info->proto == IPPROTO_UDP)
hints.ai_socktype = SOCK_DGRAM;
else
hints.ai_socktype = SOCK_STREAM;
@@ -370,7 +370,7 @@ static int create_client(struct conn_info *info, CLIENT **client)
haddr = ai;
while (haddr) {
- if (haddr->ai_protocol != info->proto->p_proto) {
+ if (haddr->ai_protocol != info->proto) {
haddr = haddr->ai_next;
continue;
}
@@ -417,16 +417,11 @@ out_close:
int rpc_udp_getclient(struct conn_info *info,
unsigned int program, unsigned int version)
{
- struct protoent *pe_proto;
CLIENT *client;
int ret;
if (!info->client) {
- pe_proto = getprotobyname("udp");
- if (!pe_proto)
- return -ENOENT;
-
- info->proto = pe_proto;
+ info->proto = IPPROTO_UDP;
info->timeout.tv_sec = RPC_TOUT_UDP;
info->timeout.tv_usec = 0;
info->send_sz = UDPMSGSIZE;
@@ -458,16 +453,11 @@ void rpc_destroy_udp_client(struct conn_info *info)
int rpc_tcp_getclient(struct conn_info *info,
unsigned int program, unsigned int version)
{
- struct protoent *pe_proto;
CLIENT *client;
int ret;
if (!info->client) {
- pe_proto = getprotobyname("tcp");
- if (!pe_proto)
- return -ENOENT;
-
- info->proto = pe_proto;
+ info->proto = IPPROTO_TCP;
info->timeout.tv_sec = RPC_TOUT_TCP;
info->timeout.tv_usec = 0;
info->send_sz = 0;
@@ -513,23 +503,18 @@ void rpc_destroy_tcp_client(struct conn_info *info)
int rpc_portmap_getclient(struct conn_info *info,
const char *host, struct sockaddr *addr, size_t addr_len,
- const char *proto, unsigned int option)
+ int proto, unsigned int option)
{
- struct protoent *pe_proto;
CLIENT *client;
int ret;
- pe_proto = getprotobyname(proto);
- if (!pe_proto)
- return -ENOENT;
-
info->host = host;
info->addr = addr;
info->addr_len = addr_len;
info->program = PMAPPROG;
info->port = PMAPPORT;
info->version = PMAPVERS;
- info->proto = pe_proto;
+ info->proto = proto;
info->send_sz = RPCSMALLMSGSIZE;
info->recv_sz = RPCSMALLMSGSIZE;
info->timeout.tv_sec = PMAP_TOUT_UDP;
@@ -537,7 +522,7 @@ int rpc_portmap_getclient(struct conn_info *info,
info->close_option = option;
info->client = NULL;
- if (pe_proto->p_proto == IPPROTO_TCP)
+ if (info->proto == IPPROTO_TCP)
info->timeout.tv_sec = PMAP_TOUT_TCP;
ret = create_client(info, &client);
@@ -555,7 +540,7 @@ int rpc_portmap_getport(struct conn_info *info,
struct conn_info pmap_info;
CLIENT *client;
enum clnt_stat status;
- int proto = info->proto->p_proto;
+ int proto = info->proto;
int ret;
memset(&pmap_info, 0, sizeof(struct conn_info));
@@ -633,13 +618,13 @@ int rpc_ping_proto(struct conn_info *info)
{
CLIENT *client;
enum clnt_stat status;
- int proto = info->proto->p_proto;
+ int proto = info->proto;
int ret;
if (info->client)
client = info->client;
else {
- if (info->proto->p_proto == IPPROTO_UDP) {
+ if (info->proto == IPPROTO_UDP) {
info->send_sz = UDPMSGSIZE;
info->recv_sz = UDPMSGSIZE;
}
@@ -688,7 +673,7 @@ int rpc_ping_proto(struct conn_info *info)
static unsigned int __rpc_ping(const char *host,
unsigned long version,
- char *proto,
+ int proto,
long seconds, long micros,
unsigned int option)
{
@@ -696,6 +681,7 @@ static unsigned int __rpc_ping(const char *host,
struct conn_info info;
struct pmap parms;
+ info.proto = proto;
info.host = host;
info.addr = NULL;
info.addr_len = 0;
@@ -710,13 +696,9 @@ static unsigned int __rpc_ping(const char *host,
status = RPC_PING_FAIL;
- info.proto = getprotobyname(proto);
- if (!info.proto)
- return status;
-
parms.pm_prog = NFS_PROGRAM;
parms.pm_vers = version;
- parms.pm_prot = info.proto->p_proto;
+ parms.pm_prot = info.proto;
parms.pm_port = 0;
status = rpc_portmap_getport(&info, &parms, &info.port);
@@ -734,19 +716,19 @@ int rpc_ping(const char *host, long seconds, long micros, unsigned int option)
unsigned long vers2 = NFS2_VERSION;
unsigned int status;
- status = __rpc_ping(host, vers2, "udp", seconds, micros, option);
+ status = __rpc_ping(host, vers2, IPPROTO_UDP, seconds, micros, option);
if (status > 0)
return RPC_PING_V2 | RPC_PING_UDP;
- status = __rpc_ping(host, vers3, "udp", seconds, micros, option);
+ status = __rpc_ping(host, vers3, IPPROTO_UDP, seconds, micros, option);
if (status > 0)
return RPC_PING_V3 | RPC_PING_UDP;
- status = __rpc_ping(host, vers2, "tcp", seconds, micros, option);
+ status = __rpc_ping(host, vers2, IPPROTO_TCP, seconds, micros, option);
if (status > 0)
return RPC_PING_V2 | RPC_PING_TCP;
- status = __rpc_ping(host, vers3, "tcp", seconds, micros, option);
+ status = __rpc_ping(host, vers3, IPPROTO_TCP, seconds, micros, option);
if (status > 0)
return RPC_PING_V3 | RPC_PING_TCP;
@@ -769,7 +751,7 @@ int rpc_time(const char *host,
double taken;
struct timeval start, end;
struct timezone tz;
- char *proto = (ping_proto & RPC_PING_UDP) ? "udp" : "tcp";
+ int proto = (ping_proto & RPC_PING_UDP) ? IPPROTO_UDP : IPPROTO_TCP;
unsigned long vers = ping_vers;
gettimeofday(&start, &tz);
@@ -791,12 +773,12 @@ static int rpc_get_exports_proto(struct conn_info *info, exports *exp)
{
CLIENT *client;
enum clnt_stat status;
- int proto = info->proto->p_proto;
+ int proto = info->proto;
unsigned int option = info->close_option;
int vers_entry;
int ret;
- if (info->proto->p_proto == IPPROTO_UDP) {
+ if (info->proto == IPPROTO_UDP) {
info->send_sz = UDPMSGSIZE;
info->recv_sz = UDPMSGSIZE;
}
@@ -903,11 +885,9 @@ exports rpc_get_exports(const char *host, long seconds, long micros, unsigned in
parms.pm_port = 0;
/* Try UDP first */
- info.proto = getprotobyname("udp");
- if (!info.proto)
- goto try_tcp;
+ info.proto = IPPROTO_UDP;
- parms.pm_prot = info.proto->p_proto;
+ parms.pm_prot = info.proto;
status = rpc_portmap_getport(&info, &parms, &info.port);
if (status < 0)
@@ -920,11 +900,9 @@ exports rpc_get_exports(const char *host, long seconds, long micros, unsigned in
return exportlist;
try_tcp:
- info.proto = getprotobyname("tcp");
- if (!info.proto)
- return NULL;
+ info.proto = IPPROTO_TCP;
- parms.pm_prot = info.proto->p_proto;
+ parms.pm_prot = info.proto;
status = rpc_portmap_getport(&info, &parms, &info.port);
if (status < 0)
diff --git a/modules/replicated.c b/modules/replicated.c
index 6b96320..dbd5513 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -419,7 +419,7 @@ void free_host_list(struct host **list)
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, int port)
+ int proto, unsigned int version, int port)
{
unsigned int random_selection = host->options & MOUNT_FLAG_RANDOM_SELECT;
unsigned int use_weight_only = host->options & MOUNT_FLAG_USE_WEIGHT_ONLY;
@@ -433,22 +433,18 @@ static unsigned int get_nfs_info(unsigned logopt, struct host *host,
int status, count = 0;
if (host->addr)
- debug(logopt, "called with host %s(%s) proto %s version 0x%x",
+ debug(logopt, "called with host %s(%s) proto %d version 0x%x",
host->name, get_addr_string(host->addr, buf, len),
proto, version);
else
debug(logopt,
- "called for host %s proto %s version 0x%x",
+ "called for host %s proto %d version 0x%x",
host->name, proto, version);
- rpc_info->proto = getprotobyname(proto);
- if (!rpc_info->proto)
- return 0;
-
+ rpc_info->proto = proto;
memset(&parms, 0, sizeof(struct pmap));
-
parms.pm_prog = NFS_PROGRAM;
- parms.pm_prot = rpc_info->proto->p_proto;
+ parms.pm_prot = proto;
if (!(version & NFS4_REQUESTED))
goto v3_ver;
@@ -479,7 +475,7 @@ static unsigned int get_nfs_info(unsigned logopt, struct host *host,
}
}
- if (rpc_info->proto->p_proto == IPPROTO_UDP)
+ if (rpc_info->proto == IPPROTO_UDP)
status = rpc_udp_getclient(rpc_info, NFS_PROGRAM, NFS4_VERSION);
else
status = rpc_tcp_getclient(rpc_info, NFS_PROGRAM, NFS4_VERSION);
@@ -540,7 +536,7 @@ v3_ver:
goto v2_ver;
}
- if (rpc_info->proto->p_proto == IPPROTO_UDP)
+ if (rpc_info->proto == IPPROTO_UDP)
status = rpc_udp_getclient(rpc_info, NFS_PROGRAM, NFS3_VERSION);
else
status = rpc_tcp_getclient(rpc_info, NFS_PROGRAM, NFS3_VERSION);
@@ -587,7 +583,7 @@ v2_ver:
goto done_ver;
}
- if (rpc_info->proto->p_proto == IPPROTO_UDP)
+ if (rpc_info->proto == IPPROTO_UDP)
status = rpc_udp_getclient(rpc_info, NFS_PROGRAM, NFS2_VERSION);
else
status = rpc_tcp_getclient(rpc_info, NFS_PROGRAM, NFS2_VERSION);
@@ -618,7 +614,7 @@ v2_ver:
}
done_ver:
- if (rpc_info->proto->p_proto == IPPROTO_UDP) {
+ if (rpc_info->proto == IPPROTO_UDP) {
rpc_destroy_udp_client(rpc_info);
rpc_destroy_udp_client(pm_info);
} else {
@@ -675,7 +671,7 @@ static int get_vers_and_cost(unsigned logopt, struct host *host,
if (version & TCP_REQUESTED) {
supported = get_nfs_info(logopt, host,
- &pm_info, &rpc_info, "tcp", vers, port);
+ &pm_info, &rpc_info, IPPROTO_TCP, vers, port);
if (IS_ERR(supported)) {
if (ERR(supported) == EHOSTUNREACH ||
ERR(supported) == ETIMEDOUT)
@@ -688,7 +684,7 @@ static int get_vers_and_cost(unsigned logopt, struct host *host,
if (version & UDP_REQUESTED) {
supported = get_nfs_info(logopt, host,
- &pm_info, &rpc_info, "udp", vers, port);
+ &pm_info, &rpc_info, IPPROTO_UDP, vers, port);
if (IS_ERR(supported)) {
if (!ret && ERR(supported) == ETIMEDOUT)
return ret;
@@ -709,7 +705,7 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host,
socklen_t len = INET6_ADDRSTRLEN;
char buf[len + 1];
struct conn_info pm_info, rpc_info;
- const char *proto;
+ int proto;
unsigned int vers;
struct timeval start, end;
struct timezone tz;
@@ -748,10 +744,10 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host,
* So, we do the conversion here.
*/
if (version & UDP_SELECTED_MASK) {
- proto = "udp";
+ proto = IPPROTO_UDP;
version >>= 8;
} else
- proto = "tcp";
+ proto = IPPROTO_TCP;
switch (version) {
case NFS2_SUPPORTED:
@@ -768,9 +764,7 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host,
return 0;
}
- rpc_info.proto = getprotobyname(proto);
- if (!rpc_info.proto)
- return 0;
+ rpc_info.proto = proto;
if (port > 0)
rpc_info.port = port;
@@ -786,14 +780,14 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host,
memset(&parms, 0, sizeof(struct pmap));
parms.pm_prog = NFS_PROGRAM;
- parms.pm_prot = rpc_info.proto->p_proto;
+ parms.pm_prot = rpc_info.proto;
parms.pm_vers = vers;
ret = rpc_portmap_getport(&pm_info, &parms, &rpc_info.port);
if (ret < 0)
goto done;
}
- if (rpc_info.proto->p_proto == IPPROTO_UDP)
+ if (rpc_info.proto == IPPROTO_UDP)
status = rpc_udp_getclient(&rpc_info, NFS_PROGRAM, vers);
else
status = rpc_tcp_getclient(&rpc_info, NFS_PROGRAM, vers);
@@ -815,7 +809,7 @@ static int get_supported_ver_and_cost(unsigned logopt, struct host *host,
}
}
done:
- if (rpc_info.proto->p_proto == IPPROTO_UDP) {
+ if (rpc_info.proto == IPPROTO_UDP) {
rpc_destroy_udp_client(&rpc_info);
rpc_destroy_udp_client(&pm_info);
} else {

View File

@ -0,0 +1,149 @@
autofs-5.0.7 - workaround missing GNU versionsort extension
From: Chris Packham <chris.packham@alliedtelesis.co.nz>
alphasort() and scandir() are specified in POSIX.1-2008, versionsort()
is a GNU extension. When versionsort isn't available fallback to using
alphasort.
---
CHANGELOG | 1 +
configure | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++
configure.in | 6 +++++
include/config.h.in | 3 ++
modules/lookup_dir.c | 5 ++++
5 files changed, 77 insertions(+), 0 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 4eaa9f9..39388a5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -27,6 +27,7 @@
- lib/defaults.c: use WITH_LDAP conditional around LDAP types.
- make yellow pages support optional.
- modules/replicated.c: use sin6_addr.s6_addr32.
+- workaround missing GNU versionsort extension.
25/07/2012 autofs-5.0.7
=======================
diff --git a/configure b/configure
index cf6428c..c1423d8 100755
--- a/configure
+++ b/configure
@@ -4010,6 +4010,68 @@ $as_echo "yes" >&6; }
KRB5_FLAGS=`$KRB5_CONFIG --cflags`
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing versionsort" >&5
+$as_echo_n "checking for library containing versionsort... " >&6; }
+if ${ac_cv_search_versionsort+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char versionsort ();
+int
+main ()
+{
+return versionsort ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' ; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_versionsort=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_versionsort+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_versionsort+:} false; then :
+
+else
+ ac_cv_search_versionsort=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_versionsort" >&5
+$as_echo "$ac_cv_search_versionsort" >&6; }
+ac_res=$ac_cv_search_versionsort
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+if test "$ac_cv_search_versionsort" = "no"; then
+
+$as_echo "#define WITHOUT_VERSIONSORT 1" >>confdefs.h
+
+fi
+
#
# glibc/libc 6 new libraries
#
diff --git a/configure.in b/configure.in
index 363c376..4029375 100644
--- a/configure.in
+++ b/configure.in
@@ -163,6 +163,12 @@ AF_SLOPPY_MOUNT()
AF_CHECK_LIBXML()
AF_CHECK_KRB5()
+AC_SEARCH_LIBS([versionsort],[])
+if test "$ac_cv_search_versionsort" = "no"; then
+ AC_DEFINE(WITHOUT_VERSIONSORT, 1,
+ [Define if your C library does not provide versionsort])
+fi
+
#
# glibc/libc 6 new libraries
#
diff --git a/include/config.h.in b/include/config.h.in
index 7f1c5b5..a2a05a8 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -135,6 +135,9 @@
/* Define to 1 to use the libtirpc tsd usage workaround */
#undef TIRPC_WORKAROUND
+/* Define if your C library does not provide versionsort */
+#undef WITHOUT_VERSIONSORT
+
/* Define if using the dmalloc debugging malloc package */
#undef WITH_DMALLOC
diff --git a/modules/lookup_dir.c b/modules/lookup_dir.c
index 33901c0..07471b7 100644
--- a/modules/lookup_dir.c
+++ b/modules/lookup_dir.c
@@ -39,6 +39,11 @@
#define AUTOFS_DIR_EXT ".autofs"
#define AUTOFS_DIR_EXTSIZ (sizeof(AUTOFS_DIR_EXT) - 1)
+/* Work around non-GNU systems that don't provide versionsort */
+#ifdef WITHOUT_VERSIONSORT
+#define versionsort alphasort
+#endif
+
struct lookup_context {
const char *mapname;
};

View File

@ -8,7 +8,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.0.7
Release: 9%{?dist}
Release: 10%{?dist}
Epoch: 1
License: GPLv2+
Group: System Environment/Daemons
@ -33,6 +33,16 @@ Patch17: autofs-5.0.7-handle-new-location-of-systemd.patch
Patch18: autofs-5.0.7-fix-map-entry-duplicate-offset-detection.patch
Patch19: autofs-5.0.7-allow-nsswitch_conf-to-not-contain-automount-lines.patch
Patch20: autofs-5.0.7-fix-nobind-man-page-description.patch
Patch21: autofs-5.0.7-fix-submount-offset-delete.patch
Patch22: autofs-5.0.7-fix-init-script-status-return.patch
Patch23: autofs-5.0.7-fix-use-get_proximity-without-libtirpc.patch
Patch24: autofs-5.0.7-dont-use-dirent-d_type-to-filter-out-files-in-scandir.patch
Patch25: autofs-5.0.7-dont-schedule-new-alarms-after-readmap.patch
Patch26: autofs-5.0.7-use-numeric-protocol-ids-instead-of-protoent-structs.patch
Patch27: autofs-5.0.7-lib-defaults-use-WITH_LDAP-conditional-around-LDAP-types.patch
Patch28: autofs-5.0.7-make-yellow-pages-support-optional.patch
Patch29: autofs-5.0.7-modules-replicated-use-sin6.addr-s6_addr32.patch
Patch30: autofs-5.0.7-workaround-missing-GNU-versionsort-extension.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if %{with_systemd}
BuildRequires: systemd-units
@ -109,6 +119,16 @@ echo %{version}-%{release} > .version
%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
%build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@ -200,6 +220,18 @@ fi
%dir /etc/auto.master.d
%changelog
* Mon Jan 21 2013 Ian Kent <ikent@redhat.com> - 1:5.0.7-10
- fix submount offset delete.
- fix init script status return.
- fix use get_proximity() without libtirpc.
- don't use dirent d_type to filter out files in scandir().
- don't schedule new alarms after readmap.
- use numeric protocol ids instead of protoent structs.
- lib/defaults.c: use WITH_LDAP conditional around LDAP types.
- make yellow pages support optional.
- modules/replicated.c: use sin6_addr.s6_addr32.
- workaround missing GNU versionsort extension.
* Tue Nov 21 2012 Ian Kent <ikent@redhat.com> - 1:5.0.7-9
- fix nobind man page description.