All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Feist <cfeist@redhat.com>
To: raven@themaw.net, autofs@linux.kernel.org
Subject: [patch] Fix for ldap_search when multiple cn's are in one LDAP entry.
Date: Fri, 10 Dec 2004 13:11:39 -0600	[thread overview]
Message-ID: <41B9F4EB.2050202@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 659 bytes --]

This patch fixes a bug in the ldap search which will only use the first 
mount point found in an LDAP entry.

For example if an ldap entry looks like this:

dn: cn=%T%I_apps, nisMapName=auto_home, ou=foo.bar
nismapname: auto_home
objectClass: top
objectClass: nisobject
nismapentry: foo.bar.ti.com:/vol/vol6/TI_apps
cn: %T%I_apps
cn: TI_apps

Then the auto_home map will only be used in /%T%I_apps

If you try to cd into TI_apps you'll just get an error.  The patch 
forces ldap_search to iterate through all of the different cn's in an 
entry so you can cd into either %T%I_apps or TI_apps and the proper 
directory will still be automounted.

Thanks,
Chris

[-- Attachment #2: autofs-4.1.3-ldap-multiple-map.patch --]
[-- Type: text/x-patch, Size: 900 bytes --]

--- autofs-4.1.3/modules/lookup_ldap.c.orig	2004-04-03 01:14:33.000000000 -0600
+++ autofs-4.1.3/modules/lookup_ldap.c	2004-12-10 13:06:21.470895667 -0600
@@ -154,7 +154,7 @@
 			struct lookup_context *context)
 {
 	struct lookup_context *ctxt = (struct lookup_context *) context;
-	int rv, i, l, count;
+	int rv, i, j, l, count, keycount;
 	time_t age = time(NULL);
 	char *query;
 	LDAPMessage *result, *e;
@@ -250,10 +250,14 @@
 		}
 
 		count = ldap_count_values(values);
+		keycount = ldap_count_values(keyValue);
 		for (i = 0; i < count; i++) {
-			if (**keyValue == '/' && strlen(*keyValue) == 1)
-				**keyValue = '*';
-			cache_update(*keyValue, values[i], age);
+		  	for (j = 0; j < keycount; j++) {
+				if (*(keyValue[j]) == '/' &&
+				    strlen(keyValue[j]) == 1)
+			  		*(keyValue[j]) = '*';
+				cache_update(keyValue[j], values[i], age);
+			}
 		}
 		ldap_value_free(values);
 

[-- Attachment #3: Type: text/plain, Size: 140 bytes --]

_______________________________________________
autofs mailing list
autofs@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/autofs

             reply	other threads:[~2004-12-10 19:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-10 19:11 Chris Feist [this message]
2005-01-06  5:54 ` [patch] Fix for ldap_search when multiple cn's are in one LDAP entry Ian Kent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41B9F4EB.2050202@redhat.com \
    --to=cfeist@redhat.com \
    --cc=autofs@linux.kernel.org \
    --cc=raven@themaw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.