Announcement

Collapse
No announcement yet.

Fix for User/Decorator.pm with aliases

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fix for User/Decorator.pm with aliases

    Hi,

    if you have aliases in your LDAP databases it may happen that a user has only one alias (not multiple). In this case the OXLDAPsync will fail.

    Here is a patch for Decorator.pm, around line 95

    ---
    PHP Code:
     if ($self->{_mapping}->{'aliases'})
                {
                            
    my $aliases $self->{_entry}->get_value($self->{_mapping}->{aliases}, asref => 1)
    ;
                            if (
    ref($aliaseseq 'ARRAY'){
                                    
    $aliasstr join(',',@$aliases);
                            } else {                                
    $aliasstr $aliases;
                            }
                } 
    ----

    Best regards, Eike

  • #2
    Thank you for your investigation!

    Could you please make a unified diff and post it here?

    Comment


    • #3
      Code:
      --- Decorator.orig.pm   2010-06-17 17:32:28.000000000 +0200
      +++ Decorator.pm        2010-06-17 15:23:21.000000000 +0200
      @@ -95,7 +95,11 @@
                  if ($self->{_mapping}->{'aliases'})
                  {
                              my $aliases = $self->{_entry}->get_value($self->{_mapping}->{aliases}, asref => 1);
      -                       $aliasstr = join(',',@$aliases);
      +                       if (ref($aliases) eq 'ARRAY'){
      +                               $aliasstr = join(',',@$aliases);
      +                       } else {
      +                               $aliasstr = $aliases;
      +                       }
                  }
                  if ($aliasstr)
                  {

      Comment


      • #4
        I just tried to reproduce your problem description, but I was not able to do so. Even without your patch, I can have users with one or multiple aliases.

        Could you please describe what happens on your system without your patch?

        Comment


        • #5
          Have a look at the old OX5 LDAP database structure. There the mail aliases are attributes of the user object. Always at least one entry:

          mail : me@mail.com
          alias : me@mail.com

          If you have multiple mail aliases it like

          mail : me@mail.com
          alias : me@mail.com
          alias : alias1@mail.com
          alias : alias2@mail.com

          If I set "aliases = alias" in mappins.conf everything is fine for multiple aliases, because search returns an array. If I have only one alias entry (what is usual the case) the search does not return an array, but a string.

          The patch fixes this.

          best regards, Eike

          btw. Mrs. Betz wrote me you would contact me regarding roxy... (uhh sorry, not you Mr. Herkens).
          Last edited by ehoffman; 06-18-2010, 12:01 PM.

          Comment

          Working...
          X