rpms/autofs/FC-4 autofs-4.1.4-check-return-of-is-local-addr.patch, NONE, 1.1 autofs-4.1.4-configureable-locking.patch, NONE, 1.1 autofs-4.1.4-fix-sort-opts.patch, NONE, 1.1 autofs-4.1.4-keylen-length-check.patch, NONE, 1.1 autofs-4.1.4-locking-fix.patch, NONE, 1.1 autofs-4.1.4-multi-parse-fix.patch, NONE, 1.1 autofs-4.1.4-no-slash-misc.patch, NONE, 1.1 autofs-4.1.4-reentrant-syslog-copyright.patch, NONE, 1.1 autofs-4.1.4-reentrant-syslog.patch, NONE, 1.1 autofs-4.1.4-sockopt-len-type.patch, NONE, 1.1 autofs-4.1.4-sol10-schema.patch, NONE, 1.1 autofs-4.1.4-solaris-hosts-in-auto-master.patch, 1.1, 1.2 autofs-4.1.4-sun-parse-fixes.patch, NONE, 1.1 autofs-4.1.4-yp_order-order-type.patch, NONE, 1.1 autofs-4.1.4-check-nsswitch-submount.patch, 1.2, 1.3 autofs.spec, 1.64, 1.65 autofs-4.1.4-deferred-syslog.patch, 1.1, NONE autofs-4.1.4-init-redhat-only.patch, 1.1, NONE
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Thu Jan 19 01:23:53 UTC 2006
Author: ikent
Update of /cvs/dist/rpms/autofs/FC-4
In directory cvs.devel.redhat.com:/tmp/cvs-serv15225
Modified Files:
autofs-4.1.4-check-nsswitch-submount.patch autofs.spec
Added Files:
autofs-4.1.4-check-return-of-is-local-addr.patch
autofs-4.1.4-configureable-locking.patch
autofs-4.1.4-fix-sort-opts.patch
autofs-4.1.4-keylen-length-check.patch
autofs-4.1.4-locking-fix.patch
autofs-4.1.4-multi-parse-fix.patch
autofs-4.1.4-no-slash-misc.patch
autofs-4.1.4-reentrant-syslog-copyright.patch
autofs-4.1.4-reentrant-syslog.patch
autofs-4.1.4-sockopt-len-type.patch
autofs-4.1.4-sol10-schema.patch
autofs-4.1.4-solaris-hosts-in-auto-master.patch
autofs-4.1.4-sun-parse-fixes.patch
autofs-4.1.4-yp_order-order-type.patch
Removed Files:
autofs-4.1.4-deferred-syslog.patch
autofs-4.1.4-init-redhat-only.patch
Log Message:
* Tue Jan 17 2006 Ian Kent <ikent at redhat.com> - 1:4.1.4-15
- Sync patches with rawhide.
- Replace deferred syslog patch with reentrant syslog patch.
- Update copyright declaration for reentrant-syslog source.
- Replace check-is-multi with more general multi-parse-fix.
- Add fix for premature return when waiting for lock file.
- Add patch for configure option to disable locking during mount.
But don't disable locking by default.
- Add ability to handle automount schema used in Sun directory server.
- Quell compiler warning about getsockopt parameter.
- Quell compiler warning about yp_order parameter.
autofs-4.1.4-check-return-of-is-local-addr.patch:
mount_nfs.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
--- NEW FILE autofs-4.1.4-check-return-of-is-local-addr.patch ---
--- autofs-4.1.4/modules/mount_nfs.c.orig 2005-10-26 18:37:31.000000000 -0400
+++ autofs-4.1.4/modules/mount_nfs.c 2005-10-26 18:37:38.000000000 -0400
@@ -192,7 +192,7 @@
*pstrip = '\0';
/* Check if the host is the localhost */
- if (is_local_mount(p)) {
+ if (is_local_mount(p) > 0) {
debug(MODPREFIX "host %s: is localhost", p);
/* Strip off hostname and ':' */
autofs-4.1.4-configureable-locking.patch:
configure | 18 ++++++++++++++++++
configure.in | 10 ++++++++++
daemon/spawn.c | 2 ++
include/automount.h | 8 ++++++--
include/config.h.in | 2 ++
patches/util-linux-2.12a-flock.patch | 26 ++++++++++++++++++++++++++
patches/util-linux-2.12q-flock.patch | 25 +++++++++++++++++++++++++
7 files changed, 89 insertions(+), 2 deletions(-)
--- NEW FILE autofs-4.1.4-configureable-locking.patch ---
This patch provides a configure option to disable the use of a lock
file when calling mount from autofs. It also adds a patch to the
"patches" directory that needs to be used for mount to (hopefuully)
prevent /etc/mtab corruption when rapidly mounting filesystems
when autofs does not use locking.
To disable the locking add the configure option --disable-mount-locking.
diff -Nurp autofs-4.1.4.orig/configure autofs-4.1.4/configure
--- autofs-4.1.4.orig/configure 2005-04-06 23:24:37.000000000 +0800
+++ autofs-4.1.4/configure 2005-10-23 11:33:44.000000000 +0800
@@ -842,6 +842,7 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-ext-env disable search in environment for substitution variable
+--disable-mount-locking disable use of locking when spawning mount command
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -4308,6 +4309,23 @@ _ACEOF
fi
#
+# Disable use of locking when spawning mount command
+#
+# Check whether --enable-mount-locking or --disable-mount-locking was given.
+if test "${enable_mount_locking+set}" = set; then
+ enableval="$enable_mount_locking"
+
+else
+ enableval=yes
+fi;
+if test x$enable_mount_locking = xyes -o x$enableval = xyes; then
+ cat >>confdefs.h <<\_ACEOF
+#define ENABLE_MOUNT_LOCKING 1
+_ACEOF
+
+fi
+
+#
# Write Makefile.conf and include/config.h
#
ac_config_headers="$ac_config_headers include/config.h"
diff -Nurp autofs-4.1.4.orig/configure.in autofs-4.1.4/configure.in
--- autofs-4.1.4.orig/configure.in 2005-04-06 23:24:37.000000000 +0800
+++ autofs-4.1.4/configure.in 2005-10-23 11:33:35.000000000 +0800
@@ -167,6 +167,16 @@ if test x$enable_ext_env = xyes; then
fi
#
+# Disable use of locking when spawning mount command
+#
+AC_ARG_ENABLE(mount-locking,
+--disable-mount-locking disable use of locking when spawning mount command,,
+ enableval=yes)
+if test x$enable_mount_locking = xyes -o x$enableval = xyes; then
+ AC_DEFINE(ENABLE_MOUNT_LOCKING, 1)
+fi
+
+#
# Write Makefile.conf and include/config.h
#
AC_CONFIG_HEADER(include/config.h)
diff -Nurp autofs-4.1.4.orig/daemon/spawn.c autofs-4.1.4/daemon/spawn.c
--- autofs-4.1.4.orig/daemon/spawn.c 2005-02-10 20:56:53.000000000 +0800
+++ autofs-4.1.4/daemon/spawn.c 2005-10-23 10:51:10.000000000 +0800
@@ -322,6 +322,7 @@ int spawnl(int logpri, const char *prog,
return do_spawn(logpri, 0, prog, (const char **) argv);
}
+#ifdef ENABLE_MOUNT_LOCKING
int spawnll(int logpri, const char *prog, ...)
{
va_list arg;
@@ -342,3 +343,4 @@ int spawnll(int logpri, const char *prog
return do_spawn(logpri, 1, prog, (const char **) argv);
}
+#endif
diff -Nurp autofs-4.1.4.orig/include/automount.h autofs-4.1.4/include/automount.h
--- autofs-4.1.4.orig/include/automount.h 2005-01-26 21:03:02.000000000 +0800
+++ autofs-4.1.4/include/automount.h 2005-10-23 10:51:10.000000000 +0800
@@ -121,9 +121,13 @@ extern struct autofs_point ap;
int aquire_lock(void);
void release_lock(void);
-int spawnll(int logpri, const char *prog, ...);
int spawnl(int logpri, const char *prog, ...);
-int spawnv(int logpri, const char *prog, const char *const *argv);
+#ifdef ENABLE_MOUNT_LOCKING
+int spawnll(int logpri, const char *prog, ...);
+#else
+#define spawnll spawnl
+#endif
+int spawnv(int ogpri, const char *prog, const char *const *argv);
void reset_signals(void);
void ignore_signals(void);
void discard_pending(int sig);
diff -Nurp autofs-4.1.4.orig/include/config.h.in autofs-4.1.4/include/config.h.in
--- autofs-4.1.4.orig/include/config.h.in 2004-02-03 23:23:21.000000000 +0800
+++ autofs-4.1.4/include/config.h.in 2005-10-23 10:51:10.000000000 +0800
@@ -25,3 +25,5 @@
#undef HAVE_SLOPPY_MOUNT
#undef ENABLE_EXT_ENV
+
+#undef ENABLE_MOUNT_LOCKING
diff -Nurp autofs-4.1.4.orig/patches/util-linux-2.12a-flock.patch autofs-4.1.4/patches/util-linux-2.12a-flock.patch
--- autofs-4.1.4.orig/patches/util-linux-2.12a-flock.patch 1970-01-01 08:00:00.000000000 +0800
+++ autofs-4.1.4/patches/util-linux-2.12a-flock.patch 2005-10-23 10:51:10.000000000 +0800
@@ -0,0 +1,30 @@
+--- util-linux-2.12a/mount/fstab.c.flock 2005-09-17 01:36:03.000000000 +0800
++++ util-linux-2.12a/mount/fstab.c 2005-09-17 01:41:12.000000000 +0800
+@@ -488,7 +488,7 @@ lock_mtab (void) {
+ }
+ /* proceed anyway */
+ }
+- we_created_lockfile = 1;
++ we_created_lockfile = fd;
+ } else {
+ static int tries = 0;
+
+@@ -510,9 +510,8 @@ lock_mtab (void) {
+ MOUNTED_LOCK);
+ sleep(1);
+ }
++ close(fd);
+ }
+-
+- close(fd);
+ }
+ }
+
+@@ -520,6 +519,7 @@ lock_mtab (void) {
+ void
+ unlock_mtab (void) {
+ if (we_created_lockfile) {
++ close(we_created_lockfile);
+ unlink (MOUNTED_LOCK);
+ we_created_lockfile = 0;
+ }
diff -Nurp autofs-4.1.4.orig/patches/util-linux-2.12q-flock.patch autofs-4.1.4/patches/util-linux-2.12q-flock.patch
--- autofs-4.1.4.orig/patches/util-linux-2.12q-flock.patch 1970-01-01 08:00:00.000000000 +0800
+++ autofs-4.1.4/patches/util-linux-2.12q-flock.patch 2005-10-23 10:51:10.000000000 +0800
@@ -0,0 +1,29 @@
+--- util-linux-2.12q/mount/fstab.c.flock 2005-09-17 01:10:37.000000000 +0800
++++ util-linux-2.12q/mount/fstab.c 2005-09-17 01:16:51.000000000 +0800
+@@ -417,6 +417,7 @@
+ unlock_mtab (void) {
+ if (we_created_lockfile) {
+ unlink (MOUNTED_LOCK);
++ close(we_created_lock_file);
+ we_created_lockfile = 0;
+ }
+ }
+@@ -528,6 +529,7 @@
+ }
+ /* proceed anyway */
+ }
++ we_created_lock_file = fd;
+ } else {
+ static int tries = 0;
+
+@@ -549,9 +551,8 @@
+ MOUNTED_LOCK);
+ sleep(1);
+ }
++ close(fd);
+ }
+-
+- close(fd);
+ }
+ }
+
autofs-4.1.4-fix-sort-opts.patch:
auto.net | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
--- NEW FILE autofs-4.1.4-fix-sort-opts.patch ---
--- autofs-4.1.4/samples/auto.net.orig 2005-11-03 19:15:10.000000000 -0500
+++ autofs-4.1.4/samples/auto.net 2005-11-03 19:15:19.000000000 -0500
@@ -37,7 +37,7 @@ done
# Newer distributions get this right
SHOWMOUNT="$SMNT --no-headers -e $key"
-$SHOWMOUNT | LC_ALL=C sort +0 | \
+$SHOWMOUNT | LC_ALL=C sort -k 1 | \
awk -v key="$key" -v opts="$opts" -- '
BEGIN { ORS=""; first=1 }
{ if (first) { print opts; first=0 }; print " \\\n\t" $1, key ":" $1 }
autofs-4.1.4-keylen-length-check.patch:
lookup_file.c | 4 ++++
1 files changed, 4 insertions(+)
--- NEW FILE autofs-4.1.4-keylen-length-check.patch ---
Fix a buffer overflow with large key lengths.
-Jeff
diff -Nurp autofs-4.1.4.orig/modules/lookup_file.c autofs-4.1.4/modules/lookup_file.c
--- autofs-4.1.4.orig/modules/lookup_file.c 2005-04-06 23:14:23.000000000 +0800
+++ autofs-4.1.4/modules/lookup_file.c 2005-05-07 17:27:30.000000000 +0800
@@ -157,6 +157,10 @@ static int read_one(FILE *f, char *key,
break;
case st_compare:
+ if (kptr - key > KEY_MAX_LEN) {
+ state = st_badent;
+ break;
+ }
if (ch == '\n')
state = st_begin;
else if (isspace(ch) && !escape) {
autofs-4.1.4-locking-fix.patch:
daemon/spawn.c | 17 ++++++++++-------
lib/lock.c | 8 ++++----
2 files changed, 14 insertions(+), 11 deletions(-)
--- NEW FILE autofs-4.1.4-locking-fix.patch ---
This patch fixes two things.
First, sloppy error handling when spawning a sub task.
Second, if the process receives a signal while waiting on the lock
file it will return a "timed out" error after only a little more
than a tenth of a second. This was due to the wait time variable
not being reset after each tenth of a second wait.
diff -Nurp autofs-4.1.4.orig/daemon/spawn.c autofs-4.1.4/daemon/spawn.c
--- autofs-4.1.4.orig/daemon/spawn.c 2005-02-10 20:56:53.000000000 +0800
+++ autofs-4.1.4/daemon/spawn.c 2005-11-01 18:36:35.000000000 +0800
@@ -214,14 +214,15 @@ static int do_spawn(int logpri, int use_
sigfillset(&allsignals);
sigprocmask(SIG_BLOCK, &allsignals, &oldsig);
- if (pipe(pipefd))
+ if (pipe(pipefd)) {
+ if (use_lock)
+ release_lock();
+ sigprocmask(SIG_SETMASK, &oldsig, NULL);
return -1;
+ }
f = fork();
- if (f < 0) {
- sigprocmask(SIG_SETMASK, &oldsig, NULL);
- return -1;
- } else if (f == 0) {
+ if (f == 0) {
reset_signals();
close(pipefd[0]);
dup2(pipefd[1], STDOUT_FILENO);
@@ -243,6 +244,8 @@ static int do_spawn(int logpri, int use_
if (f < 0) {
close(pipefd[0]);
+ if (use_lock)
+ release_lock();
sigprocmask(SIG_SETMASK, &oldsig, NULL);
return -1;
}
@@ -287,11 +290,11 @@ static int do_spawn(int logpri, int use_
if (waitpid(f, &status, 0) != f)
status = -1; /* waitpid() failed */
- sigprocmask(SIG_SETMASK, &oldsig, NULL);
-
if (use_lock)
release_lock();
+ sigprocmask(SIG_SETMASK, &oldsig, NULL);
+
return status;
}
}
diff -Nurp autofs-4.1.4.orig/lib/lock.c autofs-4.1.4/lib/lock.c
--- autofs-4.1.4.orig/lib/lock.c 2005-01-17 23:09:28.000000000 +0800
+++ autofs-4.1.4/lib/lock.c 2005-11-01 20:12:28.000000000 +0800
@@ -208,9 +208,6 @@ void release_lock(void)
*/
static int wait_for_lockf(const char *lockf)
{
- struct timespec t = { 0, WAIT_INTERVAL };
- struct timespec r;
- int ts_size = sizeof(struct timespec);
int tries = WAIT_TRIES;
int status = 0;
struct stat st;
@@ -218,10 +215,13 @@ static int wait_for_lockf(const char *lo
while (tries-- && !status) {
status = stat(lockf, &st);
if (!status) {
+ struct timespec t = { 0, WAIT_INTERVAL };
+ struct timespec r;
+
while (nanosleep(&t, &r) == -1 && errno == EINTR) {
if (got_term)
return 0;
- memcpy(&t, &r, ts_size);
+ memcpy(&t, &r, sizeof(struct timespec));
}
}
}
autofs-4.1.4-multi-parse-fix.patch:
parse_sun.c | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
--- NEW FILE autofs-4.1.4-multi-parse-fix.patch ---
diff -Nurp autofs-4.1.4.orig/modules/parse_sun.c autofs-4.1.4/modules/parse_sun.c
--- autofs-4.1.4.orig/modules/parse_sun.c 2005-04-05 20:42:42.000000000 +0800
+++ autofs-4.1.4/modules/parse_sun.c 2005-04-25 10:00:13.000000000 +0800
@@ -766,7 +766,16 @@ static int check_is_multi(const char *ma
{
const char *p = (char *) mapent;
int multi = 0;
- int first_chunk = 0;
+ int not_first_chunk = 0;
+
+ if (!p) {
+ crit("check_is_multi: unexpected NULL map entry pointer");
+ return 0;
+ }
+
+ /* If first character is "/" it's a multi-mount */
+ if (*p == '/')
+ return 1;
while (*p) {
p = skipspace(p);
@@ -779,7 +788,7 @@ static int check_is_multi(const char *ma
* path that begins with '/' indicates a mutil-mount
* entry.
*/
- if (first_chunk) {
+ if (not_first_chunk) {
if (*p == '/' || *p == '-') {
multi = 1;
break;
@@ -796,7 +805,7 @@ static int check_is_multi(const char *ma
* after which it's a multi mount.
*/
p += chunklen(p, check_colon(p));
- first_chunk++;
+ not_first_chunk++;
}
return multi;
@@ -883,7 +892,12 @@ int parse_mount(const char *root, const
return 1;
}
- path = dequote(p, l = chunklen(p, 0));
+ if (*p != '/') {
+ l = 0;
+ path = dequote("/", 1);
+ } else
+ path = dequote(p, l = chunklen(p, 0));
+
if (!path) {
error(MODPREFIX "out of memory");
free(myoptions);
autofs-4.1.4-no-slash-misc.patch:
auto.master | 1 -
1 files changed, 1 deletion(-)
--- NEW FILE autofs-4.1.4-no-slash-misc.patch ---
--- autofs-4.1.4/samples/auto.master.orig 2005-11-17 08:42:36.000000000 -0500
+++ autofs-4.1.4/samples/auto.master 2005-11-17 08:42:42.000000000 -0500
@@ -7,5 +7,4 @@
# For details of the format look at autofs(5).
#/misc /etc/auto.misc --timeout=60
#/smb /etc/auto.smb
-/misc /etc/auto.misc
/net /etc/auto.net
autofs-4.1.4-reentrant-syslog-copyright.patch:
COPYRIGHT | 36 +++++++++++++++++++++++++++++++++++-
1 files changed, 35 insertions(+), 1 deletion(-)
--- NEW FILE autofs-4.1.4-reentrant-syslog-copyright.patch ---
--- autofs-4.1.4/COPYRIGHT.reentrant-syslog-copyright 2006-01-15 23:24:04.000000000 -0500
+++ autofs-4.1.4/COPYRIGHT 2006-01-15 23:24:46.000000000 -0500
@@ -14,4 +14,38 @@
GNU General Public License for more details.
Portions Copyright (C) 1999-2000 Jeremy Fitzhardinge
-Portions Copyright (C) 2001-2003 Ian Kent
+Portions Copyright (C) 2001-2005 Ian Kent
+
+The files lib/syslog.c and include/syslog.h are licenced under the
+BSD License and require that a copy of the notice ibelow be included in
+accompanying documentation and be distributed with binary distributions
+of the code, so be sure to include this file along with any binary
+distributions derived from this source package.
+
+Copyright (c) 1983, 1988, 1993
+ The Regents of the University of California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
autofs-4.1.4-reentrant-syslog.patch:
daemon/automount.c | 72 ++++--
include/automount.h | 27 ++
include/syslog.h | 201 ++++++++++++++++
lib/Makefile | 5
lib/syslog.c | 383 ++++++++++++++++++++++++++++++++
lib/vsprintf.c | 619 ++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 1289 insertions(+), 18 deletions(-)
--- NEW FILE autofs-4.1.4-reentrant-syslog.patch ---
--- autofs-4.1.4/daemon/automount.c.orig 2005-03-06 04:43:55.000000000 -0500
+++ autofs-4.1.4/daemon/automount.c 2005-10-26 13:25:25.000000000 -0400
@@ -38,13 +38,32 @@
#include <sys/poll.h>
#include <linux/auto_fs4.h>
+#include "automount.h"
+
#ifndef NDEBUG
-#define assert(x) do { if (!(x)) { syslog(LOG_CRIT, __FILE__ ":%d: assertion failed: " #x, __LINE__); } } while(0)
+#define assert(x) \
+ do { \
+ if (!(x)) { \
+ crit(__FILE__ ":%d: assertion failed: " #x, \
+ __LINE__); \
+ } \
+ } while(0)
#else
#define assert(x) do { } while(0)
#endif
-#include "automount.h"
+#ifndef NDEBUG
+#define assert_r(context, x) \
+ do { \
+ if (!(x)) { \
+ crit_r(context, \
+ __FILE__ ":%d: assertion failed: ",\
+ __LINE__); \
+ } \
+ } while(0)
+#else
+#define assert_r(context, x) do { } while(0)
+#endif
const char *program; /* Initialized with argv[0] */
const char *version = VERSION_STRING; /* Program version */
@@ -67,6 +86,9 @@ sigset_t sigchld_mask;
struct autofs_point ap;
+/* re-entrant syslog default context data */
+#define AUTOFS_SYSLOG_CONTEXT {-1, 0, 0, LOG_PID, (const char *)0, LOG_DAEMON, 0xff}
+
volatile struct pending_mount *junk_mounts = NULL;
#define CHECK_RATIO 4 /* exp_runfreq = exp_timeout/CHECK_RATIO */
@@ -480,19 +502,25 @@ static int mount_autofs(char *path)
static void nextstate(enum states next)
{
+ static struct syslog_data syslog_context = AUTOFS_SYSLOG_CONTEXT;
+ static struct syslog_data *slc = &syslog_context;
+
if (write(ap.state_pipe[1], &next, sizeof(next)) != sizeof(next))
- error("nextstate: write failed %m");
+ error_r(slc, "nextstate: write failed %m");
}
/* Deal with all the signal-driven events in the state machine */
static void sig_statemachine(int sig)
{
+ static struct syslog_data syslog_context = AUTOFS_SYSLOG_CONTEXT;
+ static struct syslog_data *slc = &syslog_context;
int save_errno = errno;
enum states next = ap.state;
switch (sig) {
default: /* all the "can't happen" signals */
- error("process %d got unexpected signal %d!", getpid(), sig);
+ error_r(slc, "process %d got unexpected signal %d!",
+ getpid(), sig);
break;
/* don't FALLTHROUGH */
@@ -518,18 +546,21 @@ static void sig_statemachine(int sig)
break;
}
- debug("sig %d switching from %d to %d", sig, ap.state, next);
+ debug_r(slc, "sig %d switching from %d to %d", sig, ap.state, next);
errno = save_errno;
}
static int send_ready(unsigned int wait_queue_token)
{
+ static struct syslog_data syslog_context = AUTOFS_SYSLOG_CONTEXT;
+ static struct syslog_data *slc = &syslog_context;
+
if (wait_queue_token == 0)
return 0;
- debug("send_ready: token=%d\n", wait_queue_token);
+ debug_r(slc, "send_ready: token=%d\n", wait_queue_token);
if (ioctl(ap.ioctlfd, AUTOFS_IOC_READY, wait_queue_token) < 0) {
- error("AUTOFS_IOC_READY: %m");
+ error_r(slc, "AUTOFS_IOC_READY: %m");
return 1;
}
return 0;
@@ -537,11 +568,14 @@ static int send_ready(unsigned int wait_
static int send_fail(unsigned int wait_queue_token)
{
+ static struct syslog_data syslog_context = AUTOFS_SYSLOG_CONTEXT;
+ static struct syslog_data *slc = &syslog_context;
+
if (wait_queue_token == 0)
return 0;
- debug("send_fail: token=%d\n", wait_queue_token);
+ debug_r(slc, "send_fail: token=%d\n", wait_queue_token);
if (ioctl(ap.ioctlfd, AUTOFS_IOC_FAIL, wait_queue_token) < 0) {
- syslog(LOG_ERR, "AUTOFS_IOC_FAIL: %m");
+ error_r(slc, "AUTOFS_IOC_FAIL: %m");
return 1;
}
return 0;
@@ -552,6 +586,8 @@ static int send_fail(unsigned int wait_q
result. */
static enum states handle_child(int hang)
{
+ static struct syslog_data syslog_context = AUTOFS_SYSLOG_CONTEXT;
+ static struct syslog_data *slc = &syslog_context;
pid_t pid;
int status;
enum states next = ST_INVAL;
@@ -559,7 +595,7 @@ static enum states handle_child(int hang
while ((pid = waitpid(-1, &status, hang ? 0 : WNOHANG)) > 0) {
struct pending_mount volatile *mt, *volatile *mtp;
- debug("handle_child: got pid %d, sig %d (%d), stat %d\n",
+ debug_r(slc, "handle_child: got pid %d, sig %d (%d), stat %d",
pid, WIFSIGNALED(status),
WTERMSIG(status), WEXITSTATUS(status));
@@ -605,18 +641,19 @@ static enum states handle_child(int hang
}
/* Failed shutdown returns to ready */
- warn("can't shutdown: filesystem %s still busy",
- ap.path);
+ warn_r(slc,
+ "can't shutdown: filesystem %s still busy",
+ ap.path);
alarm(ap.exp_runfreq);
next = ST_READY;
break;
default:
- error("bad state %d", ap.state);
+ error_r(slc, "bad state %d", ap.state);
}
if (next != ST_INVAL)
- debug("sigchld: exp "
+ debug_r(slc, "sigchld: exp "
"%d finished, switching from %d to %d",
pid, ap.state, next);
@@ -632,7 +669,7 @@ static enum states handle_child(int hang
if (!WIFEXITED(status) && !WIFSIGNALED(status))
break;
- debug("sig_child: found pending iop pid %d: "
+ debug_r(slc, "sig_child: found pending iop pid %d: "
"signalled %d (sig %d), exit status %d",
pid, WIFSIGNALED(status),
WTERMSIG(status), WEXITSTATUS(status));
@@ -1485,11 +1522,14 @@ static void setup_signals(__sighandler_t
/* Deal with the signals recieved by direct mount supervisor */
static void sig_supervisor(int sig)
{
+ static struct syslog_data syslog_context = AUTOFS_SYSLOG_CONTEXT;
+ static struct syslog_data *slc = &syslog_context;
int save_errno = errno;
switch (sig) {
default: /* all the signals not handled */
- error("process %d got unexpected signal %d!", getpid(), sig);
+ error_r(slc, "process %d got unexpected signal %d!",
+ getpid(), sig);
return;
/* don't FALLTHROUGH */
--- autofs-4.1.4/include/automount.h.orig 2005-01-26 08:03:02.000000000 -0500
+++ autofs-4.1.4/include/automount.h 2005-10-26 13:24:14.000000000 -0400
@@ -15,6 +15,9 @@
#include <time.h>
#include "config.h"
+/* OpenBSD re-entrant syslog */
+#include "syslog.h"
+
/* We MUST have the paths to mount(8) and umount(8) */
#ifndef HAVE_MOUNT
#error Failed to locate mount(8)!
@@ -302,5 +305,29 @@ if (do_verbose || do_debug) \
if (do_debug) \
syslog(LOG_DEBUG, msg, ##args);
+/* Define reentrant logging macros for signal handlers */
+
+#define debug_r(context, msg, args...) \
+do { \
+ if (do_debug) \
+ syslog_r(LOG_DEBUG, context, msg, ##args); \
+} while (0)
+
+#define warn_r(context, msg, args...) \
+do { \
+ if (do_verbose || do_debug) \
+ syslog_r(LOG_WARNING, context, msg, ##args); \
+} while (0)
+
+#define error_r(context, msg, args...) \
+do { \
+ syslog_r(LOG_ERR, context, msg, ##args); \
+} while (0)
+
+#define crit_r(context, msg, args...) \
+do { \
+ syslog_r(LOG_CRIT, context, msg, ##args); \
+} while (0)
+
#endif
--- /dev/null 2005-10-26 07:34:27.808601500 -0400
+++ autofs-4.1.4/include/syslog.h 2005-10-26 13:24:14.000000000 -0400
@@ -0,0 +1,201 @@
+/* $OpenBSD: syslog.h,v 1.11 2003/08/24 01:27:07 avsm Exp $ */
+/* $NetBSD: syslog.h,v 1.14 1996/04/03 20:46:44 christos Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)syslog.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_SYSLOG_H_
+#define _SYS_SYSLOG_H_
+
+#include <features.h>
+#define __need___va_list
+#include <stdarg.h>
+
+#define _PATH_LOG "/dev/log"
+
+/*
+ * priorities/facilities are encoded into a single 32-bit quantity, where the
+ * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
+ * (0-big number). Both the priorities and the facilities map roughly
+ * one-to-one to strings in the syslogd(8) source code. This mapping is
+ * included in this file.
+ *
+ * priorities (these are ordered)
+ */
+#define LOG_EMERG 0 /* system is unusable */
+#define LOG_ALERT 1 /* action must be taken immediately */
+#define LOG_CRIT 2 /* critical conditions */
+#define LOG_ERR 3 /* error conditions */
+#define LOG_WARNING 4 /* warning conditions */
+#define LOG_NOTICE 5 /* normal but significant condition */
+#define LOG_INFO 6 /* informational */
+#define LOG_DEBUG 7 /* debug-level messages */
+
+#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
+ /* extract priority */
+#define LOG_PRI(p) ((p) & LOG_PRIMASK)
+#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
+
+#ifdef SYSLOG_NAMES
+#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */
+ /* mark "facility" */
+#define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0)
+typedef struct _code {
+ char *c_name;
+ int c_val;
+} CODE;
+
+CODE prioritynames[] = {
+ { "alert", LOG_ALERT },
+ { "crit", LOG_CRIT },
+ { "debug", LOG_DEBUG },
+ { "emerg", LOG_EMERG },
+ { "err", LOG_ERR },
+ { "error", LOG_ERR }, /* DEPRECATED */
+ { "info", LOG_INFO },
+ { "none", INTERNAL_NOPRI }, /* INTERNAL */
+ { "notice", LOG_NOTICE },
+ { "panic", LOG_EMERG }, /* DEPRECATED */
+ { "warn", LOG_WARNING }, /* DEPRECATED */
+ { "warning", LOG_WARNING },
+ { NULL, -1 },
+};
+#endif
+
+/* facility codes */
+#define LOG_KERN (0<<3) /* kernel messages */
+#define LOG_USER (1<<3) /* random user-level messages */
+#define LOG_MAIL (2<<3) /* mail system */
+#define LOG_DAEMON (3<<3) /* system daemons */
+#define LOG_AUTH (4<<3) /* security/authorization messages */
+#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
+#define LOG_LPR (6<<3) /* line printer subsystem */
+#define LOG_NEWS (7<<3) /* network news subsystem */
+#define LOG_UUCP (8<<3) /* UUCP subsystem */
+#define LOG_CRON (9<<3) /* clock daemon */
+#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */
+#define LOG_FTP (11<<3) /* ftp daemon */
+
+ /* other codes through 15 reserved for system use */
+#define LOG_LOCAL0 (16<<3) /* reserved for local use */
+#define LOG_LOCAL1 (17<<3) /* reserved for local use */
+#define LOG_LOCAL2 (18<<3) /* reserved for local use */
+#define LOG_LOCAL3 (19<<3) /* reserved for local use */
+#define LOG_LOCAL4 (20<<3) /* reserved for local use */
+#define LOG_LOCAL5 (21<<3) /* reserved for local use */
+#define LOG_LOCAL6 (22<<3) /* reserved for local use */
+#define LOG_LOCAL7 (23<<3) /* reserved for local use */
+
+#define LOG_NFACILITIES 24 /* current number of facilities */
+#define LOG_FACMASK 0x03f8 /* mask to extract facility part */
+ /* facility of pri */
+#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
+
+#ifdef SYSLOG_NAMES
+CODE facilitynames[] = {
+ { "auth", LOG_AUTH },
+ { "authpriv", LOG_AUTHPRIV },
+ { "cron", LOG_CRON },
+ { "daemon", LOG_DAEMON },
+ { "ftp", LOG_FTP },
+ { "kern", LOG_KERN },
+ { "lpr", LOG_LPR },
+ { "mail", LOG_MAIL },
+ { "mark", INTERNAL_MARK }, /* INTERNAL */
+ { "news", LOG_NEWS },
+ { "security", LOG_AUTH }, /* DEPRECATED */
+ { "syslog", LOG_SYSLOG },
+ { "user", LOG_USER },
+ { "uucp", LOG_UUCP },
+ { "local0", LOG_LOCAL0 },
+ { "local1", LOG_LOCAL1 },
+ { "local2", LOG_LOCAL2 },
+ { "local3", LOG_LOCAL3 },
+ { "local4", LOG_LOCAL4 },
+ { "local5", LOG_LOCAL5 },
+ { "local6", LOG_LOCAL6 },
+ { "local7", LOG_LOCAL7 },
+ { NULL, -1 },
+};
+#endif
+
+/* Used by reentrant functions */
+
+struct syslog_data {
+ int log_file;
+ int connected;
+ int opened;
+ int log_stat;
+ const char *log_tag;
+ int log_fac;
+ int log_mask;
+};
+
+#define SYSLOG_DATA_INIT {-1, 0, 0, 0, (const char *)0, LOG_USER, 0xff}
+
+/*
+ * arguments to setlogmask.
+ */
+#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */
+#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */
+
+/*
+ * Option flags for openlog.
+ *
+ * LOG_ODELAY no longer does anything.
+ * LOG_NDELAY is the inverse of what it used to be.
+ */
+#define LOG_PID 0x01 /* log the pid with each message */
+#define LOG_CONS 0x02 /* log on the console if errors in sending */
+#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
+#define LOG_NDELAY 0x08 /* don't delay open */
+#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
+#define LOG_PERROR 0x20 /* log to stderr as well */
+
+__BEGIN_DECLS
+void closelog(void);
+void openlog(const char *__ident, int __option, int __facility);
+int setlogmask(int __mask);
+void syslog(int __pri, const char *__fmt, ...)
+ __attribute__((__format__(__printf__, 2, 3)));
+void vsyslog(int __pri, const char *, __gnuc_va_list __ap)
+ __attribute__((__format__(__printf__, 2, 0)));
+void closelog_r(struct syslog_data *__data);
+void openlog_r(const char *__ident, int __option, int __facility, struct syslog_data *__data);
+int setlogmask_r(int __mask, struct syslog_data *__data);
+void syslog_r(int __pri, struct syslog_data *__data, const char *__fmt, ...)
+ __attribute__((__format__(__printf__, 3, 4)));
+void vsyslog_r(int __pri, struct syslog_data *__data, const char *__fmt, __gnuc_va_list __ap)
+ __attribute__((__format__(__printf__, 3, 0)));
+__END_DECLS
+
+#endif /* !_SYS_SYSLOG_H_ */
+
--- autofs-4.1.4/lib/Makefile.orig 2005-01-09 04:16:43.000000000 -0500
+++ autofs-4.1.4/lib/Makefile 2005-10-26 13:26:59.000000000 -0400
@@ -9,10 +9,11 @@ include ../Makefile.rules
RPCGEN = /usr/bin/rpcgen
RANLIB = /usr/bin/ranlib
-SRCS = cache.c listmount.c cat_path.c rpc_subs.c mounts.c lock.c
+SRCS = cache.c listmount.c cat_path.c rpc_subs.c mounts.c lock.c syslog.c \
+ vsprintf.c
RPCS = mount.h mount_clnt.c mount_xdr.c
OBJS = cache.o mount_clnt.o mount_xdr.o listmount.o \
- cat_path.o rpc_subs.o mounts.o lock.o
+ cat_path.o rpc_subs.o mounts.o lock.o syslog.o vsprintf.o
LIB = autofs.a
--- /dev/null 2005-10-26 07:34:27.808601500 -0400
+++ autofs-4.1.4/lib/syslog.c 2005-10-26 13:24:14.000000000 -0400
@@ -0,0 +1,383 @@
+#ident "$Id: syslog.c,v 1.1 2005/05/01 09:48:34 raven Exp $"
+/*
+ * Copyright (c) 1983, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+#include <sys/un.h>
+#include <netdb.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <stdarg.h>
+
+#include "syslog.h"
+
+#define TBUF_LEN 2048
+#define FMT_LEN 1024
+#define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
+
+#define DEC() \
+ do { \
+ if (prlen < 0) \
+ prlen = 0; \
+ if (prlen >= tbuf_left) \
+ prlen = tbuf_left - 1; \
+ p += prlen; \
+ tbuf_left -= prlen; \
+ } while (0)
+
+/* Use our internal printf routines */
+extern int snprintf_int(char * buf, size_t size, const char * fmt, ...)
+ __attribute__ ((format (printf, 3, 4)));
+extern int vsnprintf_int(char *buf, size_t size, const char *fmt, va_list args)
+ __attribute__ ((format (printf, 3, 0)));
+
+static struct syslog_data sdata = SYSLOG_DATA_INIT;
+static int LogType = SOCK_DGRAM; /* type of socket connection */
+
+extern char *__progname; /* Program name, from crt0. */
+
+static void disconnectlog_r(struct syslog_data *); /* disconnect from syslogd */
+static void connectlog_r(struct syslog_data *); /* (re)connect to syslogd */
+
+/*
+ * syslog, vsyslog --
+ * print message on log file; output is intended for syslogd(8).
+ */
+void
+syslog(int pri, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsyslog(pri, fmt, ap);
+ va_end(ap);
+}
+
+void
+vsyslog(int pri, const char *fmt, va_list ap)
+{
+ vsyslog_r(pri, &sdata, fmt, ap);
+}
+
+void
+openlog(const char *ident, int logstat, int logfac)
+{
+ openlog_r(ident, logstat, logfac, &sdata);
+}
+
+void
+closelog(void)
+{
+ closelog_r(&sdata);
+}
+
+/* setlogmask -- set the log mask level */
+int
+setlogmask(int pmask)
+{
+ return setlogmask_r(pmask, &sdata);
+}
+
+/* Reentrant version of syslog, i.e. syslog_r() */
+
+void
+syslog_r(int pri, struct syslog_data *data, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsyslog_r(pri, data, fmt, ap);
+ va_end(ap);
+}
+
+void
+vsyslog_r(int pri, struct syslog_data *data, const char *fmt, va_list ap)
+{
+ int cnt;
+ char ch, *p, *t;
+ time_t now;
+ int fd, saved_errno, error;
+ char *stdp = NULL, tbuf[TBUF_LEN], fmt_cpy[FMT_LEN];
+ int tbuf_left, fmt_left, prlen;
+
+ /* Check for invalid bits. */
+ if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) {
+ if (data == &sdata) {
+ syslog(INTERNALLOG,
+ "syslog: unknown facility/priority: %x", pri);
+ } else {
+ syslog_r(INTERNALLOG, data,
+ "syslog_r: unknown facility/priority: %x", pri);
+ }
+ pri &= LOG_PRIMASK|LOG_FACMASK;
+ }
+
+ /* Check priority against setlogmask values. */
+ if (!(LOG_MASK(LOG_PRI(pri)) & data->log_mask))
+ return;
+
+ saved_errno = errno;
+
+ /* Set default facility if none specified. */
+ if ((pri & LOG_FACMASK) == 0)
+ pri |= data->log_fac;
+
+ /* If we have been called through syslog(), no need for reentrancy. */
+ if (data == &sdata)
+ (void)time(&now);
+
+ p = tbuf;
+ tbuf_left = TBUF_LEN;
+
+ prlen = snprintf_int(p, tbuf_left, "<%d>", pri);
+ DEC();
+
+ /*
+ * syslogd will expand time automagically for reentrant case, and
+ * for normal case, just do like before
+ */
+ if (data == &sdata) {
+ prlen = strftime(p, tbuf_left, "%h %e %T ", localtime(&now));
+ DEC();
+ }
+
+ if (data->log_stat & LOG_PERROR)
+ stdp = p;
+ if (data->log_tag == NULL)
+ data->log_tag = __progname;
+ if (data->log_tag != NULL) {
+ prlen = snprintf_int(p, tbuf_left, "%s", data->log_tag);
+ DEC();
+ }
+ if (data->log_stat & LOG_PID) {
+ prlen = snprintf_int(p, tbuf_left, "[%ld]", (long)getpid());
+ DEC();
+ }
+ if (data->log_tag != NULL) {
+ if (tbuf_left > 1) {
+ *p++ = ':';
+ tbuf_left--;
+ }
+ if (tbuf_left > 1) {
+ *p++ = ' ';
+ tbuf_left--;
+ }
+ }
+
+ /* strerror() is not reentrant */
+
+ for (t = fmt_cpy, fmt_left = FMT_LEN; (ch = *fmt); ++fmt) {
+ if (ch == '%' && fmt[1] == 'm') {
+ ++fmt;
+ if (data == &sdata) {
+ prlen = snprintf_int(t, fmt_left, "%s",
+ strerror(saved_errno));
+ } else {
+ prlen = snprintf_int(t, fmt_left, "Error %d",
+ saved_errno);
+ }
+ if (prlen < 0)
+ prlen = 0;
+ if (prlen >= fmt_left)
+ prlen = fmt_left - 1;
+ t += prlen;
+ fmt_left -= prlen;
+ } else if (ch == '%' && fmt[1] == '%' && fmt_left > 2) {
+ *t++ = '%';
+ *t++ = '%';
+ fmt++;
+ fmt_left -= 2;
+ } else {
+ if (fmt_left > 1) {
+ *t++ = ch;
+ fmt_left--;
+ }
+ }
+ }
+ *t = '\0';
+
+ prlen = vsnprintf_int(p, tbuf_left, fmt_cpy, ap);
+ DEC();
+ cnt = p - tbuf;
+
+ /* Output to stderr if requested. */
+ if (data->log_stat & LOG_PERROR) {
+ struct iovec iov[2];
+
+ iov[0].iov_base = stdp;
+ iov[0].iov_len = cnt - (stdp - tbuf);
+ iov[1].iov_base = "\n";
+ iov[1].iov_len = 1;
+ (void)writev(STDERR_FILENO, iov, 2);
+ }
+
+ /* Get connected, output the message to the local logger. */
+ if (!data->opened)
+ openlog_r(data->log_tag, data->log_stat, 0, data);
+ connectlog_r(data);
+
+ /* If we have a SOCK_STREAM connection, also send ASCII NUL as
+ a record terminator. */
+ if (LogType == SOCK_STREAM)
+ cnt++;
+
+ /*
+ * If the send() failed, there are two likely scenarios:
+ * 1) syslogd was restarted
+ * 2) /dev/log is out of socket buffer space
+ * We attempt to reconnect to /dev/log to take care of
+ * case #1 and keep send()ing data to cover case #2
+ * to give syslogd a chance to empty its socket buffer.
+ */
+ if ((error = send(data->log_file, tbuf, cnt, 0)) < 0) {
+ if (errno != ENOBUFS) {
+ disconnectlog_r(data);
+ connectlog_r(data);
+ }
+ do {
+ usleep(1);
+ if ((error = send(data->log_file, tbuf, cnt, 0)) >= 0)
+ break;
+ } while (errno == ENOBUFS);
+ }
+
+ /*
+ * Output the message to the console; try not to block
+ * as a blocking console should not stop other processes.
+ * Make sure the error reported is the one from the syslogd failure.
+ */
+ if (error == -1 && (data->log_stat & LOG_CONS) &&
+ (fd = open(_PATH_CONSOLE, O_WRONLY|O_NONBLOCK, 0)) >= 0) {
+ struct iovec iov[2];
+
+ p = strchr(tbuf, '>') + 1;
+ iov[0].iov_base = p;
+ iov[0].iov_len = cnt - (p - tbuf);
+ iov[1].iov_base = "\r\n";
+ iov[1].iov_len = 2;
+ (void)writev(fd, iov, 2);
+ (void)close(fd);
+ }
+
+ if (data != &sdata)
+ closelog_r(data);
+}
+
+static void
+disconnectlog_r(struct syslog_data *data)
+{
+ /*
+ * If the user closed the FD and opened another in the same slot,
+ * that's their problem. They should close it before calling on
+ * system services.
+ */
+ if (data->log_file != -1) {
+ close(data->log_file);
+ data->log_file = -1;
+ }
+ data->connected = 0; /* retry connect */
+}
+
+static void
+connectlog_r(struct syslog_data *data)
+{
+ struct sockaddr_un SyslogAddr; /* AF_UNIX address of local logger */
+
+again:
+ if (data->log_file == -1) {
+ if ((data->log_file = socket(AF_UNIX, LogType, 0)) == -1)
+ return;
+ (void)fcntl(data->log_file, F_SETFD, 1);
+ }
+ if (data->log_file != -1 && !data->connected) {
+ int old_errno;
+
+ memset(&SyslogAddr, '\0', sizeof(SyslogAddr));
+ SyslogAddr.sun_family = AF_UNIX;
+ strncpy(SyslogAddr.sun_path, _PATH_LOG,
+ sizeof(SyslogAddr.sun_path));
+ old_errno = errno;
+ if (connect(data->log_file, (struct sockaddr *)&SyslogAddr,
+ sizeof(SyslogAddr)) == -1) {
+ int save_errno = errno;
+ (void)close(data->log_file);
+ data->log_file = -1;
+ if (LogType == SOCK_DGRAM && save_errno == EPROTOTYPE) {
+ /* retry with SOCK_STREAM */
+ LogType = SOCK_STREAM;
+ errno = old_errno;
+ goto again;
+ }
+ } else
+ data->connected = 1;
+ }
+}
+
+void
+openlog_r(const char *ident, int logstat, int logfac, struct syslog_data *data)
+{
+ if (ident != NULL)
+ data->log_tag = ident;
+ data->log_stat = logstat;
+ if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0)
+ data->log_fac = logfac;
+
+ if (data->log_stat & LOG_NDELAY) /* open immediately */
+ connectlog_r(data);
+
+ data->opened = 1; /* ident and facility has been set */
+}
+
+void
+closelog_r(struct syslog_data *data)
+{
+ (void)close(data->log_file);
+ data->log_file = -1;
+ data->connected = 0;
+ data->log_tag = NULL;
+}
+
+/* setlogmask -- set the log mask level */
+int
+setlogmask_r(int pmask, struct syslog_data *data)
+{
+ int omask;
+
+ omask = data->log_mask;
+ if (pmask != 0)
+ data->log_mask = pmask;
+ return (omask);
+}
--- /dev/null 2005-10-26 07:34:27.808601500 -0400
+++ autofs-4.1.4/lib/vsprintf.c 2005-10-26 13:24:14.000000000 -0400
@@ -0,0 +1,619 @@
+#ident "$Id: vsprintf.c,v 1.1 2005/05/01 09:48:34 raven Exp $"
+/*
+ * Stolen from the linux kernel.
+ *
+ * License: GPL
+ */
+/*------------------ Original Copyright -----------------*/
+/*
+ * linux/lib/vsprintf.c
+ *
+ * Copyright (C) 1991, 1992 Linus Torvalds
+ */
+
+/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
+/*
+ * Wirzenius wrote this portably, Torvalds fucked it up :-)
+ */
+
+/*
+ * Fri Jul 13 2001 Crutcher Dunnavant <crutcher+kernel at datastacks.com>
+ * - changed to provide snprintf and vsnprintf functions
+ * So Feb 1 16:51:32 CET 2004 Juergen Quade <quade at hsnr.de>
+ * - scnprintf and vscnprintf
+ */
+
+/* Also copied from: */
+
+/*
+ * linux/lib/string.c
+ *
+ * Copyright (C) 1991, 1992 Linus Torvalds
+ */
+
+/*
+ * stupid library routines.. The optimized versions should generally be found
+ * as inline code in <asm-xx/string.h>
+ *
+ * These are buggy as well..
+ *
+ * * Fri Jun 25 1999, Ingo Oeser <ioe at informatik.tu-chemnitz.de>
+ * - Added strsep() which will replace strtok() soon (because strsep() is
+ * reentrant and should be faster). Use only strsep() in new code, please.
+ *
+ * * Sat Feb 09 2002, Jason Thomas <jason at topic.com.au>,
+ * Matthew Hawkins <matt at mh.dropbear.id.au>
+ * - Kissed strtok() goodbye
+ */
+/*-------------------------------------------------------*/
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#define BITS_PER_LONG __WORDSIZE
+#define PAGE_SIZE getpagesize()
+
+
+#if BITS_PER_LONG == 64
+
+# define do_div(n,base) ({ \
+ uint32_t __base = (base); \
+ uint32_t __rem; \
+ __rem = ((uint64_t)(n)) % __base; \
+ (n) = ((uint64_t)(n)) / __base; \
+ __rem; \
+ })
+
+#elif BITS_PER_LONG == 32
+
+/* Not needed on 64bit architectures */
+uint32_t __div64_32(uint64_t *n, uint32_t base)
+{
+ uint64_t rem = *n;
+ uint64_t b = base;
+ uint64_t res, d = 1;
+ uint32_t high = rem >> 32;
+
+ /* Reduce the thing a bit first */
+ res = 0;
+ if (high >= base) {
+ high /= base;
+ res = (uint64_t) high << 32;
+ rem -= (uint64_t) (high*base) << 32;
+ }
+
+ while ((int64_t)b > 0 && b < rem) {
+ b = b+b;
+ d = d+d;
+ }
+
+ do {
+ if (rem >= b) {
+ rem -= b;
+ res += d;
+ }
+ b >>= 1;
+ d >>= 1;
+ } while (d);
+
+ *n = res;
+ return rem;
+}
+
+/* The unnecessary pointer compare is there
+ * to check for type safety (n must be 64bit)
+ */
+# define do_div(n,base) ({ \
+ uint32_t __base = (base); \
+ uint32_t __rem; \
+ (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
+ if (((n) >> 32) == 0) { \
+ __rem = (uint32_t)(n) % __base; \
+ (n) = (uint32_t)(n) / __base; \
+ } else \
+ __rem = __div64_32(&(n), __base); \
+ __rem; \
+ })
+
+# else
+
+# error do_div() does not yet support the C64
+
+#endif /* BITS_PER_LONG */
+
+
+/**
+ * strnlen - Find the length of a length-limited string
+ * @s: The string to be sized
+ * @count: The maximum number of bytes to search
+ */
+size_t strnlen(const char * s, size_t count)
+{
+ const char *sc;
+
+ for (sc = s; count-- && *sc != '\0'; ++sc)
+ /* nothing */;
+ return sc - s;
+}
+
+/**
+ * simple_strtoul - convert a string to an unsigned long
+ * @cp: The start of the string
+ * @endp: A pointer to the end of the parsed string will be placed here
+ * @base: The number base to use
+ */
+unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
+{
+ unsigned long result = 0,value;
+
+ if (!base) {
+ base = 10;
+ if (*cp == '0') {
+ base = 8;
+ cp++;
+ if ((toupper(*cp) == 'X') && isxdigit(cp[1])) {
+ cp++;
+ base = 16;
+ }
+ }
+ } else if (base == 16) {
+ if (cp[0] == '0' && toupper(cp[1]) == 'X')
+ cp += 2;
+ }
+ while (isxdigit(*cp) &&
+ (value = isdigit(*cp) ? *cp-'0' : toupper(*cp)-'A'+10) < base) {
+ result = result*base + value;
+ cp++;
+ }
+ if (endp)
+ *endp = (char *)cp;
+ return result;
+}
+
+/**
+ * simple_strtol - convert a string to a signed long
+ * @cp: The start of the string
+ * @endp: A pointer to the end of the parsed string will be placed here
+ * @base: The number base to use
+ */
+long simple_strtol(const char *cp,char **endp,unsigned int base)
+{
+ if(*cp=='-')
+ return -simple_strtoul(cp+1,endp,base);
+ return simple_strtoul(cp,endp,base);
+}
+
+/**
+ * simple_strtoull - convert a string to an unsigned long long
+ * @cp: The start of the string
+ * @endp: A pointer to the end of the parsed string will be placed here
+ * @base: The number base to use
+ */
+unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base)
+{
+ unsigned long long result = 0,value;
+
+ if (!base) {
+ base = 10;
+ if (*cp == '0') {
+ base = 8;
+ cp++;
+ if ((toupper(*cp) == 'X') && isxdigit(cp[1])) {
+ cp++;
+ base = 16;
+ }
+ }
+ } else if (base == 16) {
+ if (cp[0] == '0' && toupper(cp[1]) == 'X')
+ cp += 2;
+ }
+ while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
+ ? toupper(*cp) : *cp)-'A'+10) < base) {
+ result = result*base + value;
+ cp++;
+ }
+ if (endp)
+ *endp = (char *)cp;
+ return result;
+}
+
+/**
+ * simple_strtoll - convert a string to a signed long long
+ * @cp: The start of the string
+ * @endp: A pointer to the end of the parsed string will be placed here
+ * @base: The number base to use
+ */
+long long simple_strtoll(const char *cp,char **endp,unsigned int base)
+{
+ if(*cp=='-')
+ return -simple_strtoull(cp+1,endp,base);
+ return simple_strtoull(cp,endp,base);
+}
+
+static int skip_atoi(const char **s)
+{
+ int i=0;
+
+ while (isdigit(**s))
+ i = i*10 + *((*s)++) - '0';
+ return i;
+}
+
+#define ZEROPAD 1 /* pad with zero */
+#define SIGN 2 /* unsigned/signed long */
+#define PLUS 4 /* show plus */
+#define SPACE 8 /* space if plus */
+#define LEFT 16 /* left justified */
+#define SPECIAL 32 /* 0x */
+#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
+
+static char * number(char * buf, char * end, unsigned long long num, int base, int size, int precision, int type)
+{
+ char c,sign,tmp[66];
+ const char *digits;
+ static const char small_digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
+ static const char large_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ int i;
+
+ digits = (type & LARGE) ? large_digits : small_digits;
+ if (type & LEFT)
+ type &= ~ZEROPAD;
+ if (base < 2 || base > 36)
+ return NULL;
+ c = (type & ZEROPAD) ? '0' : ' ';
+ sign = 0;
+ if (type & SIGN) {
+ if ((signed long long) num < 0) {
+ sign = '-';
+ num = - (signed long long) num;
+ size--;
+ } else if (type & PLUS) {
+ sign = '+';
+ size--;
+ } else if (type & SPACE) {
+ sign = ' ';
+ size--;
+ }
+ }
+ if (type & SPECIAL) {
+ if (base == 16)
+ size -= 2;
+ else if (base == 8)
+ size--;
+ }
+ i = 0;
+ if (num == 0)
+ tmp[i++]='0';
+ else while (num != 0)
+ tmp[i++] = digits[do_div(num,base)];
+ if (i > precision)
+ precision = i;
+ size -= precision;
+ if (!(type&(ZEROPAD+LEFT))) {
+ while(size-->0) {
+ if (buf <= end)
+ *buf = ' ';
+ ++buf;
+ }
+ }
+ if (sign) {
+ if (buf <= end)
+ *buf = sign;
+ ++buf;
+ }
+ if (type & SPECIAL) {
+ if (base==8) {
+ if (buf <= end)
+ *buf = '0';
+ ++buf;
+ } else if (base==16) {
+ if (buf <= end)
+ *buf = '0';
+ ++buf;
+ if (buf <= end)
+ *buf = digits[33];
+ ++buf;
+ }
+ }
+ if (!(type & LEFT)) {
+ while (size-- > 0) {
+ if (buf <= end)
+ *buf = c;
+ ++buf;
+ }
+ }
+ while (i < precision--) {
+ if (buf <= end)
+ *buf = '0';
+ ++buf;
+ }
+ while (i-- > 0) {
+ if (buf <= end)
+ *buf = tmp[i];
+ ++buf;
+ }
+ while (size-- > 0) {
+ if (buf <= end)
+ *buf = ' ';
+ ++buf;
+ }
+ return buf;
+}
+
+/**
+ * vsnprintf_int - Format a string and place it in a buffer
+ * @buf: The buffer to place the result into
+ * @size: The size of the buffer, including the trailing null space
+ * @fmt: The format string to use
+ * @args: Arguments for the format string
+ *
+ * The return value is the number of characters which would
+ * be generated for the given input, excluding the trailing
+ * '\0', as per ISO C99. If you want to have the exact
+ * number of characters written into @buf as return value
+ * (not including the trailing '\0'), use vscnprintf. If the
+ * return is greater than or equal to @size, the resulting
+ * string is truncated.
+ *
+ * Call this function if you are already dealing with a va_list.
+ * You probably want snprintf instead.
+ */
+int vsnprintf_int(char *buf, size_t size, const char *fmt, va_list args)
+{
+ int len;
+ unsigned long long num;
+ int i, base;
+ char *str, *end, c;
+ const char *s;
+
+ int flags; /* flags to number() */
+
+ int field_width; /* width of output field */
+ int precision; /* min. # of digits for integers; max
+ number of chars for from string */
+ int qualifier; /* 'h', 'l', or 'L' for integer fields */
+ /* 'z' support added 23/7/1999 S.H. */
+ /* 'z' changed to 'Z' --davidm 1/25/99 */
+
+ /* Reject out-of-range values early */
+ if ((int) size < 0)
+ return 0;
+
+ str = buf;
+ end = buf + size - 1;
+
+ if (end < buf - 1) {
+ end = ((void *) -1);
+ size = end - buf + 1;
+ }
+
+ for (; *fmt ; ++fmt) {
+ if (*fmt != '%') {
+ if (str <= end)
+ *str = *fmt;
+ ++str;
+ continue;
+ }
+
+ /* process flags */
+ flags = 0;
+ repeat:
+ ++fmt; /* this also skips first '%' */
+ switch (*fmt) {
+ case '-': flags |= LEFT; goto repeat;
+ case '+': flags |= PLUS; goto repeat;
+ case ' ': flags |= SPACE; goto repeat;
+ case '#': flags |= SPECIAL; goto repeat;
+ case '0': flags |= ZEROPAD; goto repeat;
+ }
+
+ /* get field width */
+ field_width = -1;
+ if (isdigit(*fmt))
+ field_width = skip_atoi(&fmt);
+ else if (*fmt == '*') {
+ ++fmt;
+ /* it's the next argument */
+ field_width = va_arg(args, int);
+ if (field_width < 0) {
+ field_width = -field_width;
+ flags |= LEFT;
+ }
+ }
+
+ /* get the precision */
+ precision = -1;
+ if (*fmt == '.') {
+ ++fmt;
+ if (isdigit(*fmt))
+ precision = skip_atoi(&fmt);
+ else if (*fmt == '*') {
+ ++fmt;
+ /* it's the next argument */
+ precision = va_arg(args, int);
+ }
+ if (precision < 0)
+ precision = 0;
+ }
+
+ /* get the conversion qualifier */
+ qualifier = -1;
+ if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' ||
+ *fmt =='Z' || *fmt == 'z') {
+ qualifier = *fmt;
+ ++fmt;
+ if (qualifier == 'l' && *fmt == 'l') {
+ qualifier = 'L';
+ ++fmt;
+ }
+ }
+
+ /* default base */
+ base = 10;
+
+ switch (*fmt) {
+ case 'c':
+ if (!(flags & LEFT)) {
+ while (--field_width > 0) {
+ if (str <= end)
+ *str = ' ';
+ ++str;
+ }
+ }
+ c = (unsigned char) va_arg(args, int);
+ if (str <= end)
+ *str = c;
+ ++str;
+ while (--field_width > 0) {
+ if (str <= end)
+ *str = ' ';
+ ++str;
+ }
+ continue;
+
+ case 's':
+ s = va_arg(args, char *);
+ if ((unsigned long)s < PAGE_SIZE)
+ s = "<NULL>";
+
+ len = strnlen(s, precision);
+
+ if (!(flags & LEFT)) {
+ while (len < field_width--) {
+ if (str <= end)
+ *str = ' ';
+ ++str;
+ }
+ }
+ for (i = 0; i < len; ++i) {
+ if (str <= end)
+ *str = *s;
+ ++str; ++s;
+ }
+ while (len < field_width--) {
+ if (str <= end)
+ *str = ' ';
+ ++str;
+ }
+ continue;
+
+ case 'p':
+ if (field_width == -1) {
+ field_width = 2*sizeof(void *);
+ flags |= ZEROPAD;
+ }
+ str = number(str, end,
+ (unsigned long) va_arg(args, void *),
+ 16, field_width, precision, flags);
+ continue;
+
+
+ case 'n':
+ /* FIXME:
+ * What does C99 say about the overflow case here? */
+ if (qualifier == 'l') {
+ long * ip = va_arg(args, long *);
+ *ip = (str - buf);
+ } else if (qualifier == 'Z' || qualifier == 'z') {
+ size_t * ip = va_arg(args, size_t *);
+ *ip = (str - buf);
+ } else {
+ int * ip = va_arg(args, int *);
+ *ip = (str - buf);
+ }
+ continue;
+
+ case '%':
+ if (str <= end)
+ *str = '%';
+ ++str;
+ continue;
+
+ /* integer number formats - set up the flags and "break" */
+ case 'o':
+ base = 8;
+ break;
+
+ case 'X':
+ flags |= LARGE;
+ case 'x':
+ base = 16;
+ break;
+
+ case 'd':
+ case 'i':
+ flags |= SIGN;
+ case 'u':
+ break;
+
+ default:
+ if (str <= end)
+ *str = '%';
+ ++str;
+ if (*fmt) {
+ if (str <= end)
+ *str = *fmt;
+ ++str;
+ } else {
+ --fmt;
+ }
+ continue;
+ }
+ if (qualifier == 'L')
+ num = va_arg(args, long long);
+ else if (qualifier == 'l') {
+ num = va_arg(args, unsigned long);
+ if (flags & SIGN)
+ num = (signed long) num;
+ } else if (qualifier == 'Z' || qualifier == 'z') {
+ num = va_arg(args, size_t);
+ } else if (qualifier == 'h') {
+ num = (unsigned short) va_arg(args, int);
+ if (flags & SIGN)
+ num = (signed short) num;
+ } else {
+ num = va_arg(args, unsigned int);
+ if (flags & SIGN)
+ num = (signed int) num;
+ }
+ str = number(str, end, num, base,
+ field_width, precision, flags);
+ }
+ if (str <= end)
+ *str = '\0';
+ else if (size > 0)
+ /* don't write out a null byte if the buf size is zero */
+ *end = '\0';
+ /* the trailing null byte doesn't count towards the total
+ * ++str;
+ */
+ return str-buf;
+}
+
+/**
+ * snprintf_int - Format a string and place it in a buffer
+ * @buf: The buffer to place the result into
+ * @size: The size of the buffer, including the trailing null space
+ * @fmt: The format string to use
+ * @...: Arguments for the format string
+ *
+ * The return value is the number of characters which would be
+ * generated for the given input, excluding the trailing null,
+ * as per ISO C99. If the return is greater than or equal to
+ * @size, the resulting string is truncated.
+ */
+int snprintf_int(char * buf, size_t size, const char *fmt, ...)
+{
+ va_list args;
+ int i;
+
+ va_start(args, fmt);
+ i=vsnprintf_int(buf,size,fmt,args);
+ va_end(args);
+ return i;
+}
+
autofs-4.1.4-sockopt-len-type.patch:
lib/rpc_subs.c | 3 ++-
modules/mount_nfs.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
--- NEW FILE autofs-4.1.4-sockopt-len-type.patch ---
--- autofs-4.1.4/lib/rpc_subs.c.sockopt-len-type 2006-01-18 06:51:52.000000000 -0500
+++ autofs-4.1.4/lib/rpc_subs.c 2006-01-18 06:55:17.000000000 -0500
@@ -105,7 +105,8 @@
*/
static int connect_nb(int fd, struct sockaddr_in *addr, struct timeval *tout)
{
- int flags, ret, len;
+ int flags, ret;
+ socklen_t len;
fd_set wset, rset;
flags = fcntl(fd, F_GETFL, 0);
--- autofs-4.1.4/modules/mount_nfs.c.sockopt-len-type 2006-01-18 06:51:03.000000000 -0500
+++ autofs-4.1.4/modules/mount_nfs.c 2006-01-18 06:54:30.000000000 -0500
@@ -71,7 +71,7 @@
{
struct sockaddr_in src_addr, local_addr;
int src_len = sizeof(src_addr);
- int local_len = sizeof(local_addr);
+ socklen_t local_len = sizeof(local_addr);
int sock, ret;
sock = socket(AF_INET, SOCK_DGRAM, udpproto);
autofs-4.1.4-sol10-schema.patch:
modules/lookup_ldap.c | 52 ++++++++++++++++++++++---------
samples/autofs-ldap-auto-master.c | 62 ++++++++++++++++++++++----------------
2 files changed, 73 insertions(+), 41 deletions(-)
--- NEW FILE autofs-4.1.4-sol10-schema.patch ---
--- autofs-4.1.4/modules/lookup_ldap.c.sol10-schema 2005-02-27 00:37:14.000000000 -0500
+++ autofs-4.1.4/modules/lookup_ldap.c 2006-01-16 21:39:59.000000000 -0500
@@ -201,6 +201,7 @@
char **values = NULL;
char *attrs[] = { key, type, NULL };
LDAP *ldap;
+ int found_entry = 0;
if (ctxt == NULL) {
crit(MODPREFIX "context was NULL");
@@ -267,6 +268,8 @@
continue;
}
+ found_entry = 1;
+
values = ldap_get_values(ldap, e, type);
if (!values) {
info(MODPREFIX "no %s defined for %s", type, query);
@@ -297,28 +300,42 @@
ldap_msgfree(result);
ldap_unbind(ldap);
- return 1;
+ if (found_entry)
+ return 1;
+ else
+ return 0;
}
static int read_map(const char *root, struct lookup_context *ctxt,
const char *key, int keyvallen, time_t age, int *result_ldap)
{
- int rv1 = LDAP_SUCCESS, rv2 = LDAP_SUCCESS;
+ int rv = LDAP_SUCCESS;
int ret;
/* all else fails read entire map */
ret = read_one_map(root, "nisObject", "cn",
- key, keyvallen, "nisMapEntry", ctxt, age, &rv1);
- if (ret)
- goto ret_ok;
+ key, keyvallen, "nisMapEntry", ctxt, age, &rv);
+ if (ret) {
+ if (rv == LDAP_SUCCESS)
+ goto ret_ok;
+ }
ret = read_one_map(root, "automount", "cn", key, keyvallen,
- "automountInformation", ctxt, age, &rv2);
- if (ret)
- goto ret_ok;
+ "automountInformation", ctxt, age, &rv);
+ if (ret) {
+ if (rv == LDAP_SUCCESS)
+ goto ret_ok;
+ }
+
+ ret = read_one_map(root, "automount", "automountKey", key, keyvallen,
+ "automountInformation", ctxt, age, &rv);
+ if (ret) {
+ if (rv == LDAP_SUCCESS)
+ goto ret_ok;
+ }
if (result_ldap)
- *result_ldap = (rv1 == LDAP_SUCCESS ? rv2 : rv1);
+ *result_ldap = rv;
return 0;
@@ -593,7 +610,7 @@
int lookup_mount(const char *root, const char *name, int name_len, void *context)
{
struct lookup_context *ctxt = (struct lookup_context *) context;
- int ret, ret2;
+ int ret, ret2, ret3;
char key[KEY_MAX_LEN + 1];
int key_len;
char mapent[MAPENT_MAX_LEN + 1];
@@ -614,10 +631,12 @@
ret = lookup_one(root, key, "nisObject", "cn", "nisMapEntry", ctxt);
ret2 = lookup_one(root, key,
"automount", "cn", "automountInformation", ctxt);
+ ret3 = lookup_one(root, key,
+ "automount", "automountKey", "automountInformation", ctxt);
- debug("ret = %d, ret2 = %d", ret, ret2);
+ debug("ret = %d, ret2 = %d ret3 = %d", ret, ret2, ret3);
- if (!ret && !ret2)
+ if (!ret && !ret2 && ret3)
return 1;
me = cache_lookup_first();
@@ -625,10 +644,11 @@
if (t_last_read > ap.exp_runfreq)
if ((ret & (CHE_MISSING | CHE_UPDATED)) &&
- (ret2 & (CHE_MISSING | CHE_UPDATED)))
+ (ret2 & (CHE_MISSING | CHE_UPDATED)) &&
+ (ret3 & (CHE_MISSING | CHE_UPDATED)))
need_hup = 1;
- if (ret == CHE_MISSING && ret2 == CHE_MISSING) {
+ if (ret == CHE_MISSING && ret2 == CHE_MISSING && ret3 == CHE_MISSING) {
int wild = CHE_MISSING;
/* Maybe update wild card map entry */
@@ -637,10 +657,12 @@
"cn", "nisMapEntry", ctxt);
ret2 = lookup_wild(root, "automount",
"cn", "automountInformation", ctxt);
+ ret3 = lookup_wild(root, "automount", "automountKey",
+ "automountInformation", ctxt);
wild = (ret & (CHE_MISSING | CHE_FAIL)) &&
(ret2 & (CHE_MISSING | CHE_FAIL));
- if (ret & CHE_MISSING && ret2 & CHE_MISSING)
+ if (ret & CHE_MISSING && ret2 & CHE_MISSING && ret3 & CHE_MISSING)
cache_delete(root, "*", 0);
}
--- autofs-4.1.4/samples/autofs-ldap-auto-master.c.sol10-schema 2006-01-16 21:35:07.000000000 -0500
+++ autofs-4.1.4/samples/autofs-ldap-auto-master.c 2006-01-16 21:36:07.000000000 -0500
@@ -159,7 +159,7 @@
{
LDAP *ld = NULL;
int result;
- int c, mapset = 0;
+ int c, mapset = 0, default_schema = 1;
const char *map_key = MAPKEY, *entry_key = ENTRYKEY, *value = VALUE;
const char *map_oc = MAPOC, *entry_oc = ENTRYOC;
const char *map = MAP;
@@ -173,23 +173,27 @@
/* This is the object class we expect maps to
* have. The default is MAPOC. */
map_oc = optarg;
+ default_schema = 0;
break;
case 'e':
/* This is the object class we entries in the
* map to be in. The default is ENTRYOC. */
entry_oc = optarg;
+ default_schema = 0;
break;
case 'n':
/* This is the attribute which we use as the
* key when looking up maps. Usually we use
* MAP_KEY. */
map_key = optarg;
+ default_schema = 0;
break;
case 'k':
/* This is the attribute which we use as the
* key when looking up entries. Usually we use
* ENTRY_KEY. */
entry_key = optarg;
+ default_schema = 0;
break;
case 'v':
/* This is the attribute which we treat as
@@ -197,6 +201,7 @@
* look up a map. Usually this is the
* VALUE attribute. */
value = optarg;
+ default_schema = 0;
break;
default:
fprintf(stderr, "syntax: %s\n"
@@ -245,31 +250,36 @@
return 2;
}
- /* Try to dump the map given the preferred or user-supplied schema. */
- if(!dump_map(ld, map, map_oc, entry_oc, map_key, entry_key, value) &&
- (mapset || !dump_map(ld, "auto_master", map_oc, entry_oc, map_key,
- entry_key, value))) {
- if(strcmp(map_oc, "automountMap") ||
- strcmp(entry_oc, "automount") ||
- strcmp(map_key, "ou") ||
- strcmp(entry_key, "cn") ||
- strcmp(value, "automountInformation")) {
- if (!dump_map(ld,
- map,
- "automountMap",
- "automount",
- "ou",
- "cn",
- "automountInformation") && !mapset)
- dump_map(ld,
- "auto_master",
- "automountMap",
- "automount",
- "ou",
- "cn",
- "automountInformation");
- }
- }
+ /* Try to dump the map given the preferred or user-supplied schema.
+
+ Behavior should be as follows:
+ If the user specifies their own schema (ie. setting the map
+ object class) we try to obtain a map for their settings and if they
+ don't specify a map key, we also check 'auto_master' as the map key.
+ If we don't find a map, then we return nothing.
+
+ If the user doesn't specify their own schema, we try all known
+ schemas with map names of 'auto.master' & 'auto_master', unless
+ a map name has been specified on the command line. If a map name
+ is specified on the command line then we try all known schemas
+ with that map name.
+ */
+
+ if (dump_map(ld, map, map_oc, entry_oc, map_key,
+ entry_key, value));
+ else if (!mapset && dump_map(ld, "auto_master", map_oc, entry_oc,
+ map_key, entry_key, value));
+ else if (!default_schema);
+ else if (dump_map(ld, map, "automountMap","automount","ou",
+ "cn","automountInformation"));
+ else if (!mapset && dump_map(ld, "auto_master", "automountMap",
+ "automount","ou","cn",
+ "automountInformation"));
+ else if (dump_map(ld, map, "automountMap","automount","automountMapName",
+ "automountKey","automountInformation"));
+ else if (!mapset && dump_map(ld, "auto_master", "automountMap",
+ "automount","automountMapName",
+ "automountKey", "automountInformation"));
/* Close the connection to the server and quit. */
ldap_unbind(ld);
autofs-4.1.4-solaris-hosts-in-auto-master.patch:
rc.autofs.in | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
Index: autofs-4.1.4-solaris-hosts-in-auto-master.patch
===================================================================
RCS file: autofs-4.1.4-solaris-hosts-in-auto-master.patch
diff -N autofs-4.1.4-solaris-hosts-in-auto-master.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ autofs-4.1.4-solaris-hosts-in-auto-master.patch 19 Jan 2006 01:23:50 -0000 1.2
@@ -0,0 +1,11 @@
+--- autofs-4.1.4/samples/rc.autofs.in.orig 2005-04-27 09:58:55.000000000 -0400
++++ autofs-4.1.4/samples/rc.autofs.in 2005-04-27 09:59:18.000000000 -0400
+@@ -233,7 +233,7 @@ function getmounts()
+ dir=`echo "$dir" | sed -e "s/\/*$//"`
+
+ if [ ! -z "$map" -a "$map" = "-hosts" ] ; then
+- continue
++ map="/etc/auto.net"
+ fi
+
+ if [ $DISABLE_DIRECT -eq 1 \
autofs-4.1.4-sun-parse-fixes.patch:
parse_sun.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+)
--- NEW FILE autofs-4.1.4-sun-parse-fixes.patch ---
diff -Nurp autofs-4.1.4.orig/modules/parse_sun.c autofs-4.1.4/modules/parse_sun.c
--- autofs-4.1.4.orig/modules/parse_sun.c 2005-05-07 17:39:44.000000000 +0800
+++ autofs-4.1.4/modules/parse_sun.c 2005-05-07 17:35:27.000000000 +0800
@@ -680,6 +680,10 @@ static int sun_mount(const char *root, c
"mounting root %s, mountpoint %s, what %s, fstype %s, options %s\n",
root, mountpoint, what, fstype, options);
+ /* A malformed entry of the form key /xyz will trigger this case */
+ if (!what || *what == '\0')
+ return 1;
+
if (!strcmp(fstype, "nfs")) {
rv = mount_nfs->mount_mount(root, mountpoint, strlen(mountpoint),
what, fstype, options, mount_nfs->context);
@@ -695,6 +699,18 @@ static int sun_mount(const char *root, c
return rv;
}
+static int key_exists(struct multi_mnt *list, char *path, int pathlen)
+{
+ struct multi_mnt *mmptr = list;
+
+ while (mmptr && pathlen == strlen(mmptr->path)) {
+ if (!strncmp(mmptr->path, path, pathlen))
+ return 1;
+ mmptr = mmptr->next;
+ }
+ return 0;
+}
+
/*
* Build list of mounts in shortest -> longest order.
* Pass in list head and return list head.
@@ -725,6 +741,12 @@ struct multi_mnt *multi_add_list(struct
mmptr = mmptr->next;
}
+ /* if a multimount entry has duplicate keys, it is invalid */
+ if (key_exists(mmptr, path, plen)) {
+ free(new);
+ return NULL;
+ }
+
if (old)
old->next = new;
new->next = mmptr;
autofs-4.1.4-yp_order-order-type.patch:
nsswitch.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
--- NEW FILE autofs-4.1.4-yp_order-order-type.patch ---
--- autofs-4.1.4/lib/nsswitch.c.yp_order-order-type 2006-01-17 05:53:25.000000000 -0500
+++ autofs-4.1.4/lib/nsswitch.c 2006-01-17 05:53:37.000000000 -0500
@@ -138,7 +138,7 @@
{
int err;
char *domainname;
- int order;
+ unsigned int order;
if ((err = yp_get_default_domain(&domainname)) != YPERR_SUCCESS) {
error (MODPREFIX "unable to get default yp domain");
autofs-4.1.4-check-nsswitch-submount.patch:
include/automount.h | 8 ++
lib/Makefile | 4 -
lib/nsswitch.c | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/Makefile | 4 +
modules/parse_sun.c | 32 +++++-----
5 files changed, 183 insertions(+), 19 deletions(-)
Index: autofs-4.1.4-check-nsswitch-submount.patch
===================================================================
RCS file: /cvs/dist/rpms/autofs/FC-4/autofs-4.1.4-check-nsswitch-submount.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- autofs-4.1.4-check-nsswitch-submount.patch 14 Apr 2005 02:30:56 -0000 1.2
+++ autofs-4.1.4-check-nsswitch-submount.patch 19 Jan 2006 01:23:50 -0000 1.3
@@ -1,6 +1,6 @@
---- autofs-4.1.4/include/automount.h.orig 2005-04-13 20:54:52.749944144 -0400
-+++ autofs-4.1.4/include/automount.h 2005-04-13 20:56:21.850398816 -0400
-@@ -282,6 +282,14 @@ int is_mounted(const char *table, const
+--- autofs-4.1.4/include/automount.h.orig 2005-10-26 15:05:08.000000000 -0400
++++ autofs-4.1.4/include/automount.h 2005-10-26 15:05:25.000000000 -0400
+@@ -285,6 +285,14 @@ int is_mounted(const char *table, const
int has_fstab_option(const char *path, const char *opt);
int allow_owner_mount(const char *);
@@ -15,8 +15,8 @@
/* log notification */
extern int do_verbose;
extern int do_debug;
---- autofs-4.1.4/lib/nsswitch.c.orig 2005-04-13 20:54:25.405101192 -0400
-+++ autofs-4.1.4/lib/nsswitch.c 2005-04-13 20:54:07.827773352 -0400
+--- autofs-4.1.4/lib/nsswitch.c.orig 2005-10-26 15:05:08.000000000 -0400
++++ autofs-4.1.4/lib/nsswitch.c 2005-10-26 15:05:25.000000000 -0400
@@ -0,0 +1,154 @@
+#include <stdio.h>
+#include <stdlib.h>
@@ -172,23 +172,23 @@
+
+ return 1;
+}
---- autofs-4.1.4/lib/Makefile.orig 2005-04-13 20:55:00.260802320 -0400
-+++ autofs-4.1.4/lib/Makefile 2005-04-13 20:56:21.850398816 -0400
-@@ -9,10 +9,10 @@ include ../Makefile.rules
- RPCGEN = /usr/bin/rpcgen
+--- autofs-4.1.4/lib/Makefile.orig 2005-10-26 15:05:08.000000000 -0400
++++ autofs-4.1.4/lib/Makefile 2005-10-26 15:05:36.000000000 -0400
+@@ -10,10 +10,10 @@ RPCGEN = /usr/bin/rpcgen
RANLIB = /usr/bin/ranlib
--SRCS = cache.c listmount.c cat_path.c rpc_subs.c mounts.c lock.c
-+SRCS = cache.c listmount.c cat_path.c rpc_subs.c mounts.c lock.c nsswitch.c
+ SRCS = cache.c listmount.c cat_path.c rpc_subs.c mounts.c lock.c syslog.c \
+- vsprintf.c
++ vsprintf.c nsswitch.c
RPCS = mount.h mount_clnt.c mount_xdr.c
OBJS = cache.o mount_clnt.o mount_xdr.o listmount.o \
-- cat_path.o rpc_subs.o mounts.o lock.o
-+ cat_path.o rpc_subs.o mounts.o lock.o nsswitch.o
+- cat_path.o rpc_subs.o mounts.o lock.o syslog.o vsprintf.o
++ cat_path.o rpc_subs.o mounts.o lock.o syslog.o vsprintf.o nsswitch.o
LIB = autofs.a
---- autofs-4.1.4/modules/parse_sun.c.orig 2005-04-13 20:55:18.508028320 -0400
-+++ autofs-4.1.4/modules/parse_sun.c 2005-04-13 20:56:21.852398512 -0400
+--- autofs-4.1.4/modules/parse_sun.c.orig 2005-10-26 15:05:08.000000000 -0400
++++ autofs-4.1.4/modules/parse_sun.c 2005-10-26 15:05:25.000000000 -0400
@@ -566,6 +566,8 @@ static int sun_mount(const char *root, c
int rv;
char *mountpoint;
@@ -237,8 +237,8 @@
} else {
what = alloca(loclen + 1);
memcpy(what, loc, loclen);
---- autofs-4.1.4/modules/Makefile.orig 2005-04-13 20:55:31.997977536 -0400
-+++ autofs-4.1.4/modules/Makefile 2005-04-13 20:56:21.851398664 -0400
+--- autofs-4.1.4/modules/Makefile.orig 2005-10-26 15:05:08.000000000 -0400
++++ autofs-4.1.4/modules/Makefile 2005-10-26 15:05:25.000000000 -0400
@@ -86,3 +86,7 @@ lookup_ldap.so: lookup_ldap.c
$(CC) $(SOLDFLAGS) $(CFLAGS) $(LDAP_FLAGS) -o lookup_ldap.so \
lookup_ldap.c $(AUTOFS_LIB) $(LIBLDAP)
Index: autofs.spec
===================================================================
RCS file: /cvs/dist/rpms/autofs/FC-4/autofs.spec,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- autofs.spec 4 May 2005 19:31:39 -0000 1.64
+++ autofs.spec 19 Jan 2006 01:23:50 -0000 1.65
@@ -4,24 +4,35 @@
Summary: A tool for automatically mounting and unmounting filesystems.
Name: autofs
%define version 4.1.4
-%define release 8
+%define release 15
Version: %{version}
Release: %{release}
Epoch: 1
License: GPL
Group: System Environment/Daemons
Source: ftp://ftp.kernel.org/pub/linux/daemons/autofs/v4/autofs-%{version}.tar.bz2
-Patch1: autofs-4.1.4-init-redhat-only.patch
-Patch2: autofs-4.1.4-init-nsswitch-comment.patch
-Patch3: autofs-4.1.4-init-one-auto-master.patch
-Patch4: autofs-4.1.4-init-browse-as-non-first-option.patch
-Patch5: autofs-4.1.4-hesiod-bind.patch
-Patch6: autofs-4.1.4-non-replicated-ping.patch
-Patch7: autofs-4.1.4-check-nsswitch-submount.patch
-Patch8: autofs-4.1.3-alt-master-ldap.patch
-Patch9: autofs-4.1.4-check-is-multi.patch
-Patch10: autofs-4.1.4-cache-update-race-fix.patch
-Patch11: autofs-4.1.4-deferred-syslog.patch
+Patch1: autofs-4.1.4-reentrant-syslog.patch
+Patch2: autofs-4.1.4-reentrant-syslog-copyright.patch
+Patch3: autofs-4.1.4-init-nsswitch-comment.patch
+Patch4: autofs-4.1.4-init-one-auto-master.patch
+Patch5: autofs-4.1.4-init-browse-as-non-first-option.patch
+Patch6: autofs-4.1.4-hesiod-bind.patch
+Patch7: autofs-4.1.4-non-replicated-ping.patch
+Patch8: autofs-4.1.4-check-nsswitch-submount.patch
+Patch9: autofs-4.1.3-alt-master-ldap.patch
+Patch10: autofs-4.1.4-multi-parse-fix.patch
+Patch11: autofs-4.1.4-cache-update-race-fix.patch
+Patch12: autofs-4.1.4-solaris-hosts-in-auto-master.patch
+Patch13: autofs-4.1.4-keylen-length-check.patch
+Patch14: autofs-4.1.4-sun-parse-fixes.patch
+Patch15: autofs-4.1.4-check-return-of-is-local-addr.patch
+Patch16: autofs-4.1.4-fix-sort-opts.patch
+Patch17: autofs-4.1.4-no-slash-misc.patch
+Patch18: autofs-4.1.4-locking-fix.patch
+Patch19: autofs-4.1.4-configureable-locking.patch
+Patch20: autofs-4.1.4-sol10-schema.patch
+Patch21: autofs-4.1.4-sockopt-len-type.patch
+Patch22: autofs-4.1.4-yp_order-order-type.patch
Buildroot: /var/tmp/autofs-tmp
BuildPrereq: autoconf, hesiod-devel, openldap-devel, perl
@@ -72,6 +83,17 @@
%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
%build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -125,6 +147,18 @@
%{_libdir}/autofs/*
%changelog
+* Tue Jan 17 2006 Ian Kent <ikent at redhat.com> - 1:4.1.4-15
+- Sync patches with rawhide.
+- Replace deferred syslog patch with reentrant syslog patch.
+- Update copyright declaration for reentrant-syslog source.
+- Replace check-is-multi with more general multi-parse-fix.
+- Add fix for premature return when waiting for lock file.
+- Add patch for configure option to disable locking during mount.
+ But don't disable locking by default.
+- Add ability to handle automount schema used in Sun directory server.
+- Quell compiler warning about getsockopt parameter.
+- Quell compiler warning about yp_order parameter.
+
* Wed May 4 2005 Jeff Moyer <jmoyer at redhat.com> - 1:4.1.4-8
- Add in the deferred syslog patch. This fixes a hung automounter issue
related to unsafe calls to syslog in signal handler context.
--- autofs-4.1.4-deferred-syslog.patch DELETED ---
--- autofs-4.1.4-init-redhat-only.patch DELETED ---
More information about the fedora-cvs-commits
mailing list