From 1616911228941ee3a7d785e5f0f93615309f7daf Mon Sep 17 00:00:00 2001 From: Tijl Coosemans Date: Sun, 11 Jan 2015 14:10:33 +0000 Subject: [PATCH] Fix build when OpenSSL doesn't support SSL2/SSL3 PR: 195796 --- security/sst/files/patch-sst.c | 92 +++++++++++++++++++++++++++------- 1 file changed, 75 insertions(+), 17 deletions(-) diff --git a/security/sst/files/patch-sst.c b/security/sst/files/patch-sst.c index edf563ce8205..43f16a332dcb 100644 --- a/security/sst/files/patch-sst.c +++ b/security/sst/files/patch-sst.c @@ -1,13 +1,16 @@ ---- sst.c 2000-05-04 15:47:28.000000000 -0400 -+++ sst.c 2013-06-20 08:55:27.000000000 -0400 -@@ -213,5 +213,5 @@ +--- sst.c.orig 2000-05-04 19:47:28 UTC ++++ sst.c +@@ -212,7 +212,7 @@ + ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** */ #ifndef lint -static char rcsid[] = "$Header: /local/src/local.bin/sst/SRC/RCS/sst.c,v 1.12 2000/05/04 19:47:26 pkern Exp $"; +static const char rcsid[] = "$Header: /local/src/local.bin/sst/SRC/RCS/sst.c,v 1.12 2000/05/04 19:47:26 pkern Exp $"; #endif -@@ -262,8 +262,8 @@ + #include +@@ -261,10 +261,10 @@ int timeout = 0; + int inetd = 0; int eofclnt = 0; -char *prog = "sst"; @@ -20,7 +23,9 @@ +const char *method = NULL; char certfbuf[MAXPATHLEN], ssldbuf[MAXPATHLEN]; -@@ -298,6 +298,6 @@ + char *certf = NULL, *pkeyf = NULL, *ssld = NULL; +@@ -297,8 +297,8 @@ pid_t pid = 0; + * Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. */ -void @@ -29,7 +34,9 @@ +ERR_log_errors(void) { unsigned long l; -@@ -315,6 +315,6 @@ + char buf[200]; +@@ -314,13 +314,17 @@ ERR_log_errors() + } } -void @@ -38,7 +45,7 @@ +show_SSL_errors(void) { if (logging) ERR_log_errors(); -@@ -322,4 +322,8 @@ + else ERR_print_errors_fp(stderr); } +#ifndef __GNUC__ @@ -47,14 +54,18 @@ + #define SHOW_x(L,F,x) { \ if (logging) syslog((L), "%s", (x)); \ -@@ -347,5 +351,5 @@ + else fprintf((F), "%d: %s\n", getpid(), (x)); } +@@ -346,7 +350,7 @@ show_SSL_errors() + #define SHOW_info2(f,a1,a2) SHOW_x2(LOG_DEBUG,tty,f,a1,a2) -char *usageopts[] = { +const char *usageopts[] = { "", " options:", -@@ -375,7 +379,8 @@ + " --------", +@@ -374,9 +378,10 @@ char *usageopts[] = { + NULL }; -usage() @@ -65,7 +76,9 @@ + const char **uop = usageopts; if (logging) { -@@ -390,6 +395,6 @@ + syslog(LOG_ERR, "usage: %s [ '--' ]", prog); +@@ -389,8 +394,8 @@ usage() + } /* reaper -- zombie prevention */ -void @@ -74,13 +87,17 @@ +reaper(int signal __attribute__((unused))) { int w; -@@ -415,4 +420,5 @@ + pid_t p; +@@ -414,6 +419,7 @@ reaper() + * * - EOF on rd when in server mode means the actual server has finished. */ +static void relay(ssl, sd, rd, wd) SSL *ssl; -@@ -523,20 +529,12 @@ + int sd, rd, wd; +@@ -522,22 +528,14 @@ done: + } if (verbose) { - if (sizeof(off_t) > 4) { @@ -106,7 +123,24 @@ +static void srvr_prep(ctx, ssl, sd) SSL_CTX **ctx; -@@ -610,6 +608,6 @@ + SSL **ssl; +@@ -556,10 +554,14 @@ int sd; + + if (method == NULL) + meth = SSLv23_server_method(); ++#ifndef OPENSSL_NO_SSL2 + else if (strcmp(method, "ssl2") == 0) + meth = SSLv2_server_method(); ++#endif ++#ifndef OPENSSL_NO_SSL3_METHOD + else if (strcmp(method, "ssl3") == 0) + meth = SSLv3_server_method(); ++#endif + else if (strcmp(method, "tls1") == 0) + meth = TLSv1_server_method(); + else +@@ -609,8 +611,8 @@ int sd; + SHOW_info1("client cert subject: %s", subj); SHOW_info1("client cert issuer: %s", issu); - Free(subj); @@ -115,14 +149,33 @@ + free(issu); /* -@@ -625,5 +623,5 @@ + * XXX ... +@@ -624,7 +626,7 @@ int sd; + } } - +static void clnt_prep(ctx, ssl, sd) SSL_CTX **ctx; -@@ -700,6 +698,6 @@ + SSL **ssl; +@@ -643,10 +645,14 @@ int sd; + + if (method == NULL) + meth = SSLv23_client_method(); ++#ifndef OPENSSL_NO_SSL2 + else if (strcmp(method, "ssl2") == 0) + meth = SSLv2_client_method(); ++#endif ++#ifndef OPENSSL_NO_SSL3_METHOD + else if (strcmp(method, "ssl3") == 0) + meth = SSLv3_client_method(); ++#endif + else if (strcmp(method, "tls1") == 0) + meth = TLSv1_client_method(); + else +@@ -699,8 +705,8 @@ int sd; + SHOW_info1("server cert subject: %s", subj); SHOW_info1("server cert issuer: %s", issu); - Free(subj); @@ -131,16 +184,21 @@ + free(issu); /* -@@ -714,5 +712,5 @@ + * XXX ... +@@ -713,7 +719,7 @@ int sd; + X509_free (server_cert); } - +int main(ac, av) int ac; -@@ -757,5 +755,4 @@ + char *av[]; +@@ -756,7 +762,6 @@ char *av[]; + if (logging) openlog(prog, LOG_PID, LOG_SSL); if (errflg) { -usage: usage(); exit(1); + }