Skip to contentSkip to conversation

Handle ldap entries with multiple cn's for a single key

PATCH New Jeff Moyer 1 participant 1 message Nov 9, 2006 Kernel automounter

lore
Share & tools
lore

Jeff Moyer

author
#0 lore raw

PATCH 1/1 Handle ldap entries with multiple cn's for a single key

Hi, Ian, list, (sorry if this is a dup, mailer issues...)

This small patch fixes a rather odd problem noticed in the wild. Basically, a customer had multiple cn's for the wildcard key. The key would show up in searches for "/" or "*". So, when enumerating the result set from ldap, we would try to mount the entry for each one of those! This, of course, would lead to an "already mounted" error, and we would tear everything down due to the failure.

The fix is to stop once we find an entry that successfully mounts. Comments welcome.

-Jeff

modules/lookup_ldap.c +4 -0
index 3d0cba0..08a1c56 100644
@@ -687,6 +687,10 @@ int lookup_mount(const char *root, const
 			debug(MODPREFIX "%s -> %s", key, mapent);
 			ret = ctxt->parse->parse_mount(root, name, name_len,
 						  mapent, ctxt->parse->context);
+			/* stop after the first successful mount */
+			if (ret == 0)
+				break;
+
 			me = cache_lookup_next(me);
 		}
 	} else {