This patch adds support for LDAP mail address tables which are used
by smtpd.conf to list recipients of specified domains. I used it
to configure a backup mx server. Seems to work fine.

Guenther

Index: usr.sbin/smtpd/table_ldap.c
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/table_ldap.c,v
retrieving revision 1.8
diff -u -p -r1.8 table_ldap.c
--- usr.sbin/smtpd/table_ldap.c 26 Dec 2013 17:25:32 -0000      1.8
+++ usr.sbin/smtpd/table_ldap.c 12 Jun 2014 10:06:23 -0000
@@ -142,6 +142,7 @@ table_ldap_check(int service, const char
        case K_DOMAIN:
        case K_CREDENTIALS:
        case K_USERINFO:
+       case K_MAILADDR:
                return ldap_run_query(service, key, NULL, 0);
        default:
                return (-1);
@@ -156,6 +157,7 @@ table_ldap_lookup(int service, const cha
        case K_DOMAIN:
        case K_CREDENTIALS:
        case K_USERINFO:
+       case K_MAILADDR:
                return ldap_run_query(service, key, dst, sz);
        default:
                return (-1);
@@ -364,6 +366,12 @@ ldap_config(void)
                else if (!strcmp(key, "userinfo_attributes"))
                        ldap_parse_attributes(queries[LDAP_USERINFO].attrs,
                            key, value, 4);
+
+               else if (!strcmp(key, "mailaddr_filter"))
+                       read_value(&queries[LDAP_MAILADDR].filter, key, value);
+               else if (!strcmp(key, "mailaddr_attributes"))
+                       ldap_parse_attributes(queries[LDAP_MAILADDR].attrs,
+                           key, value, 1);
                else
                        log_warnx("warn: table-ldap: bogus entry \"%s\"", key);
        }
@@ -536,6 +544,10 @@ ldap_run_query(int type, const char *key
        case K_USERINFO:
                if (snprintf(dst, sz, "%s:%s:%s:%s", res[0][0], res[1][0],
                    res[2][0], res[3][0]) >= (int)sz)
+                       ret = -1;
+               break;
+       case K_MAILADDR:
+               if (strlcpy(dst, res[0][0], sz) >= sz)
                        ret = -1;
                break;
        }

-- 
You received this mail because you are subscribed to [email protected]
To unsubscribe, send a mail to: [email protected]

Reply via email to