nginxtra 1.0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -0
- data/bin/nginxtra +5 -0
- data/lib/nginxtra.rb +12 -0
- data/lib/nginxtra/action.rb +36 -0
- data/lib/nginxtra/actions/compile.rb +60 -0
- data/lib/nginxtra/actions/install.rb +99 -0
- data/lib/nginxtra/actions/reload.rb +14 -0
- data/lib/nginxtra/actions/restart.rb +15 -0
- data/lib/nginxtra/actions/start.rb +53 -0
- data/lib/nginxtra/actions/status.rb +31 -0
- data/lib/nginxtra/actions/stop.rb +14 -0
- data/lib/nginxtra/cli.rb +77 -0
- data/lib/nginxtra/config.rb +339 -0
- data/lib/nginxtra/error.rb +13 -0
- data/lib/nginxtra/status.rb +57 -0
- data/src/nginx/CHANGES +5630 -0
- data/src/nginx/CHANGES.ru +5716 -0
- data/src/nginx/LICENSE +25 -0
- data/src/nginx/README +3 -0
- data/src/nginx/auto/cc/acc +15 -0
- data/src/nginx/auto/cc/bcc +72 -0
- data/src/nginx/auto/cc/ccc +46 -0
- data/src/nginx/auto/cc/conf +189 -0
- data/src/nginx/auto/cc/gcc +183 -0
- data/src/nginx/auto/cc/icc +121 -0
- data/src/nginx/auto/cc/msvc +138 -0
- data/src/nginx/auto/cc/name +101 -0
- data/src/nginx/auto/cc/owc +104 -0
- data/src/nginx/auto/cc/sunc +158 -0
- data/src/nginx/auto/define +12 -0
- data/src/nginx/auto/endianess +45 -0
- data/src/nginx/auto/feature +123 -0
- data/src/nginx/auto/have +12 -0
- data/src/nginx/auto/have_headers +12 -0
- data/src/nginx/auto/headers +13 -0
- data/src/nginx/auto/include +61 -0
- data/src/nginx/auto/init +51 -0
- data/src/nginx/auto/install +184 -0
- data/src/nginx/auto/lib/conf +83 -0
- data/src/nginx/auto/lib/geoip/conf +79 -0
- data/src/nginx/auto/lib/google-perftools/conf +45 -0
- data/src/nginx/auto/lib/libatomic/conf +43 -0
- data/src/nginx/auto/lib/libatomic/make +14 -0
- data/src/nginx/auto/lib/libgd/conf +83 -0
- data/src/nginx/auto/lib/libxslt/conf +156 -0
- data/src/nginx/auto/lib/make +32 -0
- data/src/nginx/auto/lib/md5/conf +103 -0
- data/src/nginx/auto/lib/md5/make +96 -0
- data/src/nginx/auto/lib/md5/makefile.bcc +22 -0
- data/src/nginx/auto/lib/md5/makefile.msvc +22 -0
- data/src/nginx/auto/lib/md5/makefile.owc +11 -0
- data/src/nginx/auto/lib/openssl/conf +74 -0
- data/src/nginx/auto/lib/openssl/make +67 -0
- data/src/nginx/auto/lib/openssl/makefile.bcc +18 -0
- data/src/nginx/auto/lib/openssl/makefile.msvc +14 -0
- data/src/nginx/auto/lib/pcre/conf +180 -0
- data/src/nginx/auto/lib/pcre/make +64 -0
- data/src/nginx/auto/lib/pcre/makefile.bcc +26 -0
- data/src/nginx/auto/lib/pcre/makefile.msvc +22 -0
- data/src/nginx/auto/lib/pcre/makefile.owc +24 -0
- data/src/nginx/auto/lib/perl/conf +60 -0
- data/src/nginx/auto/lib/perl/make +36 -0
- data/src/nginx/auto/lib/sha1/conf +79 -0
- data/src/nginx/auto/lib/sha1/make +96 -0
- data/src/nginx/auto/lib/sha1/makefile.bcc +22 -0
- data/src/nginx/auto/lib/sha1/makefile.msvc +22 -0
- data/src/nginx/auto/lib/sha1/makefile.owc +11 -0
- data/src/nginx/auto/lib/test +40 -0
- data/src/nginx/auto/lib/zlib/conf +76 -0
- data/src/nginx/auto/lib/zlib/make +114 -0
- data/src/nginx/auto/lib/zlib/makefile.bcc +15 -0
- data/src/nginx/auto/lib/zlib/makefile.msvc +14 -0
- data/src/nginx/auto/lib/zlib/makefile.owc +14 -0
- data/src/nginx/auto/lib/zlib/patch.zlib.h +10 -0
- data/src/nginx/auto/make +417 -0
- data/src/nginx/auto/modules +479 -0
- data/src/nginx/auto/nohave +12 -0
- data/src/nginx/auto/options +490 -0
- data/src/nginx/auto/os/conf +105 -0
- data/src/nginx/auto/os/darwin +116 -0
- data/src/nginx/auto/os/freebsd +136 -0
- data/src/nginx/auto/os/linux +152 -0
- data/src/nginx/auto/os/solaris +60 -0
- data/src/nginx/auto/os/win32 +29 -0
- data/src/nginx/auto/sources +518 -0
- data/src/nginx/auto/stubs +8 -0
- data/src/nginx/auto/summary +114 -0
- data/src/nginx/auto/types/sizeof +83 -0
- data/src/nginx/auto/types/typedef +77 -0
- data/src/nginx/auto/types/uintptr_t +42 -0
- data/src/nginx/auto/types/value +12 -0
- data/src/nginx/auto/unix +719 -0
- data/src/nginx/conf/fastcgi.conf +24 -0
- data/src/nginx/conf/fastcgi_params +23 -0
- data/src/nginx/conf/koi-utf +109 -0
- data/src/nginx/conf/koi-win +103 -0
- data/src/nginx/conf/mime.types +80 -0
- data/src/nginx/conf/nginx.conf +118 -0
- data/src/nginx/conf/scgi_params +15 -0
- data/src/nginx/conf/uwsgi_params +15 -0
- data/src/nginx/conf/win-utf +126 -0
- data/src/nginx/configure +108 -0
- data/src/nginx/contrib/README +15 -0
- data/src/nginx/contrib/geo2nginx.pl +58 -0
- data/src/nginx/contrib/unicode2nginx/koi-utf +131 -0
- data/src/nginx/contrib/unicode2nginx/unicode-to-nginx.pl +45 -0
- data/src/nginx/contrib/unicode2nginx/win-utf +130 -0
- data/src/nginx/html/50x.html +18 -0
- data/src/nginx/html/index.html +8 -0
- data/src/nginx/man/nginx.8 +202 -0
- data/src/nginx/src/core/nginx.c +1333 -0
- data/src/nginx/src/core/nginx.h +20 -0
- data/src/nginx/src/core/ngx_array.c +147 -0
- data/src/nginx/src/core/ngx_array.h +53 -0
- data/src/nginx/src/core/ngx_buf.c +218 -0
- data/src/nginx/src/core/ngx_buf.h +162 -0
- data/src/nginx/src/core/ngx_conf_file.c +1506 -0
- data/src/nginx/src/core/ngx_conf_file.h +348 -0
- data/src/nginx/src/core/ngx_config.h +134 -0
- data/src/nginx/src/core/ngx_connection.c +1074 -0
- data/src/nginx/src/core/ngx_connection.h +195 -0
- data/src/nginx/src/core/ngx_core.h +95 -0
- data/src/nginx/src/core/ngx_cpuinfo.c +139 -0
- data/src/nginx/src/core/ngx_crc.h +39 -0
- data/src/nginx/src/core/ngx_crc32.c +129 -0
- data/src/nginx/src/core/ngx_crc32.h +79 -0
- data/src/nginx/src/core/ngx_crypt.c +238 -0
- data/src/nginx/src/core/ngx_crypt.h +20 -0
- data/src/nginx/src/core/ngx_cycle.c +1379 -0
- data/src/nginx/src/core/ngx_cycle.h +142 -0
- data/src/nginx/src/core/ngx_file.c +993 -0
- data/src/nginx/src/core/ngx_file.h +151 -0
- data/src/nginx/src/core/ngx_hash.c +976 -0
- data/src/nginx/src/core/ngx_hash.h +122 -0
- data/src/nginx/src/core/ngx_inet.c +1008 -0
- data/src/nginx/src/core/ngx_inet.h +120 -0
- data/src/nginx/src/core/ngx_list.c +71 -0
- data/src/nginx/src/core/ngx_list.h +83 -0
- data/src/nginx/src/core/ngx_log.c +459 -0
- data/src/nginx/src/core/ngx_log.h +250 -0
- data/src/nginx/src/core/ngx_md5.c +289 -0
- data/src/nginx/src/core/ngx_md5.h +60 -0
- data/src/nginx/src/core/ngx_murmurhash.c +50 -0
- data/src/nginx/src/core/ngx_murmurhash.h +19 -0
- data/src/nginx/src/core/ngx_open_file_cache.c +882 -0
- data/src/nginx/src/core/ngx_open_file_cache.h +119 -0
- data/src/nginx/src/core/ngx_output_chain.c +673 -0
- data/src/nginx/src/core/ngx_palloc.c +433 -0
- data/src/nginx/src/core/ngx_palloc.h +95 -0
- data/src/nginx/src/core/ngx_parse.c +249 -0
- data/src/nginx/src/core/ngx_parse.h +24 -0
- data/src/nginx/src/core/ngx_queue.c +80 -0
- data/src/nginx/src/core/ngx_queue.h +112 -0
- data/src/nginx/src/core/ngx_radix_tree.c +291 -0
- data/src/nginx/src/core/ngx_radix_tree.h +46 -0
- data/src/nginx/src/core/ngx_rbtree.c +383 -0
- data/src/nginx/src/core/ngx_rbtree.h +84 -0
- data/src/nginx/src/core/ngx_regex.c +206 -0
- data/src/nginx/src/core/ngx_regex.h +56 -0
- data/src/nginx/src/core/ngx_resolver.c +2201 -0
- data/src/nginx/src/core/ngx_resolver.h +149 -0
- data/src/nginx/src/core/ngx_sha1.h +31 -0
- data/src/nginx/src/core/ngx_shmtx.c +284 -0
- data/src/nginx/src/core/ngx_shmtx.h +38 -0
- data/src/nginx/src/core/ngx_slab.c +701 -0
- data/src/nginx/src/core/ngx_slab.h +54 -0
- data/src/nginx/src/core/ngx_spinlock.c +53 -0
- data/src/nginx/src/core/ngx_string.c +1837 -0
- data/src/nginx/src/core/ngx_string.h +231 -0
- data/src/nginx/src/core/ngx_times.c +407 -0
- data/src/nginx/src/core/ngx_times.h +51 -0
- data/src/nginx/src/event/modules/ngx_aio_module.c +171 -0
- data/src/nginx/src/event/modules/ngx_devpoll_module.c +569 -0
- data/src/nginx/src/event/modules/ngx_epoll_module.c +833 -0
- data/src/nginx/src/event/modules/ngx_eventport_module.c +602 -0
- data/src/nginx/src/event/modules/ngx_kqueue_module.c +785 -0
- data/src/nginx/src/event/modules/ngx_poll_module.c +443 -0
- data/src/nginx/src/event/modules/ngx_rtsig_module.c +735 -0
- data/src/nginx/src/event/modules/ngx_select_module.c +435 -0
- data/src/nginx/src/event/modules/ngx_win32_select_module.c +400 -0
- data/src/nginx/src/event/ngx_event.c +1275 -0
- data/src/nginx/src/event/ngx_event.h +573 -0
- data/src/nginx/src/event/ngx_event_accept.c +428 -0
- data/src/nginx/src/event/ngx_event_busy_lock.c +286 -0
- data/src/nginx/src/event/ngx_event_busy_lock.h +65 -0
- data/src/nginx/src/event/ngx_event_connect.c +258 -0
- data/src/nginx/src/event/ngx_event_connect.h +76 -0
- data/src/nginx/src/event/ngx_event_mutex.c +70 -0
- data/src/nginx/src/event/ngx_event_openssl.c +2382 -0
- data/src/nginx/src/event/ngx_event_openssl.h +162 -0
- data/src/nginx/src/event/ngx_event_pipe.c +996 -0
- data/src/nginx/src/event/ngx_event_pipe.h +95 -0
- data/src/nginx/src/event/ngx_event_posted.c +173 -0
- data/src/nginx/src/event/ngx_event_posted.h +75 -0
- data/src/nginx/src/event/ngx_event_timer.c +159 -0
- data/src/nginx/src/event/ngx_event_timer.h +102 -0
- data/src/nginx/src/http/modules/ngx_http_access_module.c +384 -0
- data/src/nginx/src/http/modules/ngx_http_addition_filter_module.c +250 -0
- data/src/nginx/src/http/modules/ngx_http_auth_basic_module.c +478 -0
- data/src/nginx/src/http/modules/ngx_http_autoindex_module.c +701 -0
- data/src/nginx/src/http/modules/ngx_http_browser_module.c +713 -0
- data/src/nginx/src/http/modules/ngx_http_charset_filter_module.c +1681 -0
- data/src/nginx/src/http/modules/ngx_http_chunked_filter_module.c +242 -0
- data/src/nginx/src/http/modules/ngx_http_dav_module.c +1141 -0
- data/src/nginx/src/http/modules/ngx_http_degradation_module.c +243 -0
- data/src/nginx/src/http/modules/ngx_http_empty_gif_module.c +140 -0
- data/src/nginx/src/http/modules/ngx_http_fastcgi_module.c +2916 -0
- data/src/nginx/src/http/modules/ngx_http_flv_module.c +254 -0
- data/src/nginx/src/http/modules/ngx_http_geo_module.c +1441 -0
- data/src/nginx/src/http/modules/ngx_http_geoip_module.c +671 -0
- data/src/nginx/src/http/modules/ngx_http_gzip_filter_module.c +1206 -0
- data/src/nginx/src/http/modules/ngx_http_gzip_static_module.c +299 -0
- data/src/nginx/src/http/modules/ngx_http_headers_filter_module.c +616 -0
- data/src/nginx/src/http/modules/ngx_http_image_filter_module.c +1489 -0
- data/src/nginx/src/http/modules/ngx_http_index_module.c +516 -0
- data/src/nginx/src/http/modules/ngx_http_limit_req_module.c +809 -0
- data/src/nginx/src/http/modules/ngx_http_limit_zone_module.c +553 -0
- data/src/nginx/src/http/modules/ngx_http_log_module.c +1357 -0
- data/src/nginx/src/http/modules/ngx_http_map_module.c +575 -0
- data/src/nginx/src/http/modules/ngx_http_memcached_module.c +624 -0
- data/src/nginx/src/http/modules/ngx_http_mp4_module.c +3000 -0
- data/src/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +143 -0
- data/src/nginx/src/http/modules/ngx_http_proxy_module.c +2831 -0
- data/src/nginx/src/http/modules/ngx_http_random_index_module.c +317 -0
- data/src/nginx/src/http/modules/ngx_http_range_filter_module.c +855 -0
- data/src/nginx/src/http/modules/ngx_http_realip_module.c +476 -0
- data/src/nginx/src/http/modules/ngx_http_referer_module.c +613 -0
- data/src/nginx/src/http/modules/ngx_http_rewrite_module.c +1019 -0
- data/src/nginx/src/http/modules/ngx_http_scgi_module.c +1714 -0
- data/src/nginx/src/http/modules/ngx_http_secure_link_module.c +355 -0
- data/src/nginx/src/http/modules/ngx_http_split_clients_module.c +242 -0
- data/src/nginx/src/http/modules/ngx_http_ssi_filter_module.c +2913 -0
- data/src/nginx/src/http/modules/ngx_http_ssi_filter_module.h +114 -0
- data/src/nginx/src/http/modules/ngx_http_ssl_module.c +652 -0
- data/src/nginx/src/http/modules/ngx_http_ssl_module.h +52 -0
- data/src/nginx/src/http/modules/ngx_http_static_module.c +278 -0
- data/src/nginx/src/http/modules/ngx_http_stub_status_module.c +144 -0
- data/src/nginx/src/http/modules/ngx_http_sub_filter_module.c +716 -0
- data/src/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +237 -0
- data/src/nginx/src/http/modules/ngx_http_userid_filter_module.c +846 -0
- data/src/nginx/src/http/modules/ngx_http_uwsgi_module.c +1774 -0
- data/src/nginx/src/http/modules/ngx_http_xslt_filter_module.c +984 -0
- data/src/nginx/src/http/modules/perl/Makefile.PL +42 -0
- data/src/nginx/src/http/modules/perl/nginx.pm +137 -0
- data/src/nginx/src/http/modules/perl/nginx.xs +986 -0
- data/src/nginx/src/http/modules/perl/ngx_http_perl_module.c +1076 -0
- data/src/nginx/src/http/modules/perl/ngx_http_perl_module.h +67 -0
- data/src/nginx/src/http/modules/perl/typemap +3 -0
- data/src/nginx/src/http/ngx_http.c +2073 -0
- data/src/nginx/src/http/ngx_http.h +160 -0
- data/src/nginx/src/http/ngx_http_busy_lock.c +307 -0
- data/src/nginx/src/http/ngx_http_busy_lock.h +54 -0
- data/src/nginx/src/http/ngx_http_cache.h +148 -0
- data/src/nginx/src/http/ngx_http_config.h +75 -0
- data/src/nginx/src/http/ngx_http_copy_filter_module.c +300 -0
- data/src/nginx/src/http/ngx_http_core_module.c +4736 -0
- data/src/nginx/src/http/ngx_http_core_module.h +541 -0
- data/src/nginx/src/http/ngx_http_file_cache.c +1715 -0
- data/src/nginx/src/http/ngx_http_header_filter_module.c +623 -0
- data/src/nginx/src/http/ngx_http_parse.c +1734 -0
- data/src/nginx/src/http/ngx_http_parse_time.c +276 -0
- data/src/nginx/src/http/ngx_http_postpone_filter_module.c +178 -0
- data/src/nginx/src/http/ngx_http_request.c +3181 -0
- data/src/nginx/src/http/ngx_http_request.h +573 -0
- data/src/nginx/src/http/ngx_http_request_body.c +644 -0
- data/src/nginx/src/http/ngx_http_script.c +1752 -0
- data/src/nginx/src/http/ngx_http_script.h +257 -0
- data/src/nginx/src/http/ngx_http_special_response.c +789 -0
- data/src/nginx/src/http/ngx_http_upstream.c +4555 -0
- data/src/nginx/src/http/ngx_http_upstream.h +350 -0
- data/src/nginx/src/http/ngx_http_upstream_round_robin.c +791 -0
- data/src/nginx/src/http/ngx_http_upstream_round_robin.h +85 -0
- data/src/nginx/src/http/ngx_http_variables.c +2053 -0
- data/src/nginx/src/http/ngx_http_variables.h +115 -0
- data/src/nginx/src/http/ngx_http_write_filter_module.c +315 -0
- data/src/nginx/src/mail/ngx_mail.c +542 -0
- data/src/nginx/src/mail/ngx_mail.h +407 -0
- data/src/nginx/src/mail/ngx_mail_auth_http_module.c +1452 -0
- data/src/nginx/src/mail/ngx_mail_core_module.c +553 -0
- data/src/nginx/src/mail/ngx_mail_handler.c +773 -0
- data/src/nginx/src/mail/ngx_mail_imap_handler.c +457 -0
- data/src/nginx/src/mail/ngx_mail_imap_module.c +253 -0
- data/src/nginx/src/mail/ngx_mail_imap_module.h +39 -0
- data/src/nginx/src/mail/ngx_mail_parse.c +885 -0
- data/src/nginx/src/mail/ngx_mail_pop3_handler.c +500 -0
- data/src/nginx/src/mail/ngx_mail_pop3_module.c +264 -0
- data/src/nginx/src/mail/ngx_mail_pop3_module.h +38 -0
- data/src/nginx/src/mail/ngx_mail_proxy_module.c +1089 -0
- data/src/nginx/src/mail/ngx_mail_smtp_handler.c +872 -0
- data/src/nginx/src/mail/ngx_mail_smtp_module.c +308 -0
- data/src/nginx/src/mail/ngx_mail_smtp_module.h +45 -0
- data/src/nginx/src/mail/ngx_mail_ssl_module.c +491 -0
- data/src/nginx/src/mail/ngx_mail_ssl_module.h +52 -0
- data/src/nginx/src/misc/ngx_cpp_test_module.cpp +27 -0
- data/src/nginx/src/misc/ngx_google_perftools_module.c +126 -0
- data/src/nginx/src/os/unix/ngx_aio_read.c +109 -0
- data/src/nginx/src/os/unix/ngx_aio_read_chain.c +78 -0
- data/src/nginx/src/os/unix/ngx_aio_write.c +109 -0
- data/src/nginx/src/os/unix/ngx_aio_write_chain.c +100 -0
- data/src/nginx/src/os/unix/ngx_alloc.c +90 -0
- data/src/nginx/src/os/unix/ngx_alloc.h +45 -0
- data/src/nginx/src/os/unix/ngx_atomic.h +311 -0
- data/src/nginx/src/os/unix/ngx_channel.c +258 -0
- data/src/nginx/src/os/unix/ngx_channel.h +34 -0
- data/src/nginx/src/os/unix/ngx_daemon.c +69 -0
- data/src/nginx/src/os/unix/ngx_darwin.h +20 -0
- data/src/nginx/src/os/unix/ngx_darwin_config.h +96 -0
- data/src/nginx/src/os/unix/ngx_darwin_init.c +166 -0
- data/src/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +366 -0
- data/src/nginx/src/os/unix/ngx_errno.c +87 -0
- data/src/nginx/src/os/unix/ngx_errno.h +68 -0
- data/src/nginx/src/os/unix/ngx_file_aio_read.c +208 -0
- data/src/nginx/src/os/unix/ngx_files.c +566 -0
- data/src/nginx/src/os/unix/ngx_files.h +343 -0
- data/src/nginx/src/os/unix/ngx_freebsd.h +24 -0
- data/src/nginx/src/os/unix/ngx_freebsd_config.h +119 -0
- data/src/nginx/src/os/unix/ngx_freebsd_init.c +259 -0
- data/src/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +756 -0
- data/src/nginx/src/os/unix/ngx_freebsd_rfork_thread.h +122 -0
- data/src/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +436 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_amd64.h +82 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_ppc.h +155 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_sparc64.h +82 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_x86.h +127 -0
- data/src/nginx/src/os/unix/ngx_linux.h +18 -0
- data/src/nginx/src/os/unix/ngx_linux_aio_read.c +137 -0
- data/src/nginx/src/os/unix/ngx_linux_config.h +117 -0
- data/src/nginx/src/os/unix/ngx_linux_init.c +91 -0
- data/src/nginx/src/os/unix/ngx_linux_sendfile_chain.c +378 -0
- data/src/nginx/src/os/unix/ngx_os.h +84 -0
- data/src/nginx/src/os/unix/ngx_posix_config.h +153 -0
- data/src/nginx/src/os/unix/ngx_posix_init.c +124 -0
- data/src/nginx/src/os/unix/ngx_process.c +590 -0
- data/src/nginx/src/os/unix/ngx_process.h +87 -0
- data/src/nginx/src/os/unix/ngx_process_cycle.c +1390 -0
- data/src/nginx/src/os/unix/ngx_process_cycle.h +61 -0
- data/src/nginx/src/os/unix/ngx_pthread_thread.c +278 -0
- data/src/nginx/src/os/unix/ngx_readv_chain.c +258 -0
- data/src/nginx/src/os/unix/ngx_recv.c +180 -0
- data/src/nginx/src/os/unix/ngx_send.c +73 -0
- data/src/nginx/src/os/unix/ngx_setproctitle.c +135 -0
- data/src/nginx/src/os/unix/ngx_setproctitle.h +52 -0
- data/src/nginx/src/os/unix/ngx_shmem.c +126 -0
- data/src/nginx/src/os/unix/ngx_shmem.h +29 -0
- data/src/nginx/src/os/unix/ngx_socket.c +116 -0
- data/src/nginx/src/os/unix/ngx_socket.h +64 -0
- data/src/nginx/src/os/unix/ngx_solaris.h +16 -0
- data/src/nginx/src/os/unix/ngx_solaris_config.h +107 -0
- data/src/nginx/src/os/unix/ngx_solaris_init.c +75 -0
- data/src/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +251 -0
- data/src/nginx/src/os/unix/ngx_sunpro_amd64.il +43 -0
- data/src/nginx/src/os/unix/ngx_sunpro_atomic_sparc64.h +61 -0
- data/src/nginx/src/os/unix/ngx_sunpro_sparc64.il +36 -0
- data/src/nginx/src/os/unix/ngx_sunpro_x86.il +44 -0
- data/src/nginx/src/os/unix/ngx_thread.h +128 -0
- data/src/nginx/src/os/unix/ngx_time.c +104 -0
- data/src/nginx/src/os/unix/ngx_time.h +66 -0
- data/src/nginx/src/os/unix/ngx_udp_recv.c +115 -0
- data/src/nginx/src/os/unix/ngx_user.c +109 -0
- data/src/nginx/src/os/unix/ngx_user.h +24 -0
- data/src/nginx/src/os/unix/ngx_writev_chain.c +181 -0
- data/src/nginx/src/os/unix/rfork_thread.S +73 -0
- metadata +419 -0
@@ -0,0 +1,129 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Igor Sysoev
|
4
|
+
* Copyright (C) Nginx, Inc.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
#include <ngx_config.h>
|
9
|
+
#include <ngx_core.h>
|
10
|
+
|
11
|
+
|
12
|
+
/*
|
13
|
+
* The code and lookup tables are based on the algorithm
|
14
|
+
* described at http://www.w3.org/TR/PNG/
|
15
|
+
*
|
16
|
+
* The 256 element lookup table takes 1024 bytes, and it may be completely
|
17
|
+
* cached after processing about 30-60 bytes of data. So for short data
|
18
|
+
* we use the 16 element lookup table that takes only 64 bytes and align it
|
19
|
+
* to CPU cache line size. Of course, the small table adds code inside
|
20
|
+
* CRC32 loop, but the cache misses overhead is bigger than overhead of
|
21
|
+
* the additional code. For example, ngx_crc32_short() of 16 bytes of data
|
22
|
+
* takes half as much CPU clocks than ngx_crc32_long().
|
23
|
+
*/
|
24
|
+
|
25
|
+
|
26
|
+
static uint32_t ngx_crc32_table16[] = {
|
27
|
+
0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac,
|
28
|
+
0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c,
|
29
|
+
0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c,
|
30
|
+
0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c
|
31
|
+
};
|
32
|
+
|
33
|
+
|
34
|
+
uint32_t ngx_crc32_table256[] = {
|
35
|
+
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
|
36
|
+
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
|
37
|
+
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
|
38
|
+
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
|
39
|
+
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
|
40
|
+
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
|
41
|
+
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
|
42
|
+
0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
|
43
|
+
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
|
44
|
+
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
45
|
+
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
|
46
|
+
0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
|
47
|
+
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
|
48
|
+
0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
|
49
|
+
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
50
|
+
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
|
51
|
+
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
|
52
|
+
0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
53
|
+
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
|
54
|
+
0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
55
|
+
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
|
56
|
+
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
|
57
|
+
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
|
58
|
+
0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
|
59
|
+
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
|
60
|
+
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
|
61
|
+
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
|
62
|
+
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
|
63
|
+
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
|
64
|
+
0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
65
|
+
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
|
66
|
+
0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
|
67
|
+
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
|
68
|
+
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
|
69
|
+
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
|
70
|
+
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
71
|
+
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
|
72
|
+
0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
|
73
|
+
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
|
74
|
+
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
75
|
+
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
|
76
|
+
0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
77
|
+
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
|
78
|
+
0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
|
79
|
+
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
80
|
+
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
|
81
|
+
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
|
82
|
+
0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
|
83
|
+
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
|
84
|
+
0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
85
|
+
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
|
86
|
+
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
|
87
|
+
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
|
88
|
+
0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
89
|
+
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
|
90
|
+
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
|
91
|
+
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
|
92
|
+
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
|
93
|
+
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
|
94
|
+
0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
95
|
+
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
|
96
|
+
0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
|
97
|
+
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
98
|
+
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
99
|
+
};
|
100
|
+
|
101
|
+
|
102
|
+
uint32_t *ngx_crc32_table_short = ngx_crc32_table16;
|
103
|
+
|
104
|
+
|
105
|
+
ngx_int_t
|
106
|
+
ngx_crc32_table_init(void)
|
107
|
+
{
|
108
|
+
void *p;
|
109
|
+
|
110
|
+
if (((uintptr_t) ngx_crc32_table_short
|
111
|
+
& ~((uintptr_t) ngx_cacheline_size - 1))
|
112
|
+
== (uintptr_t) ngx_crc32_table_short)
|
113
|
+
{
|
114
|
+
return NGX_OK;
|
115
|
+
}
|
116
|
+
|
117
|
+
p = ngx_alloc(16 * sizeof(uint32_t) + ngx_cacheline_size, ngx_cycle->log);
|
118
|
+
if (p == NULL) {
|
119
|
+
return NGX_ERROR;
|
120
|
+
}
|
121
|
+
|
122
|
+
p = ngx_align_ptr(p, ngx_cacheline_size);
|
123
|
+
|
124
|
+
ngx_memcpy(p, ngx_crc32_table16, 16 * sizeof(uint32_t));
|
125
|
+
|
126
|
+
ngx_crc32_table_short = p;
|
127
|
+
|
128
|
+
return NGX_OK;
|
129
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Igor Sysoev
|
4
|
+
* Copyright (C) Nginx, Inc.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
#ifndef _NGX_CRC32_H_INCLUDED_
|
9
|
+
#define _NGX_CRC32_H_INCLUDED_
|
10
|
+
|
11
|
+
|
12
|
+
#include <ngx_config.h>
|
13
|
+
#include <ngx_core.h>
|
14
|
+
|
15
|
+
|
16
|
+
extern uint32_t *ngx_crc32_table_short;
|
17
|
+
extern uint32_t ngx_crc32_table256[];
|
18
|
+
|
19
|
+
|
20
|
+
static ngx_inline uint32_t
|
21
|
+
ngx_crc32_short(u_char *p, size_t len)
|
22
|
+
{
|
23
|
+
u_char c;
|
24
|
+
uint32_t crc;
|
25
|
+
|
26
|
+
crc = 0xffffffff;
|
27
|
+
|
28
|
+
while (len--) {
|
29
|
+
c = *p++;
|
30
|
+
crc = ngx_crc32_table_short[(crc ^ (c & 0xf)) & 0xf] ^ (crc >> 4);
|
31
|
+
crc = ngx_crc32_table_short[(crc ^ (c >> 4)) & 0xf] ^ (crc >> 4);
|
32
|
+
}
|
33
|
+
|
34
|
+
return crc ^ 0xffffffff;
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
static ngx_inline uint32_t
|
39
|
+
ngx_crc32_long(u_char *p, size_t len)
|
40
|
+
{
|
41
|
+
uint32_t crc;
|
42
|
+
|
43
|
+
crc = 0xffffffff;
|
44
|
+
|
45
|
+
while (len--) {
|
46
|
+
crc = ngx_crc32_table256[(crc ^ *p++) & 0xff] ^ (crc >> 8);
|
47
|
+
}
|
48
|
+
|
49
|
+
return crc ^ 0xffffffff;
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
#define ngx_crc32_init(crc) \
|
54
|
+
crc = 0xffffffff
|
55
|
+
|
56
|
+
|
57
|
+
static ngx_inline void
|
58
|
+
ngx_crc32_update(uint32_t *crc, u_char *p, size_t len)
|
59
|
+
{
|
60
|
+
uint32_t c;
|
61
|
+
|
62
|
+
c = *crc;
|
63
|
+
|
64
|
+
while (len--) {
|
65
|
+
c = ngx_crc32_table256[(c ^ *p++) & 0xff] ^ (c >> 8);
|
66
|
+
}
|
67
|
+
|
68
|
+
*crc = c;
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
#define ngx_crc32_final(crc) \
|
73
|
+
crc ^= 0xffffffff
|
74
|
+
|
75
|
+
|
76
|
+
ngx_int_t ngx_crc32_table_init(void);
|
77
|
+
|
78
|
+
|
79
|
+
#endif /* _NGX_CRC32_H_INCLUDED_ */
|
@@ -0,0 +1,238 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Maxim Dounin
|
4
|
+
*/
|
5
|
+
|
6
|
+
|
7
|
+
#include <ngx_config.h>
|
8
|
+
#include <ngx_core.h>
|
9
|
+
#include <ngx_md5.h>
|
10
|
+
#if (NGX_HAVE_SHA1)
|
11
|
+
#include <ngx_sha1.h>
|
12
|
+
#endif
|
13
|
+
|
14
|
+
|
15
|
+
#if (NGX_CRYPT)
|
16
|
+
|
17
|
+
static ngx_int_t ngx_crypt_apr1(ngx_pool_t *pool, u_char *key, u_char *salt,
|
18
|
+
u_char **encrypted);
|
19
|
+
static ngx_int_t ngx_crypt_plain(ngx_pool_t *pool, u_char *key, u_char *salt,
|
20
|
+
u_char **encrypted);
|
21
|
+
|
22
|
+
#if (NGX_HAVE_SHA1)
|
23
|
+
|
24
|
+
static ngx_int_t ngx_crypt_ssha(ngx_pool_t *pool, u_char *key, u_char *salt,
|
25
|
+
u_char **encrypted);
|
26
|
+
|
27
|
+
#endif
|
28
|
+
|
29
|
+
|
30
|
+
static u_char *ngx_crypt_to64(u_char *p, uint32_t v, size_t n);
|
31
|
+
|
32
|
+
|
33
|
+
ngx_int_t
|
34
|
+
ngx_crypt(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
|
35
|
+
{
|
36
|
+
if (ngx_strncmp(salt, "$apr1$", sizeof("$apr1$") - 1) == 0) {
|
37
|
+
return ngx_crypt_apr1(pool, key, salt, encrypted);
|
38
|
+
|
39
|
+
} else if (ngx_strncmp(salt, "{PLAIN}", sizeof("{PLAIN}") - 1) == 0) {
|
40
|
+
return ngx_crypt_plain(pool, key, salt, encrypted);
|
41
|
+
|
42
|
+
#if (NGX_HAVE_SHA1)
|
43
|
+
} else if (ngx_strncmp(salt, "{SSHA}", sizeof("{SSHA}") - 1) == 0) {
|
44
|
+
return ngx_crypt_ssha(pool, key, salt, encrypted);
|
45
|
+
#endif
|
46
|
+
}
|
47
|
+
|
48
|
+
/* fallback to libc crypt() */
|
49
|
+
|
50
|
+
return ngx_libc_crypt(pool, key, salt, encrypted);
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
static ngx_int_t
|
55
|
+
ngx_crypt_apr1(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
|
56
|
+
{
|
57
|
+
ngx_int_t n;
|
58
|
+
ngx_uint_t i;
|
59
|
+
u_char *p, *last, final[16];
|
60
|
+
size_t saltlen, keylen;
|
61
|
+
ngx_md5_t md5, ctx1;
|
62
|
+
|
63
|
+
/* Apache's apr1 crypt is Paul-Henning Kamp's md5 crypt with $apr1$ magic */
|
64
|
+
|
65
|
+
keylen = ngx_strlen(key);
|
66
|
+
|
67
|
+
/* true salt: no magic, max 8 chars, stop at first $ */
|
68
|
+
|
69
|
+
salt += sizeof("$apr1$") - 1;
|
70
|
+
last = salt + 8;
|
71
|
+
for (p = salt; *p && *p != '$' && p < last; p++) { /* void */ }
|
72
|
+
saltlen = p - salt;
|
73
|
+
|
74
|
+
/* hash key and salt */
|
75
|
+
|
76
|
+
ngx_md5_init(&md5);
|
77
|
+
ngx_md5_update(&md5, key, keylen);
|
78
|
+
ngx_md5_update(&md5, (u_char *) "$apr1$", sizeof("$apr1$") - 1);
|
79
|
+
ngx_md5_update(&md5, salt, saltlen);
|
80
|
+
|
81
|
+
ngx_md5_init(&ctx1);
|
82
|
+
ngx_md5_update(&ctx1, key, keylen);
|
83
|
+
ngx_md5_update(&ctx1, salt, saltlen);
|
84
|
+
ngx_md5_update(&ctx1, key, keylen);
|
85
|
+
ngx_md5_final(final, &ctx1);
|
86
|
+
|
87
|
+
for (n = keylen; n > 0; n -= 16) {
|
88
|
+
ngx_md5_update(&md5, final, n > 16 ? 16 : n);
|
89
|
+
}
|
90
|
+
|
91
|
+
ngx_memzero(final, sizeof(final));
|
92
|
+
|
93
|
+
for (i = keylen; i; i >>= 1) {
|
94
|
+
if (i & 1) {
|
95
|
+
ngx_md5_update(&md5, final, 1);
|
96
|
+
|
97
|
+
} else {
|
98
|
+
ngx_md5_update(&md5, key, 1);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
ngx_md5_final(final, &md5);
|
103
|
+
|
104
|
+
for (i = 0; i < 1000; i++) {
|
105
|
+
ngx_md5_init(&ctx1);
|
106
|
+
|
107
|
+
if (i & 1) {
|
108
|
+
ngx_md5_update(&ctx1, key, keylen);
|
109
|
+
|
110
|
+
} else {
|
111
|
+
ngx_md5_update(&ctx1, final, 16);
|
112
|
+
}
|
113
|
+
|
114
|
+
if (i % 3) {
|
115
|
+
ngx_md5_update(&ctx1, salt, saltlen);
|
116
|
+
}
|
117
|
+
|
118
|
+
if (i % 7) {
|
119
|
+
ngx_md5_update(&ctx1, key, keylen);
|
120
|
+
}
|
121
|
+
|
122
|
+
if (i & 1) {
|
123
|
+
ngx_md5_update(&ctx1, final, 16);
|
124
|
+
|
125
|
+
} else {
|
126
|
+
ngx_md5_update(&ctx1, key, keylen);
|
127
|
+
}
|
128
|
+
|
129
|
+
ngx_md5_final(final, &ctx1);
|
130
|
+
}
|
131
|
+
|
132
|
+
/* output */
|
133
|
+
|
134
|
+
*encrypted = ngx_pnalloc(pool, sizeof("$apr1$") - 1 + saltlen + 16 + 1);
|
135
|
+
if (*encrypted == NULL) {
|
136
|
+
return NGX_ERROR;
|
137
|
+
}
|
138
|
+
|
139
|
+
p = ngx_cpymem(*encrypted, "$apr1$", sizeof("$apr1$") - 1);
|
140
|
+
p = ngx_copy(p, salt, saltlen);
|
141
|
+
*p++ = '$';
|
142
|
+
|
143
|
+
p = ngx_crypt_to64(p, (final[ 0]<<16) | (final[ 6]<<8) | final[12], 4);
|
144
|
+
p = ngx_crypt_to64(p, (final[ 1]<<16) | (final[ 7]<<8) | final[13], 4);
|
145
|
+
p = ngx_crypt_to64(p, (final[ 2]<<16) | (final[ 8]<<8) | final[14], 4);
|
146
|
+
p = ngx_crypt_to64(p, (final[ 3]<<16) | (final[ 9]<<8) | final[15], 4);
|
147
|
+
p = ngx_crypt_to64(p, (final[ 4]<<16) | (final[10]<<8) | final[ 5], 4);
|
148
|
+
p = ngx_crypt_to64(p, final[11], 2);
|
149
|
+
*p = '\0';
|
150
|
+
|
151
|
+
return NGX_OK;
|
152
|
+
}
|
153
|
+
|
154
|
+
|
155
|
+
static u_char *
|
156
|
+
ngx_crypt_to64(u_char *p, uint32_t v, size_t n)
|
157
|
+
{
|
158
|
+
static u_char itoa64[] =
|
159
|
+
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
160
|
+
|
161
|
+
while (n--) {
|
162
|
+
*p++ = itoa64[v & 0x3f];
|
163
|
+
v >>= 6;
|
164
|
+
}
|
165
|
+
|
166
|
+
return p;
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
static ngx_int_t
|
171
|
+
ngx_crypt_plain(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
|
172
|
+
{
|
173
|
+
size_t len;
|
174
|
+
u_char *p;
|
175
|
+
|
176
|
+
len = ngx_strlen(key);
|
177
|
+
|
178
|
+
*encrypted = ngx_pnalloc(pool, sizeof("{PLAIN}") - 1 + len + 1);
|
179
|
+
if (*encrypted == NULL) {
|
180
|
+
return NGX_ERROR;
|
181
|
+
}
|
182
|
+
|
183
|
+
p = ngx_cpymem(*encrypted, "{PLAIN}", sizeof("{PLAIN}") - 1);
|
184
|
+
ngx_memcpy(p, key, len + 1);
|
185
|
+
|
186
|
+
return NGX_OK;
|
187
|
+
}
|
188
|
+
|
189
|
+
|
190
|
+
#if (NGX_HAVE_SHA1)
|
191
|
+
|
192
|
+
static ngx_int_t
|
193
|
+
ngx_crypt_ssha(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
|
194
|
+
{
|
195
|
+
size_t len;
|
196
|
+
ngx_str_t encoded, decoded;
|
197
|
+
ngx_sha1_t sha1;
|
198
|
+
|
199
|
+
/* "{SSHA}" base64(SHA1(key salt) salt) */
|
200
|
+
|
201
|
+
/* decode base64 salt to find out true salt */
|
202
|
+
|
203
|
+
encoded.data = salt + sizeof("{SSHA}") - 1;
|
204
|
+
encoded.len = ngx_strlen(encoded.data);
|
205
|
+
|
206
|
+
decoded.data = ngx_pnalloc(pool, ngx_base64_decoded_length(encoded.len));
|
207
|
+
if (decoded.data == NULL) {
|
208
|
+
return NGX_ERROR;
|
209
|
+
}
|
210
|
+
|
211
|
+
ngx_decode_base64(&decoded, &encoded);
|
212
|
+
|
213
|
+
/* update SHA1 from key and salt */
|
214
|
+
|
215
|
+
ngx_sha1_init(&sha1);
|
216
|
+
ngx_sha1_update(&sha1, key, ngx_strlen(key));
|
217
|
+
ngx_sha1_update(&sha1, decoded.data + 20, decoded.len - 20);
|
218
|
+
ngx_sha1_final(decoded.data, &sha1);
|
219
|
+
|
220
|
+
/* encode it back to base64 */
|
221
|
+
|
222
|
+
len = sizeof("{SSHA}") - 1 + ngx_base64_encoded_length(decoded.len) + 1;
|
223
|
+
|
224
|
+
*encrypted = ngx_pnalloc(pool, len);
|
225
|
+
if (*encrypted == NULL) {
|
226
|
+
return NGX_ERROR;
|
227
|
+
}
|
228
|
+
|
229
|
+
encoded.data = ngx_cpymem(*encrypted, "{SSHA}", sizeof("{SSHA}") - 1);
|
230
|
+
ngx_encode_base64(&encoded, &decoded);
|
231
|
+
encoded.data[encoded.len] = '\0';
|
232
|
+
|
233
|
+
return NGX_OK;
|
234
|
+
}
|
235
|
+
|
236
|
+
#endif /* NGX_HAVE_SHA1 */
|
237
|
+
|
238
|
+
#endif /* NGX_CRYPT */
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Igor Sysoev
|
4
|
+
* Copyright (C) Nginx, Inc.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
#ifndef _NGX_CRYPT_H_INCLUDED_
|
9
|
+
#define _NGX_CRYPT_H_INCLUDED_
|
10
|
+
|
11
|
+
|
12
|
+
#include <ngx_config.h>
|
13
|
+
#include <ngx_core.h>
|
14
|
+
|
15
|
+
|
16
|
+
ngx_int_t ngx_crypt(ngx_pool_t *pool, u_char *key, u_char *salt,
|
17
|
+
u_char **encrypted);
|
18
|
+
|
19
|
+
|
20
|
+
#endif /* _NGX_CRYPT_H_INCLUDED_ */
|