Changeset 4596
- Timestamp:
- 02/13/07 13:10:26 (2 years ago)
- Files:
-
- wired/branches/p7/config.h.in (modified) (3 diffs)
- wired/branches/p7/configure (modified) (14 diffs)
- wired/branches/p7/configure.in (modified) (2 diffs)
- wired/branches/p7/wired/accounts.c (modified) (3 diffs)
- wired/branches/p7/wired/clients.c (modified) (2 diffs)
- wired/branches/p7/wired/clients.h (modified) (2 diffs)
- wired/branches/p7/wired/server.c (modified) (11 diffs)
- wired/branches/p7/wired/transfers.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wired/branches/p7/config.h.in
r4519 r4596 7 7 #undef HAVE_INTTYPES_H 8 8 9 /* Define to 1 if you have the <libxml/parser.h> header file. */ 10 #undef HAVE_LIBXML_PARSER_H 11 9 12 /* Define to 1 if you have the <memory.h> header file. */ 10 13 #undef HAVE_MEMORY_H … … 12 15 /* Define to 1 if you have the <openssl/sha.h> header file. */ 13 16 #undef HAVE_OPENSSL_SHA_H 14 15 /* Define to 1 if you have the <openssl/ssl.h> header file. */16 #undef HAVE_OPENSSL_SSL_H17 17 18 18 /* Define to 1 if you have the <pthread.h> header file. */ … … 39 39 /* Define to 1 if you have the <unistd.h> header file. */ 40 40 #undef HAVE_UNISTD_H 41 42 /* Define to 1 if you have the <zlib.h> header file. */ 43 #undef HAVE_ZLIB_H 41 44 42 45 /* Define to the address where bug reports for this package should be sent. */ wired/branches/p7/configure
r4532 r4596 1388 1388 1389 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1390 1399 # Get host 1391 1400 ac_aux_dir= … … 3147 3156 fi 3148 3157 3149 if test -d /usr/local/ssl/include; then3150 CPPFLAGS="$CPPFLAGS -I/usr/local/ssl/include"3151 fi3152 3153 if test -d /usr/kerberos/include; then3154 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"3155 fi3156 3157 3158 3158 3159 if test -d /usr/local/lib; then 3159 3160 LDFLAGS="$LDFLAGS -L/usr/local/lib" 3160 fi3161 3162 if test -d /usr/local/ssl/lib; then3163 LDFLAGS="$LDFLAGS -L/usr/local/ssl/lib"3164 3161 fi 3165 3162 … … 4343 4340 done 4344 4341 4342 4343 4344 4345 if test "$_wi_ssl_paths_added" != yes ; then 4346 if test -d /usr/local/ssl/include; then 4347 CPPFLAGS="$CPPFLAGS -I/usr/local/ssl/include" 4348 fi 4349 4350 if test -d /usr/kerberos/include; then 4351 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include" 4352 fi 4353 4354 if test -d /usr/local/ssl/lib; then 4355 LDFLAGS="$LDFLAGS -L/usr/local/ssl/lib" 4356 fi 4357 fi 4358 4359 _wi_ssl_paths_added=yes 4345 4360 4346 4361 … … 4599 4614 4600 4615 4601 4602 4603 for ac_header in openssl/ssl.h 4616 #WI_INCLUDE_SSL_LIBRARY 4617 4618 if test -d /usr/include/libxml2; then 4619 CPPFLAGS="$CPPFLAGS -I/usr/include/libxml2" 4620 fi 4621 4622 if test -d /usr/local/include/libxml2; then 4623 CPPFLAGS="$CPPFLAGS -I/usr/local/include/libxml2" 4624 fi 4625 4626 4627 for ac_header in libxml/parser.h 4604 4628 do 4605 4629 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` … … 4746 4770 _ACEOF 4747 4771 4748 echo "$as_me:$LINENO: checking for SSL_library_init in -lssl" >&54749 echo $ECHO_N "checking for SSL_library_init in -lssl... $ECHO_C" >&64750 if test "${ac_cv_lib_ ssl_SSL_library_init+set}" = set; then4772 echo "$as_me:$LINENO: checking for xmlParseFile in -lxml2" >&5 4773 echo $ECHO_N "checking for xmlParseFile in -lxml2... $ECHO_C" >&6 4774 if test "${ac_cv_lib_xml2_xmlParseFile+set}" = set; then 4751 4775 echo $ECHO_N "(cached) $ECHO_C" >&6 4752 4776 else 4753 4777 ac_check_lib_save_LIBS=$LIBS 4754 LIBS="-l ssl$LIBS"4778 LIBS="-lxml2 $LIBS" 4755 4779 cat >conftest.$ac_ext <<_ACEOF 4756 4780 /* confdefs.h. */ … … 4766 4790 /* We use char because int might match the return type of a gcc2 4767 4791 builtin and then its argument prototype would still apply. */ 4768 char SSL_library_init();4792 char xmlParseFile (); 4769 4793 int 4770 4794 main () 4771 4795 { 4772 SSL_library_init();4796 xmlParseFile (); 4773 4797 ; 4774 4798 return 0; … … 4797 4821 echo "$as_me:$LINENO: \$? = $ac_status" >&5 4798 4822 (exit $ac_status); }; }; then 4799 ac_cv_lib_ ssl_SSL_library_init=yes4823 ac_cv_lib_xml2_xmlParseFile=yes 4800 4824 else 4801 4825 echo "$as_me: failed program was:" >&5 4802 4826 sed 's/^/| /' conftest.$ac_ext >&5 4803 4827 4804 ac_cv_lib_ ssl_SSL_library_init=no4828 ac_cv_lib_xml2_xmlParseFile=no 4805 4829 fi 4806 4830 rm -f conftest.err conftest.$ac_objext \ … … 4808 4832 LIBS=$ac_check_lib_save_LIBS 4809 4833 fi 4810 echo "$as_me:$LINENO: result: $ac_cv_lib_ ssl_SSL_library_init" >&54811 echo "${ECHO_T}$ac_cv_lib_ ssl_SSL_library_init" >&64812 if test $ac_cv_lib_ ssl_SSL_library_init= yes; then4813 4814 LIBS="$LIBS -l ssl"4815 4816 else 4817 4818 4819 { { echo "$as_me:$LINENO: error: could not locate OpenSSL4820 4821 If you installed OpenSSLinto a non-standard directory, please run:4834 echo "$as_me:$LINENO: result: $ac_cv_lib_xml2_xmlParseFile" >&5 4835 echo "${ECHO_T}$ac_cv_lib_xml2_xmlParseFile" >&6 4836 if test $ac_cv_lib_xml2_xmlParseFile = yes; then 4837 4838 LIBS="$LIBS -lxml2" 4839 4840 else 4841 4842 4843 { { echo "$as_me:$LINENO: error: could not locate libxml2 4844 4845 If you installed libxml2 into a non-standard directory, please run: 4822 4846 4823 4847 env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&5 4824 echo "$as_me: error: could not locate OpenSSL4825 4826 If you installed OpenSSLinto a non-standard directory, please run:4848 echo "$as_me: error: could not locate libxml2 4849 4850 If you installed libxml2 into a non-standard directory, please run: 4827 4851 4828 4852 env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&2;} … … 4836 4860 4837 4861 4838 { { echo "$as_me:$LINENO: error: could not locate OpenSSL4839 4840 If you installed OpenSSLinto a non-standard directory, please run:4862 { { echo "$as_me:$LINENO: error: could not locate libxml2 4863 4864 If you installed libxml2 into a non-standard directory, please run: 4841 4865 4842 4866 env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&5 4843 echo "$as_me: error: could not locate OpenSSL4844 4845 If you installed OpenSSLinto a non-standard directory, please run:4867 echo "$as_me: error: could not locate libxml2 4868 4869 If you installed libxml2 into a non-standard directory, please run: 4846 4870 4847 4871 env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&2;} … … 4856 4880 4857 4881 4858 for ac_header in CoreServices/CoreServices.h4882 for ac_header in zlib.h 4859 4883 do 4860 4884 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` … … 5001 5025 _ACEOF 5002 5026 5003 LIBS="$LIBS -framework CoreServices -framework Carbon" 5027 echo "$as_me:$LINENO: checking for deflate in -lz" >&5 5028 echo $ECHO_N "checking for deflate in -lz... $ECHO_C" >&6 5029 if test "${ac_cv_lib_z_deflate+set}" = set; then 5030 echo $ECHO_N "(cached) $ECHO_C" >&6 5031 else 5032 ac_check_lib_save_LIBS=$LIBS 5033 LIBS="-lz $LIBS" 5034 cat >conftest.$ac_ext <<_ACEOF 5035 /* confdefs.h. */ 5036 _ACEOF 5037 cat confdefs.h >>conftest.$ac_ext 5038 cat >>conftest.$ac_ext <<_ACEOF 5039 /* end confdefs.h. */ 5040 5041 /* Override any gcc2 internal prototype to avoid an error. */ 5042 #ifdef __cplusplus 5043 extern "C" 5044 #endif 5045 /* We use char because int might match the return type of a gcc2 5046 builtin and then its argument prototype would still apply. */ 5047 char deflate (); 5048 int 5049 main () 5050 { 5051 deflate (); 5052 ; 5053 return 0; 5054 } 5055 _ACEOF 5056 rm -f conftest.$ac_objext conftest$ac_exeext 5057 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 5058 (eval $ac_link) 2>conftest.er1 5059 ac_status=$? 5060 grep -v '^ *+' conftest.er1 >conftest.err 5061 rm -f conftest.er1 5062 cat conftest.err >&5 5063 echo "$as_me:$LINENO: \$? = $ac_status" >&5 5064 (exit $ac_status); } && 5065 { ac_try='test -z "$ac_c_werror_flag" 5066 || test ! -s conftest.err' 5067 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 5068 (eval $ac_try) 2>&5 5069 ac_status=$? 5070 echo "$as_me:$LINENO: \$? = $ac_status" >&5 5071 (exit $ac_status); }; } && 5072 { ac_try='test -s conftest$ac_exeext' 5073 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 5074 (eval $ac_try) 2>&5 5075 ac_status=$? 5076 echo "$as_me:$LINENO: \$? = $ac_status" >&5 5077 (exit $ac_status); }; }; then 5078 ac_cv_lib_z_deflate=yes 5079 else 5080 echo "$as_me: failed program was:" >&5 5081 sed 's/^/| /' conftest.$ac_ext >&5 5082 5083 ac_cv_lib_z_deflate=no 5084 fi 5085 rm -f conftest.err conftest.$ac_objext \ 5086 conftest$ac_exeext conftest.$ac_ext 5087 LIBS=$ac_check_lib_save_LIBS 5088 fi 5089 echo "$as_me:$LINENO: result: $ac_cv_lib_z_deflate" >&5 5090 echo "${ECHO_T}$ac_cv_lib_z_deflate" >&6 5091 if test $ac_cv_lib_z_deflate = yes; then 5092 5093 LIBS="$LIBS -lz" 5094 5095 else 5096 5097 5098 { { echo "$as_me:$LINENO: error: could not locate zlib 5099 5100 If you installed zlib into a non-standard directory, please run: 5101 5102 env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&5 5103 echo "$as_me: error: could not locate zlib 5104 5105 If you installed zlib into a non-standard directory, please run: 5106 5107 env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&2;} 5108 { (exit 1); exit 1; }; } 5109 5110 5111 fi 5112 5113 5114 else 5115 5116 5117 { { echo "$as_me:$LINENO: error: could not locate zlib 5118 5119 If you installed zlib into a non-standard directory, please run: 5120 5121 env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&5 5122 echo "$as_me: error: could not locate zlib 5123 5124 If you installed zlib into a non-standard directory, please run: 5125 5126 env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&2;} 5127 { (exit 1); exit 1; }; } 5128 5004 5129 5005 5130 fi … … 5009 5134 5010 5135 5011 case $host in 5012 *-solaris*) 5013 5014 cat >>confdefs.h <<\_ACEOF 5015 #define _POSIX_PTHREAD_SEMANTICS 5016 _ACEOF 5017 5018 ;; 5019 esac 5020 5021 5022 for ac_header in pthread.h 5136 5137 for ac_header in CoreServices/CoreServices.h 5023 5138 do 5024 5139 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` … … 5165 5280 _ACEOF 5166 5281 5282 LIBS="$LIBS -framework CoreServices -framework Carbon" 5283 5284 fi 5285 5286 done 5287 5288 5289 5290 case $host in 5291 *-solaris*) 5292 5293 cat >>confdefs.h <<\_ACEOF 5294 #define _POSIX_PTHREAD_SEMANTICS 5295 _ACEOF 5296 5297 ;; 5298 esac 5299 5300 5301 for ac_header in pthread.h 5302 do 5303 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` 5304 if eval "test \"\${$as_ac_Header+set}\" = set"; then 5305 echo "$as_me:$LINENO: checking for $ac_header" >&5 5306 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 5307 if eval "test \"\${$as_ac_Header+set}\" = set"; then 5308 echo $ECHO_N "(cached) $ECHO_C" >&6 5309 fi 5310 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 5311 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 5312 else 5313 # Is the header compilable? 5314 echo "$as_me:$LINENO: checking $ac_header usability" >&5 5315 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 5316 cat >conftest.$ac_ext <<_ACEOF 5317 /* confdefs.h. */ 5318 _ACEOF 5319 cat confdefs.h >>conftest.$ac_ext 5320 cat >>conftest.$ac_ext <<_ACEOF 5321 /* end confdefs.h. */ 5322 $ac_includes_default 5323 #include <$ac_header> 5324 _ACEOF 5325 rm -f conftest.$ac_objext 5326 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 5327 (eval $ac_compile) 2>conftest.er1 5328 ac_status=$? 5329 grep -v '^ *+' conftest.er1 >conftest.err 5330 rm -f conftest.er1 5331 cat conftest.err >&5 5332 echo "$as_me:$LINENO: \$? = $ac_status" >&5 5333 (exit $ac_status); } && 5334 { ac_try='test -z "$ac_c_werror_flag" 5335 || test ! -s conftest.err' 5336 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 5337 (eval $ac_try) 2>&5 5338 ac_status=$? 5339 echo "$as_me:$LINENO: \$? = $ac_status" >&5 5340 (exit $ac_status); }; } && 5341 { ac_try='test -s conftest.$ac_objext' 5342 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 5343 (eval $ac_try) 2>&5 5344 ac_status=$? 5345 echo "$as_me:$LINENO: \$? = $ac_status" >&5 5346 (exit $ac_status); }; }; then 5347 ac_header_compiler=yes 5348 else 5349 echo "$as_me: failed program was:" >&5 5350 sed 's/^/| /' conftest.$ac_ext >&5 5351 5352 ac_header_compiler=no 5353 fi 5354 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext 5355 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 5356 echo "${ECHO_T}$ac_header_compiler" >&6 5357 5358 # Is the header present? 5359 echo "$as_me:$LINENO: checking $ac_header presence" >&5 5360 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 5361 cat >conftest.$ac_ext <<_ACEOF 5362 /* confdefs.h. */ 5363 _ACEOF 5364 cat confdefs.h >>conftest.$ac_ext 5365 cat >>conftest.$ac_ext <<_ACEOF 5366 /* end confdefs.h. */ 5367 #include <$ac_header> 5368 _ACEOF 5369 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 5370 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 5371 ac_status=$? 5372 grep -v '^ *+' conftest.er1 >conftest.err 5373 rm -f conftest.er1 5374 cat conftest.err >&5 5375 echo "$as_me:$LINENO: \$? = $ac_status" >&5 5376 (exit $ac_status); } >/dev/null; then 5377 if test -s conftest.err; then 5378 ac_cpp_err=$ac_c_preproc_warn_flag 5379 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag 5380 else 5381 ac_cpp_err= 5382 fi 5383 else 5384 ac_cpp_err=yes 5385 fi 5386 if test -z "$ac_cpp_err"; then 5387 ac_header_preproc=yes 5388 else 5389 echo "$as_me: failed program was:" >&5 5390 sed 's/^/| /' conftest.$ac_ext >&5 5391 5392 ac_header_preproc=no 5393 fi 5394 rm -f conftest.err conftest.$ac_ext 5395 echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 5396 echo "${ECHO_T}$ac_header_preproc" >&6 5397 5398 # So? What about this header? 5399 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in 5400 yes:no: ) 5401 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 5402 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} 5403 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 5404 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} 5405 ac_header_preproc=yes 5406 ;; 5407 no:yes:* ) 5408 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 5409 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} 5410 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 5411 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} 5412 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 5413 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} 5414 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 5415 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} 5416 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 5417 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} 5418 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 5419 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} 5420 ( 5421 cat <<\_ASBOX 5422 ## ------------------------------------- ## 5423 ## Report this to axel@zankasoftware.com ## 5424 ## ------------------------------------- ## 5425 _ASBOX 5426 ) | 5427 sed "s/^/$as_me: WARNING: /" >&2 5428 ;; 5429 esac 5430 echo "$as_me:$LINENO: checking for $ac_header" >&5 5431 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 5432 if eval "test \"\${$as_ac_Header+set}\" = set"; then 5433 echo $ECHO_N "(cached) $ECHO_C" >&6 5434 else 5435 eval "$as_ac_Header=\$ac_header_preproc" 5436 fi 5437 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 5438 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 5439 5440 fi 5441 if test `eval echo '${'$as_ac_Header'}'` = yes; then 5442 cat >>confdefs.h <<_ACEOF 5443 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 5444 _ACEOF 5445 5167 5446 echo "$as_me:$LINENO: checking for pthreads" >&5 5168 5447 echo $ECHO_N "checking for pthreads... $ECHO_C" >&6 … … 5994 6273 5995 6274 if test "$wd_libwired"; then 5996 ac_configure_args="$ac_configure_args --enable- ssl --enable-pthreads--with-rundir=$wd_libwired_rundir --with-objdir=$wd_libwired_objdir"6275 ac_configure_args="$ac_configure_args --enable-pthreads --enable-p7 --with-rundir=$wd_libwired_rundir --with-objdir=$wd_libwired_objdir" 5997 6276 5998 6277 wired/branches/p7/configure.in
r4519 r4596 174 174 WI_INCLUDE_RESOLV_LIBRARY 175 175 WI_INCLUDE_CRYPTO_LIBRARY 176 WI_INCLUDE_SSL_LIBRARY 176 #WI_INCLUDE_SSL_LIBRARY 177 WI_INCLUDE_LIBXML2_LIBRARY 178 WI_INCLUDE_ZLIB_LIBRARY 177 179 WI_INCLUDE_CORESERVICES_FRAMEWORK 178 180 WI_INCLUDE_PTHREADS … … 200 202 201 203 if test "$wd_libwired"; then 202 ac_configure_args="$ac_configure_args --enable- ssl --enable-pthreads--with-rundir=$wd_libwired_rundir --with-objdir=$wd_libwired_objdir"204 ac_configure_args="$ac_configure_args --enable-pthreads --enable-p7 --with-rundir=$wd_libwired_rundir --with-objdir=$wd_libwired_objdir" 203 205 AC_CONFIG_SUBDIRS([libwired]) 204 206 fi wired/branches/p7/wired/accounts.c
r4508 r4596 48 48 49 49 50 static wi_string_t * _wd_accounts_password_provider(wi_string_t *); 51 50 52 static wi_boolean_t _wd_accounts_delete_from_file(wi_file_t *, wi_string_t *); 51 53 static void _wd_accounts_reload_user(wi_string_t *); … … 76 78 wd_users_lock = wi_lock_init(wi_lock_alloc()); 77 79 wd_groups_lock = wi_lock_init(wi_lock_alloc()); 80 81 wi_p7_socket_password_provider = _wd_accounts_password_provider; 78 82 } 79 83 … … 521 525 #pragma mark - 522 526 527 static wi_string_t * _wd_accounts_password_provider(wi_string_t *username) { 528 wd_account_t *account; 529 530 account = wd_accounts_read_user(username); 531 532 if(!account) 533 return NULL; 534 535 if(wi_string_length(account->password) == 0) 536 return wi_string_sha1(account->password); 537 538 return account->password; 539 } 540 541 542 543 #pragma mark - 544 523 545 static wi_boolean_t _wd_accounts_delete_from_file(wi_file_t *file, wi_string_t *name) { 524 546 wi_file_t *tmpfile; wired/branches/p7/wired/clients.c
r4576 r4596 166 166 167 167 168 wd_client_t * wd_client_init_with_socket(wd_client_t *client, wi_ socket_t *socket) {168 wd_client_t * wd_client_init_with_socket(wd_client_t *client, wi_p7_socket_t *p7_socket) { 169 169 wi_address_t *address; 170 170 171 171 client->uid = wd_client_uid(); 172 client->socket = wi_retain(socket); 172 client->socket = wi_retain(wi_p7_socket_socket(p7_socket)); 173 client->p7_socket = wi_retain(p7_socket); 173 174 client->state = WD_CLIENT_STATE_CONNECTED; 174 175 client->login_time = wi_time_interval(); 175 176 client->idle_time = client->idle_time; 176 177 177 address = wi_socket_address( socket);178 address = wi_socket_address(client->socket); 178 179 client->ip = wi_retain(wi_address_string(address)); 179 180 client->host = wi_retain(wi_address_hostname(address)); … … 193 194 194 195 wi_release(client->socket); 196 wi_release(client->p7_socket); 195 197 196 198 wi_release(client->account); wired/branches/p7/wired/clients.h
r4508 r4596 57 57 wi_lock_t *socket_lock; 58 58 wi_socket_t *socket; 59 wi_p7_socket_t *p7_socket; 59 60 60 61 wi_lock_t *flag_lock; … … 95 96 96 97 wd_client_t * wd_client_alloc(void); 97 wd_client_t * wd_client_init_with_socket(wd_client_t *, wi_ socket_t *);98 wd_client_t * wd_client_init_with_socket(wd_client_t *, wi_p7_socket_t *); 98 99 99 100 void wd_client_lock_socket(wd_client_t *); wired/branches/p7/wired/server.c
r4568 r4596 36 36 #include <wired/wired.h> 37 37 38 #include <openssl/rsa.h> 39 #include <openssl/pem.h> 40 #include <openssl/err.h> 41 38 42 #include "accounts.h" 39 43 #include "banlist.h" … … 61 65 static wi_socket_context_t *wd_transfer_socket_context; 62 66 67 static wi_p7_spec_t *wd_p7_spec; 68 static EVP_PKEY *wd_p7_pkey; 69 63 70 wi_string_t *wd_banner; 64 71 … … 71 78 wi_string_t *ip, *string; 72 79 wi_address_family_t family; 73 80 74 81 wd_control_sockets = wi_array_init(wi_array_alloc()); 75 82 wd_transfer_sockets = wi_array_init(wi_array_alloc()); … … 175 182 wi_string_t *string; 176 183 wi_data_t *data; 184 185 /* load protocol spec */ 186 if(!wd_p7_spec) { 187 wd_p7_spec = wi_p7_spec_init_with_file(wi_p7_spec_alloc(), WI_STR("protocol.xml"), true); 188 189 if(!wd_p7_spec) 190 wi_log_err(WI_STR("Could not load protocol.xml: %m")); 191 } 177 192 178 193 /* reload banner */ … … 208 223 209 224 /* set SSL cipher list */ 210 if(wd_settings.controlcipher) {225 /* if(wd_settings.controlcipher) { 211 226 if(!wi_socket_context_set_ssl_ciphers(wd_control_socket_context, wd_settings.controlcipher)) { 212 227 wi_log_err(WI_STR("Could not set SSL cipher list \"%@\": %m"), … … 220 235 wd_settings.transfercipher); 221 236 } 222 } 237 }*/ 223 238 224 239 /* load SSL certificate */ 225 if(wd_settings.certificate) {240 /* if(wd_settings.certificate) { 226 241 if(!wi_socket_context_set_ssl_certificate(wd_control_socket_context, wd_settings.certificate) || 227 242 !wi_socket_context_set_ssl_certificate(wd_transfer_socket_context, wd_settings.certificate)) { … … 229 244 wd_settings.certificate); 230 245 } 231 } 246 }*/ 232 247 } 233 248 … … 237 252 238 253 void wd_ssl_init(void) { 239 unsigned char dh1024_p[] = {254 /* unsigned char dh1024_p[] = { 240 255 0xBC,0xBB,0x2B,0x4F,0x58,0x58,0x9C,0x4D,0x46,0x0D,0xBB,0x9E, 241 256 0x4D,0x85,0x69,0x56,0x43,0x5E,0xFB,0xC8,0xF6,0xC0,0xAC,0x8E, … … 260 275 if(!wi_socket_context_set_ssl_dh(wd_control_socket_context, dh1024_p, sizeof(dh1024_p), dh1024_g, sizeof(dh1024_g)) || 261 276 !wi_socket_context_set_ssl_dh(wd_transfer_socket_context, dh1024_p, sizeof(dh1024_p), dh1024_g, sizeof(dh1024_g))) 262 wi_log_err(WI_STR("Could not set anonymous DH key: %m")); 277 wi_log_err(WI_STR("Could not set anonymous DH key: %m"));*/ 278 279 280 281 282 RSA *rsa; 283 FILE *fp; 284 285 fp = fopen("key", "r"); 286 287 if(!fp) 288 wi_log_err(WI_STR("fopen(): key: %s"), strerror(errno)); 289 290 ERR_load_crypto_strings(); 291 292 rsa = PEM_read_RSAPrivateKey(fp, NULL, NULL, NULL); 293 294 if(!rsa) 295 wi_log_err(WI_STR("PEM_read_RSAPublicKey(): %s"), ERR_reason_error_string(ERR_get_error())); 296 297 wd_p7_pkey = EVP_PKEY_new(); 298 EVP_PKEY_assign_RSA(wd_p7_pkey, rsa); 263 299 } 264 300 … … 270 306 wi_pool_t *pool; 271 307 wi_socket_t *socket; 308 wi_p7_socket_t *p7_socket; 272 309 wi_address_t *address; 273 310 wi_string_t *ip; … … 297 334 wi_socket_set_direction(socket, WI_SOCKET_READ); 298 335 336 p7_socket = wi_autorelease(wi_p7_socket_init_with_socket(wi_p7_socket_alloc(), socket, wd_p7_spec)); 337 wi_p7_socket_set_private_key(p7_socket, wd_p7_pkey); 338 339 if(!wi_p7_socket_accept(p7_socket, 10.0, WI_P7_ALL)) { 340 wi_socket_close(socket); 341 342 wi_log_err(WI_STR("Could not accept a connection: %m")); 343 344 goto next; 345 } 346 299 347 wi_log_info(WI_STR("Connect from %@"), ip); 300 348 301 349 /* spawn a client thread */ 302 client = wi_autorelease(wd_client_init_with_socket(wd_client_alloc(), socket));350 client = wi_autorelease(wd_client_init_with_socket(wd_client_alloc(), p7_socket)); 303 351 304 352 if(!wi_thread_create_thread(wd_control_thread, client)) wired/branches/p7/wired/transfers.c
r4576 r4596 587 587 588 588 static void wd_transfer_download(wd_transfer_t *transfer) { 589 #if 0 589 590 wi_pool_t *pool; 590 591 SSL *ssl; … … 719 720 720 721 wi_release(pool); 722 #endif 721 723 } 722 724 … … 724 726 725 727 static void wd_transfer_upload(wd_transfer_t *transfer) { 728 #if 0 726 729 wi_pool_t *pool; 727 730 wi_string_t *path; … … 868 871 869 872 wi_release(pool); 870 } 873 #endif 874 }
