(tls_available,tls_done): Static variables.
(imap4d_starttls): Register mu_deinit_tls_libs as an 'atexit' function. (starttls_init): New function.
Showing
1 changed file
with
14 additions
and
0 deletions
... | @@ -19,6 +19,9 @@ | ... | @@ -19,6 +19,9 @@ |
19 | 19 | ||
20 | #ifdef WITH_TLS | 20 | #ifdef WITH_TLS |
21 | 21 | ||
22 | static int tls_available; | ||
23 | static int tls_done; | ||
24 | |||
22 | int | 25 | int |
23 | imap4d_starttls (struct imap4d_command *command, char *arg) | 26 | imap4d_starttls (struct imap4d_command *command, char *arg) |
24 | { | 27 | { |
... | @@ -40,10 +43,21 @@ imap4d_starttls (struct imap4d_command *command, char *arg) | ... | @@ -40,10 +43,21 @@ imap4d_starttls (struct imap4d_command *command, char *arg) |
40 | imap4d_capability_remove ("STARTTLS"); | 43 | imap4d_capability_remove ("STARTTLS"); |
41 | login_disabled = 0; | 44 | login_disabled = 0; |
42 | imap4d_capability_remove ("LOGINDISABLED"); | 45 | imap4d_capability_remove ("LOGINDISABLED"); |
46 | util_atexit (mu_deinit_tls_libs); | ||
43 | } | 47 | } |
44 | return status; | 48 | return status; |
45 | } | 49 | } |
46 | 50 | ||
51 | void | ||
52 | starttls_init () | ||
53 | { | ||
54 | tls_available = mu_check_tls_environment (); | ||
55 | if (tls_available) | ||
56 | tls_available = mu_init_tls_libs (); | ||
57 | if (tls_available) | ||
58 | imap4d_capability_add ("STARTTLS"); | ||
59 | } | ||
60 | |||
47 | #endif /* WITH_TLS */ | 61 | #endif /* WITH_TLS */ |
48 | 62 | ||
49 | /* EOF */ | 63 | /* EOF */ | ... | ... |
-
Please register or sign in to post a comment