diff --git a/CHANGELOG b/CHANGELOG index 02a975d..2ffaba6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,7 @@ - cthon cleanup and corrections. - cthon more cleanup and corrections. - cthon correction to host validation. +- cthon fix submount operation broken by above. 13/7/2006 autofs-5.0.1 rc1 -------------------------- diff --git a/daemon/mount.c b/daemon/mount.c index 723c2f9..59f8f44 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -22,6 +22,8 @@ #include #include #include "automount.h" +#define ERR_PREFIX "(mount):" + /* These filesystems are known not to work with the "generic" module */ /* Note: starting with Samba 2.0.6, smbfs is handled generically. */ static char *not_generic[] = { "nfs", "userfs", "afs", "autofs", @@ -36,14 +38,14 @@ int do_mount(struct autofs_point *ap, co char **ngp; int rv; - mod = open_mount(modstr = fstype, NULL); + mod = open_mount(modstr = fstype, ERR_PREFIX); if (!mod) { for (ngp = not_generic; *ngp; ngp++) { if (!strcmp(fstype, *ngp)) break; } if (!*ngp) - mod = open_mount(modstr = "generic", NULL); + mod = open_mount(modstr = "generic", ERR_PREFIX); if (!mod) { error(ap->logopt, "cannot find mount method for filesystem %s", diff --git a/lib/parse_subs.c b/lib/parse_subs.c index d5efb8b..ab5de39 100644 --- a/lib/parse_subs.c +++ b/lib/parse_subs.c @@ -53,6 +53,10 @@ int check_colon(const char *str) { char *ptr = (char *) str; + /* Colon escape */ + if (*ptr == ':') + return 1; + while (*ptr && *ptr != ':' && *ptr != '/') { ptr++; } diff --git a/modules/mount_autofs.c b/modules/mount_autofs.c index af28c5c..768bcbf 100644 --- a/modules/mount_autofs.c +++ b/modules/mount_autofs.c @@ -33,7 +33,7 @@ #define MODPREFIX "mount(autofs): " /* Attribute to create detached thread */ extern pthread_attr_t thread_attr; -extern struct startup_cond sc; +extern struct startup_cond suc; int mount_version = AUTOFS_MOUNT_VERSION; /* Required by protocol */ @@ -189,7 +189,7 @@ int mount_mount(struct autofs_point *ap, return 1; } - status = pthread_mutex_lock(&sc.mutex); + status = pthread_mutex_lock(&suc.mutex); if (status) { crit(ap->logopt, MODPREFIX "failed to lock startup condition mutex!"); @@ -198,8 +198,8 @@ int mount_mount(struct autofs_point *ap, return 1; } - sc.done = 0; - sc.status = 0; + suc.done = 0; + suc.status = 0; pthread_mutex_lock(&ap->mounts_mutex); @@ -209,7 +209,7 @@ int mount_mount(struct autofs_point *ap, "failed to create mount handler thread for %s", fullpath); pthread_mutex_unlock(&ap->mounts_mutex); - status = pthread_mutex_unlock(&sc.mutex); + status = pthread_mutex_unlock(&suc.mutex); if (status) fatal(status); cache_release(source); @@ -218,20 +218,20 @@ int mount_mount(struct autofs_point *ap, } nap->thid = thid; - while (!sc.done) { - status = pthread_cond_wait(&sc.cond, &sc.mutex); + while (!suc.done) { + status = pthread_cond_wait(&suc.cond, &suc.mutex); if (status) { pthread_mutex_unlock(&ap->mounts_mutex); - pthread_mutex_unlock(&sc.mutex); + pthread_mutex_unlock(&suc.mutex); fatal(status); } } - if (sc.status) { + if (suc.status) { crit(ap->logopt, MODPREFIX "failed to create submount for %s", fullpath); pthread_mutex_unlock(&ap->mounts_mutex); - status = pthread_mutex_unlock(&sc.mutex); + status = pthread_mutex_unlock(&suc.mutex); if (status) fatal(status); return 1; @@ -242,7 +242,7 @@ int mount_mount(struct autofs_point *ap, pthread_mutex_unlock(&ap->mounts_mutex); - status = pthread_mutex_unlock(&sc.mutex); + status = pthread_mutex_unlock(&suc.mutex); if (status) fatal(status); diff --git a/modules/parse_sun.c b/modules/parse_sun.c index b07424f..50f086d 100644 --- a/modules/parse_sun.c +++ b/modules/parse_sun.c @@ -507,34 +507,13 @@ static int sun_mount(struct autofs_point sprintf(mountpoint, "%.*s", namelen, name); what = alloca(loclen + 1); - memcpy(what, loc, loclen); - what[loclen] = '\0'; -/* - if (!strcmp(fstype, "autofs") && strchr(loc, ':') == NULL) { - char mtype[7]; - int mtype_len; - - if (loc[0] == '/') { - mtype_len = 5; - if (loc[1] == '/') - strcpy(mtype, "ldap:"); - else - strcpy(mtype, "file:"); - } else { - mtype_len = 3; - strcpy(mtype, "yp:"); - } - - what = alloca(loclen + mtype_len + 1); - memcpy(what, mtype, mtype_len); - memcpy(what + mtype_len, loc, loclen); - what[loclen + mtype_len] = '\0'; + if (*loc == ':') { + memcpy(what, loc + 1, loclen - 1); + what[loclen - 1] = '\0'; } else { -*/ - what = alloca(loclen + 1); memcpy(what, loc, loclen); what[loclen] = '\0'; -/* } */ + } debug(ap->logopt, MODPREFIX @@ -752,7 +731,7 @@ static int validate_location(char *loc) char *ptr = loc; /* We don't know much about these */ - if (*ptr == '/') + if (*ptr == ':') return 1; /* If a ':' is present now it must be a host name */ @@ -825,10 +804,6 @@ static int parse_mapent(const char *ent, return 0; } - /* Skip ':' escape */ - if (*p == ':') - p++; - l = chunklen(p, check_colon(p)); loc = dequote(p, l, logopt); if (!loc) { @@ -861,10 +836,6 @@ static int parse_mapent(const char *ent, return 0; } - /* Skip ':' escape */ - if (*p == ':') - p++; - l = chunklen(p, check_colon(p)); ent = dequote(p, l, logopt); if (!ent) { @@ -1227,10 +1198,10 @@ int parse_mount(struct autofs_point *ap, free(options); return 1; } - +/* if (*p == ':') - p++; /* Sun escape for entries starting with / */ - + p++; /* Sun escape for entries starting with / */ /* +*/ l = chunklen(p, check_colon(p)); loc = dequote(p, l, ap->logopt); if (!loc) {