View | Details | Raw Unified | Return to bug 1341
Collapse All | Expand All

(-)a/spamc/libspamc.c (+12 lines)
Lines 2049-2054 libspamc_sslversion() Link Here
2049
2049
2050
/* --------------------------------------------------------------------------- */
2050
/* --------------------------------------------------------------------------- */
2051
2051
2052
char *
2053
libspamc_sslversion()
2054
{
2055
#ifdef SPAMC_SSL
2056
    return OPENSSL_VERSION_TEXT;
2057
#else
2058
    return NULL;
2059
#endif
2060
}
2061
2062
/* --------------------------------------------------------------------------- */
2063
2052
/*
2064
/*
2053
* Unit tests.  Must be built externally, e.g.:
2065
* Unit tests.  Must be built externally, e.g.:
2054
*
2066
*
(-)a/spamc/spamc.c (-33 / +30 lines)
Lines 43-55 Link Here
43
#include <arpa/inet.h>
43
#include <arpa/inet.h>
44
#endif
44
#endif
45
45
46
#ifdef SPAMC_SSL
47
#include <openssl/crypto.h>
48
#ifndef OPENSSL_VERSION_TEXT
49
#define OPENSSL_VERSION_TEXT "OpenSSL"
50
#endif
51
#endif
52
53
#ifdef HAVE_SYSEXITS_H
46
#ifdef HAVE_SYSEXITS_H
54
#include <sysexits.h>
47
#include <sysexits.h>
55
#endif
48
#endif
Lines 115-124 check_malloc (void *ptr) Link Here
115
void
108
void
116
print_version(void)
109
print_version(void)
117
{
110
{
111
    char *sslver = libspamc_sslversion();
118
    printf("%s version %s\n", "SpamAssassin Client", VERSION_STRING);
112
    printf("%s version %s\n", "SpamAssassin Client", VERSION_STRING);
119
#ifdef SPAMC_SSL
113
    if (sslver) {
120
    printf("  compiled with SSL support (%s)\n", OPENSSL_VERSION_TEXT);
114
        printf("  compiled with SSL support (%s)\n", sslver);
121
#endif
115
    }
122
}
116
}
123
117
124
static void
118
static void
Lines 143-151 print_usage(void) Link Here
143
        "                      hostname.\n");
137
        "                      hostname.\n");
144
    usg("  -p, --port port     Specify port for connection to spamd.\n"
138
    usg("  -p, --port port     Specify port for connection to spamd.\n"
145
        "                      [default: 783]\n");
139
        "                      [default: 783]\n");
146
#ifdef SPAMC_SSL
140
    if (libspamc_sslversion()) {
147
    usg("  -S, --ssl           Use SSL to talk to spamd.\n");
141
        usg("  -S, --ssl           Use SSL to talk to spamd.\n");
148
#endif
142
    }
149
#ifndef _WIN32
143
#ifndef _WIN32
150
    usg("  -U, --socket path   Connect to spamd via UNIX domain sockets.\n");
144
    usg("  -U, --socket path   Connect to spamd via UNIX domain sockets.\n");
151
#endif
145
#endif
Lines 340-368 read_args(int argc, char **argv, Link Here
340
                *max_size = atoi(spamc_optarg);
334
                *max_size = atoi(spamc_optarg);
341
                break;
335
                break;
342
            }
336
            }
343
#ifdef SPAMC_SSL
344
            case 'S':
337
            case 'S':
345
            {
338
            {
346
                flags |= SPAMC_USE_SSL;
339
                if (libspamc_sslversion()) {
347
		if (!spamc_optarg || (strcmp(spamc_optarg,"sslv23") == 0)) {
340
                    flags |= SPAMC_USE_SSL;
348
		  /* this is the default */
341
                    if (!spamc_optarg || (strcmp(spamc_optarg,"sslv23") == 0)) {
349
		}
342
                        /* this is the default */
350
	        else if (strcmp(spamc_optarg,"sslv2") == 0) {
343
                    }
351
		  flags |= SPAMC_SSLV2;
344
                    else if (strcmp(spamc_optarg,"sslv2") == 0) {
352
		}
345
                        flags |= SPAMC_SSLV2;
353
		else if (strcmp(spamc_optarg,"sslv3") == 0) {
346
                    }
354
		  flags |= SPAMC_SSLV3;
347
                    else if (strcmp(spamc_optarg,"sslv3") == 0) {
355
		}
348
                        flags |= SPAMC_SSLV3;
356
		else if (strcmp(spamc_optarg,"tlsv1") == 0) {
349
                    }
357
		  flags |= (SPAMC_SSLV2 | SPAMC_SSLV3);
350
                    else if (strcmp(spamc_optarg,"tlsv1") == 0) {
358
		}
351
                        flags |= (SPAMC_SSLV2 | SPAMC_SSLV3);
359
		else {
352
                    }
360
		    libspamc_log(flags, LOG_ERR, "Please specifiy a legal ssl version (%s)", spamc_optarg);
353
                    else {
361
		    ret = EX_USAGE;
354
                        libspamc_log(flags, LOG_ERR, "Please specifiy a legal ssl version (%s)", spamc_optarg);
362
		}
355
                        ret = EX_USAGE;
363
                break;
356
                    }
357
                    break;
358
                }
359
                libspamc_log(flags, LOG_ERR, "invalid usage");
360
                print_usage();
361
                return(EX_USAGE);
364
            }
362
            }
365
#endif
366
            case 't':
363
            case 't':
367
            {
364
            {
368
                timeout = atoi(spamc_optarg);
365
                timeout = atoi(spamc_optarg);
(-)a/spamc/utils.h (+4 lines)
Lines 30-35 extern int libspamc_timeout; /* default timeout in seconds */ Link Here
30
#include <openssl/pem.h>
30
#include <openssl/pem.h>
31
#include <openssl/ssl.h>
31
#include <openssl/ssl.h>
32
#include <openssl/err.h>
32
#include <openssl/err.h>
33
#ifndef OPENSSL_VERSION_TEXT
34
#define OPENSSL_VERSION_TEXT "OpenSSL"
35
#endif
36
33
#else
37
#else
34
typedef int SSL;		/* fake type to avoid conditional compilation */
38
typedef int SSL;		/* fake type to avoid conditional compilation */
35
typedef int SSL_CTX;
39
typedef int SSL_CTX;

Return to bug 1341