aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--modules/mount_smbfs.c18
-rw-r--r--samples/rc.autofs2
3 files changed, 15 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index 65e0d6b..99b286a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
Since autofs-3.1.1:
-------------------
+* NULL pointer fix in mount_smbfs (from Rene H°jbjerg Larsen).
Since autofs-3.1.0:
-------------------
diff --git a/modules/mount_smbfs.c b/modules/mount_smbfs.c
index 811fe8d..472b961 100644
--- a/modules/mount_smbfs.c
+++ b/modules/mount_smbfs.c
@@ -7,7 +7,7 @@
*
* Mount point input format expected is: //server/service[/root_path...]
*
- * Copyright 1997 Transmeta Corporation - All Rights Reserved
+ * Copyright 1997-1998 Transmeta Corporation - 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
@@ -136,14 +136,21 @@ int mount_mount(const char *root, const char *name, int name_len,
const char **argv;
fullpath = alloca(strlen(root)+name_len+2);
- optcopy = alloca(optsize = strlen(options)+1);
- if ( !fullpath || !optcopy ) {
+ if (options)
+ optcopy = alloca(optsize = strlen(options)+1);
+ else {
+ optsize = 0;
+ optcopy = NULL;
+ }
+ if ( !fullpath || (!optcopy && optsize)) {
syslog(LOG_ERR, MODPREFIX "alloca: %m");
return 1;
}
sprintf(fullpath, "%s/%s", root, name);
- memcpy(optcopy, options, optsize);
+ if (optsize)
+ memcpy(optcopy, options, optsize);
+
argc = smb_parse_options(optcopy, NULL, NULL, &qbuflen) + 4;
argv = alloca(sizeof(char *) * argc);
qbuf = alloca(qbuflen);
@@ -154,7 +161,8 @@ int mount_mount(const char *root, const char *name, int name_len,
argv[0] = PATH_SMBMOUNT;
argv[1] = what;
argv[2] = fullpath;
- memcpy(optcopy, options, optsize);
+ if (optsize)
+ memcpy(optcopy, options, optsize);
smb_parse_options(optcopy, argv+3, qbuf, NULL);
syslog(LOG_DEBUG, MODPREFIX "calling mkdir %s", fullpath);
diff --git a/samples/rc.autofs b/samples/rc.autofs
index 10bd1ad..4a6f638 100644
--- a/samples/rc.autofs
+++ b/samples/rc.autofs
@@ -110,7 +110,7 @@ function redhat()
case "$1" in
start)
# Check if the automounter is already running?
- if [ ! -f /var/lock/automount ]; then
+ if [ ! -f /var/lock/subsys/automount ]; then
echo 'Starting automounter: '
getmounts | sh
touch /var/lock/subsys/automount