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

« back to all changes in this revision

Viewing changes to src/lib-ssl-iostream/iostream-openssl.h

  • 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
1
#ifndef IOSTREAM_OPENSSL_H
2
2
#define IOSTREAM_OPENSSL_H
3
3
 
4
 
#include "iostream-ssl.h"
 
4
#include "iostream-ssl-private.h"
5
5
 
6
6
#include <openssl/ssl.h>
7
7
 
10
10
 
11
11
        pool_t pool;
12
12
        const struct ssl_iostream_settings *set;
13
 
        /* Used as logging prefix, e.g. "client" or "server" */
14
 
        const char *source;
15
13
 
16
14
        DH *dh_512, *dh_1024;
17
15
        int username_nid;
23
21
        int refcount;
24
22
        struct ssl_iostream_context *ctx;
25
23
 
26
 
        const struct ssl_iostream_settings *set;
27
 
 
28
24
        SSL *ssl;
29
25
        BIO *bio_ext;
30
26
 
32
28
        struct ostream *plain_output;
33
29
        struct ostream *ssl_output;
34
30
 
35
 
        char *source;
 
31
        char *host;
36
32
        char *last_error;
 
33
        char *log_prefix;
 
34
        char *plain_stream_errstr;
37
35
        int plain_stream_errno;
38
36
 
39
37
        /* copied settings */
40
38
        bool verbose, verbose_invalid_cert, require_valid_cert;
41
39
        int username_nid;
42
40
 
43
 
        int (*handshake_callback)(void *context);
 
41
        ssl_iostream_handshake_callback_t *handshake_callback;
44
42
        void *handshake_context;
45
43
 
46
44
        unsigned int handshaked:1;
 
45
        unsigned int handshake_failed:1;
47
46
        unsigned int cert_received:1;
48
47
        unsigned int cert_broken:1;
49
48
        unsigned int want_read:1;
 
49
        unsigned int input_handler:1;
50
50
        unsigned int ostream_flush_waiting_input:1;
51
51
        unsigned int closed:1;
52
52
};
53
53
 
54
54
extern int dovecot_ssl_extdata_index;
55
55
 
56
 
struct istream *i_stream_create_ssl(struct ssl_iostream *ssl_io);
57
 
struct ostream *o_stream_create_ssl(struct ssl_iostream *ssl_io);
58
 
void ssl_iostream_unref(struct ssl_iostream **ssl_io);
59
 
 
60
 
int ssl_iostream_load_key(const struct ssl_iostream_settings *set,
61
 
                          const char *key_source, EVP_PKEY **pkey_r);
 
56
struct istream *openssl_i_stream_create_ssl(struct ssl_iostream *ssl_io);
 
57
struct ostream *openssl_o_stream_create_ssl(struct ssl_iostream *ssl_io);
 
58
 
 
59
int openssl_iostream_context_init_client(const struct ssl_iostream_settings *set,
 
60
                                         struct ssl_iostream_context **ctx_r,
 
61
                                         const char **error_r);
 
62
int openssl_iostream_context_init_server(const struct ssl_iostream_settings *set,
 
63
                                         struct ssl_iostream_context **ctx_r,
 
64
                                         const char **error_r);
 
65
void openssl_iostream_context_deinit(struct ssl_iostream_context *ctx);
 
66
void openssl_iostream_global_deinit(void);
 
67
 
 
68
int openssl_iostream_load_key(const struct ssl_iostream_settings *set,
 
69
                              EVP_PKEY **pkey_r, const char **error_r);
62
70
const char *ssl_iostream_get_use_certificate_error(const char *cert);
63
71
int openssl_cert_match_name(SSL *ssl, const char *verify_name);
 
72
int openssl_get_protocol_options(const char *protocols);
 
73
#define OPENSSL_ALL_PROTOCOL_OPTIONS \
 
74
        (SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1)
64
75
 
65
76
/* Sync plain_input/plain_output streams with BIOs. Returns TRUE if at least
66
77
   one byte was read/written. */
67
 
bool ssl_iostream_bio_sync(struct ssl_iostream *ssl_io);
 
78
bool openssl_iostream_bio_sync(struct ssl_iostream *ssl_io);
68
79
/* Call when there's more data available in plain_input/plain_output.
69
80
   Returns 1 if it's ok to continue with SSL_read/SSL_write, 0 if not
70
81
   (still handshaking), -1 if error occurred. */
71
 
int ssl_iostream_more(struct ssl_iostream *ssl_io);
 
82
int openssl_iostream_more(struct ssl_iostream *ssl_io);
72
83
 
73
84
/* Returns 1 if the operation should be retried (we read/wrote more data),
74
85
   0 if the operation should retried later once more data has been
75
86
   read/written, -1 if a fatal error occurred (errno is set). */
76
 
int ssl_iostream_handle_error(struct ssl_iostream *ssl_io, int ret,
77
 
                              const char *func_name);
78
 
int ssl_iostream_handle_write_error(struct ssl_iostream *ssl_io, int ret,
79
 
                                    const char *func_name);
80
 
 
81
 
const char *ssl_iostream_error(void);
82
 
const char *ssl_iostream_key_load_error(void);
83
 
 
84
 
void ssl_iostream_context_free_params(struct ssl_iostream_context *ctx);
 
87
int openssl_iostream_handle_error(struct ssl_iostream *ssl_io, int ret,
 
88
                                  const char *func_name);
 
89
int openssl_iostream_handle_write_error(struct ssl_iostream *ssl_io, int ret,
 
90
                                        const char *func_name);
 
91
 
 
92
const char *openssl_iostream_error(void);
 
93
const char *openssl_iostream_key_load_error(void);
 
94
 
 
95
int openssl_iostream_generate_params(buffer_t *output, const char **error_r);
 
96
int openssl_iostream_context_import_params(struct ssl_iostream_context *ctx,
 
97
                                           const buffer_t *input);
 
98
void openssl_iostream_context_free_params(struct ssl_iostream_context *ctx);
85
99
 
86
100
#endif