Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > 5f15b8690fd88aa8b2d835f26230ba86 > files > 23

autofs-5.0.2-8mdv2008.0.src.rpm

diff --git a/CHANGELOG b/CHANGELOG
index 2ce58b4..903e619 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,7 @@
 - change random multiple server selection option name to be consistent
   with existing downstream version 4 naming.
 - fix mount point directory creation for bind mounts.
+- add quoting for exports gathered by hosts map.
 
 18/06/2007 autofs-5.0.2
 -----------------------
diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c
index a9a4c75..1f8fa15 100644
--- a/modules/lookup_hosts.c
+++ b/modules/lookup_hosts.c
@@ -215,7 +215,7 @@ done:
 		if (mapent) {
 			int len = strlen(mapent) + 1;
 
-			len += strlen(name) + 2*strlen(exp->ex_dir) + 3;
+			len += strlen(name) + 2*(strlen(exp->ex_dir) + 2) + 3;
 			mapent = realloc(mapent, len);
 			if (!mapent) {
 				char *estr;
@@ -224,10 +224,11 @@ done:
 				rpc_exports_free(exp);
 				return NSS_STATUS_UNAVAIL;
 			}
-			strcat(mapent, " ");
+			strcat(mapent, " \"");
 			strcat(mapent, exp->ex_dir);
+			strcat(mapent, "\"");
 		} else {
-			int len = 2*strlen(exp->ex_dir) + strlen(name) + 3;
+			int len = 2*(strlen(exp->ex_dir) + 2) + strlen(name) + 3;
 
 			mapent = malloc(len);
 			if (!mapent) {
@@ -237,12 +238,15 @@ done:
 				rpc_exports_free(exp);
 				return NSS_STATUS_UNAVAIL;
 			}
-			strcpy(mapent, exp->ex_dir);
+			strcpy(mapent, "\"");
+			strcat(mapent, exp->ex_dir);
+			strcat(mapent, "\"");
 		}
-		strcat(mapent, " ");
+		strcat(mapent, " \"");
 		strcat(mapent, name);
 		strcat(mapent, ":");
 		strcat(mapent, exp->ex_dir);
+		strcat(mapent, "\"");
 
 		exp = exp->ex_next;
 	}
@@ -260,13 +264,9 @@ done:
 	cache_update(mc, source, name, mapent, now);
 	cache_unlock(mc);
 
-	debug(LOGOPT_ANY, "source wait");
-
 	master_source_current_wait(ap->entry);
 	ap->entry->current = source;
 
-	debug(LOGOPT_ANY, "do parse_mount");
-
 	ret = ctxt->parse->parse_mount(ap, name, name_len,
 				 mapent, ctxt->parse->context);
 	free(mapent);