Package: lbdb
Version: 0.34
Severity: normal
Tags: patch

mutt_ldap_query(1) gives the following example:

           # a practical illustrating example being:
           #  debian   => [’db.debian.org’,
           #               ’ou=users,dc=debian,dc=org’,
           #               ’uid cn sn ircnick’,
           #               ’uid cn sn ircnick’,
           #               [EMAIL PROTECTED],
           #               ’${cn} ${sn}’,
           #               ’${ircnick}’],
           # the output of the query will be then:
           # [EMAIL PROTECTED] ${sn}\t${ircnick} (i.e.: email name comment)

However, the e-mail address output here does not work as described:

  $ /usr/lib/lbdb/mutt_ldap_query --lbdb_output --nickname=debian cjwatson
  cjwatson        Colin Watson

This is because parameter substitution in the e-mail result field is not
handled correctly. I've attached a patch that gets this right, yielding:

  $ ./mutt_ldap_query --lbdb_output --nickname=debian cjwatson
  [EMAIL PROTECTED]     Colin Watson

Thanks,

-- 
Colin Watson                                       [EMAIL PROTECTED]
--- mutt_ldap_query.orig	2006-11-12 13:24:47.000000000 +0000
+++ mutt_ldap_query	2008-03-04 12:52:18.000000000 +0000
@@ -211,7 +211,11 @@
       my $result = '';
 # if this is email we take all the values
       if( $ldap_result_email =~ /\${$answer}/ ) {
-        @emails = $entry->get_value($answer);
+        foreach my $result ($entry->get_value($answer)) {
+          my $email = $ldap_result_email;
+          $email =~ s/\${$answer}/$result/g;
+          push @emails, $email;
+        }
       } 
       else {
         my $result = '';

Reply via email to