- fix array out of bounds accesses and cleanup couple of other alloca()

calls.
- Undo mistake in copy order for submount path introduced by rev 11 patch.
- add check for alternate libxml2 library for libxml2 tsd workaround.
- add check for alternate libtirpc library for libtirpc tsd workaround.
- cleanup configure defines for libtirpc.
- add WITH_LIBTIRPC to -V status report.
- add libtirpc-devel to BuildRequires.
- add nfs mount protocol default configuration option.
This commit is contained in:
Ian Kent 2009-02-24 04:16:36 +00:00
parent fac65808ae
commit 16a3693853
5 changed files with 5850 additions and 2 deletions

View File

@ -0,0 +1,181 @@
autofs-5.0.4 - add nfs mount protocol default configuration option
From: Ian Kent <raven@themaw.net>
Add configuration option MOUNT_NFS_DEFAULT_PROTOCOL with default of 3.
Since the default mount protocol used by mount.nfs(8) will change to
NFS version 4 at some point, and because we can't identify the default
automatically, we need to be able to set it in our configuration.
This will only make a difference for replicated map entries as
availability probing isn't used for single host map entries.
---
CHANGELOG | 1 +
include/defaults.h | 2 ++
lib/defaults.c | 15 ++++++++++++++-
man/auto.master.5.in | 6 ++++++
modules/mount_nfs.c | 8 +++++---
redhat/autofs.sysconfig.in | 10 ++++++++++
samples/autofs.conf.default.in | 10 ++++++++++
7 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index ad74b7d..0ce2a56 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -25,6 +25,7 @@
- add check for alternate libtirpc library for libtirpc tsd workaround.
- cleanup configure defines for libtirpc.
- add WITH_LIBTIRPC to -V status report.
+- add nfs mount protocol default configuration option.
4/11/2008 autofs-5.0.4
-----------------------
diff --git a/include/defaults.h b/include/defaults.h
index 9a2430f..9bf16e5 100644
--- a/include/defaults.h
+++ b/include/defaults.h
@@ -37,6 +37,7 @@
#define DEFAULT_ENTRY_ATTR "cn"
#define DEFAULT_VALUE_ATTR "nisMapEntry"
+#define DEFAULT_NFS_MOUNT_PROTOCOL 3
#define DEFAULT_APPEND_OPTIONS 1
#define DEFAULT_AUTH_CONF_FILE AUTOFS_MAP_DIR "/autofs_ldap_auth.conf"
@@ -61,6 +62,7 @@ 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_umount_wait(void);
const char *defaults_get_auth_conf_file(void);
diff --git a/lib/defaults.c b/lib/defaults.c
index e507a59..17164bd 100644
--- a/lib/defaults.c
+++ b/lib/defaults.c
@@ -45,6 +45,7 @@
#define ENV_NAME_ENTRY_ATTR "ENTRY_ATTRIBUTE"
#define ENV_NAME_VALUE_ATTR "VALUE_ATTRIBUTE"
+#define ENV_MOUNT_NFS_DEFAULT_PROTOCOL "MOUNT_NFS_DEFAULT_PROTOCOL"
#define ENV_APPEND_OPTIONS "APPEND_OPTIONS"
#define ENV_UMOUNT_WAIT "UMOUNT_WAIT"
#define ENV_AUTH_CONF_FILE "AUTH_CONF_FILE"
@@ -326,7 +327,8 @@ unsigned int defaults_read_config(unsigned int to_syslog)
check_set_config_value(key, ENV_APPEND_OPTIONS, 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_MAP_HASH_TABLE_SIZE, value, to_syslog) ||
+ check_set_config_value(key, ENV_MOUNT_NFS_DEFAULT_PROTOCOL, value, to_syslog))
;
}
@@ -643,6 +645,17 @@ struct ldap_schema *defaults_get_schema(void)
return schema;
}
+unsigned int defaults_get_mount_nfs_default_proto(void)
+{
+ long proto;
+
+ proto = get_env_number(ENV_MOUNT_NFS_DEFAULT_PROTOCOL);
+ if (proto < 2 || proto > 4)
+ proto = DEFAULT_NFS_MOUNT_PROTOCOL;
+
+ return (unsigned int) proto;
+}
+
unsigned int defaults_get_append_options(void)
{
int res;
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index 9cc5f02..aaa6324 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -183,6 +183,12 @@ but it is the best we can do.
.B BROWSE_MODE
Maps are browsable by default (program default "yes").
.TP
+.B MOUNT_NFS_DEFAULT_PROTOCOL
+Specify the default protocol used by mount.nfs(8) (program default 3). Since
+we can't identify this default automatically we need to set it in the autofs
+configuration. This option will only make a difference for replicated map
+entries as availability probing isn't used for single host map entries.
+.TP
.B APPEND_OPTIONS
Determine whether global options, given on the command line or per mount
in the master map, are appended to map entry options or if the map entry
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
index 4f3f514..14d3850 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -61,7 +61,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
char fullpath[PATH_MAX];
char buf[MAX_ERR_BUF];
struct host *this, *hosts = NULL;
- unsigned int vers;
+ unsigned int mount_default_proto, vers;
char *nfsoptions = NULL;
unsigned int random_selection = ap->flags & MOUNT_FLAG_RANDOM_SELECT;
int len, status, err, existed = 1;
@@ -130,10 +130,12 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
nfsoptions, nosymlink, ro);
}
+ mount_default_proto = defaults_get_mount_nfs_default_proto();
+ vers = NFS_VERS_MASK | NFS_PROTO_MASK;
if (strcmp(fstype, "nfs4") == 0)
vers = NFS4_VERS_MASK | TCP_SUPPORTED;
- else
- vers = NFS_VERS_MASK | NFS_PROTO_MASK;
+ else if (mount_default_proto == 4)
+ vers = vers | NFS4_VERS_MASK;
if (!parse_location(ap->logopt, &hosts, what)) {
info(ap->logopt, MODPREFIX "no hosts available");
diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in
index fe36f45..04e521c 100644
--- a/redhat/autofs.sysconfig.in
+++ b/redhat/autofs.sysconfig.in
@@ -22,6 +22,16 @@ TIMEOUT=300
#
BROWSE_MODE="no"
#
+# MOUNT_NFS_DEFAULT_PROTOCOL - specify the default protocol used by
+# mount.nfs(8). Since we can't identify
+# the default automatically we need to
+# set it in our configuration. This will
+# only make a difference for replicated
+# map entries as availability probing isn't
+# used for single host map entries.
+#
+#MOUNT_NFS_DEFAULT_PROTOCOL=3
+#
# APPEND_OPTIONS - append to global options instead of replace.
#
#APPEND_OPTIONS="yes"
diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
index 4496738..52d18ec 100644
--- a/samples/autofs.conf.default.in
+++ b/samples/autofs.conf.default.in
@@ -22,6 +22,16 @@ TIMEOUT=300
#
BROWSE_MODE="no"
#
+# MOUNT_NFS_DEFAULT_PROTOCOL - specify the default protocol used by
+# mount.nfs(8). Since we can't identify
+# the default automatically we need to
+# set it in our configuration. This will
+# only make a difference for replicated
+# map entries as availability probing isn't
+# used for single host map entries.
+#
+#MOUNT_NFS_DEFAULT_PROTOCOL=3
+#
# APPEND_OPTIONS - append to global options instead of replace.
#
#APPEND_OPTIONS="yes"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,190 @@
autofs-5.0.4 - easy alloca replacements fix
From: Ian Kent <raven@themaw.net>
Fix array out of bounds accesses and remove alloca(3) calls from
modules/mount_autofs.c and modules/mount_nfs.c as well.
---
CHANGELOG | 1 +
modules/lookup_ldap.c | 3 ---
modules/mount_autofs.c | 9 ++-------
modules/mount_bind.c | 6 +++++-
modules/mount_changer.c | 6 +++++-
modules/mount_ext2.c | 6 +++++-
modules/mount_generic.c | 6 +++++-
modules/mount_nfs.c | 12 +++++++-----
8 files changed, 30 insertions(+), 19 deletions(-)
--- autofs-5.0.4.orig/CHANGELOG
+++ autofs-5.0.4/CHANGELOG
@@ -20,6 +20,7 @@
- update to configure libtirpc if present.
- update to provide ipv6 name and address support.
- update to provide ipv6 address parsing.
+- easy alloca replacements fix.
4/11/2008 autofs-5.0.4
-----------------------
--- autofs-5.0.4.orig/modules/lookup_ldap.c
+++ autofs-5.0.4/modules/lookup_ldap.c
@@ -1474,7 +1474,6 @@ int lookup_read_master(struct master *ma
free(query);
return NSS_STATUS_UNAVAIL;
}
- query[l] = '\0';
/* Initialize the LDAP context. */
ldap = do_reconnect(logopt, ctxt);
@@ -2213,7 +2212,6 @@ static int read_one_map(struct autofs_po
free(sp.query);
return NSS_STATUS_UNAVAIL;
}
- sp.query[l] = '\0';
/* Initialize the LDAP context. */
sp.ldap = do_reconnect(ap->logopt, ctxt);
@@ -2404,7 +2402,6 @@ static int lookup_one(struct autofs_poin
free(query);
return CHE_FAIL;
}
- query[ql] = '\0';
/* Initialize the LDAP context. */
ldap = do_reconnect(ap->logopt, ctxt);
--- autofs-5.0.4.orig/modules/mount_autofs.c
+++ autofs-5.0.4/modules/mount_autofs.c
@@ -45,7 +45,8 @@ int mount_mount(struct autofs_point *ap,
{
struct startup_cond suc;
pthread_t thid;
- char *realpath, *mountpoint;
+ char realpath[PATH_MAX];
+ char mountpoint[PATH_MAX];
const char **argv;
int argc, status, ghost = ap->flags & MOUNT_FLAG_GHOST;
time_t timeout = ap->exp_timeout;
@@ -62,8 +63,6 @@ int mount_mount(struct autofs_point *ap,
/* Root offset of multi-mount */
len = strlen(root);
if (root[len - 1] == '/') {
- realpath = alloca(strlen(ap->path) + name_len + 2);
- mountpoint = alloca(len + 1);
strcpy(realpath, ap->path);
strcat(realpath, "/");
strcat(realpath, name);
@@ -71,8 +70,6 @@ int mount_mount(struct autofs_point *ap,
strncpy(mountpoint, root, len);
mountpoint[len] = '\0';
} else if (*name == '/') {
- realpath = alloca(name_len + 1);
- mountpoint = alloca(len + 1);
if (ap->flags & MOUNT_FLAG_REMOUNT) {
strcpy(mountpoint, name);
strcpy(realpath, name);
@@ -81,8 +78,6 @@ int mount_mount(struct autofs_point *ap,
strcpy(realpath, name);
}
} else {
- realpath = alloca(len + name_len + 2);
- mountpoint = alloca(len + name_len + 2);
strcpy(mountpoint, root);
strcat(mountpoint, "/");
strcpy(realpath, mountpoint);
--- autofs-5.0.4.orig/modules/mount_bind.c
+++ autofs-5.0.4/modules/mount_bind.c
@@ -81,8 +81,12 @@ int mount_mount(struct autofs_point *ap,
len = strlen(root);
if (root[len - 1] == '/') {
len = snprintf(fullpath, len, "%s", root);
- /* Direct mount name is absolute path so don't use root */
} else if (*name == '/') {
+ /*
+ * Direct or offset mount, name is absolute path so
+ * don't use root (but with move mount changes root
+ * is now the same as name).
+ */
len = sprintf(fullpath, "%s", root);
} else {
len = sprintf(fullpath, "%s/%s", root, name);
--- autofs-5.0.4.orig/modules/mount_changer.c
+++ autofs-5.0.4/modules/mount_changer.c
@@ -58,8 +58,12 @@ int mount_mount(struct autofs_point *ap,
len = strlen(root);
if (root[len - 1] == '/') {
len = snprintf(fullpath, len, "%s", root);
- /* Direct mount name is absolute path so don't use root */
} else if (*name == '/') {
+ /*
+ * Direct or offset mount, name is absolute path so
+ * don't use root (but with move mount changes root
+ * is now the same as name).
+ */
len = sprintf(fullpath, "%s", root);
} else {
len = sprintf(fullpath, "%s/%s", root, name);
--- autofs-5.0.4.orig/modules/mount_ext2.c
+++ autofs-5.0.4/modules/mount_ext2.c
@@ -50,8 +50,12 @@ int mount_mount(struct autofs_point *ap,
len = strlen(root);
if (root[len - 1] == '/') {
len = snprintf(fullpath, len, "%s", root);
- /* Direct mount name is absolute path so don't use root */
} else if (*name == '/') {
+ /*
+ * Direct or offset mount, name is absolute path so
+ * don't use root (but with move mount changes root
+ * is now the same as name).
+ */
len = sprintf(fullpath, "%s", root);
} else {
len = sprintf(fullpath, "%s/%s", root, name);
--- autofs-5.0.4.orig/modules/mount_generic.c
+++ autofs-5.0.4/modules/mount_generic.c
@@ -49,8 +49,12 @@ int mount_mount(struct autofs_point *ap,
len = strlen(root);
if (root[len - 1] == '/') {
len = snprintf(fullpath, len, "%s", root);
- /* Direct mount name is absolute path so don't use root */
} else if (*name == '/') {
+ /*
+ * Direct or offset mount, name is absolute path so
+ * don't use root (but with move mount changes root
+ * is now the same as name).
+ */
len = sprintf(fullpath, "%s", root);
} else {
len = sprintf(fullpath, "%s/%s", root, name);
--- autofs-5.0.4.orig/modules/mount_nfs.c
+++ autofs-5.0.4/modules/mount_nfs.c
@@ -58,7 +58,8 @@ int mount_mount(struct autofs_point *ap,
const char *what, const char *fstype, const char *options,
void *context)
{
- char *fullpath, buf[MAX_ERR_BUF];
+ char fullpath[PATH_MAX];
+ char buf[MAX_ERR_BUF];
struct host *this, *hosts = NULL;
unsigned int vers;
char *nfsoptions = NULL;
@@ -150,14 +151,15 @@ int mount_mount(struct autofs_point *ap,
/* Root offset of multi-mount */
len = strlen(root);
if (root[len - 1] == '/') {
- fullpath = alloca(len);
len = snprintf(fullpath, len, "%s", root);
- /* Direct mount name is absolute path so don't use root */
} else if (*name == '/') {
- fullpath = alloca(len + 1);
+ /*
+ * Direct or offset mount, name is absolute path so
+ * don't use root (but with move mount changes root
+ * is now the same as name).
+ */
len = sprintf(fullpath, "%s", root);
} else {
- fullpath = alloca(len + name_len + 2);
len = sprintf(fullpath, "%s/%s", root, name);
}
fullpath[len] = '\0';

View File

@ -0,0 +1,38 @@
autofs-5.0.4 - libxml2 workaround fix
From: Ian Kent <raven@themaw.net>
Add a check for libxml2.so.2 for the libxml2 workaround in case libxml2.so
is not present.
---
CHANGELOG | 1 +
daemon/automount.c | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 1cb56fe..b8ad22e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -21,6 +21,7 @@
- update to provide ipv6 name and address support.
- update to provide ipv6 address parsing.
- easy alloca replacements fix.
+- add check for alternate libxml2 library for libxml2 tsd workaround.
4/11/2008 autofs-5.0.4
-----------------------
diff --git a/daemon/automount.c b/daemon/automount.c
index 1ec686b..a664277 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -2058,6 +2058,8 @@ int main(int argc, char *argv[])
#ifdef LIBXML2_WORKAROUND
void *dh_xml2 = dlopen("libxml2.so", RTLD_NOW);
+ if (!dh_xml2)
+ dh_xml2 = dlopen("libxml2.so.2", RTLD_NOW);
#endif
#ifdef TIRPC_WORKAROUND
void *dh_tirpc = dlopen("libitirpc.so", RTLD_NOW);

View File

@ -4,7 +4,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.0.4
Release: 11
Release: 15
Epoch: 1
License: GPLv2+
Group: System Environment/Daemons
@ -32,8 +32,12 @@ Patch19: autofs-5.0.4-configure-libtirpc.patch
Patch20: autofs-5.0.4-ipv6-name-and-address-support.patch
Patch21: autofs-5.0.4-ipv6-parse.patch
Patch22: autofs-5.0.4-use-CLOEXEC-flag-setmntent-include-fix.patch
Patch23: autofs-5.0.4-easy-alloca-replacements-fix.patch
Patch24: autofs-5.0.4-libxml2-workaround-fix.patch
Patch25: autofs-5.0.4-configure-libtirpc-fix.patch
Patch26: autofs-5.0.4-add-nfs-mount-proto-default-conf-option.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
BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs libtirpc-devel
Requires: kernel >= 2.6.17
Requires: bash mktemp sed gawk textutils sh-utils grep module-init-tools /bin/ps
Requires(post): /sbin/chkconfig
@ -95,6 +99,10 @@ echo %{version}-%{release} > .version
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@ -147,6 +155,16 @@ fi
%{_libdir}/autofs/
%changelog
* Tue Feb 24 2009 Ian Kent <ikent@redhat.com> - 1:5.0.4-15
- fix array out of bounds accesses and cleanup couple of other alloca() calls.
- Undo mistake in copy order for submount path introduced by rev 11 patch.
- add check for alternate libxml2 library for libxml2 tsd workaround.
- add check for alternate libtirpc library for libtirpc tsd workaround.
- cleanup configure defines for libtirpc.
- add WITH_LIBTIRPC to -V status report.
- add libtirpc-devel to BuildRequires.
- add nfs mount protocol default configuration option.
* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:5.0.4-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild