[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/autofs/devel autofs-5.0.1-rc2-fix-master-parse-shift-reduce.patch, NONE, 1.1 autofs-5.0.1-rc2-macro-table-locking.patch, NONE, 1.1 autofs-5.0.1-rc2-misc-memory-leaks.patch, NONE, 1.1 autofs-5.0.1-rc2-nsswitch-parser-locking.patch, NONE, 1.1 autofs-5.0.1-rc2-one-master-map-read-only.patch, NONE, 1.1 autofs-5.0.1-rc2-dont-create-remote-dirs.patch, 1.1, 1.2 autofs.spec, 1.159, 1.160



Author: ikent

Update of /cvs/dist/rpms/autofs/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv7700

Modified Files:
	autofs-5.0.1-rc2-dont-create-remote-dirs.patch autofs.spec 
Added Files:
	autofs-5.0.1-rc2-fix-master-parse-shift-reduce.patch 
	autofs-5.0.1-rc2-macro-table-locking.patch 
	autofs-5.0.1-rc2-misc-memory-leaks.patch 
	autofs-5.0.1-rc2-nsswitch-parser-locking.patch 
	autofs-5.0.1-rc2-one-master-map-read-only.patch 
Log Message:
* Mon Oct 30 2006 Ian Kent <ikent redhat com> - 5.0.1-0.rc2.20
- Update patch for changed semantics of mkdir in recent kernels.
- fix macro table locking.
- fix nsswitch parser locking.
- allow only one master map read task at a time.
- fix misc memory leaks.


autofs-5.0.1-rc2-fix-master-parse-shift-reduce.patch:
 master_parse.y |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

--- NEW FILE autofs-5.0.1-rc2-fix-master-parse-shift-reduce.patch ---
diff --git a/lib/master_parse.y b/lib/master_parse.y
index 6bd7403..47d9a07 100644
--- a/lib/master_parse.y
+++ b/lib/master_parse.y
@@ -308,9 +308,9 @@ dn:	DNSERVER dnattrs
 	{
 		strcpy($$, $1);
 	}
-	| DNSERVER DNNAME
+	|
 	{
-		master_notify($2);
+		master_notify("syntax error in dn");
 		YYABORT;
 	}
 	;
@@ -545,8 +545,10 @@ int master_parse_entry(const char *buffe
 	entry = master_find_mapent(master, path);
 	if (!entry) {
 		new = master_new_mapent(path, age);
-		if (!new)
+		if (!new) {
+			local_free_vars();
 			return 0;
+		}
 		entry = new;
 	}
 
@@ -556,6 +558,7 @@ int master_parse_entry(const char *buffe
 			error(LOGOPT_ANY, "failed to add autofs_point");
 			if (new)
 				master_free_mapent(new);
+			local_free_vars();
 			return 0;
 		}
 		set_mnt_logging(entry->ap);
@@ -593,6 +596,7 @@ int master_parse_entry(const char *buffe
 		error(LOGOPT_ANY, "failed to add source");
 		if (new)
 			master_free_mapent(new);
+		local_free_vars();
 		return 0;
 	}
 
@@ -602,6 +606,7 @@ int master_parse_entry(const char *buffe
 			error(LOGOPT_ANY, "failed to init source cache");
 			if (new)
 				master_free_mapent(new);
+			local_free_vars();
 			return 0;
 		}
 	}

autofs-5.0.1-rc2-macro-table-locking.patch:
 CHANGELOG           |    1 
 include/macros.h    |    2 +
 lib/macros.c        |   58 +++++++++++++++++++++++-----------------------------
 modules/parse_sun.c |   18 ++++++++++++++++
 4 files changed, 47 insertions(+), 32 deletions(-)

--- NEW FILE autofs-5.0.1-rc2-macro-table-locking.patch ---
diff --git a/CHANGELOG b/CHANGELOG
index 04d8159..4163c43 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -27,6 +27,7 @@
   occurance).
 - allow additional common LDAP attributes in map dn.
 - deal with changed semantics of mkdir in 2.6.19.
+- fix macro table locking.
 
 1/9/2006 autofs-5.0.1 rc2
 -------------------------
diff --git a/include/macros.h b/include/macros.h
index 96fda3b..a73a4a7 100644
--- a/include/macros.h
+++ b/include/macros.h
@@ -29,6 +29,8 @@ void macro_init(void);
 int macro_is_systemvar(const char *str, int len);
 int macro_global_addvar(const char *str, int len, const char *value);
 int macro_parse_globalvar(const char *define);
+void macro_lock(void);
+void macro_unlock(void);
 struct substvar *
 macro_addvar(struct substvar *table, const char *str, int len, const char *value);
 void macro_global_removevar(const char *str, int len);
diff --git a/lib/macros.c b/lib/macros.c
index a8703c8..936ae06 100644
--- a/lib/macros.c
+++ b/lib/macros.c
@@ -38,6 +38,7 @@ static struct substvar
 static struct substvar *system_table = &sv_osvers;
 
 static pthread_mutex_t table_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t macro_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 void dump_table(struct substvar *table)
 {
@@ -76,7 +77,7 @@ void macro_init(void)
 
 int macro_is_systemvar(const char *str, int len)
 {
-	struct substvar *sv = system_table;
+	struct substvar *sv;
 	int found = 0;
 	int status;
 
@@ -84,6 +85,8 @@ int macro_is_systemvar(const char *str, 
 	if (status)
 		fatal(status);
 
+	sv = system_table;
+
 	while (sv) {
 		if (!strncmp(str, sv->def, len) && sv->def[len] == '\0') {
 			found = 1;
@@ -101,13 +104,15 @@ int macro_is_systemvar(const char *str, 
 
 int macro_global_addvar(const char *str, int len, const char *value)
 {
-	struct substvar *sv = system_table;
+	struct substvar *sv;
 	int status, ret = 0;
 
 	status = pthread_mutex_lock(&table_mutex);
 	if (status)
 		fatal(status);
 
+	sv = system_table;
+
 	while (sv) {
 		if (!strncmp(str, sv->def, len) && sv->def[len] == '\0')
 			break;
@@ -184,15 +189,24 @@ int macro_parse_globalvar(const char *de
 	return macro_global_addvar(buf, strlen(buf), value);
 }
 
-struct substvar *
-macro_addvar(struct substvar *table, const char *str, int len, const char *value)
+void macro_lock(void)
 {
-	struct substvar *lv = table;
-	int status;
+	int status = pthread_mutex_lock(&macro_mutex);
+	if (status)
+		fatal(status);
+}
 
-	status = pthread_mutex_lock(&table_mutex);
+void macro_unlock(void)
+{
+	int status = pthread_mutex_unlock(&macro_mutex);
 	if (status)
 		fatal(status);
+}
+
+struct substvar *
+macro_addvar(struct substvar *table, const char *str, int len, const char *value)
+{
+	struct substvar *lv = table;
 
 	while (lv) {
 		if (!strncmp(str, lv->def, len) && lv->def[len] == '\0')
@@ -240,9 +254,6 @@ macro_addvar(struct substvar *table, con
 		lv = new;
 	}
 done:
-	status = pthread_mutex_unlock(&table_mutex);
-	if (status)
-		fatal(status);
 
 	return lv;
 }
@@ -290,11 +301,6 @@ macro_removevar(struct substvar *table, 
 {
 	struct substvar *list, *lv;
 	struct substvar *last = NULL;
-	int status;
-
-	status = pthread_mutex_lock(&table_mutex);
-	if (status)
-		fatal(status);
 
 	lv = list = table;
 
@@ -317,26 +323,21 @@ macro_removevar(struct substvar *table, 
 		free(lv);
 	}
 
-	status = pthread_mutex_unlock(&table_mutex);
-	if (status)
-		fatal(status);
-
 	return list;
 }
 
 void macro_free_global_table(void)
 {
-	struct substvar *sv = system_table;
+	struct substvar *sv;
 	struct substvar *next;
 	int status;
 
-	if (!sv)
-		return;
-
 	status = pthread_mutex_lock(&table_mutex);
 	if (status)
 		fatal(status);
 
+	sv = system_table;
+
 	while (sv) {
 		if (sv->readonly) {
 			sv = sv->next;
@@ -351,6 +352,8 @@ void macro_free_global_table(void)
 		sv = next;
 	}
 
+	system_table = &sv_osvers;
+
 	status = pthread_mutex_unlock(&table_mutex);
 	if (status)
 		fatal(status);
@@ -362,15 +365,10 @@ void macro_free_table(struct substvar *t
 {
 	struct substvar *lv = table;
 	struct substvar *next;
-	int status;
 
 	if (!lv)
 		return;
 
-	status = pthread_mutex_lock(&table_mutex);
-	if (status)
-		fatal(status);
-
 	while (lv) {
 		next = lv->next;
 		if (lv->def)
@@ -381,10 +379,6 @@ void macro_free_table(struct substvar *t
 		lv = next;
 	}
 
-	status = pthread_mutex_unlock(&table_mutex);
-	if (status)
-		fatal(status);
-
 	return;
 }
 
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
index ed374ec..9f9bf54 100644
--- a/modules/parse_sun.c
+++ b/modules/parse_sun.c
@@ -68,7 +68,9 @@ static struct parse_context default_cont
 /* Free all storage associated with this context */
 static void kill_context(struct parse_context *ctxt)
 {
+	macro_lock();
 	macro_free_table(ctxt->subst);
+	macro_unlock();
 	if (ctxt->optstr)
 		free(ctxt->optstr);
 	if (ctxt->macros)
@@ -267,9 +269,13 @@ int parse_init(int argc, const char *con
 				else
 					val = "";
 
+				macro_lock();
+
 				ctxt->subst = macro_addvar(ctxt->subst,
 							def, strlen(def), val);
 
+				macro_unlock();
+
 				/* we use 5 for the "-D", "=", "," and the null */
 				if (ctxt->macros) {
 					len = strlen(ctxt->macros) + strlen(def) + strlen(val);
@@ -914,11 +920,17 @@ int parse_mount(struct autofs_point *ap,
 		return 1;
 	}
 
+	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
+	macro_lock();
+
 	ctxt->subst = addstdenv(ctxt->subst);
 
 	mapent_len = expandsunent(mapent, NULL, name, ctxt->subst, slashify);
 	if (mapent_len == 0) {
 		error(ap->logopt, MODPREFIX "failed to expand map entry");
+		ctxt->subst = removestdenv(ctxt->subst);
+		macro_unlock();
+		pthread_setcancelstate(cur_state, NULL);
 		return 1;
 	}
 
@@ -926,6 +938,9 @@ int parse_mount(struct autofs_point *ap,
 	if (!pmapent) {	
 		char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
 		error(ap->logopt, MODPREFIX "alloca: %s", estr);
+		ctxt->subst = removestdenv(ctxt->subst);
+		macro_unlock();
+		pthread_setcancelstate(cur_state, NULL);
 		return 1;
 	}
 	pmapent[mapent_len] = '\0';
@@ -933,6 +948,9 @@ int parse_mount(struct autofs_point *ap,
 	expandsunent(mapent, pmapent, name, ctxt->subst, slashify);
 	ctxt->subst = removestdenv(ctxt->subst);
 
+	macro_unlock();
+	pthread_setcancelstate(cur_state, NULL);
+
 	debug(ap->logopt, MODPREFIX "expanded entry: %s", pmapent);
 
 	options = strdup(ctxt->optstr ? ctxt->optstr : "");

autofs-5.0.1-rc2-misc-memory-leaks.patch:
 CHANGELOG             |    1 +
 daemon/direct.c       |    2 +-
 daemon/indirect.c     |    2 +-
 modules/lookup_file.c |    5 ++++-
 modules/parse_sun.c   |   41 +++++++++++++++++++++++------------------
 5 files changed, 30 insertions(+), 21 deletions(-)

--- NEW FILE autofs-5.0.1-rc2-misc-memory-leaks.patch ---
diff --git a/CHANGELOG b/CHANGELOG
index 9bebe79..bcd6e5c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -30,6 +30,7 @@
 - fix macro table locking.
 - fix nsswitch parser locking.
 - allow only one master map read task at a time.
+- fix misc memory leaks.
 
 1/9/2006 autofs-5.0.1 rc2
 -------------------------
diff --git a/daemon/direct.c b/daemon/direct.c
index d2b75f9..c92a745 100644
--- a/daemon/direct.c
+++ b/daemon/direct.c
@@ -887,8 +887,8 @@ void *expire_proc_direct(void *arg)
 	left = 0;
 
 	/* Get a list of real mounts and expire them if possible */
-	pthread_cleanup_push(mnts_cleanup, mnts);
 	mnts = get_mnt_list(_PROC_MOUNTS, "/", 0);
+	pthread_cleanup_push(mnts_cleanup, mnts);
 	for (next = mnts; next; next = next->next) {
 		if (!strcmp(next->fs_type, "autofs")) {
 			/*
diff --git a/daemon/indirect.c b/daemon/indirect.c
index 492cbbb..5b073e4 100644
--- a/daemon/indirect.c
+++ b/daemon/indirect.c
@@ -477,8 +477,8 @@ void *expire_proc_indirect(void *arg)
 	left = 0;
 
 	/* Get a list of real mounts and expire them if possible */
-	pthread_cleanup_push(mnts_cleanup, mnts);
 	mnts = get_mnt_list(_PROC_MOUNTS, ap->path, 0);
+	pthread_cleanup_push(mnts_cleanup, mnts);
 	for (next = mnts; next; next = next->next) {
 		char *ind_key;
 		int ret;
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
index d09afac..a0e22d2 100644
--- a/modules/lookup_file.c
+++ b/modules/lookup_file.c
@@ -192,6 +192,7 @@ static int read_one(FILE *f, char *key, 
 			else {
 				if (key_len == KEY_MAX_LEN) {
 					state = st_badent;
+					gotten = got_nothing;
 					warn(LOGOPT_ANY,
 					      MODPREFIX "map key \"%s...\" "
 					      "is too long.  The maximum key "
@@ -822,8 +823,10 @@ static int lookup_one(struct autofs_poin
 				}
 
 				eq = strncmp(s_key, key, key_len);
-				if (eq != 0)
+				if (eq != 0) {
+					free(s_key);
 					continue;
+				}
 
 				free(s_key);
 
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
index 9f9bf54..9847ea9 100644
--- a/modules/parse_sun.c
+++ b/modules/parse_sun.c
@@ -394,16 +394,11 @@ static char *concat_options(char *left, 
 	char buf[MAX_ERR_BUF];
 	char *ret;
 
-	if (left == NULL || *left == '\0') {
-		free(left);
-		ret = strdup(right);
-		return ret;
-	}
+	if (left == NULL || *left == '\0')
+		return strdup(right);
 
-	if (right == NULL || *right == '\0') {
-		free(right);
+	if (right == NULL || *right == '\0')
 		return strdup(left);
-	}
 
 	ret = malloc(strlen(left) + strlen(right) + 2);
 
@@ -741,6 +736,8 @@ static int parse_mapent(const char *ent,
 				estr = strerror_r(errno, buf, MAX_ERR_BUF);
 				error(logopt, MODPREFIX
 				      "concat_options: %s", estr);
+				if (newopt)
+					free(newopt);
 				free(myoptions);
 				return 0;
 			}
@@ -780,7 +777,7 @@ static int parse_mapent(const char *ent,
 	p = skipspace(p);
 
 	while (*p && *p != '/') {
-		char *ent;
+		char *tmp, *ent;
 
 		/* Location can't begin with a '/' */
 		if (*p == '/') {
@@ -811,14 +808,15 @@ static int parse_mapent(const char *ent,
 
 		debug(logopt, MODPREFIX "dequote(\"%.*s\") -> %s", l, p, ent);
 
-		loc = realloc(loc, strlen(loc) + l + 2);
-		if (!loc) {
+		tmp = realloc(loc, strlen(loc) + l + 2);
+		if (!tmp) {
 			error(logopt, MODPREFIX "out of memory");
 			free(ent);
 			free(myoptions);
 			free(loc);
 			return 0;
 		}
+		loc = tmp;
 
 		strcat(loc, " ");
 		strcat(loc, ent);
@@ -968,17 +966,23 @@ int parse_mount(struct autofs_point *ap,
 		char *mnt_options = NULL;
 
 		do {
-			char *noptions = NULL;
+			char *tmp, *noptions = NULL;
 
 			p = parse_options(p, &noptions, ap->logopt);
-			mnt_options = concat_options(mnt_options, noptions);
-
-			if (mnt_options == NULL) {
+			tmp = concat_options(mnt_options, noptions);
+			if (!tmp) {
 				char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
 				error(ap->logopt,
 				      MODPREFIX "concat_options: %s", estr);
+				if (noptions)
+					free(noptions);
+				if (mnt_options)
+					free(mnt_options);
+				free(options);
 				return 1;
 			}
+			mnt_options = tmp;
+
 			p = skipspace(p);
 		} while (*p == '-');
 
@@ -1232,7 +1236,7 @@ int parse_mount(struct autofs_point *ap,
 		p = skipspace(p);
 
 		while (*p) {
-			char *ent;
+			char *tmp, *ent;
 
 			l = chunklen(p, check_colon(p));
 			ent = dequote(p, l, ap->logopt);
@@ -1255,14 +1259,15 @@ int parse_mount(struct autofs_point *ap,
 			debug(ap->logopt,
 			      MODPREFIX "dequote(\"%.*s\") -> %s", l, p, ent);
 
-			loc = realloc(loc, strlen(loc) + l + 2);
-			if (!loc) {
+			tmp = realloc(loc, strlen(loc) + l + 2);
+			if (!tmp) {
 				free(ent);
 				free(loc);
 				free(options);
 				error(ap->logopt, MODPREFIX "out of memory");
 				return 1;
 			}
+			loc = tmp;
 
 			strcat(loc, " ");
 			strcat(loc, ent);

autofs-5.0.1-rc2-nsswitch-parser-locking.patch:
 CHANGELOG       |    1 +
 lib/nss_parse.y |   33 ++++++++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

--- NEW FILE autofs-5.0.1-rc2-nsswitch-parser-locking.patch ---
diff --git a/CHANGELOG b/CHANGELOG
index 4163c43..a0f9350 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -28,6 +28,7 @@
 - allow additional common LDAP attributes in map dn.
 - deal with changed semantics of mkdir in 2.6.19.
 - fix macro table locking.
+- fix nsswitch parser locking.
 
 1/9/2006 autofs-5.0.1 rc2
 -------------------------
diff --git a/lib/nss_parse.y b/lib/nss_parse.y
index 68620f1..bc12c73 100644
--- a/lib/nss_parse.y
+++ b/lib/nss_parse.y
@@ -32,6 +32,8 @@ #include "automount.h"
 #include "nsswitch.h"
 #include "nss_parse.tab.h"
 
+static pthread_mutex_t parse_mutex = PTHREAD_MUTEX_INITIALIZER;
+
 static struct list_head *nss_list;
 static struct nss_source *src;
 struct nss_action act[NSS_STATUS_MAX];
@@ -122,6 +124,29 @@ static int nss_error(const char *s)
 	return(0);
 }
 
+static void parse_mutex_lock(void)
+{
+	int status = pthread_mutex_lock(&parse_mutex);
+	if (status)
+		fatal(status);
+	return;
+}
+
+static void parse_mutex_unlock(void *arg)
+{
+	int status = pthread_mutex_unlock(&parse_mutex);
+	if (status)
+		fatal(status);
+	return;
+}
+
+static void parse_close_nsswitch(void *arg)
+{
+	FILE *nsswitch = (FILE *) arg;
+	fclose(nsswitch);
+	return;
+}
+
 int nsswitch_parse(struct list_head *list)
 {
 	FILE *nsswitch;
@@ -133,6 +158,8 @@ int nsswitch_parse(struct list_head *lis
 		return 1;
 	}
 
+	pthread_cleanup_push(parse_close_nsswitch, nsswitch);
+
 	fd = fileno(nsswitch);
 
 	if ((cl_flags = fcntl(fd, F_GETFD, 0)) != -1) {
@@ -140,13 +167,17 @@ int nsswitch_parse(struct list_head *lis
 		fcntl(fd, F_SETFD, cl_flags);
 	}
 
+	parse_mutex_lock();
+	pthread_cleanup_push(parse_mutex_unlock, NULL);
+
 	nss_in = nsswitch;
 
 	nss_list = list;
 	status = nss_parse();
 	nss_list = NULL;
 
-	fclose(nsswitch);
+	pthread_cleanup_pop(1);
+	pthread_cleanup_pop(1);
 
 	if (status)
 		return 1;

autofs-5.0.1-rc2-one-master-map-read-only.patch:
 CHANGELOG          |    1 +
 daemon/automount.c |   13 +++++++++++++
 daemon/state.c     |    6 +++---
 include/master.h   |    1 +
 lib/master.c       |    1 +
 5 files changed, 19 insertions(+), 3 deletions(-)

--- NEW FILE autofs-5.0.1-rc2-one-master-map-read-only.patch ---
diff --git a/CHANGELOG b/CHANGELOG
index a0f9350..9bebe79 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -29,6 +29,7 @@
 - deal with changed semantics of mkdir in 2.6.19.
 - fix macro table locking.
 - fix nsswitch parser locking.
+- allow only one master map read task at a time.
 
 1/9/2006 autofs-5.0.1 rc2
 -------------------------
diff --git a/daemon/automount.c b/daemon/automount.c
index ccb8021..4e776ca 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -935,6 +935,7 @@ static void *do_read_master(void *arg)
 	if (status) {
 		error(master->default_logging,
 		      "failed to signal master read map condition");
+		master->reading = 0;
 		status = pthread_mutex_unlock(&mrc.mutex);
 		if (status)
 			fatal(status);
@@ -947,6 +948,8 @@ static void *do_read_master(void *arg)
 
 	status = master_read_master(master, age, readall);
 
+	master->reading = 0;
+
 	return NULL;
 }
 
@@ -959,10 +962,20 @@ static int do_hup_signal(struct master *
 	if (status)
 		fatal(status);
 
+	if (master->reading) {
+		status = pthread_mutex_unlock(&mrc.mutex);
+		if (status)
+			fatal(status);
+		return 1;
+	}
+
+	master->reading = 1;
+
 	status = pthread_create(&thid, &thread_attr, do_read_master, NULL);
 	if (status) {
 		error(master->default_logging,
 		      "master read map thread create failed");
+		master->reading = 0;
 		status = pthread_mutex_unlock(&mrc.mutex);
 		if (status)
 			fatal(status);
diff --git a/daemon/state.c b/daemon/state.c
index ea13114..ca091ad 100644
--- a/daemon/state.c
+++ b/daemon/state.c
@@ -682,8 +682,8 @@ int st_add_task(struct autofs_point *ap,
 
 		empty = 0;
 
-		/* Don't add duplicate shutdown tasks */
-		if (task->state == state &&
+		/* Don't add duplicate tasks */
+		if (task->state == state ||
 		   (ap_state == ST_SHUTDOWN_PENDING ||
 		    ap_state == ST_SHUTDOWN_FORCE))
 			break;
@@ -701,7 +701,7 @@ int st_add_task(struct autofs_point *ap,
 
 			p_task = list_entry(q, struct state_queue, pending);
 
-			if (p_task->state == state &&
+			if (p_task->state == state ||
 			   (ap_state == ST_SHUTDOWN_PENDING ||
 			    ap_state == ST_SHUTDOWN_FORCE))
 				goto done;
diff --git a/include/master.h b/include/master.h
index e25626d..f1f675c 100644
--- a/include/master.h
+++ b/include/master.h
@@ -57,6 +57,7 @@ struct master {
 	char *name;
 	unsigned int recurse;
 	unsigned int depth;
+	unsigned int reading;
 	unsigned int default_ghost;
 	unsigned int default_logging;
 	unsigned int default_timeout;
diff --git a/lib/master.c b/lib/master.c
index 0c3c343..f0fdb62 100644
--- a/lib/master.c
+++ b/lib/master.c
@@ -699,6 +699,7 @@ struct master *master_new(const char *na
 
 	master->recurse = 0;
 	master->depth = 0;
+	master->reading = 0;
 	master->default_ghost = ghost;
 	master->default_timeout = timeout;
 	master->default_logging = defaults_get_logging();

autofs-5.0.1-rc2-dont-create-remote-dirs.patch:
 CHANGELOG           |    1 
 daemon/automount.c  |   65 +++++++++++++++++++++++++++++++++++++++-----------
 daemon/indirect.c   |    2 -
 include/automount.h |    2 +
 lib/mounts.c        |   67 +++++++++++++++++++++++++++++++++++++++++++++++++---
 5 files changed, 119 insertions(+), 18 deletions(-)

Index: autofs-5.0.1-rc2-dont-create-remote-dirs.patch
===================================================================
RCS file: /cvs/dist/rpms/autofs/devel/autofs-5.0.1-rc2-dont-create-remote-dirs.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- autofs-5.0.1-rc2-dont-create-remote-dirs.patch	25 Oct 2006 08:56:30 -0000	1.1
+++ autofs-5.0.1-rc2-dont-create-remote-dirs.patch	30 Oct 2006 03:55:26 -0000	1.2
@@ -11,18 +11,20 @@
  1/9/2006 autofs-5.0.1 rc2
  -------------------------
 diff --git a/daemon/automount.c b/daemon/automount.c
-index 343fd68..3220ba0 100644
+index 343fd68..ccb8021 100644
 --- a/daemon/automount.c
 +++ b/daemon/automount.c
-@@ -72,6 +72,32 @@ static int umount_all(struct autofs_poin
+@@ -72,33 +72,70 @@ static int umount_all(struct autofs_poin
  extern pthread_mutex_t master_mutex;
  extern struct master *master_list;
  
-+static int do_mkdir(const char *path, mode_t mode)
++static int do_mkdir(const char *parent, const char *path, mode_t mode)
 +{
 +	int status;
 +	struct stat st;
++	struct statfs fs;
 +
++	/* If path exists we're done */
 +	status = stat(path, &st);
 +	if (status == 0) {
 +		if (!S_ISDIR(st.st_mode)) {
@@ -32,7 +34,15 @@
 +		return 1;
 +	}
 +
-+	if (contained_in_local_fs(path)) {
++	/*
++	 * If we're trying to create a directory within an autofs fs
++	 * of the path is contained in a localy mounted fs go ahead.
++	 */
++	status = -1;
++	if (*parent)
++		status = statfs(parent, &fs);
++	if ((status != -1 && fs.f_type == AUTOFS_SUPER_MAGIC) ||
++	    contained_in_local_fs(path)) {
 +		if (mkdir(path, mode) == -1) {
 +			if (errno == EEXIST)
 +				return 1;
@@ -47,9 +57,18 @@
  int mkdir_path(const char *path, mode_t mode)
  {
  	char *buf = alloca(strlen(path) + 1);
-@@ -84,19 +110,9 @@ int mkdir_path(const char *path, mode_t 
++	char *parent = alloca(strlen(path) + 1);
+ 	const char *cp = path, *lcp = path;
+-	char *bp = buf;
++	char *bp = buf, *pp = parent;
++
++	*parent = '\0';
+ 
+ 	do {
+ 		if (cp != path && (*cp == '/' || *cp == '\0')) {
+ 			memcpy(bp, lcp, cp - lcp);
  			bp += cp - lcp;
- 			lcp = cp;
+-			lcp = cp;
  			*bp = '\0';
 -			if (mkdir(buf, mode) == -1) {
 -				/* If it already exists, make sure it's a directory */
@@ -63,13 +82,23 @@
 -						if (*cp != '\0')
 -							continue;
 -					}
--				}
-+			if (!do_mkdir(buf, mode)) {
-+				if (*cp != '\0')
++			if (!do_mkdir(parent, buf, mode)) {
++				if (*cp != '\0') {
++					memcpy(pp, lcp, cp - lcp);
++					pp += cp - lcp;
++					*pp = '\0';
++					lcp = cp;
 +					continue;
+ 				}
  				return -1;
  			}
++			memcpy(pp, lcp, cp - lcp);
++			pp += cp - lcp;
++			*pp = '\0';
++			lcp = cp;
  		}
+ 	} while (*cp++ != '\0');
+ 
 diff --git a/daemon/indirect.c b/daemon/indirect.c
 index 608f37b..492cbbb 100644
 --- a/daemon/indirect.c
@@ -104,18 +133,10 @@
  int has_fstab_option(const char *opt);
  char *find_mnt_ino(const char *table, dev_t dev, ino_t ino);
 diff --git a/lib/mounts.c b/lib/mounts.c
-index 46131cd..008f92a 100644
+index 46131cd..1e92ca5 100644
 --- a/lib/mounts.c
 +++ b/lib/mounts.c
-@@ -19,6 +19,7 @@ #include <mntent.h>
- #include <limits.h>
- #include <sys/types.h>
- #include <sys/stat.h>
-+#include <sys/vfs.h>
- #include <stdio.h>
- 
- #include "automount.h"
-@@ -170,6 +171,14 @@ struct mnt_list *get_mnt_list(const char
+@@ -170,9 +170,16 @@ struct mnt_list *get_mnt_list(const char
  		}
  		strcpy(ent->path, mnt->mnt_dir);
  
@@ -129,8 +150,20 @@
 +
  		ent->fs_type = malloc(strlen(mnt->mnt_type) + 1);
  		if (!ent->fs_type) {
- 			free(ent->path);
-@@ -240,6 +249,9 @@ void free_mnt_list(struct mnt_list *list
+-			free(ent->path);
+ 			endmntent(tab);
+ 			free_mnt_list(list);
+ 			return NULL;
+@@ -181,8 +188,6 @@ struct mnt_list *get_mnt_list(const char
+ 
+ 		ent->opts = malloc(strlen(mnt->mnt_opts) + 1);
+ 		if (!ent->opts) {
+-			free(ent->fs_type);
+-			free(ent->path);
+ 			endmntent(tab);
+ 			free_mnt_list(list);
+ 			return NULL;
+@@ -240,6 +245,9 @@ void free_mnt_list(struct mnt_list *list
  		if (this->path)
  			free(this->path);
  
@@ -140,7 +173,7 @@
  		if (this->fs_type)
  			free(this->fs_type);
  
-@@ -250,6 +262,47 @@ void free_mnt_list(struct mnt_list *list
+@@ -250,6 +258,43 @@ void free_mnt_list(struct mnt_list *list
  	}
  }
  
@@ -148,8 +181,7 @@
 +{
 +	struct mnt_list *mnts, *this;
 +	size_t pathlen = strlen(path);
-+	struct statfs fs;
-+	int rv, ret;
++	int ret;
 +
 +	if (!path || !pathlen || pathlen > PATH_MAX)
 +		return 0;
@@ -166,9 +198,6 @@
 +		if (!strncmp(path, this->path, len)) {
 +			if (len > 1 && pathlen > len && path[len] != '/')
 +				continue;
-+			rv = statfs(this->path, &fs);
-+			if (rv != -1 && fs.f_type == AUTOFS_SUPER_MAGIC)
-+				ret = 1;
 +			else if (this->fs_name[0] == '/') {
 +				if (strlen(this->fs_name) > 1) {
 +					if (this->fs_name[1] != '/')
@@ -188,7 +217,7 @@
  int is_mounted(const char *table, const char *path, unsigned int type)
  {
  	struct mntent *mnt;
-@@ -497,6 +550,7 @@ void tree_free_mnt_tree(struct mnt_list 
+@@ -497,6 +542,7 @@ void tree_free_mnt_tree(struct mnt_list 
  		list_del(&this->self);
  
  		free(this->path);
@@ -196,13 +225,22 @@
  		free(this->fs_type);
  
  		if (this->opts)
-@@ -570,8 +624,18 @@ struct mnt_list *tree_make_mnt_tree(cons
+@@ -506,6 +552,7 @@ void tree_free_mnt_tree(struct mnt_list 
+ 	}
+ 
+ 	free(tree->path);
++	free(tree->fs_name);
+ 	free(tree->fs_type);
+ 
+ 	if (tree->opts)
+@@ -570,9 +617,21 @@ struct mnt_list *tree_make_mnt_tree(cons
  		}
  		strcpy(ent->path, mnt->mnt_dir);
  
 +		ent->fs_name = malloc(strlen(mnt->mnt_fsname) + 1);
 +		if (!ent->fs_name) {
 +			free(ent->path);
++			free(ent);
 +			endmntent(tab);
 +			tree_free_mnt_tree(tree);
 +			return NULL;
@@ -213,13 +251,17 @@
  		if (!ent->fs_type) {
 +			free(ent->fs_name);
  			free(ent->path);
++			free(ent);
  			endmntent(tab);
  			tree_free_mnt_tree(tree);
-@@ -582,6 +646,7 @@ struct mnt_list *tree_make_mnt_tree(cons
+ 			return NULL;
+@@ -582,7 +641,9 @@ struct mnt_list *tree_make_mnt_tree(cons
  		ent->opts = malloc(strlen(mnt->mnt_opts) + 1);
  		if (!ent->opts) {
  			free(ent->fs_type);
 +			free(ent->fs_name);
  			free(ent->path);
++			free(ent);
  			endmntent(tab);
  			tree_free_mnt_tree(tree);
+ 			return NULL;


Index: autofs.spec
===================================================================
RCS file: /cvs/dist/rpms/autofs/devel/autofs.spec,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -r1.159 -r1.160
--- autofs.spec	25 Oct 2006 09:00:09 -0000	1.159
+++ autofs.spec	30 Oct 2006 03:55:26 -0000	1.160
@@ -4,7 +4,7 @@
 Summary: A tool for automatically mounting and unmounting filesystems.
 Name: autofs
 %define version 5.0.1
-%define release 0.rc2.19
+%define release 0.rc2.20
 Version: %{version}
 Release: %{release}
 Epoch: 1
@@ -35,6 +35,11 @@
 Patch21: autofs-5.0.1-rc2-get_query_dn-subtree-2.patch
 Patch22: autofs-5.0.1-rc2-ldap-allow-extra-attrs.patch
 Patch23: autofs-5.0.1-rc2-dont-create-remote-dirs.patch
+Patch24: autofs-5.0.1-rc2-fix-master-parse-shift-reduce.patch
+Patch25: autofs-5.0.1-rc2-macro-table-locking.patch
+Patch26: autofs-5.0.1-rc2-nsswitch-parser-locking.patch
+Patch27: autofs-5.0.1-rc2-one-master-map-read-only.patch
+Patch28: autofs-5.0.1-rc2-misc-memory-leaks.patch
 Buildroot: /var/tmp/autofs-tmp
 BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel
 Prereq: chkconfig
@@ -98,6 +103,11 @@
 %patch21 -p1
 %patch22 -p1
 %patch23 -p1
+%patch24 -p1
+%patch25 -p1
+%patch26 -p1
+%patch27 -p1
+%patch28 -p1
 
 %build
 #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -154,6 +164,13 @@
 %{_libdir}/autofs/*
 
 %changelog
+* Mon Oct 30 2006 Ian Kent <ikent redhat com> - 5.0.1-0.rc2.20
+- Update patch for changed semantics of mkdir in recent kernels.
+- fix macro table locking.
+- fix nsswitch parser locking.
+- allow only one master map read task at a time.
+- fix misc memory leaks.
+
 * Wed Oct 25 2006 Ian Kent <ikent redhat com> - 5.0.1-0.rc2.19
 - deal with changed semantics of mkdir in recent kernels.
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]