#2494 'gecos' field computed badly with accent

1.270
closed
5
2006-06-07
2006-04-27
No

Lookin at ldap-useradmin/save_user.cgi, you can see
that the "gecos" field is computed from the 'real' field.
if (&in_schema($schema, "gecos")) {
push(@props, "gecos", $in{'real'});
}

In my country (France), some people names have accents.
But gecos field cannot support accents. So, when
modifying users, the error message is:

Failed to modify user in LDAP database : gecos: value
#0 invalid per syntax

I also tried to put 'gecos' as an extra editable
property in configuration module, but it did not work.
The gecos field is always computated with the real name.

Discussion

  • Fabrice Robin

    Fabrice Robin - 2006-04-27

    Logged In: YES
    user_id=1183040

    Possible solution in save_user.cgi

    sub AccentInsensitive {
    my ($string) = @_;

    $string = Encode::decode_utf8($string);

    $string =~ tr/ÀÁÂÃÄÅàáâãäå/a/;
    $string =~ tr/Çç/c/;
    $string =~ tr/ÈÉÊËèéêë/e/;
    $string =~ tr/ÌÍÎÏìíîï/i/;
    $string =~ tr/Ð/d/;
    $string =~ tr/Ññ/n/;
    $string =~ tr/ÒÓÔÕÖØðòóôõöø/o/;
    $string =~ tr/ÙÚÛÜùúûü/u/;
    $string =~ tr/Ýýÿ/y/;
    $string =~ tr/ß/b/;
    $string =~ s/æÆ/ae/go;

    return Encode::encode_utf8($string);
    }

    sub name_fields
    {
    if ($config{'given'}) {
    push(@props, "gn", $firstname)
    if ($firstname && &in_schema($schema,
    "givenName"));
    push(@props, "sn", $lastname)
    if ($lastname && &in_schema($schema, "sn"));
    if ($firstname || $lastname) {
    push(@classes, $config{'given_class'});
    }
    }
    if (&in_schema($schema, "gecos")) {
    push(@props, "gecos", &AccentInsensitive($in{'real'}));
    }
    }

     
  • Jamie Cameron

    Jamie Cameron - 2006-06-07

    Logged In: YES
    user_id=129364

    I can't see how this problem can be solved in Webmin - it
    really looks like an LDAP server bug. I would advise
    updating your schema files to allow accents in the gecos
    field, or if that is not possible removing it from the
    schema completely.

     
  • Jamie Cameron

    Jamie Cameron - 2006-06-07
    • status: open --> closed
     
  • Fabrice Robin

    Fabrice Robin - 2006-06-07

    Logged In: YES
    user_id=1183040

    This is definitely not an LDAP server bug.

    The 'gecos' field is defined as an IA5 string (US-ASCII).
    Therefore it does not admit any latin accent...

    As this Webmin module compute the 'gecos' field from the
    'real' field, which admits accent, we obtain the error
    message. The solution would be to transform accent to their
    equivalent as in US-ASCII as shown in AccentInsensitive
    function (It works well for me). Or to stop computing gecos
    from real...

    I understand that English-speaking country do not encounter
    this problem, but for other countries this is a critical
    bug. It is impossible to create/modify a ldap account via
    Webmin.

    Best regards,
    Fabrice Robin

     
  • Fabrice Robin

    Fabrice Robin - 2006-06-07
    • status: closed --> open
     
  • Jamie Cameron

    Jamie Cameron - 2006-06-07

    Logged In: YES
    user_id=129364

    OK, I see what you mean now ..
    I should be able to update Webmin to convert accented
    characters to non-accented. Do you know of any Perl funtion
    or module to do this though?

     
  • Fabrice Robin

    Fabrice Robin - 2006-06-07

    Logged In: YES
    user_id=1183040

    I don't know any Perl function or module to do this.
    That is why I created my own function AccentInsensitive.
    But I am not a Perl expert ;-)

     
  • Jamie Cameron

    Jamie Cameron - 2006-06-07
    • status: open --> closed
     
  • Jamie Cameron

    Jamie Cameron - 2006-06-07

    Logged In: YES
    user_id=129364

    Ok, I missed your function in the bug report at first .. I
    will include this in the next Webmin release, which should
    solve the problem.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks