[prev in list] [next in list] [prev in thread] [next in thread] 

List:       qmail-ldap
Subject:    bringing virtual domains in ldap
From:       Franky Van Liedekerke <franky.van.liedekerke () pandora ! be>
Date:       1999-06-14 16:28:22
[Download RAW message or body]

Hi,

I have done some coding and managed to get some of the functionality of
virtual domains quite easily in qmail-ldap:

suppose you have the domain YYY.ZZ in the qmail control file 'locals':

when mail is sent to user xxx@YYY.ZZ, this is searched for in ldap, when
it is not found, the domain only is being checked (see code for
qmail-lspawn.c below).

Franky



+ stralloc       filter2 = {0};


+   if ( (num_entries = ldap_count_entries(ld,res)) ==0) {
+        stralloc tmp_mail = {0};
+        char *tmp_uid;
+        char *tmp_dom;
+        if (!stralloc_copy(&tmp_mail,mail) ) _exit(QLX_NOMEM);
+        if (!stralloc_cats(&tmp_mail," ") ) _exit(QLX_NOMEM);
+        tmp_uid=strtok(tmp_mail.s, "@");
+        tmp_dom=strtok(NULL, " ");

+        if (!stralloc_copys(&filter2,"maildomain=" ) )
_exit(QLX_NOMEM);
+        if (!stralloc_cats(&filter2,tmp_dom)) _exit(QLX_NOMEM);
+        if (!stralloc_0(&filter2)) _exit(QLX_NOMEM);
+        if ( (rc =
ldap_search_s(ld,qldap_basedn.s,LDAP_SCOPE_SUBTREE,filter2.s,
attrs,0,&res)) != LDAP_SUCCESS ) {
+           return 14;
+        }
+   }

   /* count the results, we must have exactly one */
   if ( (num_entries = ldap_count_entries(ld,res)) != 1) return 1;

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic