avoid preprocessor warnings on missing features: #if => #ifdef
This commit is contained in:
parent
cf6a7b4d18
commit
4afd31a457
|
@ -34,7 +34,7 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
#if HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
# define _GNU_SOURCE
|
# define _GNU_SOURCE
|
||||||
# include <getopt.h>
|
# include <getopt.h>
|
||||||
struct option Opts[] = {
|
struct option Opts[] = {
|
||||||
|
@ -187,7 +187,7 @@ main( int argc, char **argv )
|
||||||
#define FLAGS "wW:alCLRc:defhp:qu:P:r:F:M:1I:s:vVD"
|
#define FLAGS "wW:alCLRc:defhp:qu:P:r:F:M:1I:s:vVD"
|
||||||
|
|
||||||
mod = all = list = ops = writeout = Quiet = Verbose = Debug = 0;
|
mod = all = list = ops = writeout = Quiet = Verbose = Debug = 0;
|
||||||
#if HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
while ((i = getopt_long( argc, argv, FLAGS, Opts, NULL )) != -1)
|
while ((i = getopt_long( argc, argv, FLAGS, Opts, NULL )) != -1)
|
||||||
#else
|
#else
|
||||||
while ((i = getopt( argc, argv, FLAGS )) != -1)
|
while ((i = getopt( argc, argv, FLAGS )) != -1)
|
||||||
|
@ -252,7 +252,7 @@ main( int argc, char **argv )
|
||||||
mod = 1;
|
mod = 1;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
if (!strncasecmp( "imaps:", optarg, 6 )) {
|
if (!strncasecmp( "imaps:", optarg, 6 )) {
|
||||||
global.use_imaps = 1;
|
global.use_imaps = 1;
|
||||||
global.port = 993;
|
global.port = 993;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
/* This must come before isync.h to avoid our #define S messing up
|
/* This must come before isync.h to avoid our #define S messing up
|
||||||
* blowfish.h on MacOS X. */
|
* blowfish.h on MacOS X. */
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
# include <openssl/ssl.h>
|
# include <openssl/ssl.h>
|
||||||
# include <openssl/err.h>
|
# include <openssl/err.h>
|
||||||
# include <openssl/hmac.h>
|
# include <openssl/hmac.h>
|
||||||
|
@ -62,7 +62,7 @@ typedef struct imap_server_conf {
|
||||||
int port;
|
int port;
|
||||||
char *user;
|
char *user;
|
||||||
char *pass;
|
char *pass;
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
char *cert_file;
|
char *cert_file;
|
||||||
unsigned use_imaps:1;
|
unsigned use_imaps:1;
|
||||||
unsigned require_ssl:1;
|
unsigned require_ssl:1;
|
||||||
|
@ -96,7 +96,7 @@ typedef struct _list {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int fd;
|
int fd;
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
SSL *ssl;
|
SSL *ssl;
|
||||||
unsigned int use_ssl:1;
|
unsigned int use_ssl:1;
|
||||||
#endif
|
#endif
|
||||||
|
@ -124,7 +124,7 @@ typedef struct imap_store {
|
||||||
/* command queue */
|
/* command queue */
|
||||||
int nexttag, num_in_progress, literal_pending;
|
int nexttag, num_in_progress, literal_pending;
|
||||||
struct imap_cmd *in_progress, **in_progress_append;
|
struct imap_cmd *in_progress, **in_progress_append;
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
SSL_CTX *SSLContext;
|
SSL_CTX *SSLContext;
|
||||||
#endif
|
#endif
|
||||||
buffer_t buf; /* this is BIG, so put it last */
|
buffer_t buf; /* this is BIG, so put it last */
|
||||||
|
@ -155,7 +155,7 @@ enum CAPABILITY {
|
||||||
UIDPLUS,
|
UIDPLUS,
|
||||||
LITERALPLUS,
|
LITERALPLUS,
|
||||||
NAMESPACE,
|
NAMESPACE,
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
CRAM,
|
CRAM,
|
||||||
STARTTLS,
|
STARTTLS,
|
||||||
#endif
|
#endif
|
||||||
|
@ -166,7 +166,7 @@ static const char *cap_list[] = {
|
||||||
"UIDPLUS",
|
"UIDPLUS",
|
||||||
"LITERAL+",
|
"LITERAL+",
|
||||||
"NAMESPACE",
|
"NAMESPACE",
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
"AUTH=CRAM-MD5",
|
"AUTH=CRAM-MD5",
|
||||||
"STARTTLS",
|
"STARTTLS",
|
||||||
#endif
|
#endif
|
||||||
|
@ -187,7 +187,7 @@ static const char *Flags[] = {
|
||||||
"Deleted",
|
"Deleted",
|
||||||
};
|
};
|
||||||
|
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
/* Some of this code is inspired by / lifted from mutt. */
|
/* Some of this code is inspired by / lifted from mutt. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -351,7 +351,7 @@ init_ssl_ctx( imap_store_t *ctx )
|
||||||
static void
|
static void
|
||||||
socket_perror( const char *func, Socket_t *sock, int ret )
|
socket_perror( const char *func, Socket_t *sock, int ret )
|
||||||
{
|
{
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (sock->use_ssl) {
|
if (sock->use_ssl) {
|
||||||
|
@ -388,7 +388,7 @@ socket_read( Socket_t *sock, char *buf, int len )
|
||||||
|
|
||||||
assert( sock->fd >= 0 );
|
assert( sock->fd >= 0 );
|
||||||
n =
|
n =
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
sock->use_ssl ? SSL_read( sock->ssl, buf, len ) :
|
sock->use_ssl ? SSL_read( sock->ssl, buf, len ) :
|
||||||
#endif
|
#endif
|
||||||
read( sock->fd, buf, len );
|
read( sock->fd, buf, len );
|
||||||
|
@ -407,7 +407,7 @@ socket_write( Socket_t *sock, char *buf, int len )
|
||||||
|
|
||||||
assert( sock->fd >= 0 );
|
assert( sock->fd >= 0 );
|
||||||
n =
|
n =
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
sock->use_ssl ? SSL_write( sock->ssl, buf, len ) :
|
sock->use_ssl ? SSL_write( sock->ssl, buf, len ) :
|
||||||
#endif
|
#endif
|
||||||
write( sock->fd, buf, len );
|
write( sock->fd, buf, len );
|
||||||
|
@ -428,7 +428,7 @@ socket_pending( Socket_t *sock )
|
||||||
return -1;
|
return -1;
|
||||||
if (num > 0)
|
if (num > 0)
|
||||||
return num;
|
return num;
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
if (sock->use_ssl)
|
if (sock->use_ssl)
|
||||||
return SSL_pending( sock->ssl );
|
return SSL_pending( sock->ssl );
|
||||||
#endif
|
#endif
|
||||||
|
@ -1295,7 +1295,7 @@ imap_open_store( store_conf_t *conf,
|
||||||
struct hostent *he;
|
struct hostent *he;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
int s, a[2], preauth;
|
int s, a[2], preauth;
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
int use_ssl;
|
int use_ssl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1317,7 +1317,7 @@ imap_open_store( store_conf_t *conf,
|
||||||
ctx->in_progress_append = &ctx->in_progress;
|
ctx->in_progress_append = &ctx->in_progress;
|
||||||
|
|
||||||
/* open connection to IMAP server */
|
/* open connection to IMAP server */
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
use_ssl = 0;
|
use_ssl = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1379,7 +1379,7 @@ imap_open_store( store_conf_t *conf,
|
||||||
ctx->buf.sock.fd = s;
|
ctx->buf.sock.fd = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
if (srvc->use_imaps) {
|
if (srvc->use_imaps) {
|
||||||
if (start_tls( ctx ))
|
if (start_tls( ctx ))
|
||||||
goto ssl_bail;
|
goto ssl_bail;
|
||||||
|
@ -1407,7 +1407,7 @@ imap_open_store( store_conf_t *conf,
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
||||||
if (!preauth) {
|
if (!preauth) {
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
if (!srvc->use_imaps && (srvc->use_sslv2 || srvc->use_sslv3 || srvc->use_tlsv1)) {
|
if (!srvc->use_imaps && (srvc->use_sslv2 || srvc->use_sslv3 || srvc->use_tlsv1)) {
|
||||||
/* always try to select SSL support if available */
|
/* always try to select SSL support if available */
|
||||||
if (CAP(STARTTLS)) {
|
if (CAP(STARTTLS)) {
|
||||||
|
@ -1452,7 +1452,7 @@ imap_open_store( store_conf_t *conf,
|
||||||
*/
|
*/
|
||||||
srvc->pass = nfstrdup( arg );
|
srvc->pass = nfstrdup( arg );
|
||||||
}
|
}
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
if (CAP(CRAM)) {
|
if (CAP(CRAM)) {
|
||||||
struct imap_cmd *cmd = new_imap_cmd();
|
struct imap_cmd *cmd = new_imap_cmd();
|
||||||
|
|
||||||
|
@ -1470,7 +1470,7 @@ imap_open_store( store_conf_t *conf,
|
||||||
error( "Skipping account %s, server forbids LOGIN\n", srvc->name );
|
error( "Skipping account %s, server forbids LOGIN\n", srvc->name );
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
if (!use_ssl)
|
if (!use_ssl)
|
||||||
#endif
|
#endif
|
||||||
warn( "*** IMAP Warning *** Password is being sent in the clear\n" );
|
warn( "*** IMAP Warning *** Password is being sent in the clear\n" );
|
||||||
|
@ -1504,7 +1504,7 @@ imap_open_store( store_conf_t *conf,
|
||||||
cb( &ctx->gen, aux );
|
cb( &ctx->gen, aux );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
ssl_bail:
|
ssl_bail:
|
||||||
/* This avoids that we try to send LOGOUT to an unusable socket. */
|
/* This avoids that we try to send LOGOUT to an unusable socket. */
|
||||||
close( ctx->buf.sock.fd );
|
close( ctx->buf.sock.fd );
|
||||||
|
@ -1785,7 +1785,7 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep, int *err )
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
/* this will probably annoy people, but its the best default just in
|
/* this will probably annoy people, but its the best default just in
|
||||||
* case people forget to turn it on
|
* case people forget to turn it on
|
||||||
*/
|
*/
|
||||||
|
@ -1796,7 +1796,7 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep, int *err )
|
||||||
while (getcline( cfg ) && cfg->cmd) {
|
while (getcline( cfg ) && cfg->cmd) {
|
||||||
if (!strcasecmp( "Host", cfg->cmd )) {
|
if (!strcasecmp( "Host", cfg->cmd )) {
|
||||||
/* The imap[s]: syntax is just a backwards compat hack. */
|
/* The imap[s]: syntax is just a backwards compat hack. */
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
if (!memcmp( "imaps:", cfg->val, 6 )) {
|
if (!memcmp( "imaps:", cfg->val, 6 )) {
|
||||||
cfg->val += 6;
|
cfg->val += 6;
|
||||||
server->use_imaps = 1;
|
server->use_imaps = 1;
|
||||||
|
@ -1818,7 +1818,7 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep, int *err )
|
||||||
server->pass = nfstrdup( cfg->val );
|
server->pass = nfstrdup( cfg->val );
|
||||||
else if (!strcasecmp( "Port", cfg->cmd ))
|
else if (!strcasecmp( "Port", cfg->cmd ))
|
||||||
server->port = parse_int( cfg );
|
server->port = parse_int( cfg );
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
else if (!strcasecmp( "CertificateFile", cfg->cmd )) {
|
else if (!strcasecmp( "CertificateFile", cfg->cmd )) {
|
||||||
server->cert_file = expand_strdup( cfg->val );
|
server->cert_file = expand_strdup( cfg->val );
|
||||||
if (access( server->cert_file, R_OK )) {
|
if (access( server->cert_file, R_OK )) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ PACKAGE " " VERSION " - mailbox synchronizer\n"
|
||||||
"--create and --expunge can be suffixed with -master/-slave. Read the man page.\n"
|
"--create and --expunge can be suffixed with -master/-slave. Read the man page.\n"
|
||||||
"\nSupported mailbox formats are: IMAP4rev1, Maildir\n"
|
"\nSupported mailbox formats are: IMAP4rev1, Maildir\n"
|
||||||
"\nCompile time options:\n"
|
"\nCompile time options:\n"
|
||||||
#if HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
" +HAVE_LIBSSL\n"
|
" +HAVE_LIBSSL\n"
|
||||||
#else
|
#else
|
||||||
" -HAVE_LIBSSL\n"
|
" -HAVE_LIBSSL\n"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user