[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tpop3d-discuss] Re: LDAP search scope (was: tpop3d v1.4.1pre4)
From: |
Chris Lightfoot |
Subject: |
[tpop3d-discuss] Re: LDAP search scope (was: tpop3d v1.4.1pre4) |
Date: |
Mon, 25 Feb 2002 16:31:09 +0000 |
User-agent: |
Mutt/1.3.24i |
On Mon, Feb 25, 2002 at 11:25:39AM -0500, Michael Klatsky wrote:
> Chris-
>
> I beleive so- one can strictly limit searches to a particular tree using
> scope. For example, one mught have a tree in which the user "joe" exists
> in two different levels under the same search root (virtual domains,
> etc) and specifiying whether a one level, sub level, or a base level
> search is handy for that.
>
> I generally like to have all (or at least most) of the LDAP
> configuration and search directives available to me in a config file,
> whether it be postfix, ftp or any other LDAPified app.
Fair enough:
Index: auth_ldap.c
===================================================================
RCS file: /home/cvs/tpop3d/auth_ldap.c,v
retrieving revision 1.4
diff -u -r1.4 auth_ldap.c
--- auth_ldap.c 2002/02/25 16:16:25 1.4
+++ auth_ldap.c 2002/02/25 16:30:40
@@ -40,6 +40,7 @@
gid_t gid;
int tls;
char *filter_spec;
+ int scope;
struct {
char *mailbox, *mboxtype, *user, *group;
} attr;
@@ -52,7 +53,10 @@
NULL, /* or password */
-1, -1, /* no default user/group */
0, /* don't use TLS */
- "(mail=$(local_part)@$(domain))", /* default filter matches complet
e email address to mail attribute */
+ "(mail=$(local_part)@$(domain))",
+ /* default filter matches complete email address
+ * to mail attribute */
+ LDAP_SCOPE_SUBTREE, /* search subtree by default. */
{
NULL, /* attribute from which to obtain mailbox location
*/
NULL, /* by default, guess mailbox type. */
@@ -148,6 +152,17 @@
ldapinfo.filter_spec = xstrdup(s);
else
log_print(LOG_WARNING, _("auth_ldap_init: using default auth-ldap-filte
r `%s'"), ldapinfo.filter_spec);
+
+ if ((s = config_get_string("auth-ldap-scope"))) {
+ if (strcasecmp(s, "subtree") == 0)
+ ldapinfo.scope = LDAP_SCOPE_SUBTREE;
+ else if (strcasecmp(s, "base") == 0)
+ ldapinfo.scope = LDAP_SCOPE_BASE;
+ else if (strcasecmp(s, "onelevel") == 0)
+ ldapinfo.scope = LDAP_SCOPE_ONELEVEL;
+ else
+ log_print(LOG_WARNING, _("auth_ldap_init: unknown scope specificati
on `%s'; using default, `subtree'"), s);
+ }
/* Mailbox locations, or attribute which specifies it. */
s = config_get_string("auth-ldap-mailbox");
Index: cfgdirectives.c
===================================================================
RCS file: /home/cvs/tpop3d/cfgdirectives.c,v
retrieving revision 1.11
diff -u -r1.11 cfgdirectives.c
--- cfgdirectives.c 2002/02/24 18:07:52 1.11
+++ cfgdirectives.c 2002/02/25 16:30:40
@@ -62,6 +62,7 @@
"auth-ldap-password",
"auth-ldap-use-tls",
"auth-ldap-filter",
+ "auth-ldap-scope",
"auth-ldap-mailbox",
"auth-ldap-mailbox-attr",
"auth-ldap-mboxtype-attr",
--
I'd like to see anyone-- prophet, king or god--
who could get a thousand cats to agree on anything
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [tpop3d-discuss] Re: LDAP search scope (was: tpop3d v1.4.1pre4),
Chris Lightfoot <=