~ubuntu-branches/ubuntu/utopic/dovecot/utopic-proposed

« back to all changes in this revision

Viewing changes to src/auth/password-scheme.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
Tags: 1:2.2.9-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2003-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2003-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "array.h"
6
6
#include "hex-binary.h"
7
7
#include "md4.h"
8
8
#include "md5.h"
9
 
#include "hmac-md5.h"
 
9
#include "hmac.h"
 
10
#include "hmac-cram-md5.h"
10
11
#include "ntlm.h"
11
12
#include "mycrypt.h"
12
13
#include "randgen.h"
367
368
                str = password_generate_md5_crypt(plaintext, password);
368
369
                return strcmp(str, password) == 0 ? 1 : 0;
369
370
        } else if (password_decode(password, "PLAIN-MD5",
370
 
                                   &md5_password, &md5_size, &error) < 0) {
 
371
                                   &md5_password, &md5_size, &error) <= 0) {
371
372
                *error_r = "Not a valid MD5-CRYPT or PLAIN-MD5 password";
372
373
                return -1;
373
374
        } else {
655
656
cram_md5_generate(const char *plaintext, const char *user ATTR_UNUSED,
656
657
                  const unsigned char **raw_password_r, size_t *size_r)
657
658
{
658
 
        struct hmac_md5_context ctx;
 
659
        struct hmac_context ctx;
659
660
        unsigned char *context_digest;
660
661
 
661
662
        context_digest = t_malloc(CRAM_MD5_CONTEXTLEN);
662
 
        hmac_md5_init(&ctx, (const unsigned char *)plaintext,
663
 
                      strlen(plaintext));
 
663
        hmac_init(&ctx, (const unsigned char *)plaintext,
 
664
                  strlen(plaintext), &hash_method_md5);
664
665
        hmac_md5_get_cram_context(&ctx, context_digest);
665
666
 
666
667
        *raw_password_r = context_digest;
817
818
        { "SSHA256", PW_ENCODING_BASE64, 0, ssha256_verify, ssha256_generate },
818
819
        { "SSHA512", PW_ENCODING_BASE64, 0, ssha512_verify, ssha512_generate },
819
820
        { "PLAIN", PW_ENCODING_NONE, 0, NULL, plain_generate },
 
821
        { "CLEAR", PW_ENCODING_NONE, 0, NULL, plain_generate },
820
822
        { "CLEARTEXT", PW_ENCODING_NONE, 0, NULL, plain_generate },
821
823
        { "PLAIN-TRUNC", PW_ENCODING_NONE, 0, plain_trunc_verify, plain_generate },
822
824
        { "CRAM-MD5", PW_ENCODING_HEX, CRAM_MD5_CONTEXTLEN,
823
825
          NULL, cram_md5_generate },
 
826
        { "SCRAM-SHA-1", PW_ENCODING_NONE, 0, scram_sha1_verify,
 
827
          scram_sha1_generate},
824
828
        { "HMAC-MD5", PW_ENCODING_HEX, CRAM_MD5_CONTEXTLEN,
825
829
          NULL, cram_md5_generate },
826
830
        { "DIGEST-MD5", PW_ENCODING_HEX, MD5_RESULTLEN,