Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 130701790bf2d95e902edf16031ff596 > files > 223

autofs-5.0.1-0.rc2.164.el5_8.src.rpm

diff -up autofs-5.0.1/modules/lookup_nisplus.c.basedn-with-spaces-fix autofs-5.0.1/modules/lookup_nisplus.c
--- autofs-5.0.1/modules/lookup_nisplus.c.basedn-with-spaces-fix	2007-11-12 10:49:29.000000000 +0900
+++ autofs-5.0.1/modules/lookup_nisplus.c	2007-11-12 10:49:29.000000000 +0900
@@ -90,7 +90,7 @@ int lookup_read_master(struct master *ma
 	char *path, *ent;
 	char *buffer;
 	char buf[MAX_ERR_BUF];
-	int cur_state;
+	int cur_state, len;
 
 	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
 	tablename = alloca(strlen(ctxt->mapname) + strlen(ctxt->domainname) + 20);
@@ -138,11 +138,13 @@ int lookup_read_master(struct master *ma
 
 		ent = ENTRY_VAL(this, 1);
 
-		buffer = malloc(ENTRY_LEN(this, 0) + 1 + ENTRY_LEN(this, 1) + 1);
+		len = ENTRY_LEN(this, 0) + 1 + ENTRY_LEN(this, 1) + 2;
+		buffer = malloc(len);
 		if (!buffer) {
 			logerr(MODPREFIX "could not malloc parse buffer");
 			continue;
 		}
+		memset(buffer, 0 , len);
 
 		strcat(buffer, path);
 		strcat(buffer, " ");
diff -up autofs-5.0.1/modules/lookup_file.c.basedn-with-spaces-fix autofs-5.0.1/modules/lookup_file.c
--- autofs-5.0.1/modules/lookup_file.c.basedn-with-spaces-fix	2007-11-12 10:49:29.000000000 +0900
+++ autofs-5.0.1/modules/lookup_file.c	2007-11-12 10:49:29.000000000 +0900
@@ -483,7 +483,7 @@ int lookup_read_master(struct master *ma
 
 			master->name = save_name;
 		} else {
-			blen = path_len + 1 + ent_len + 1;
+			blen = path_len + 1 + ent_len + 2;
 			buffer = malloc(blen);
 			if (!buffer) {
 				error(logopt,
diff -up autofs-5.0.1/modules/lookup_ldap.c.basedn-with-spaces-fix autofs-5.0.1/modules/lookup_ldap.c
--- autofs-5.0.1/modules/lookup_ldap.c.basedn-with-spaces-fix	2007-11-12 10:49:29.000000000 +0900
+++ autofs-5.0.1/modules/lookup_ldap.c	2007-11-12 10:49:29.000000000 +0900
@@ -1368,7 +1368,7 @@ int lookup_read_master(struct master *ma
 			goto next;
 		}
 
-		blen = strlen(*keyValue) + 1 + strlen(*values) + 1;
+		blen = strlen(*keyValue) + 1 + strlen(*values) + 2;
 		if (blen > PARSE_MAX_BUF) {
 			error(logopt, MODPREFIX "map entry too long");
 			ldap_value_free(values);
diff -up autofs-5.0.1/modules/lookup_yp.c.basedn-with-spaces-fix autofs-5.0.1/modules/lookup_yp.c
--- autofs-5.0.1/modules/lookup_yp.c.basedn-with-spaces-fix	2007-11-12 10:49:29.000000000 +0900
+++ autofs-5.0.1/modules/lookup_yp.c	2007-11-12 10:49:29.000000000 +0900
@@ -178,7 +178,7 @@ int yp_all_master_callback(int status, c
 	*(ypkey + ypkeylen) = '\0';
 	*(val + vallen) = '\0';
 
-	len = ypkeylen + 1 + vallen + 1;
+	len = ypkeylen + 1 + vallen + 2;
 
 	buffer = alloca(len);
 	if (!buffer) {
diff -up autofs-5.0.1/lib/master_tok.l.basedn-with-spaces-fix autofs-5.0.1/lib/master_tok.l
--- autofs-5.0.1/lib/master_tok.l.basedn-with-spaces-fix	2007-11-12 10:49:29.000000000 +0900
+++ autofs-5.0.1/lib/master_tok.l	2007-11-12 10:49:40.000000000 +0900
@@ -110,7 +110,8 @@ AT_DC		([dD][[cC])
 AT_O		([oO])
 AT_C		([cC])
 DNATTRSTR	{AT_CN}|{AT_NMN}|{AT_AMN}|{AT_OU}|{AT_DC}|{AT_O}|{AT_C}
-DNNAMESTR	([[:alnum:]_.\-]+)
+DNNAMESTR1	([[:alnum:]_.\- ]+)
+DNNAMESTR2	([[:alnum:]_.\-]+)
 
 INTMAP		(-hosts|-null)
 MULTI		((multi)(,(sun|hesiod))?(:{OPTWS}|{WS}))
@@ -283,7 +284,12 @@ OPTTOUT		(-t{OPTWS}|-t{OPTWS}={OPTWS}|--
 		return EQUAL;
 	}
 
-	{DNNAMESTR} {
+	{DNNAMESTR1}/","{DNATTRSTR}"=" {
+		strcpy(master_lval.strtype, master_text);
+		return DNNAME;
+	}
+
+	{DNNAMESTR2} {
 		strcpy(master_lval.strtype, master_text);
 		return DNNAME;
 	}
@@ -382,7 +388,13 @@ void master_set_scan_buffer(const char *
 {
 	line = buffer;
 	line_pos = &line[0];
-	line_lim = line + strlen(buffer);
+	/*
+	 * Ensure buffer is 1 greater than string and is zeroed before
+	 * the parse so we can fit the extra NULL which allows us to
+	 * explicitly match an end of line within the buffer (ie. the
+	 * need for 2 NULLS when parsing in memeory buffers).
+	 */ 
+	line_lim = line + strlen(buffer) + 1;
 }
 
 #define min(a,b) (((a) < (b)) ? (a) : (b))