~ubuntu-dev/ubuntu/lucid/dovecot/lucid-201002110912

« back to all changes in this revision

Viewing changes to src/auth/passdb-ldap.c

  • Committer: Bazaar Package Importer
  • Author(s): CHuck Short, Chuck Short
  • Date: 2009-11-06 00:47:29 UTC
  • mfrom: (4.1.9 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091106004729-i39n7v9e7d4h51f6
Tags: 1:1.2.6-1ubuntu1
* Merge from debian testing, remaining changes:
  Add new binary pkg dovecot-postfix that integrates postfix and dovecot
  automatically: (LP: #164837)
  + debian/control:
    - add new binary with short description
    - set Architecture all for dovecot-postfix (LP: #329878)
  + debian/dovecot-postfix.postinst:
    - create initial certificate symlinks to snakeoil.
    - set up postfix with postconf to:
      - use Maildir/ as the default mailbox.
      - use dovecot as the sasl authentication server.
      - use dovecot LDA (deliver).
      - use tls for smtp{d} services.
    - fix certificates paths in postfix' main.cf
    - add reject_unauth_destination to postfix' recipient restrictions
    - add reject_unknown_sender_domain to postfix' sender restrictions
    - rename configuration name on remove, delete on purge
    - restart dovecot after linking certificates
    - handle use case when postfix is unconfigurated
   + debian/dovecot-postfix.dirs: create backup directory for postfix's configuration
   + restart postfix and dovecot.
   + debian/dovecot-postfix.postrm:
     - remove all dovecot related configuration from postfix.
     - restart postfix and dovecot.
   + debian/dovecot-common.init:
     - check if /etc/dovecot/dovecot-postfix.conf exists and use it
       as the configuration file if so.
   + debian/patches/warning-ubuntu-postfix.dpatch
     - add warning about dovecot-postfix.conf in dovecot default 
       configuration file
   + debian/patches/dovecot-postfix.conf.diff:
     - Ubuntu server custom changes to the default dovecot configuration for
       better interfation with postfix
     - enable sieve plugin
   + debian/patches/dovecot-postfix.conf.diff:
     + Ubuntu server custom changes to the default dovecot configuration for
       better integration with postfix:
       - enable imap, pop3, imaps, pop3s and managesieve by default.
       - enable dovecot LDA (deliver).
       - enable SASL auth socket in postfix private directory.
   + debian/rules:
     - copy, patch and install dovecot-postfix.conf in /etc/dovecot/.
     - build architecure independent packages too
   + Use Snakeoil SSL certificates by default.
     - debian/control: Depend on ssl-cert.
     - debian/patches/ssl-cert-snakeoil.dpatch: Change default SSL cert
       paths to snakeoil.
     - debian/dovecot-common.postinst: Relax grep for SSL_* a bit.
   + Add autopkgtest to debian/tests/*.
   + Fast TearDown: Update the lsb init header to not stop in level 6.
   + Add ufw integration:
     - Created debian/dovecot-common.ufw.profile.
     - debian/rules:
       + install profile
     - debian/control:
       + Suggest ufw
   + debian/{control,rules}: enable PIE hardening.
   + dovecot-imapd, dovecot-pop3: Replaces dovecot-common (<< 1:1.1). LP: #254721
   + debian/control:
     - Update Vcs-* headers.
   + debian/rules:
     - Create emtpy stamp.h.in files in dovecot-sieve/ and dovecot-managesieve/
       if they're not there since empty files are not included in the diff.gz 
       file.
   + Add SMTP-AUTH support for Outlook (login auth mechanism)
   + Dropped:
     - debian/patches/security-CVE-2009-3235: Applied upstream.
     - debian/patches/fix-pop3-assertion.dpatch: Applied upstream.
     - dovecot-sieve and dovecot-managesieve: Use the debian patches instead.

  [Chuck Short]
  - Updated dovecot-sieve to 0.1.13.
  - Updated dovecot-managesieve to 0.11.9.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Copyright (c) 2003-2009 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "common.h"
 
4
#include "passdb.h"
4
5
 
5
 
#ifdef PASSDB_LDAP
 
6
#if defined(PASSDB_LDAP) && (defined(BUILTIN_LDAP) || defined(PLUGIN_BUILD))
6
7
 
7
8
#include "ioloop.h"
8
9
#include "hash.h"
11
12
#include "password-scheme.h"
12
13
#include "auth-cache.h"
13
14
#include "db-ldap.h"
14
 
#include "passdb.h"
15
15
 
16
16
#include <ldap.h>
17
17
#include <stdlib.h>
128
128
        /* auth_request_set_field() sets scheme */
129
129
        i_assert(password == NULL || scheme != NULL);
130
130
 
131
 
        /* LDAP's RFC2307 specifies the MD5 scheme for what we call PLAIN-MD5.
132
 
           We can detect this case, because base64 doesn't use '$'. */
133
 
        if (scheme != NULL && strncasecmp(scheme, "MD5", 3) == 0 &&
134
 
            strncmp(password, "$1$", 3) != 0) {
135
 
                auth_request_log_debug(auth_request, "ldap",
136
 
                                       "Password doesn't look like MD5-CRYPT, "
137
 
                                       "scheme changed to PLAIN-MD5");
138
 
                scheme = "PLAIN-MD5";
139
 
        }
140
 
 
141
131
        if (auth_request->credentials_scheme != NULL) {
142
132
                passdb_handle_credentials(passdb_result, password, scheme,
143
133
                        ldap_request->callback.lookup_credentials,
165
155
                (struct passdb_ldap_request *)ldap_request;
166
156
        struct auth_request *auth_request = ldap_request->auth_request;
167
157
        enum passdb_result passdb_result;
 
158
        const char *str;
168
159
        int ret;
169
160
 
170
161
        passdb_result = PASSDB_RESULT_INTERNAL_FAILURE;
174
165
                if (ret == LDAP_SUCCESS)
175
166
                        passdb_result = PASSDB_RESULT_OK;
176
167
                else if (ret == LDAP_INVALID_CREDENTIALS) {
177
 
                        auth_request_log_info(auth_request, "ldap",
178
 
                                              "invalid credentials");
 
168
                        str = "invalid credentials";
 
169
                        if (auth_request->auth->verbose_debug_passwords) {
 
170
                                str = t_strconcat(str, " (given password: ",
 
171
                                                  auth_request->mech_password,
 
172
                                                  ")", NULL);
 
173
                        }
 
174
                        auth_request_log_info(auth_request, "ldap", "%s", str);
179
175
                        passdb_result = PASSDB_RESULT_PASSWORD_MISMATCH;
180
176
                } else {
181
177
                        auth_request_log_error(auth_request, "ldap",
390
386
        module = p_new(auth_passdb->auth->pool, struct ldap_passdb_module, 1);
391
387
        module->conn = conn = db_ldap_init(args);
392
388
        conn->pass_attr_map =
393
 
                hash_create(default_pool, conn->pool, 0, str_hash,
394
 
                            (hash_cmp_callback_t *)strcmp);
 
389
                hash_table_create(default_pool, conn->pool, 0, str_hash,
 
390
                                  (hash_cmp_callback_t *)strcmp);
395
391
 
396
392
        db_ldap_set_attrs(conn, conn->set.pass_attrs, &conn->pass_attr_names,
397
393
                          conn->pass_attr_map,
426
422
        db_ldap_unref(&module->conn);
427
423
}
428
424
 
429
 
struct passdb_module_interface passdb_ldap = {
 
425
#ifndef PLUGIN_BUILD
 
426
struct passdb_module_interface passdb_ldap =
 
427
#else
 
428
struct passdb_module_interface passdb_ldap_plugin =
 
429
#endif
 
430
{
430
431
        "ldap",
431
432
 
432
433
        passdb_ldap_preinit,
437
438
        ldap_lookup_credentials,
438
439
        NULL
439
440
};
440
 
 
 
441
#else
 
442
struct passdb_module_interface passdb_ldap = {
 
443
        MEMBER(name) "ldap"
 
444
};
441
445
#endif