Le 20/01/2017 à 18:40, Alex Rousskov a écrit :
> On 01/20/2017 09:41 AM, FUSTE Emmanuel wrote:
>> Le 20/01/2017 à 16:36, Alex Rousskov a écrit :
>>> 1. Rename notnulldelim to a positive name like haveDelimiter or, better,
>>> remove that variable completely in favor of a direct *delimiter test.
>>>
>>> 2. Use a *delimiter test instead of strcmp("") to detect empty delimiter
>>> strings.
>>>
>>> 3. Rephrase the -l help string to use "empty string" instead of "null"
>>> and "password alone" instead of "no realm" (or similar).
>
>> Is the attached v2 address all your points ?
> Thank you for adjusting your patch! You are still overcomplicating the
> delimiter test (my item #2) AFAICT. I suggest removing nulldelimiter
> variable and simply replacing
>
>    if (encrpass && (*delimiter != *nulldelimiter)) {
>
> with
>
>    if (encrpass && *delimiter) {
>
> This change can be done during commit as far as I am concerned. The rest
> looks OK to me. Again, I am not really qualified to make the acceptance
> decision in this area so you would have to wait for somebody else to do
> that.
>
>
> Cheers,
>
> Alex.
>
Oh yes, simpler and better... codding is becoming a "long time ago" 
thing for me. I need to re-practice more.
I attach here the final two line patch for the finals reviewers.

Thank you.
Regards,
Emmanuel.

--- squid3-3.5.23/helpers/digest_auth/LDAP/ldap_backend.cc.manu 2017-01-18 
15:41:31.021707038 +0100
+++ squid3-3.5.23/helpers/digest_auth/LDAP/ldap_backend.cc      2017-01-23 
10:40:24.057779421 +0100
@@ -267,7 +267,7 @@
             }
             value = values;
             while (*value) {
-                if (encrpass) {
+                if (encrpass && *delimiter ) {
                     const char *t = strtok(*value, delimiter);
                     if (t && strcmp(t, realm) == 0) {
                         password = strtok(NULL, delimiter);
@@ -577,7 +577,7 @@
     if (!userbasedn || !passattr) {
         fprintf(stderr, "Usage: " PROGRAM_NAME " -b basedn -f filter [options] 
ldap_server_name\n\n");
         fprintf(stderr, "\t-A password attribute(REQUIRED)\t\tUser attribute 
that contains the password\n");
-        fprintf(stderr, "\t-l password realm delimiter(REQUIRED)\tCharater(s) 
that devides the password attribute\n\t\t\t\t\t\tin realm and password tokens, 
default ':' realm:password\n");
+        fprintf(stderr, "\t-l password realm delimiter(REQUIRED)\tCharater(s) 
that devides the password attribute\n\t\t\t\t\t\tin realm and password tokens, 
default ':' realm:password, could be\n\t\t\t\t\t\tempty string if the password 
is alone in the password attribute\n");
         fprintf(stderr, "\t-b basedn (REQUIRED)\t\t\tbase dn under where to 
search for users\n");
         fprintf(stderr, "\t-e Encrypted passwords(REQUIRED)\tPassword are 
stored encrypted using HHA1\n");
         fprintf(stderr, "\t-F filter\t\t\t\tuser search filter pattern. %%s = 
login\n");
_______________________________________________
squid-dev mailing list
squid-dev@lists.squid-cache.org
http://lists.squid-cache.org/listinfo/squid-dev

Reply via email to