Hi,

I also had problems with umlauts. We use our Lotus Domino Server as LDAP 
server and since an update from version 6.5 to 8, our users are unable to 
authenticate via IE or Firefox if their password contains umlauts.
We are running squid on BSD and Linux and on both system you are able to 
authenticate using squid_ldap_auth on command line.
I figured out that if you use the command line (set to utf-8) the utf-8 
code will be send and if you try to use IE or Firefox the ASCII code will 
be send.
So I wrote a small work around by adding a new function 
rfc1738_unescape_with_utf to squid_ldap_auth.c. The base content is the 
original function rfc1738_unescape, but I added a switch statement to 
change the character representation from ascii to utf-8 (see code for 
german special chars below).

void
rfc1738_unescape_with_utf(char *s)
{
    char hexnum[3];
    int i, j;                   /* i is write, j is read */
    unsigned int x;
    for (i = j = 0; s[j]; i++, j++) {
        s[i] = s[j];
        if (s[i] != '%')
            continue;
        if (s[j + 1] == '%') {  /* %% case */
            j++;
            continue;
        }
        if (s[j + 1] && s[j + 2]) {
            if (s[j + 1] == '0' && s[j + 2] == '0') {   /* %00 case */
                j += 2;
                continue;
            }
            hexnum[0] = s[j + 1];
            hexnum[1] = s[j + 2];
            hexnum[2] = '\0';
            if (1 == sscanf(hexnum, "%x", &x)) {
                switch(x) {
                    case 196 :
                        s[i] = (char) 195;
                        s[i + 1] = (char) 132;
                        i++;
                        break;
                    case 214 :
                        s[i] = (char) 195;
                        s[i + 1] = (char) 150;
                        i++;
                        break;
                    case 220 :
                        s[i] = (char) 195;
                        s[i + 1] = (char) 156;
                        i++;
                        break;
                    case 223 :
                        s[i] = (char) 195;
                        s[i + 1] = (char) 159;
                        i++;
                        break;
                    case 228 :
                        s[i] = (char) 195;
                        s[i + 1] = (char) 164;
                        i++;
                        break;
                    case 246 :
                        s[i] = (char) 195;
                        s[i + 1] = (char) 182;
                        i++;
                        break;
                    case 252 :
                        s[i] = (char) 195;
                        s[i + 1] = (char) 188;
                        i++;
                        break;
                    default :
                        s[i] = (char) (0x0ff & x);
                }
                j += 2;
            }
        }
    }
    s[i] = '\0';
}

Regards

Enrico Hoyme

Reply via email to