rpms/autofs/devel autofs-5.0.1-rc2-afs-buffer-overflow-check.patch, NONE, 1.1 autofs-5.0.1-rc2-change-mount-device-to-map-name.patch, NONE, 1.1 autofs-5.0.1-rc2-replace-tempnam.patch, NONE, 1.1 autofs.spec, 1.167, 1.168
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Mon Dec 11 07:47:23 UTC 2006
- Previous message (by thread): rpms/ruby/FC-5 .cvsignore,1.16,1.17 sources,1.15,1.16
- Next message (by thread): rpms/dovecot/devel dovecot-1.0.rc15-default-settings.patch, NONE, 1.1 .cvsignore, 1.15, 1.16 dovecot.spec, 1.61, 1.62 sources, 1.16, 1.17
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: ikent
Update of /cvs/dist/rpms/autofs/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv1097
Modified Files:
autofs.spec
Added Files:
autofs-5.0.1-rc2-afs-buffer-overflow-check.patch
autofs-5.0.1-rc2-change-mount-device-to-map-name.patch
autofs-5.0.1-rc2-replace-tempnam.patch
Log Message:
* Mon Dec 11 2006 Ian Kent <ikent at redhat.com> - 5.0.1-0.rc2.34
- change mount "device" from "automount" to the map name.
- check for buffer overflow in mount_afs.c.
- replace tempnam with mkdtemp.
autofs-5.0.1-rc2-afs-buffer-overflow-check.patch:
CHANGELOG | 1 +
modules/mount_afs.c | 17 ++++++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
--- NEW FILE autofs-5.0.1-rc2-afs-buffer-overflow-check.patch ---
diff --git a/CHANGELOG b/CHANGELOG
index 4b5a14b..e42bf42 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -48,6 +48,7 @@
- expand export access checks to include missing syntax options.
- make "-hosts" module try to be sensitive to exports list changes.
- change mount "device" from "automount" to the map name.
+- check for buffer overflow in mount_afs.c.
1/9/2006 autofs-5.0.1 rc2
-------------------------
diff --git a/modules/mount_afs.c b/modules/mount_afs.c
index 252302e..3b4261a 100644
--- a/modules/mount_afs.c
+++ b/modules/mount_afs.c
@@ -30,11 +30,18 @@ int mount_init(void **context)
int mount_mount(struct autofs_point *ap, const char *root, const char *name, int name_len,
const char *what, const char *fstype, const char *options, void *context)
{
- char dest[PATH_MAX * 2];
-
- strcpy(dest, root); /* Convert the name to a mount point. */
- strncat(dest, "/", sizeof(dest));
- strncat(dest, name, sizeof(dest));
+ /* PATH_MAX is allegedly longest path allowed */
+ char dest[PATH_MAX + 1];
+ size_t r_len = strlen(root);
+ size_t d_len = r_len + name_len + 2;
+
+ if (d_len > PATH_MAX)
+ return 1;
+
+ /* Convert the name to a mount point. */
+ strcpy(dest, root);
+ strcat(dest, "/");
+ strcat(dest, name);
/* remove trailing slash (http://bugs.debian.org/141775) */
if (dest[strlen(dest)-1] == '/')
autofs-5.0.1-rc2-change-mount-device-to-map-name.patch:
CHANGELOG | 1 +
b/daemon/direct.c | 10 ++++++++--
daemon/indirect.c | 13 ++++++++++++-
include/automount.h | 1 +
lib/cache.c | 2 ++
5 files changed, 24 insertions(+), 3 deletions(-)
--- NEW FILE autofs-5.0.1-rc2-change-mount-device-to-map-name.patch ---
unchanged:
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -47,6 +47,7 @@
- remove ability to use multiple indirect mount entries in master map.
- expand export access checks to include missing syntax options.
- make "-hosts" module try to be sensitive to exports list changes.
+- change mount "device" from "automount" to the map name.
1/9/2006 autofs-5.0.1 rc2
-------------------------
diff -u b/daemon/direct.c b/daemon/direct.c
--- b/daemon/direct.c
+++ b/daemon/direct.c
@@ -357,6 +357,7 @@
struct stat st;
int status, ret, ioctlfd, cl_flags;
struct list_head list;
+ const char *map_name;
INIT_LIST_HEAD(&list);
@@ -448,7 +449,9 @@
me->dir_created = 1;
}
- ret = mount("automount", me->key, "autofs", MS_MGC_VAL, mp->options);
+ map_name = me->mc->map->argv[0];
+
+ ret = mount(map_name, me->key, "autofs", MS_MGC_VAL, mp->options);
if (ret) {
crit(ap->logopt, "failed to mount autofs path %s", me->key);
goto out_err;
@@ -695,6 +698,7 @@
time_t timeout = ap->exp_timeout;
struct stat st;
int ioctlfd, cl_flags, status, ret;
+ const char *map_name;
if (is_mounted(_PROC_MOUNTS, me->key, MNTS_AUTOFS)) {
if (ap->state != ST_READMAP)
@@ -772,7 +776,9 @@
"calling mount -t autofs " SLOPPY " -o %s automount %s",
mp->options, me->key);
- ret = mount("automount", me->key, "autofs", MS_MGC_VAL, mp->options);
+ map_name = me->mc->map->argv[0];
+
+ ret = mount(map_name, me->key, "autofs", MS_MGC_VAL, mp->options);
if (ret) {
crit(ap->logopt, "failed to mount autofs path %s", me->key);
goto out_err;
unchanged:
--- a/daemon/indirect.c
+++ b/daemon/indirect.c
@@ -147,6 +147,7 @@ static int do_mount_autofs_indirect(stru
{
time_t timeout = ap->exp_timeout;
char *options = NULL;
+ const char *type, *map_name = NULL;
struct stat st;
struct mnt_list *mnts;
int cl_flags, ret;
@@ -183,7 +184,17 @@ static int do_mount_autofs_indirect(stru
ap->dir_created = 1;
}
- ret = mount("automount", ap->path, "autofs", MS_MGC_VAL, options);
+ type = ap->entry->maps->type;
+ if (type && !strcmp(ap->entry->maps->type, "hosts")) {
+ char *tmp = alloca(7);
+ if (tmp) {
+ strcpy(tmp, "-hosts");
+ map_name = (const char *) tmp;
+ }
+ } else
+ map_name = ap->entry->maps->argv[0];
+
+ ret = mount(map_name, ap->path, "autofs", MS_MGC_VAL, options);
if (ret) {
crit(ap->logopt, "failed to mount autofs path %s", ap->path);
goto out_rmdir;
unchanged:
--- a/include/automount.h
+++ b/include/automount.h
@@ -131,6 +131,7 @@ struct mapent_cache {
unsigned int size;
pthread_mutex_t ino_index_mutex;
struct list_head *ino_index;
+ struct map_source *map;
struct mapent **hash;
};
unchanged:
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -207,6 +207,8 @@ struct mapent_cache *cache_init(struct m
INIT_LIST_HEAD(&mc->ino_index[i]);
}
+ mc->map = map;
+
cache_unlock(mc);
return mc;
autofs-5.0.1-rc2-replace-tempnam.patch:
lib/mounts.c | 33 +++++++++++++++++----------------
modules/mount_bind.c | 41 +++++++++++++++++------------------------
2 files changed, 34 insertions(+), 40 deletions(-)
--- NEW FILE autofs-5.0.1-rc2-replace-tempnam.patch ---
diff --git a/lib/mounts.c b/lib/mounts.c
index c2a8f04..050ec8c 100644
--- a/lib/mounts.c
+++ b/lib/mounts.c
@@ -38,16 +38,17 @@ static const char kver_options_template[
unsigned int query_kproto_ver(void)
{
- char options[MAX_OPTIONS_LEN + 1], *tmp;
+ char dir[] = "autoXXXXXX", *t_dir;
+ char options[MAX_OPTIONS_LEN + 1];
pid_t pgrp = getpgrp();
int pipefd[2], ioctlfd, len;
- tmp = tempnam(NULL, "auto");
- if (mkdir(tmp, 0700) == -1)
+ t_dir = mkdtemp(dir);
+ if (!t_dir)
return 0;
if (pipe(pipefd) == -1) {
- rmdir(tmp);
+ rmdir(t_dir);
return 0;
}
@@ -56,24 +57,24 @@ unsigned int query_kproto_ver(void)
if (len < 0) {
close(pipefd[0]);
close(pipefd[1]);
- rmdir(tmp);
+ rmdir(t_dir);
return 0;
}
- if (mount("automount", tmp, "autofs", MS_MGC_VAL, options)) {
+ if (mount("automount", t_dir, "autofs", MS_MGC_VAL, options)) {
close(pipefd[0]);
close(pipefd[1]);
- rmdir(tmp);
+ rmdir(t_dir);
return 0;
}
close(pipefd[1]);
- ioctlfd = open(tmp, O_RDONLY);
+ ioctlfd = open(t_dir, O_RDONLY);
if (ioctlfd == -1) {
- umount(tmp);
+ umount(t_dir);
close(pipefd[0]);
- rmdir(tmp);
+ rmdir(t_dir);
return 0;
}
@@ -82,25 +83,25 @@ unsigned int query_kproto_ver(void)
/* If this ioctl() doesn't work, it is kernel version 2 */
if (ioctl(ioctlfd, AUTOFS_IOC_PROTOVER, &kver.major) == -1) {
close(ioctlfd);
- umount(tmp);
+ umount(t_dir);
close(pipefd[0]);
- rmdir(tmp);
+ rmdir(t_dir);
return 0;
}
/* If this ioctl() doesn't work, version is 4 or less */
if (ioctl(ioctlfd, AUTOFS_IOC_PROTOSUBVER, &kver.minor) == -1) {
close(ioctlfd);
- umount(tmp);
+ umount(t_dir);
close(pipefd[0]);
- rmdir(tmp);
+ rmdir(t_dir);
return 0;
}
close(ioctlfd);
- umount(tmp);
+ umount(t_dir);
close(pipefd[0]);
- rmdir(tmp);
+ rmdir(t_dir);
return 1;
}
diff --git a/modules/mount_bind.c b/modules/mount_bind.c
index 1cdb1c6..e76e5ee 100644
--- a/modules/mount_bind.c
+++ b/modules/mount_bind.c
@@ -34,46 +34,39 @@ static int bind_works = 0;
int mount_init(void **context)
{
- char *tmp1 = tempnam(NULL, "auto");
- char *tmp2 = tempnam(NULL, "auto");
+ char tmp1[] = "autoXXXXXX", *t1_dir;
+ char tmp2[] = "autoXXXXXX", *t2_dir;
int err;
struct stat st1, st2;
- if (tmp1 == NULL || tmp2 == NULL) {
- if (tmp1)
- free(tmp1);
- if (tmp2)
- free(tmp2);
+ t1_dir = mkdtemp(tmp1);
+ t2_dir = mkdtemp(tmp2);
+ if (t1_dir == NULL || t2_dir == NULL) {
+ if (t1_dir)
+ rmdir(t1_dir);
+ if (t2_dir)
+ rmdir(t2_dir);
return 0;
}
- if (mkdir(tmp1, 0700) == -1)
- goto out2;
-
- if (mkdir(tmp2, 0700) == -1)
- goto out1;
-
- if (lstat(tmp1, &st1) == -1)
+ if (lstat(t1_dir, &st1) == -1)
goto out;
- err = spawn_mount(log_debug, "-n", "--bind", tmp1, tmp2, NULL);
+ err = spawn_mount(log_debug, "-n", "--bind", t1_dir, t2_dir, NULL);
if (err == 0 &&
- lstat(tmp2, &st2) == 0 &&
+ lstat(t2_dir, &st2) == 0 &&
st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino) {
bind_works = 1;
}
debug(LOGOPT_NONE, MODPREFIX "bind_works = %d", bind_works);
- spawn_umount(log_debug, "-n", tmp2, NULL);
+ spawn_umount(log_debug, "-n", t2_dir, NULL);
+
+out:
+ rmdir(t2_dir);
+ rmdir(t2_dir);
- out:
- rmdir(tmp2);
- out1:
- free(tmp2);
- rmdir(tmp1);
- out2:
- free(tmp1);
return 0;
}
Index: autofs.spec
===================================================================
RCS file: /cvs/dist/rpms/autofs/devel/autofs.spec,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -r1.167 -r1.168
--- autofs.spec 10 Dec 2006 07:56:21 -0000 1.167
+++ autofs.spec 11 Dec 2006 07:47:21 -0000 1.168
@@ -4,7 +4,7 @@
Summary: A tool for automatically mounting and unmounting filesystems.
Name: autofs
%define version 5.0.1
-%define release 0.rc2.33
+%define release 0.rc2.34
Version: %{version}
Release: %{release}
Epoch: 1
@@ -55,6 +55,9 @@
Patch41: autofs-5.0.1-rc2-disallow-multiple-indirect-mounts.patch
Patch42: autofs-5.0.1-rc2-add-export-syntax-checks.patch
Patch43: autofs-5.0.1-rc2-hosts-check-exports-update.patch
+Patch44: autofs-5.0.1-rc2-change-mount-device-to-map-name.patch
+Patch45: autofs-5.0.1-rc2-afs-buffer-overflow-check.patch
+Patch46: autofs-5.0.1-rc2-replace-tempnam.patch
Buildroot: /var/tmp/autofs-tmp
BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel
Prereq: chkconfig
@@ -138,6 +141,9 @@
%patch41 -p1
%patch42 -p1
%patch43 -p1
+%patch44 -p1
+%patch45 -p1
+%patch46 -p1
%build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -194,6 +200,11 @@
%{_libdir}/autofs/*
%changelog
+* Mon Dec 11 2006 Ian Kent <ikent at redhat.com> - 5.0.1-0.rc2.34
+- change mount "device" from "automount" to the map name.
+- check for buffer overflow in mount_afs.c.
+- replace tempnam with mkdtemp.
+
* Sun Dec 10 2006 Ian Kent <ikent at redhat.com> - 5.0.1-0.rc2.33
- expand export access checks to include missing syntax options.
- make "-hosts" module try to be sensitive to exports list changes.
- Previous message (by thread): rpms/ruby/FC-5 .cvsignore,1.16,1.17 sources,1.15,1.16
- Next message (by thread): rpms/dovecot/devel dovecot-1.0.rc15-default-settings.patch, NONE, 1.1 .cvsignore, 1.15, 1.16 dovecot.spec, 1.61, 1.62 sources, 1.16, 1.17
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-cvs-commits
mailing list