[tpop3d-discuss] auth-ldap module for tpop3d

Prune Prune at lecentre.net
Wed, 06 Feb 2002 19:13:37 +0100


--------------080303020807090708030809
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Chris Lightfoot wrote:

>On Wed, Feb 06, 2002 at 05:48:07PM +0100, Prune wrote:
>    [...]
>
>>It's just failing.
>>aaa (added for test) was 'auth-ldap-filter-attr' at the begining.
>>can you explain me the first part of the debug.... why is it comparing 
>>the configuration key 'aaa' to the first entry in the configuration 
>>file, then to a blank line, then to another one and the stop ??
>>
>
>Could you send me your patch (as private email if you
>don't want to release it to the list yet); it's a bit hard
>to debug this without the code in front of me.
>
You allready have all that you need... :)
the 'patch' is not actually a patch.... it's just a file :)

my part is :


in auth_ldap.c

 /* we get the attrubut used for the search */
    if ((I = stringmap_find(config, "aaa")))
      strncpy(ldap_connection.filter_attr, (char*)I->v, FILTER_MAXLENGTH) ;
    else {
         strcpy(ldap_connection.filter_attr,DEFAULT_FILTER_ATTR);
         print_log(LOG_WARNING, _("auth_mysql_init: filter-attr fail 
from the conf"));
        }


the stringmap_find returns an error. it's the same as the original... :)
the 'else' is working fine.

as I said, it's like the stringmap_find fuction was missing something 
while parsing the conf file...
no more clues yet... I'll doubble check to find why.

In the stringmap_find functions below....

item *stringmap_find(const stringmap S, const char *k) {
    stringmap S2;
    int i;
    if (!S || S->key == NULL) return 0;
    for (S2 = S;;) {
        printf("les attrisbuts stringmap : %s\t%s\n",k,S2->key);
        i = strcmp(k, S2->key);
        if (i == 0) return &(S2->d);
        else if (i < 0) {
            if (S2->l) S2 = S2->l;
            else return NULL;
        } else if (i > 0) {
            if (S2->g) S2 = S2->g;
            else return NULL;
        }
    }
}

what is the purpose of  S2->l and S2->g when the key is not found in the 
configuration file ?
this would help me to understand and, maybe, diagnose :))

Cheers,

Prune

--------------080303020807090708030809
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<html>
<head>
</head>
<body>
Chris Lightfoot wrote:<br>
<blockquote type="cite" cite="mid:20020206173345.GA30263@aquila.esc.cam.ac.uk">
  <pre wrap="">On Wed, Feb 06, 2002 at 05:48:07PM +0100, Prune wrote:<br>    [...]<br></pre>
  <blockquote type="cite">
    <pre wrap="">It's just failing.<br>aaa (added for test) was 'auth-ldap-filter-attr' at the begining.<br>can you explain me the first part of the debug.... why is it comparing <br>the configuration key 'aaa' to the first entry in the configuration <br>file, then to a blank line, then to another one and the stop ??<br></pre>
    </blockquote>
    <pre wrap=""><!----><br>Could you send me your patch (as private email if you<br>don't want to release it to the list yet); it's a bit hard<br>to debug this without the code in front of me.<br><br></pre>
    </blockquote>
You allready have all that you need... :)<br>
the 'patch' is not actually a patch.... it's just a file :)<br>
    <br>
my part is :<br>
    <br>
    <br>
in auth_ldap.c<br>
    <br>
&nbsp;/* we get the attrubut used for the search */<br>
&nbsp;&nbsp;&nbsp; if ((I = stringmap_find(config, "aaa")))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strncpy(ldap_connection.filter_attr, (char*)I-&gt;v, FILTER_MAXLENGTH)
;<br>
&nbsp;&nbsp;&nbsp; else {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcpy(ldap_connection.filter_attr,DEFAULT_FILTER_ATTR);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print_log(LOG_WARNING, _("auth_mysql_init: filter-attr fail from
the conf"));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
    <br>
    <br>
the stringmap_find returns an error. it's the same as the original... :)<br>
the 'else' is working fine.<br>
    <br>
as I said, it's like the stringmap_find fuction was missing something while
parsing the conf file...<br>
no more clues yet... I'll doubble check to find why.<br>
    <br>
In the stringmap_find functions below.... <br>
    <br>
item *stringmap_find(const stringmap S, const char *k) {<br>
&nbsp;&nbsp;&nbsp; stringmap S2;<br>
&nbsp;&nbsp;&nbsp; int i;<br>
&nbsp;&nbsp;&nbsp; if (!S || S-&gt;key == NULL) return 0;<br>
&nbsp;&nbsp;&nbsp; for (S2 = S;;) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("les attrisbuts stringmap : %s\t%s\n",k,S2-&gt;key);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = strcmp(k, S2-&gt;key);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (i == 0) return &amp;(S2-&gt;d);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (i &lt; 0) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (S2-&gt;l) S2 = S2-&gt;l;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else return NULL;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else if (i &gt; 0) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (S2-&gt;g) S2 = S2-&gt;g;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else return NULL;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
    <br>
what is the purpose of &nbsp;S2-&gt;l and S2-&gt;g when the key is not found in
the configuration file ?<br>
this would help me to understand and, maybe, diagnose :))<br>
    <br>
Cheers,<br>
    <br>
Prune<br>
    </body>
    </html>

--------------080303020807090708030809--