]> git.pld-linux.org Git - packages/eggdrop.git/blame - eggdrop-ssl.patch
- release 5
[packages/eggdrop.git] / eggdrop-ssl.patch
CommitLineData
8eb15d2d 1diff -burNp eggdrop1.6.19/aclocal.m4 eggdrop1.6.19.new/aclocal.m4
2--- eggdrop1.6.19/aclocal.m4 2008-04-19 06:21:20.000000000 +0200
3+++ eggdrop1.6.19.new/aclocal.m4 2008-09-22 14:03:38.304371902 +0200
4@@ -36,6 +36,63 @@ AC_DEFUN([EGG_MSG_CONFIGURE_START],
5 AC_MSG_RESULT
6e8c346a 6 ])
e3a05f4b 7
e3a05f4b
AG
8+dnl EGG_SSL_CRAP()
9+dnl
10+AC_DEFUN(EGG_SSL_CRAP, [dnl
11+#ssl checks - hoe
12+AC_MSG_CHECKING(whether to include SSL support)
13+AC_ARG_WITH(ssl,
14+[ --with-ssl[=PATH] Include SSL support (DIR is OpenSSL's install dir).],
15+[
16+ case "$withval" in
17+ no)
18+ AC_MSG_RESULT(no) ;;
19+ yes)
20+ AC_MSG_RESULT(yes)
21+ AC_CHECK_LIB(ssl,SSL_accept,[AC_DEFINE(EGG_SSL_EXT)
22+ SSL_LIBS="-lssl -lcrypto"],[AC_MSG_ERROR([You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL])],-lcrypto)
23+ ;;
24+ *)
25+dnl A whole whack of possible places where this might be
26+ test -f $withval/openssl/ssl.h && SSL_INCLUDE="$withval"
27+ test -f $withval/include/openssl/ssl.h && SSL_INCLUDE="$withval/include"
28+
29+ test -f $withval/lib/libssl.a && SSL_LIB="$withval/lib"
30+ test -f $withval/lib/ssl/libssl.a && SSL_LIB="$withval/lib/ssl"
31+ test -f $withval/lib/openssl/libssl.a && SSL_LIB="$withval/lib/openssl/ssl"
32+ test -f $withval/libssl.a && SSL_LIB="$withval"
33+ test -f $withval/ssl/libssl.a && SSL_LIB="$withval/ssl"
34+ test -f $withval/openssl/libssl.a && SSL_LIB="$withval/openssl"
35+
36+ test -f $withval/lib/libcrypto.a && CRYPTO_LIB="$withval/lib"
37+ test -f $withval/lib/ssl/libcrypto.a && CRYPTO_LIB="$withval/lib/ssl"
38+ test -f $withval/lib/openssl/libcrypto.a && CRYPTO_LIB="$withval/lib/openssl/ssl"
39+ test -f $withval/libcrypto.a && CRYPTO_LIB="$withval"
40+ test -f $withval/ssl/libcrypto.a && CRYPTO_LIB="$withval/ssl"
41+ test -f $withval/openssl/libcrypto.a && CRYPTO_LIB="$withval/openssl"
42+
43+ if test -n "$SSL_INCLUDE" && test -n "$SSL_LIB" && test -n "$CRYPTO_LIB"; then
44+ SSL_LIBS="-lssl -lcrypto -L$SSL_LIB -L$CRYPTO_LIB";
6e8c346a 45+ AC_DEFINE([EGG_SSL_EXT], [], [SSL support])
e3a05f4b
AG
46+ AC_MSG_RESULT(yes)
47+ else
48+ AC_MSG_RESULT(no)
49+ AC_MSG_ERROR([You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL])
50+ fi ;;
51+ esac
52+],[
53+ AC_MSG_RESULT(will try to find)
54+ AC_CHECK_LIB(ssl,SSL_accept,[AC_DEFINE(EGG_SSL_EXT)
55+ SSL_LIBS="-lssl -lcrypto"],[AC_MSG_ERROR([OpenSSL was not found. Please supply a pathname to OpenSSL])],-lcrypto)
6e8c346a 56+ AC_CHECK_HEADERS("openssl/ssl.h",,[AC_MSG_ERROR([OpenSSL was not found. Please supply a pathname to OpenSSL])],)
e3a05f4b 57+
6e8c346a
AG
58+ AC_SUBST(SSL_LIBS)dnl
59+ AC_SUBST(SSL_INCLUDE)dnl
60+])
e3a05f4b 61+
6e8c346a
AG
62+#end of ssl checks - hoe (.16 by poci)
63+])dnl
e3a05f4b 64+
8eb15d2d 65
6e8c346a
AG
66 dnl EGG_MSG_CONFIGURE_END()
67 dnl
8eb15d2d 68diff -burNp eggdrop1.6.19/config.h.in eggdrop1.6.19.new/config.h.in
69--- eggdrop1.6.19/config.h.in 2006-11-20 12:38:25.000000000 +0100
70+++ eggdrop1.6.19.new/config.h.in 2008-09-22 14:07:26.990831137 +0200
71@@ -33,6 +33,9 @@
6e8c346a
AG
72 /* Define to 1 if you have the `clock' function. */
73 #undef HAVE_CLOCK
e3a05f4b 74
6e8c346a
AG
75+/* Defines ssl mode */
76+#undef EGG_SSL_EXT
e3a05f4b 77+
6e8c346a
AG
78 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
79 */
80 #undef HAVE_DIRENT_H
8eb15d2d 81diff -burNp eggdrop1.6.19/configure eggdrop1.6.19.new/configure
82--- eggdrop1.6.19/configure 2008-04-19 06:21:20.000000000 +0200
83+++ eggdrop1.6.19.new/configure 2008-09-22 14:22:28.610498567 +0200
84@@ -856,6 +857,7 @@ Optional Packages:
6e8c346a
AG
85 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
86 --with-tcllib=PATH full path to Tcl library
87 --with-tclinc=PATH full path to Tcl header
88+ --with-ssl=PATH Include SSL support (DIR is OpenSSL's install dir).
e3a05f4b 89
6e8c346a
AG
90 Some influential environment variables:
91 CC C compiler command
8eb15d2d 92@@ -10113,8 +10115,372 @@ EOF
e3a05f4b 93
8eb15d2d 94 ac_config_commands="$ac_config_commands replace-if-changed"
e3a05f4b
AG
95
96+#ssl checks - hoe
97+echo "$as_me:$LINENO: checking whether to include SSL support" >&5
98+echo $ECHO_N "checking whether to include SSL support... $ECHO_C" >&6
99+
100+# Check whether --with-ssl or --without-ssl was given.
101+if test "${with_ssl+set}" = set; then
102+ withval="$with_ssl"
103+
104+ case "$withval" in
105+ no)
106+ echo "$as_me:$LINENO: result: no" >&5
107+echo "${ECHO_T}no" >&6 ;;
108+ yes)
109+ echo "$as_me:$LINENO: result: yes" >&5
110+echo "${ECHO_T}yes" >&6
111+ echo "$as_me:$LINENO: checking for SSL_accept in -lssl" >&5
112+echo $ECHO_N "checking for SSL_accept in -lssl... $ECHO_C" >&6
113+if test "${ac_cv_lib_ssl_SSL_accept+set}" = set; then
114+ echo $ECHO_N "(cached) $ECHO_C" >&6
115+else
116+ ac_check_lib_save_LIBS=$LIBS
117+LIBS="-lssl -lcrypto $LIBS"
118+cat >conftest.$ac_ext <<_ACEOF
e3a05f4b
AG
119+/* confdefs.h. */
120+_ACEOF
121+cat confdefs.h >>conftest.$ac_ext
122+cat >>conftest.$ac_ext <<_ACEOF
123+/* end confdefs.h. */
124+
125+/* Override any gcc2 internal prototype to avoid an error. */
126+#ifdef __cplusplus
127+extern "C"
128+#endif
129+/* We use char because int might match the return type of a gcc2
130+ builtin and then its argument prototype would still apply. */
131+char SSL_accept ();
132+int
133+main ()
134+{
135+SSL_accept ();
136+ ;
137+ return 0;
138+}
139+_ACEOF
140+rm -f conftest.$ac_objext conftest$ac_exeext
141+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
6e8c346a 142+ (eval $ac_link) 2>conftest.er1
e3a05f4b 143+ ac_status=$?
6e8c346a
AG
144+ grep -v '^ *+' conftest.er1 >conftest.err
145+ rm -f conftest.er1
146+ cat conftest.err >&5
e3a05f4b
AG
147+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
148+ (exit $ac_status); } &&
6e8c346a
AG
149+ { ac_try='test -z "$ac_c_werror_flag"
150+ || test ! -s conftest.err'
151+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
152+ (eval $ac_try) 2>&5
153+ ac_status=$?
154+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
155+ (exit $ac_status); }; } &&
156+ { ac_try='test -s conftest$ac_exeext'
e3a05f4b
AG
157+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
158+ (eval $ac_try) 2>&5
159+ ac_status=$?
160+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
161+ (exit $ac_status); }; }; then
162+ ac_cv_lib_ssl_SSL_accept=yes
163+else
164+ echo "$as_me: failed program was:" >&5
165+sed 's/^/| /' conftest.$ac_ext >&5
166+
167+ac_cv_lib_ssl_SSL_accept=no
168+fi
6e8c346a
AG
169+rm -f conftest.err conftest.$ac_objext \
170+ conftest$ac_exeext conftest.$ac_ext
e3a05f4b
AG
171+LIBS=$ac_check_lib_save_LIBS
172+fi
173+echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_accept" >&5
174+echo "${ECHO_T}$ac_cv_lib_ssl_SSL_accept" >&6
175+if test $ac_cv_lib_ssl_SSL_accept = yes; then
176+ cat >>confdefs.h <<\_ACEOF
177+#define EGG_SSL_EXT 1
178+_ACEOF
179+
180+ SSL_LIBS="-lssl -lcrypto"
181+else
182+ { { echo "$as_me:$LINENO: error: You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL" >&5
183+echo "$as_me: error: You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL" >&2;}
184+ { (exit 1); exit 1; }; }
185+fi
186+
187+ ;;
188+ *)
189+ test -f $withval/openssl/ssl.h && SSL_INCLUDE="$withval"
190+ test -f $withval/include/openssl/ssl.h && SSL_INCLUDE="$withval/include"
191+
192+ test -f $withval/lib/libssl.a && SSL_LIB="$withval/lib"
193+ test -f $withval/lib/ssl/libssl.a && SSL_LIB="$withval/lib/ssl"
194+ test -f $withval/lib/openssl/libssl.a && SSL_LIB="$withval/lib/openssl/ssl"
195+ test -f $withval/libssl.a && SSL_LIB="$withval"
196+ test -f $withval/ssl/libssl.a && SSL_LIB="$withval/ssl"
197+ test -f $withval/openssl/libssl.a && SSL_LIB="$withval/openssl"
198+
199+ test -f $withval/lib/libcrypto.a && CRYPTO_LIB="$withval/lib"
200+ test -f $withval/lib/ssl/libcrypto.a && CRYPTO_LIB="$withval/lib/ssl"
201+ test -f $withval/lib/openssl/libcrypto.a && CRYPTO_LIB="$withval/lib/openssl/ssl"
202+ test -f $withval/libcrypto.a && CRYPTO_LIB="$withval"
203+ test -f $withval/ssl/libcrypto.a && CRYPTO_LIB="$withval/ssl"
204+ test -f $withval/openssl/libcrypto.a && CRYPTO_LIB="$withval/openssl"
205+
206+ if test -n "$SSL_INCLUDE" && test -n "$SSL_LIB" && test -n "$CRYPTO_LIB"; then
207+ SSL_LIBS="-lssl -lcrypto -L$SSL_LIB -L$CRYPTO_LIB";
208+ cat >>confdefs.h <<\_ACEOF
209+#define EGG_SSL_EXT 1
210+_ACEOF
211+
212+ echo "$as_me:$LINENO: result: yes" >&5
213+echo "${ECHO_T}yes" >&6
214+ else
215+ echo "$as_me:$LINENO: result: no" >&5
216+echo "${ECHO_T}no" >&6
217+ { { echo "$as_me:$LINENO: error: You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL" >&5
218+echo "$as_me: error: You requested SSL support, but OpenSSL was not found. Please supply a pathname to OpenSSL" >&2;}
219+ { (exit 1); exit 1; }; }
220+ fi ;;
221+ esac
222+
223+else
224+
225+ echo "$as_me:$LINENO: result: will try to find" >&5
226+echo "${ECHO_T}will try to find" >&6
227+ echo "$as_me:$LINENO: checking for SSL_accept in -lssl" >&5
228+echo $ECHO_N "checking for SSL_accept in -lssl... $ECHO_C" >&6
229+if test "${ac_cv_lib_ssl_SSL_accept+set}" = set; then
230+ echo $ECHO_N "(cached) $ECHO_C" >&6
231+else
232+ ac_check_lib_save_LIBS=$LIBS
233+LIBS="-lssl -lcrypto $LIBS"
234+cat >conftest.$ac_ext <<_ACEOF
e3a05f4b
AG
235+/* confdefs.h. */
236+_ACEOF
237+cat confdefs.h >>conftest.$ac_ext
238+cat >>conftest.$ac_ext <<_ACEOF
239+/* end confdefs.h. */
240+
241+/* Override any gcc2 internal prototype to avoid an error. */
242+#ifdef __cplusplus
243+extern "C"
244+#endif
245+/* We use char because int might match the return type of a gcc2
246+ builtin and then its argument prototype would still apply. */
247+char SSL_accept ();
248+int
249+main ()
250+{
251+SSL_accept ();
252+ ;
253+ return 0;
254+}
255+_ACEOF
256+rm -f conftest.$ac_objext conftest$ac_exeext
257+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
6e8c346a 258+ (eval $ac_link) 2>conftest.er1
e3a05f4b 259+ ac_status=$?
6e8c346a
AG
260+ grep -v '^ *+' conftest.er1 >conftest.err
261+ rm -f conftest.er1
262+ cat conftest.err >&5
e3a05f4b
AG
263+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
264+ (exit $ac_status); } &&
6e8c346a
AG
265+ { ac_try='test -z "$ac_c_werror_flag"
266+ || test ! -s conftest.err'
267+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
268+ (eval $ac_try) 2>&5
269+ ac_status=$?
270+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
271+ (exit $ac_status); }; } &&
272+ { ac_try='test -s conftest$ac_exeext'
e3a05f4b
AG
273+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
274+ (eval $ac_try) 2>&5
275+ ac_status=$?
276+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
277+ (exit $ac_status); }; }; then
278+ ac_cv_lib_ssl_SSL_accept=yes
279+else
280+ echo "$as_me: failed program was:" >&5
281+sed 's/^/| /' conftest.$ac_ext >&5
282+
283+ac_cv_lib_ssl_SSL_accept=no
284+fi
6e8c346a
AG
285+rm -f conftest.err conftest.$ac_objext \
286+ conftest$ac_exeext conftest.$ac_ext
e3a05f4b
AG
287+LIBS=$ac_check_lib_save_LIBS
288+fi
289+echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_accept" >&5
290+echo "${ECHO_T}$ac_cv_lib_ssl_SSL_accept" >&6
291+if test $ac_cv_lib_ssl_SSL_accept = yes; then
292+ cat >>confdefs.h <<\_ACEOF
293+#define EGG_SSL_EXT 1
294+_ACEOF
295+
296+ SSL_LIBS="-lssl -lcrypto"
297+else
298+ { { echo "$as_me:$LINENO: error: OpenSSL was not found. Please supply a pathname to OpenSSL" >&5
299+echo "$as_me: error: OpenSSL was not found. Please supply a pathname to OpenSSL" >&2;}
300+ { (exit 1); exit 1; }; }
301+fi
302+
303+
304+for ac_header in "openssl/ssl.h"
305+do
306+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
307+if eval "test \"\${$as_ac_Header+set}\" = set"; then
308+ echo "$as_me:$LINENO: checking for $ac_header" >&5
309+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
310+if eval "test \"\${$as_ac_Header+set}\" = set"; then
311+ echo $ECHO_N "(cached) $ECHO_C" >&6
312+fi
313+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
314+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
315+else
316+ # Is the header compilable?
317+echo "$as_me:$LINENO: checking $ac_header usability" >&5
318+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
319+cat >conftest.$ac_ext <<_ACEOF
e3a05f4b
AG
320+/* confdefs.h. */
321+_ACEOF
322+cat confdefs.h >>conftest.$ac_ext
323+cat >>conftest.$ac_ext <<_ACEOF
324+/* end confdefs.h. */
325+$ac_includes_default
326+#include <$ac_header>
327+_ACEOF
328+rm -f conftest.$ac_objext
329+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
6e8c346a 330+ (eval $ac_compile) 2>conftest.er1
e3a05f4b 331+ ac_status=$?
6e8c346a
AG
332+ grep -v '^ *+' conftest.er1 >conftest.err
333+ rm -f conftest.er1
334+ cat conftest.err >&5
e3a05f4b
AG
335+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
336+ (exit $ac_status); } &&
6e8c346a
AG
337+ { ac_try='test -z "$ac_c_werror_flag"
338+ || test ! -s conftest.err'
339+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
340+ (eval $ac_try) 2>&5
341+ ac_status=$?
342+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
343+ (exit $ac_status); }; } &&
344+ { ac_try='test -s conftest.$ac_objext'
e3a05f4b
AG
345+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
346+ (eval $ac_try) 2>&5
347+ ac_status=$?
348+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
349+ (exit $ac_status); }; }; then
350+ ac_header_compiler=yes
351+else
352+ echo "$as_me: failed program was:" >&5
353+sed 's/^/| /' conftest.$ac_ext >&5
354+
355+ac_header_compiler=no
356+fi
6e8c346a 357+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
e3a05f4b
AG
358+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
359+echo "${ECHO_T}$ac_header_compiler" >&6
360+
361+# Is the header present?
362+echo "$as_me:$LINENO: checking $ac_header presence" >&5
363+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
364+cat >conftest.$ac_ext <<_ACEOF
e3a05f4b
AG
365+/* confdefs.h. */
366+_ACEOF
367+cat confdefs.h >>conftest.$ac_ext
368+cat >>conftest.$ac_ext <<_ACEOF
369+/* end confdefs.h. */
370+#include <$ac_header>
371+_ACEOF
372+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
373+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
374+ ac_status=$?
375+ grep -v '^ *+' conftest.er1 >conftest.err
376+ rm -f conftest.er1
377+ cat conftest.err >&5
378+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
379+ (exit $ac_status); } >/dev/null; then
380+ if test -s conftest.err; then
381+ ac_cpp_err=$ac_c_preproc_warn_flag
6e8c346a 382+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
e3a05f4b
AG
383+ else
384+ ac_cpp_err=
385+ fi
386+else
387+ ac_cpp_err=yes
388+fi
389+if test -z "$ac_cpp_err"; then
390+ ac_header_preproc=yes
391+else
392+ echo "$as_me: failed program was:" >&5
393+sed 's/^/| /' conftest.$ac_ext >&5
394+
395+ ac_header_preproc=no
396+fi
397+rm -f conftest.err conftest.$ac_ext
398+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
399+echo "${ECHO_T}$ac_header_preproc" >&6
8eb15d2d 400
e3a05f4b 401+# So? What about this header?
6e8c346a
AG
402+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
403+ yes:no: )
e3a05f4b
AG
404+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
405+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
6e8c346a
AG
406+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
407+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
408+ ac_header_preproc=yes
e3a05f4b 409+ ;;
6e8c346a 410+ no:yes:* )
e3a05f4b
AG
411+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
412+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
6e8c346a
AG
413+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
414+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
415+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
416+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
417+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
418+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
e3a05f4b
AG
419+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
420+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
6e8c346a
AG
421+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
422+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
e3a05f4b
AG
423+ (
424+ cat <<\_ASBOX
6e8c346a
AG
425+## -------------------------------- ##
426+## Report this to bugs@eggheads.org ##
427+## -------------------------------- ##
e3a05f4b
AG
428+_ASBOX
429+ ) |
430+ sed "s/^/$as_me: WARNING: /" >&2
431+ ;;
432+esac
433+echo "$as_me:$LINENO: checking for $ac_header" >&5
434+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
435+if eval "test \"\${$as_ac_Header+set}\" = set"; then
436+ echo $ECHO_N "(cached) $ECHO_C" >&6
437+else
6e8c346a 438+ eval "$as_ac_Header=\$ac_header_preproc"
e3a05f4b
AG
439+fi
440+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
441+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
442+
443+fi
444+if test `eval echo '${'$as_ac_Header'}'` = yes; then
445+ cat >>confdefs.h <<_ACEOF
446+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
447+_ACEOF
448+
449+else
450+ { { echo "$as_me:$LINENO: error: OpenSSL was not found. Please supply a pathname to OpenSSL" >&5
451+echo "$as_me: error: OpenSSL was not found. Please supply a pathname to OpenSSL" >&2;}
452+ { (exit 1); exit 1; }; }
453+fi
454+
455+done
456+
457+
458+
459+fi;
8eb15d2d 460
6e8c346a 461+#end of ssl checks - hoe (.16 by poci)
e3a05f4b 462
e3a05f4b 463
8eb15d2d 464 # Substitute Makefile variables.
465@@ -10827,6 +11193,8 @@ s,@TCLINC@,$TCLINC,;t t
e3a05f4b
AG
466 s,@TCLINCFN@,$TCLINCFN,;t t
467 s,@TCL_REQS@,$TCL_REQS,;t t
468 s,@TCL_LIBS@,$TCL_LIBS,;t t
469+s,@SSL_LIBS@,$SSL_LIBS,;t t
470+s,@SSL_INCLUDE@,$SSL_INCLUDE,;t t
471 s,@EGGVERSION@,$EGGVERSION,;t t
8eb15d2d 472 s,@DEST@,$DEST,;t t
e3a05f4b 473 s,@MOD_UPDIR@,$MOD_UPDIR,;t t
8eb15d2d 474diff -burNp eggdrop1.6.19/configure.ac eggdrop1.6.19.new/configure.ac
475--- eggdrop1.6.19/configure.ac 2008-02-18 23:25:33.000000000 +0100
476+++ eggdrop1.6.19.new/configure.ac 2008-09-22 14:23:32.432890637 +0200
477@@ -150,6 +150,7 @@ EGG_TCL_CHECK_THREADS
6e8c346a 478 EGG_TCL_LIB_REQS
e3a05f4b 479 EGG_TCL_LUSH
e3a05f4b
AG
480
481+EGG_SSL_CRAP
e3a05f4b 482
6e8c346a 483 # Substitute Makefile variables.
e3a05f4b 484 EGG_SUBST_EGGVERSION
8eb15d2d 485diff -burNp eggdrop1.6.19/disabled_modules eggdrop1.6.19.new/disabled_modules
486--- eggdrop1.6.19/disabled_modules 2002-06-04 07:11:10.000000000 +0200
487+++ eggdrop1.6.19.new/disabled_modules 2008-09-22 14:25:14.439395696 +0200
6e8c346a
AG
488@@ -1,12 +0,0 @@
489-# disabled_modules -- File which lists all Eggdrop modules that are
490-# disabled by default.
491-#
492-# $Id$
493-#
494-# Note:
495-# - Lines which start with a '#' character are ignored.
496-# - Every module name needs to be on its own line
497-
498-# Woobie only serves as an example for module programming. No need to
499-# compile it for normal bots ...
500-woobie
8eb15d2d 501diff -burNp eggdrop1.6.19/Makefile eggdrop1.6.19.new/Makefile
502--- eggdrop1.6.19/Makefile 2008-04-19 06:21:34.000000000 +0200
503+++ eggdrop1.6.19.new/Makefile 2008-09-22 14:25:56.388522764 +0200
6e8c346a
AG
504@@ -1,8 +0,0 @@
505-all:
506- @echo ""
507- @echo "Before you can compile your bot you have to configure it."
508- @echo "Please start the configure script now:"
509- @echo ""
510- @echo " % ./configure"
511- @echo ""
512-
8eb15d2d 513diff -burNp eggdrop1.6.19/Makefile.in eggdrop1.6.19.new/Makefile.in
514--- eggdrop1.6.19/Makefile.in 2004-08-28 08:43:21.000000000 +0200
515+++ eggdrop1.6.19.new/Makefile.in 2008-09-22 14:29:11.247383482 +0200
516@@ -57,6 +57,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
6e8c346a
AG
517 RANLIB = @RANLIB@
518 MOD_EXT = @MOD_EXT@
e3a05f4b 519 XREQS = @TCL_REQS@
e3a05f4b
AG
520+XSSL_LIBS = @SSL_LIBS@
521+XSSL_INCLUDE = @SSL_INCLUDE@
522 TCLLIB = @TCLLIB@
523 TCLLIBFN = @TCLLIBFN@
524
8eb15d2d 525@@ -89,7 +91,8 @@ egg_install_msg = echo "" && \
e3a05f4b
AG
526 MAKE_MODEGG = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(MOD_CC)' 'LD=$(MOD_LD)' \
527 'STRIP=$(MOD_STRIP)' 'RANLIB=$(RANLIB)' 'CFLGS=$(CFLGS)' \
528 'TCLLIB=$(TCLLIB)' 'TCLLIBFN=$(TCLLIBFN)' 'XREQS=$(XREQS)' \
6e8c346a 529-'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' 'EGGBUILD=(standard build)' 'MODOBJS='
e3a05f4b
AG
530+'XSSL_LIBS=$(XSSL_LIBS)' 'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' \
531+'XSSL_INCLUDE=$(XSSL_INCLUDE)' 'EGGBUILD=' 'MODOBJS='
532
533 MAKE_MODULES = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(SHLIB_CC)' 'LD=$(SHLIB_LD)' \
6e8c346a 534 'STRIP=$(SHLIB_STRIP)' 'CFLGS=$(CFLGS)' 'XLIBS=$(XLIBS)' 'MOD_EXT=$(MOD_EXT)' \
8eb15d2d 535@@ -99,12 +102,13 @@ MAKE_STATIC = $(MAKE) 'MAKE=$(MAKE)' 'CC
e3a05f4b
AG
536 'STRIP=$(STRIP)' 'RANLIB=$(RANLIB)' 'CFLGS=$(CFLGS) -DSTATIC' \
537 'TCLLIB=$(TCLLIB)' 'TCLLIBFN=$(TCLLIBFN)' 'XREQS=$(XREQS)' \
538 'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' 'EGGBUILD=(static version)' \
539-'MODOBJS=mod/*.o'
540+'XSSL_INCLUDE=$(XSSL_INCLUDE)' 'XSSL_LIBS=$(XSSL_LIBS)' 'MODOBJS=mod/*.o'
541
542 MAKE_DEBEGG = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(MOD_CC)' 'LD=$(MOD_LD) -g' \
543 'STRIP=touch' 'RANLIB=$(RANLIB)' 'CFLGS=-g3 $(DEBCFLAGS) $(CFLGS)' \
544 'TCLLIB=$(TCLLIB)' 'TCLLIBFN=$(TCLLIBFN)' 'XREQS=$(XREQS)' \
545-'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' 'EGGBUILD=(debug version)' 'MODOBJS='
546+'XSSL_LIBS=$(XSSL_LIBS)' 'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' \
547+'XSSL_INCLUDE=$(XSSL_INCLUDE)' 'EGGBUILD=(debug version)' 'MODOBJS='
548
549 MAKE_DEBMODULES = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(SHLIB_CC)' 'LD=$(SHLIB_LD)' \
550 'XLIBS=$(XLIBS)' 'STRIP=touch' 'CFLGS=-g3 $(DEBCFLAGS) $(CFLGS)' \
8eb15d2d 551@@ -113,7 +117,8 @@ MAKE_DEBMODULES = $(MAKE) 'MAKE=$(MAKE)'
e3a05f4b
AG
552 MAKE_SDEBUG = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'LD=$(LD) -g' \
553 'STRIP=touch' 'RANLIB=$(RANLIB)' 'CFLGS=-g3 $(DEBCFLAGS) -DSTATIC $(CFLGS)' \
554 'TCLLIB=$(TCLLIB)' 'TCLLIBFN=$(TCLLIBFN)' 'XREQS=$(XREQS)' 'XLIBS=$(XLIBS)' \
6e8c346a 555-'EGGEXEC=$(EGGEXEC)' 'EGGBUILD=(static debug version)' 'MODOBJS=mod/*.o'
e3a05f4b
AG
556+'XSSL_INCLUDE=$(XSSL_INCLUDE)' 'XSSL_LIBS=$(XSSL_LIBS)' 'EGGEXEC=$(EGGEXEC)' \
557+'EGGBUILD=(static and debug version)' 'MODOBJS=mod/*.o'
558
8eb15d2d 559 MAKE_DEPEND = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)'
560
561diff -burNp eggdrop1.6.19/src/dcc.c eggdrop1.6.19.new/src/dcc.c
562--- eggdrop1.6.19/src/dcc.c 2008-02-16 22:41:03.000000000 +0100
563+++ eggdrop1.6.19.new/src/dcc.c 2008-09-22 14:30:37.252784308 +0200
e3a05f4b
AG
564@@ -32,7 +32,11 @@
565 #include "tandem.h"
566
567 /* Includes for botnet md5 challenge/response code <cybah> */
568+#ifndef EGG_SSL_EXT
569 #include "md5/md5.h"
570+#else
571+#include "openssl/md5.h"
572+#endif
573
574 extern struct userrec *userlist;
575 extern struct chanset_t *chanset;
8eb15d2d 576diff -burNp eggdrop1.6.19/src/dccutil.c eggdrop1.6.19.new/src/dccutil.c
577--- eggdrop1.6.19/src/dccutil.c 2008-02-16 22:41:03.000000000 +0100
578+++ eggdrop1.6.19.new/src/dccutil.c 2008-09-22 14:31:42.540452895 +0200
e3a05f4b
AG
579@@ -33,6 +33,7 @@
580 #include "chan.h"
581 #include "modules.h"
582 #include "tandem.h"
583+#include "net.h"
584
585 extern struct dcc_t *dcc;
586 extern int dcc_total, max_dcc, dcc_flood_thr, backgrd, copy_to_tmp, MAXSOCKS;
8eb15d2d 587diff -burNp eggdrop1.6.19/src/eggdrop.h eggdrop1.6.19.new/src/eggdrop.h
588--- eggdrop1.6.19/src/eggdrop.h 2008-02-16 22:41:03.000000000 +0100
589+++ eggdrop1.6.19.new/src/eggdrop.h 2008-09-22 14:33:40.008829213 +0200
590@@ -616,18 +616,6 @@ enum {
6e8c346a
AG
591 #define HELP_TEXT 2
592 #define HELP_IRC 16
593
594-/* This is used by the net module to keep track of sockets and what's
595- * queued on them
596- */
e3a05f4b
AG
597-typedef struct {
598- int sock;
599- short flags;
600- char *inbuf;
601- char *outbuf;
602- unsigned long outbuflen; /* Outbuf could be binary data */
603- unsigned long inbuflen; /* Inbuf could be binary data */
e3a05f4b 604-} sock_list;
8eb15d2d 605-
e3a05f4b
AG
606 enum {
607 EGG_OPTION_SET = 1, /* Set option(s). */
8eb15d2d 608 EGG_OPTION_UNSET = 2 /* Unset option(s). */
609diff -burNp eggdrop1.6.19/src/main.c eggdrop1.6.19.new/src/main.c
610--- eggdrop1.6.19/src/main.c 2008-02-16 22:41:03.000000000 +0100
611+++ eggdrop1.6.19.new/src/main.c 2008-09-22 14:35:26.008450672 +0200
612@@ -161,6 +161,9 @@ int cx_line[16];
e3a05f4b
AG
613 int cx_ptr = 0;
614 #endif
615
616+#ifdef EGG_SSL_EXT
6e8c346a 617+int clean_net();
e3a05f4b
AG
618+#endif
619
620 void fatal(const char *s, int recoverable)
621 {
8eb15d2d 622@@ -171,6 +174,9 @@ void fatal(const char *s, int recoverabl
e3a05f4b
AG
623 for (i = 0; i < dcc_total; i++)
624 if (dcc[i].sock >= 0)
625 killsock(dcc[i].sock);
6e8c346a 626+ #ifdef EGG_SSL_EXT
e3a05f4b 627+ clean_net();
6e8c346a 628+ #endif
e3a05f4b
AG
629 unlink(pid_file);
630 if (!recoverable) {
631 bg_send_quit(BG_ABORT);
8eb15d2d 632diff -burNp eggdrop1.6.19/src/Makefile.in eggdrop1.6.19.new/src/Makefile.in
633--- eggdrop1.6.19/src/Makefile.in 2006-11-20 12:38:25.000000000 +0100
634+++ eggdrop1.6.19.new/src/Makefile.in 2008-09-22 14:38:37.400421493 +0200
635@@ -11,6 +11,8 @@ INSTALL = @INSTALL@
6e8c346a
AG
636 INSTALL_PROGRAM = @INSTALL_PROGRAM@
637 INSTALL_DATA = @INSTALL_DATA@
638 INSTALL_SCRIPT = @INSTALL_SCRIPT@
639+XSSL_LIBS = @SSL_LIBS@
640+XSSL_INCLUDE = @SSL_INCLUDE@
641
e3a05f4b
AG
642 CC = @CC@
643 LD = @CC@
8eb15d2d 644@@ -37,7 +39,7 @@ doofus:
6e8c346a 645 @echo "Linking eggdrop $(EGGBUILD)."
e3a05f4b
AG
646 @echo ""
647 @touch mod/mod.xlibs
648- $(LD) -o ../$(EGGEXEC) $(eggdrop_objs) $(MODOBJS) $(XLIBS) md5/md5c.o compat/*.o `cat mod/mod.xlibs`
6e8c346a 649+ $(LD) -o ../$(EGGEXEC) $(eggdrop_objs) $(MODOBJS) $(XLIBS) md5/md5c.o compat/*.o `cat mod/mod.xlibs` $(XSSL_LIBS) $(XSSL_INCLUDE)
e3a05f4b 650 $(STRIP) ../$(EGGEXEC)
e3a05f4b 651 @echo ""
6e8c346a 652 @echo "Successful compile: $(EGGEXEC)"
8eb15d2d 653diff -burNp eggdrop1.6.19/src/md5/md5c.c eggdrop1.6.19.new/src/md5/md5c.c
654--- eggdrop1.6.19/src/md5/md5c.c 2004-04-10 09:49:23.000000000 +0200
655+++ eggdrop1.6.19.new/src/md5/md5c.c 2008-09-22 14:40:36.140399142 +0200
6e8c346a 656@@ -17,9 +17,23 @@
e3a05f4b 657
e3a05f4b
AG
658 #include <string.h>
659
6e8c346a 660+#ifndef EGG_SSL_EXT
e3a05f4b 661 #include "md5.h"
6e8c346a
AG
662+#else
663+#include "openssl/md5.h"
664+#endif
665+
666 #include "compat/compat.h"
e3a05f4b 667
6e8c346a 668+typedef unsigned long MD5_u32plus;
e3a05f4b 669+
6e8c346a
AG
670+typedef struct {
671+ MD5_u32plus lo, hi;
672+ MD5_u32plus a, b, c, d;
673+ unsigned char buffer[64];
674+ MD5_u32plus block[16];
675+} MD5_CTX;
676+
677 /*
678 * The basic MD5 functions.
679 *
8eb15d2d 680diff -burNp eggdrop1.6.19/src/md5/md5.h eggdrop1.6.19.new/src/md5/md5.h
681--- eggdrop1.6.19/src/md5/md5.h 2003-03-06 04:35:59.000000000 +0100
682+++ eggdrop1.6.19.new/src/md5/md5.h 2008-09-22 14:44:22.801432410 +0200
683@@ -5,6 +5,8 @@
6e8c346a 684 * Written by Solar Designer <solar@openwall.com> in 2001, and placed in
e3a05f4b
AG
685 * the public domain. See md5c.c for more information.
686 */
e3a05f4b
AG
687+#include "../config.h"
688+#ifndef EGG_SSL_EXT
6e8c346a 689
e3a05f4b
AG
690 #ifndef _MD5_H
691 #define _MD5_H
8eb15d2d 692@@ -24,3 +26,4 @@ extern void MD5_Update(MD5_CTX *ctx, voi
e3a05f4b
AG
693 extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
694
695 #endif
696+#endif
8eb15d2d 697diff -burNp eggdrop1.6.19/src/mod/irc.mod/chan.c eggdrop1.6.19.new/src/mod/irc.mod/chan.c
698--- eggdrop1.6.19/src/mod/irc.mod/chan.c 2008-02-16 22:41:09.000000000 +0100
699+++ eggdrop1.6.19.new/src/mod/irc.mod/chan.c 2008-09-22 14:46:27.143879710 +0200
700@@ -965,10 +965,10 @@ static int got324(char *from, char *msg)
e3a05f4b
AG
701 q = strchr(p, ' ');
702 if (q != NULL) {
703 *q = 0;
704- set_key(chan, p);
705+ set_keyegg(chan, p);
706 strcpy(p, q + 1);
707 } else {
708- set_key(chan, p);
709+ set_keyegg(chan, p);
710 *p = 0;
711 }
712 }
8eb15d2d 713diff -burNp eggdrop1.6.19/src/mod/irc.mod/irc.c eggdrop1.6.19.new/src/mod/irc.mod/irc.c
714--- eggdrop1.6.19/src/mod/irc.mod/irc.c 2008-02-16 22:41:09.000000000 +0100
715+++ eggdrop1.6.19.new/src/mod/irc.mod/irc.c 2008-09-22 14:47:35.182249518 +0200
716@@ -256,7 +256,7 @@ static void maybe_revenge(struct chanset
e3a05f4b
AG
717
718 /* Set the key.
719 */
720-static void set_key(struct chanset_t *chan, char *k)
721+static void set_keyegg(struct chanset_t *chan, char *k)
722 {
723 nfree(chan->channel.key);
724 if (k == NULL) {
8eb15d2d 725diff -burNp eggdrop1.6.19/src/mod/irc.mod/irc.h eggdrop1.6.19.new/src/mod/irc.mod/irc.h
726--- eggdrop1.6.19/src/mod/irc.mod/irc.h 2008-02-16 22:41:09.000000000 +0100
727+++ eggdrop1.6.19.new/src/mod/irc.mod/irc.h 2008-09-22 14:53:47.281677127 +0200
728@@ -69,7 +69,7 @@ static void set_delay(struct chanset_t *
e3a05f4b
AG
729
730 static void reset_chan_info(struct chanset_t *);
731 static void recheck_channel(struct chanset_t *, int);
732-static void set_key(struct chanset_t *, char *);
733+static void set_keyegg(struct chanset_t *, char *);
734 static void maybe_revenge(struct chanset_t *, char *, char *, int);
735 static int detect_chan_flood(char *, char *, char *, struct chanset_t *, int,
736 char *);
8eb15d2d 737diff -burNp eggdrop1.6.19/src/mod/irc.mod/mode.c eggdrop1.6.19.new/src/mod/irc.mod/mode.c
738--- eggdrop1.6.19/src/mod/irc.mod/mode.c 2008-02-16 22:41:09.000000000 +0100
739+++ eggdrop1.6.19.new/src/mod/irc.mod/mode.c 2008-09-22 14:57:12.177766159 +0200
740@@ -1128,7 +1128,7 @@ static int gotmode(char *from, char *ori
741 break;
e3a05f4b 742 }
e3a05f4b
AG
743 if (ms2[0] == '+') {
744- set_key(chan, op);
745+ set_keyegg(chan, op);
746 if (channel_active(chan))
747 got_key(chan, nick, from, op);
748 } else {
8eb15d2d 749@@ -1139,7 +1139,7 @@ static int gotmode(char *from, char *ori
e3a05f4b
AG
750 !chan_master(user) && !match_my_nick(nick))
751 add_mode(chan, '+', 'k', chan->key_prot);
752 }
753- set_key(chan, NULL);
8eb15d2d 754+ set_keyegg(chan, NULL);
e3a05f4b 755 }
8eb15d2d 756 check_tcl_mode(nick, from, u, chan->dname, ms2, op);
e3a05f4b 757 break;
8eb15d2d 758diff -burNp eggdrop1.6.19/src/mod/module.h eggdrop1.6.19.new/src/mod/module.h
759--- eggdrop1.6.19/src/mod/module.h 2008-02-16 22:41:06.000000000 +0100
760+++ eggdrop1.6.19.new/src/mod/module.h 2008-09-22 15:00:36.262853551 +0200
6e8c346a
AG
761@@ -471,13 +471,23 @@
762 /* IPv6 leftovers: 286 */
763 /* IPv6 leftovers: 287 */
764 /* 288 - 291 */
765-/* IPv6 leftovers: 288 */
e3a05f4b
AG
766+#ifdef EGG_SSL_EXT
767+#define net_switch_to_ssl ((int (*)(int))global[289])
768+#define use_ssl (*(int *)global[290]) /* kyotou */
6e8c346a
AG
769+#define strip_mirc_codes ((void (*)(int, char *))global[291])
770+#define check_ansi ((int (*) (char *))global[292])
771+#define oatoi ((int (*) (const char *))global[293])
772+/* 292 - 295 */
773+#define str_isdigit ((int (*) (const char *))global[294])
774+#define remove_crlf ((void (*)(char **))global[295])
775+#else
776 #define strip_mirc_codes ((void (*)(int, char *))global[289])
777 #define check_ansi ((int (*) (char *))global[290])
778 #define oatoi ((int (*) (const char *))global[291])
779 /* 292 - 295 */
780 #define str_isdigit ((int (*) (const char *))global[292])
781 #define remove_crlf ((void (*)(char **))global[293])
e3a05f4b
AG
782+#endif
783
784 /* hostmasking */
785 #define maskhost(a,b) _maskhost((a),(b),1)
8eb15d2d 786diff -burNp eggdrop1.6.19/src/mod/server.mod/servmsg.c eggdrop1.6.19.new/src/mod/server.mod/servmsg.c
787--- eggdrop1.6.19/src/mod/server.mod/servmsg.c 2008-02-16 22:41:10.000000000 +0100
788+++ eggdrop1.6.19.new/src/mod/server.mod/servmsg.c 2008-09-22 15:16:40.818273894 +0200
789@@ -1293,6 +1293,14 @@ static void server_resolve_success(int s
e3a05f4b
AG
790 fatal("NO SERVERS WILL ACCEPT MY CONNECTION.", 0);
791 } else {
792 dcc[servidx].sock = serv;
6e8c346a
AG
793+ #ifdef EGG_SSL_EXT
794+ if (use_ssl) { /* kyotou */
795+ if (net_switch_to_ssl(serv)==0) {
796+ putlog(LOG_SERV, "*", "SSL %s %s (Error while switching to SSL)", IRC_FAILEDCONNECT, dcc[servidx].host);
797+ lostdcc(servidx);
798+ }
799+ }
800+ #endif
e3a05f4b
AG
801 /* Queue standard login */
802 dcc[servidx].timeval = now;
803 SERVER_SOCKET.timeout_val = &server_timeout;
8eb15d2d 804diff -burNp eggdrop1.6.19/src/modules.c eggdrop1.6.19.new/src/modules.c
805--- eggdrop1.6.19/src/modules.c 2008-02-16 22:41:04.000000000 +0100
806+++ eggdrop1.6.19.new/src/modules.c 2008-09-22 15:30:23.753434245 +0200
6e8c346a 807@@ -29,9 +29,17 @@
e3a05f4b
AG
808 #include "main.h"
809 #include "modules.h"
810 #include "tandem.h"
811+
812+#ifndef EGG_SSL_EXT
813 #include "md5/md5.h"
814+#else
815+#include "openssl/md5.h"
816+#endif
817+
e3a05f4b 818 #include "users.h"
e3a05f4b 819
6e8c346a
AG
820+#include "net.h"
821+
822 #ifndef STATIC
823 # ifdef MOD_USE_SHL
824 # include <dl.h>
8eb15d2d 825@@ -94,6 +102,10 @@ extern int parties, noshare, dcc_total,
e3a05f4b
AG
826 password_timeout, force_expire, protect_readonly, reserved_port_min,
827 reserved_port_max, copy_to_tmp, quiet_reject;
6e8c346a 828
e3a05f4b
AG
829+#ifdef EGG_SSL_EXT
830+extern int use_ssl; /* kyotou */
831+#endif
6e8c346a 832+
e3a05f4b
AG
833 extern party_t *party;
834 extern time_t now, online_since;
6e8c346a 835 extern tand_t *tandbot;
8eb15d2d 836@@ -128,6 +140,9 @@ void check_static(char *name, char *(*fu
6e8c346a
AG
837 }
838 #endif /* STATIC */
e3a05f4b
AG
839
840+#ifdef EGG_SSL_EXT
841+int net_switch_to_ssl(int);
842+#endif
e3a05f4b 843
6e8c346a
AG
844 /* The null functions */
845 void null_func()
8eb15d2d 846@@ -564,7 +579,13 @@ Function global_table[] = {
6e8c346a
AG
847 (Function) 0, /* IPv6 leftovers: 286 */
848 (Function) 0, /* IPv6 leftovers: 287 */
849 /* 288 - 291 */
e3a05f4b 850+#ifdef EGG_SSL_EXT
6e8c346a 851 (Function) 0, /* IPv6 leftovers: 288 */
e3a05f4b 852+ (Function) net_switch_to_ssl,
6e8c346a 853+ (Function) & use_ssl, /* kyotou */
e3a05f4b 854+#else
6e8c346a 855+ (Function) 0, /* IPv6 leftovers: 288 */
e3a05f4b 856+#endif
6e8c346a
AG
857 (Function) strip_mirc_codes,
858 (Function) check_ansi,
859 (Function) oatoi,
8eb15d2d 860diff -burNp eggdrop1.6.19/src/net.c eggdrop1.6.19.new/src/net.c
861--- eggdrop1.6.19/src/net.c 2008-02-16 22:41:04.000000000 +0100
862+++ eggdrop1.6.19.new/src/net.c 2008-09-22 16:10:28.739840200 +0200
863@@ -52,6 +52,18 @@
e3a05f4b
AG
864 # endif
865 #endif
866
867+#ifdef EGG_SSL_EXT
6e8c346a
AG
868+# ifndef EGG_SSL_INCS
869+# include <openssl/ssl.h>
870+# include <openssl/err.h>
871+# include <openssl/rand.h>
872+# define EGG_SSL_INCS 1
873+# endif
e3a05f4b
AG
874+#endif
875+
876+#include "net.h"
6e8c346a 877+
e3a05f4b
AG
878+
879 extern struct dcc_t *dcc;
880 extern int backgrd, use_stderr, resolve_timeout, dcc_total;
881 extern unsigned long otraffic_irc_today, otraffic_bn_today, otraffic_dcc_today,
8eb15d2d 882@@ -65,6 +77,12 @@ int firewallport = 1080; /* Default
6e8c346a
AG
883 char botuser[21] = "eggdrop"; /* Username of the user running the bot. */
884 int dcc_sanitycheck = 0; /* Do some sanity checking on dcc connections. */
8eb15d2d 885
e3a05f4b
AG
886+#ifdef EGG_SSL_EXT
887+SSL_CTX *ssl_ctx=NULL;
888+char *tls_rand_file = NULL;
889+int use_ssl = 0; /* kyotou */
890+#endif
8eb15d2d 891+
6e8c346a 892 sock_list *socklist = NULL; /* Enough to be safe. */
e3a05f4b 893 int MAXSOCKS = 0;
8eb15d2d 894 sigjmp_buf alarmret; /* Env buffer for alarm() returns. */
895@@ -88,6 +106,46 @@ IP my_atoul(char *s)
6e8c346a 896 return ret;
e3a05f4b
AG
897 }
898
899+#ifdef EGG_SSL_EXT
900+int seed_PRNG(void)
901+{
902+ char stackdata[1024];
903+ static char rand_file[300];
904+ FILE *fh;
6e8c346a 905+
e3a05f4b
AG
906+#if OPENSSL_VERSION_NUMBER >= 0x00905100
907+ if (RAND_status())
908+ return 0; /* PRNG already good seeded */
909+#endif
910+ /* if the device '/dev/urandom' is present, OpenSSL uses it by default.
911+ * check if it's present, else we have to make random data ourselfs.
912+ */
913+ if ((fh = fopen("/dev/urandom", "r"))) {
914+ fclose(fh);
915+ return 0;
916+ }
917+ if (RAND_file_name(rand_file, sizeof(rand_file)))
918+ tls_rand_file = rand_file;
919+ else
920+ return 1;
921+ if (!RAND_load_file(rand_file, 1024)) {
922+ /* no .rnd file found, create new seed */
923+ unsigned int c;
924+ c = time(NULL);
925+ RAND_seed(&c, sizeof(c));
926+ c = getpid();
927+ RAND_seed(&c, sizeof(c));
928+ RAND_seed(stackdata, sizeof(stackdata));
929+ }
930+#if OPENSSL_VERSION_NUMBER >= 0x00905100
931+ if (!RAND_status())
932+ return 2; /* PRNG still badly seeded */
933+#endif
934+ return 0;
935+}
936+#endif
6e8c346a 937+
e3a05f4b
AG
938+
939 /* Initialize the socklist
940 */
941 void init_net()
8eb15d2d 942@@ -96,9 +154,35 @@ void init_net()
e3a05f4b
AG
943
944 for (i = 0; i < MAXSOCKS; i++) {
945 socklist[i].flags = SOCK_UNUSED;
946+#ifdef EGG_SSL_EXT
947+ socklist[i].ssl=NULL;
948+#endif
8eb15d2d 949 }
e3a05f4b
AG
950+#ifdef EGG_SSL_EXT
951+ /* good place to init ssl stuff */
952+ SSL_load_error_strings();
953+ OpenSSL_add_ssl_algorithms();
954+ ssl_ctx=SSL_CTX_new(SSLv23_client_method());
6e8c346a
AG
955+ if (!ssl_ctx)
956+ fatal("SSL_CTX_new() failed",0);
e3a05f4b 957+ if (seed_PRNG())
6e8c346a 958+ fatal("Wasn't able to properly seed the PRNG!",0);
e3a05f4b 959+#endif
8eb15d2d 960 }
961
e3a05f4b
AG
962+#ifdef EGG_SSL_EXT
963+/* cleanup mess when quiting */
964+int clean_net() {
965+ if (ssl_ctx) {
966+ SSL_CTX_free(ssl_ctx);
967+ ssl_ctx = NULL;
8eb15d2d 968+ }
e3a05f4b
AG
969+ if (tls_rand_file)
970+ RAND_write_file(tls_rand_file);
971+ return 0;
8eb15d2d 972+ }
e3a05f4b 973+#endif
8eb15d2d 974+
e3a05f4b
AG
975 int expmem_net()
976 {
8eb15d2d 977 int i, tot = 0;
978@@ -231,6 +315,13 @@ int sockoptions(int sock, int operation,
6e8c346a 979
8eb15d2d 980 for (i = 0; i < MAXSOCKS; i++)
e3a05f4b
AG
981 if ((socklist[i].sock == sock) && !(socklist[i].flags & SOCK_UNUSED)) {
982+#ifdef EGG_SSL_EXT
983+ if (socklist[i].ssl) {
984+ SSL_shutdown(socklist[i].ssl);
6e8c346a
AG
985+ SSL_free(socklist[i].ssl);
986+ socklist[i].ssl=NULL;
987+ }
8eb15d2d 988+#endif
989 if (operation == EGG_OPTION_SET)
990 socklist[i].flags |= sock_options;
991 else if (operation == EGG_OPTION_UNSET)
992@@ -366,6 +457,64 @@ static int proxy_connect(int sock, char
e3a05f4b
AG
993 return sock;
994 }
995
996+#ifdef EGG_SSL_EXT
997+int net_switch_to_ssl(int sock) {
998+int err;
999+int i=0;
1000+ debug0("net_switch_to_ssl()");
1001+ while (i<MAXSOCKS) {
1002+ if (socklist[i].sock==sock) {
1003+ break;
1004+ }
1005+ i++;
1006+ }
1007+ if (i==MAXSOCKS) {
1008+ debug0("Error while swithing to SSL - sock not found in list");
1009+ return 0;
1010+ }
1011+
1012+ if (socklist[i].ssl) {
1013+ debug0("Error while swithing to SSL - already in ssl");
1014+ return 0;
1015+ }
1016+ socklist[i].ssl = SSL_new(ssl_ctx);
1017+ if (!socklist[i].ssl) {
1018+ debug0("Error while swithing to SSL - SSL_new() error");
1019+ return 0;
1020+ }
1021+
1022+ SSL_set_fd(socklist[i].ssl, socklist[i].sock);
1023+ err = SSL_connect(socklist[i].ssl);
6e8c346a 1024+
e3a05f4b
AG
1025+ while (err <= 0) {
1026+ int errs;
1027+ errs=SSL_get_error(socklist[i].ssl,err);
1028+ if ((errs!=SSL_ERROR_WANT_READ)&&(errs!=SSL_ERROR_WANT_WRITE)&&
1029+ (errs!=SSL_ERROR_WANT_X509_LOOKUP)) {
1030+ putlog(LOG_DEBUG,"*", "SSL_connect() = %d, %s", err,
1031+ (char *)ERR_error_string(ERR_get_error(), NULL));
1032+ SSL_shutdown(socklist[i].ssl);
1033+ SSL_free(socklist[i].ssl);
1034+ socklist[i].ssl = NULL;
6e8c346a 1035+ return 0;
e3a05f4b
AG
1036+ }
1037+ usleep(1000);
1038+ err = SSL_connect(socklist[i].ssl);
1039+ }
1040+
1041+ if (err==1) {
6e8c346a 1042+ debug0("SSL_connect() success");
e3a05f4b
AG
1043+ return 1;
1044+ }
6e8c346a 1045+ debug0("Error while SSL_connect()");
e3a05f4b 1046+ SSL_shutdown(socklist[i].ssl);
6e8c346a 1047+ SSL_free(socklist[i].ssl);
e3a05f4b
AG
1048+ socklist[i].ssl = NULL;
1049+ return 0;
1050+}
1051+#endif
1052+
8eb15d2d 1053+
1054 /* Starts a connection attempt to a socket
1055 *
1056 * If given a normal hostname, this will be resolved to the corresponding
1057@@ -627,6 +776,9 @@ static int sockread(char *s, int *len)
e3a05f4b
AG
1058 for (i = 0; i < MAXSOCKS; i++) {
1059 if ((!(socklist[i].flags & SOCK_UNUSED)) &&
1060 ((FD_ISSET(socklist[i].sock, &fd)) ||
1061+#ifdef EGG_SSL_EXT
6e8c346a
AG
1062+ ((socklist[i].ssl)&&(SSL_pending(socklist[i].ssl))) ||
1063+#endif
e3a05f4b
AG
1064 ((socklist[i].sock == STDOUT) && (!backgrd) &&
1065 (FD_ISSET(STDIN, &fd))))) {
1066 if (socklist[i].flags & (SOCK_LISTEN | SOCK_CONNECT)) {
8eb15d2d 1067@@ -651,7 +803,31 @@ static int sockread(char *s, int *len)
e3a05f4b
AG
1068 if ((socklist[i].sock == STDOUT) && !backgrd)
1069 x = read(STDIN, s, grab);
1070 else
1071+#ifdef EGG_SSL_EXT
1072+ {
1073+ if (socklist[i].ssl) {
1074+ x=SSL_read(socklist[i].ssl,s,grab);
1075+ if (x < 0) {
1076+ int err = SSL_get_error(socklist[i].ssl, x);
1077+ x = -1;
1078+ switch (err) {
1079+ case SSL_ERROR_WANT_READ:
1080+ errno = EAGAIN;
1081+ break;
1082+ case SSL_ERROR_WANT_WRITE:
1083+ errno = EAGAIN;
1084+ break;
1085+ case SSL_ERROR_WANT_X509_LOOKUP:
1086+ errno = EAGAIN;
1087+ break;
1088+ }
1089+ }
1090+ } else
1091 x = read(socklist[i].sock, s, grab);
1092+ }
1093+#else
8eb15d2d 1094+ x = read(socklist[i].sock, s, grab);
6e8c346a 1095+#endif
e3a05f4b
AG
1096 if (x <= 0) { /* eof */
1097 if (errno != EAGAIN) { /* EAGAIN happens when the operation would
1098 * block on a non-blocking socket, if the
8eb15d2d 1099@@ -944,6 +1120,26 @@ void tputs(register int z, char *s, unsi
e3a05f4b
AG
1100 socklist[i].outbuflen += len;
1101 return;
1102 }
1103+#ifdef EGG_SSL_EXT
1104+ if (socklist[i].ssl) {
1105+ x=SSL_write(socklist[i].ssl,s,len);
1106+ if (x < 0) {
1107+ int err = SSL_get_error(socklist[i].ssl, x);
1108+ x = -1;
1109+ switch (err) {
1110+ case SSL_ERROR_WANT_READ:
6e8c346a 1111+ errno = EAGAIN;
e3a05f4b
AG
1112+ break;
1113+ case SSL_ERROR_WANT_WRITE:
1114+ errno = EAGAIN;
1115+ break;
1116+ case SSL_ERROR_WANT_X509_LOOKUP:
1117+ errno = EAGAIN;
1118+ break;
1119+ }
6e8c346a 1120+ }
e3a05f4b 1121+ } else
6e8c346a 1122+#endif
e3a05f4b
AG
1123 /* Try. */
1124 x = write(z, s, len);
1125 if (x == -1)
8eb15d2d 1126@@ -1010,6 +1206,27 @@ void dequeue_sockets()
e3a05f4b
AG
1127 (socklist[i].outbuf != NULL) && (FD_ISSET(socklist[i].sock, &wfds))) {
1128 /* Trick tputs into doing the work */
1129 errno = 0;
1130+#ifdef EGG_SSL_EXT
6e8c346a 1131+ if (socklist[i].ssl) {
e3a05f4b
AG
1132+ x = write(socklist[i].sock, socklist[i].outbuf,
1133+ socklist[i].outbuflen);
1134+ if (x < 0) {
1135+ int err = SSL_get_error(socklist[i].ssl, x);
1136+ x = -1;
1137+ switch (err) {
1138+ case SSL_ERROR_WANT_READ:
1139+ errno = EAGAIN;
1140+ break;
1141+ case SSL_ERROR_WANT_WRITE:
1142+ errno = EAGAIN;
1143+ break;
1144+ case SSL_ERROR_WANT_X509_LOOKUP:
1145+ errno = EAGAIN;
1146+ break;
1147+ }
1148+ }
1149+ } else
6e8c346a 1150+#endif
e3a05f4b
AG
1151 x = write(socklist[i].sock, socklist[i].outbuf, socklist[i].outbuflen);
1152 if ((x < 0) && (errno != EAGAIN)
1153 #ifdef EBADSLT
8eb15d2d 1154diff -burNp eggdrop1.6.19/src/net.h eggdrop1.6.19.new/src/net.h
1155--- eggdrop1.6.19/src/net.h 1970-01-01 01:00:00.000000000 +0100
1156+++ eggdrop1.6.19.new/src/net.h 2008-09-22 16:12:38.979826983 +0200
e3a05f4b
AG
1157@@ -0,0 +1,30 @@
1158+#ifndef _EGG_NET_H
1159+#define _EGG_NET_H
1160+#ifdef EGG_SSL_EXT
1161+# ifndef EGG_SSL_INCS
1162+# include <openssl/ssl.h>
1163+# include <openssl/err.h>
1164+# include <openssl/rand.h>
1165+# define EGG_SSL_INCS 1
1166+# endif
1167+#endif
1168+
1169+/* This is used by the net module to keep track of sockets and what's
1170+ * queued on them
1171+ */
1172+typedef struct {
1173+ int sock;
1174+#ifdef EGG_SSL_EXT
6e8c346a 1175+ SSL *ssl;
e3a05f4b
AG
1176+#endif
1177+ short flags;
1178+ char *inbuf;
1179+ char *outbuf;
1180+ unsigned long outbuflen; /* Outbuf could be binary data */
1181+ unsigned long inbuflen; /* Inbuf could be binary data */
1182+#ifdef USE_IPV6
1183+ unsigned int af;
1184+#endif /* USE_IPV6 */
1185+} sock_list;
1186+
1187+#endif /* _EGG_NET_H */
8eb15d2d 1188diff -burNp eggdrop1.6.19/src/patch.h eggdrop1.6.19.new/src/patch.h
1189--- eggdrop1.6.19/src/patch.h 2008-04-19 06:21:20.000000000 +0200
1190+++ eggdrop1.6.19.new/src/patch.h 2008-09-22 16:13:41.491758122 +0200
1191@@ -36,7 +36,9 @@
6e8c346a
AG
1192 *
1193 *
e3a05f4b 1194 */
6e8c346a 1195-/* PATCH GOES HERE */
e3a05f4b
AG
1196+#ifdef EGG_SSL_EXT
1197+patch("SSL");
1198+#endif
1199 /*
1200 *
1201 *
8eb15d2d 1202diff -burNp eggdrop1.6.19/src/tcl.c eggdrop1.6.19.new/src/tcl.c
1203--- eggdrop1.6.19/src/tcl.c 2008-02-16 22:41:04.000000000 +0100
1204+++ eggdrop1.6.19.new/src/tcl.c 2008-09-22 16:16:08.499821489 +0200
1205@@ -45,6 +45,10 @@ typedef struct {
e3a05f4b
AG
1206
1207 extern time_t online_since;
e3a05f4b 1208
8eb15d2d 1209+#ifdef EGG_SSL_EXT
1210+extern int use_ssl; /* kyotou */
6e8c346a
AG
1211+#endif
1212+
e3a05f4b
AG
1213 extern char origbotname[], botuser[], motdfile[], admin[], userfile[],
1214 firewall[], helpdir[], notify_new[], hostname[], myip[], moddir[],
6e8c346a 1215 tempdir[], owner[], network[], botnetnick[], bannerfile[],
8eb15d2d 1216@@ -522,6 +526,9 @@ static tcl_ints def_tcl_ints[] = {
e3a05f4b
AG
1217 {"enable-simul", &enable_simul, 0}, /* compat */
1218 {"debug-output", &debug_output, 0}, /* compat */
1219 {"use-console-r", &use_console_r, 0}, /* compat */
8eb15d2d 1220+#ifdef EGG_SSL_EXT
1221+ {"use-ssl", &use_ssl, 0}, /* kyotou */
e3a05f4b
AG
1222+#endif
1223 {NULL, NULL, 0}
1224 };
1225
8eb15d2d 1226diff -burNp eggdrop1.6.19/src/tclmisc.c eggdrop1.6.19.new/src/tclmisc.c
1227--- eggdrop1.6.19/src/tclmisc.c 2008-02-16 22:41:04.000000000 +0100
1228+++ eggdrop1.6.19.new/src/tclmisc.c 2008-09-22 16:17:34.872716077 +0200
1229@@ -26,7 +26,12 @@
e3a05f4b
AG
1230 #include "main.h"
1231 #include "modules.h"
1232 #include "tandem.h"
6e8c346a 1233-#include "md5/md5.h"
e3a05f4b 1234+
8eb15d2d 1235+#ifndef EGG_SSL_EXT
1236+ #include "md5/md5.h"
1237+#else
1238+#include "openssl/md5.h"
1239+#endif
6e8c346a 1240
e3a05f4b 1241 #ifdef TIME_WITH_SYS_TIME
6e8c346a 1242 # include <sys/time.h>
This page took 0.345868 seconds and 4 git commands to generate.