summaryrefslogtreecommitdiff
blob: a797c00b152cb82074f1841c6e0d36a02e6c1872 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
http://bugs.gentoo.org/34151
http://bugs.gentoo.org/146828
http://bugs.gentoo.org/335001

--- apps.h
+++ apps.h
@@ -65,9 +65,9 @@
 #include "../e_os.h"
 #endif
 
-#include OPENSSL"buffer.h"
-#include OPENSSL"bio.h"
-#include OPENSSL"crypto.h"
+#include "openssl/buffer.h"
+#include "openssl/bio.h"
+#include "openssl/crypto.h"
 /*#include "progs.h"*/
 
 #ifdef WIN16
--- Makefile
+++ Makefile
@@ -1,28 +1,9 @@
-
 SRC = s_server.c s_socket.c s_cb.c
-
-# For Solaris2.6
-#EXTLIBS = -lxnet
-
-# Debug/Optimizations
-#OPT = -g
-OPT = -O2
-
-# Define 
+LIBS = `pkg-config --libs openssl`
 OPENSSL="\"openssl/\""
-#OPENSSL=""
 
-all :
-	gcc -o sslwrap ${SRC} ${OPT} -DFLAT_INC -DOPENSSL=${OPENSSL} \
-		-L/usr/local/ssl/lib -lssl -lcrypto \
-		-I/usr/local/ssl/include \
-		${EXTLIBS}
+all:
+	$(CC) $(LDFLAGS) $(CFLAGS) -o sslwrap ${SRC} -DFLAT_INC -DOPENSSL=${OPENSSL} ${LIBS}
 
 clean:
 	rm -f sslwrap *.o *~
-
-
-
-
-
-
--- s_cb.c
+++ s_cb.c
@@ -63,9 +63,9 @@
 #include "apps.h"
 #undef NON_MAIN
 #undef USE_SOCKETS
-#include OPENSSL"err.h"
-#include OPENSSL"x509.h"
-#include OPENSSL"ssl.h"
+#include "openssl/err.h"
+#include "openssl/x509.h"
+#include "openssl/ssl.h"
 #include "s_apps.h"
 
 int verify_depth=0;
--- s_server.c
+++ s_server.c
@@ -121,14 +117,14 @@
 #ifdef WIN16
 #define APPS_WIN16
 #endif
-#include OPENSSL"lhash.h"
-#include OPENSSL"bn.h"
+#include "openssl/lhash.h"
+#include "openssl/bn.h"
 #define USE_SOCKETS
 #include "apps.h"
-#include OPENSSL"err.h"
-#include OPENSSL"pem.h"
-#include OPENSSL"x509.h"
-#include OPENSSL"ssl.h"
+#include "err.h"
+#include "openssl/pem.h"
+#include "openssl/x509.h"
+#include "openssl/ssl.h"
 #include "s_apps.h"
 
 #ifndef NOPROTO
@@ -468,7 +464,7 @@
 
 	if (bugs) SSL_CTX_set_options(ctx,SSL_OP_ALL);
 	if (hack) SSL_CTX_set_options(ctx,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
-	if (hack) SSL_CTX_set_options(ctx,SSL_OP_NON_EXPORT_FIRST);
+	if (hack) SSL_CTX_set_options(ctx,SSL_OP_CIPHER_SERVER_PREFERENCE);
 
 	if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
 
@@ -622,7 +618,7 @@
 #endif /*NO_EXEC*/
 	}
 
-	if ((buf=malloc(BUFSIZZ)) == NULL)
+	if ((buf=CRYPTO_malloc(BUFSIZZ,__FILE__,__LINE__)) == NULL)
 		{
 		BIO_printf(bio_err,"out of memory\n");
 		goto err;
@@ -729,7 +725,7 @@
 	if (buf != NULL)
 		{
 		memset(buf,0,BUFSIZZ);
-		free(buf);
+		CRYPTO_free(buf);
 		}
 
 	return(ret);
--- s_socket.c
+++ s_socket.c
@@ -67,7 +67,7 @@
 #undef USE_SOCKETS
 #undef NON_MAIN
 #include "s_apps.h"
-#include OPENSSL"ssl.h"
+#include "openssl/ssl.h"
 
 #ifndef NOPROTO
 static struct hostent *GetHostByName(char *name);
@@ -305,7 +305,7 @@
 			return(0);
 			}
 		i=(*cb)(name,sock, sock);
-		if (name != NULL) free(name);
+		if (name != NULL) CRYPTO_free(name);
 		SHUTDOWN(sock);
 		if (i < 0)
 			{
@@ -410,7 +410,7 @@
 		}
 	else
 		{
-		if ((*host=(char *)malloc(strlen(h1->h_name)+1)) == NULL)
+		if ((*host=(char *)CRYPTO_malloc(strlen(h1->h_name)+1,__FILE__,__LINE__)) == NULL)
 			{
 			perror("Malloc");
 			return(0);