diff options
Diffstat (limited to 'APACHE_1_3_42/src/os/netware')
37 files changed, 3708 insertions, 0 deletions
diff --git a/APACHE_1_3_42/src/os/netware/Apache.def b/APACHE_1_3_42/src/os/netware/Apache.def new file mode 100644 index 0000000000..9f1c81463d --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/Apache.def @@ -0,0 +1,4 @@ +# NLMs Apache depends on + +MODULE clib.nlm +MODULE apachec.nlm diff --git a/APACHE_1_3_42/src/os/netware/ApacheCore.imp b/APACHE_1_3_42/src/os/netware/ApacheCore.imp new file mode 100644 index 0000000000..2cda1b1bb5 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheCore.imp @@ -0,0 +1,428 @@ + ap_MD5Final, + ap_MD5Init, + ap_MD5Update, + ap_acquire_mutex, + ap_add_cgi_vars, + ap_add_common_vars, + ap_add_loaded_module, + ap_add_module, + ap_add_named_module, + ap_add_per_dir_conf, + ap_add_per_url_conf, + ap_add_version_component, + ap_allow_options, + ap_allow_overrides, + ap_append_arrays, + ap_array_cat, + ap_auth_name, + ap_auth_type, + ap_auth_nonce, + ap_basic_http_header, + ap_bclose, + ap_bcreate, + ap_bfilbuf, + ap_bfileno, + ap_bflsbuf, + ap_bflush, + ap_bgetopt, + ap_bgets, + ap_bhalfduplex, + ap_block_alarms, + ap_blookc, + ap_bnonblock, + ap_bonerror, + ap_bpushfd, + ap_bputs, + ap_bread, + ap_bsetflag, + ap_bsetopt, + ap_bskiplf, + ap_bspawn_child, + ap_bwrite, + ap_bytes_in_free_blocks, + ap_bytes_in_pool, + ap_call_exec, + ap_can_exec, + ap_cfg_closefile, + ap_cfg_getc, + ap_cfg_getline, + ap_chdir_file, + ap_check_alarm, + ap_check_cmd_context, + ap_checkmask, + ap_cleanup_for_exec, + ap_clear_module_list, + ap_clear_pool, + ap_clear_table, + ap_close_piped_log, + ap_construct_server, + ap_construct_url, + ap_content_type_tolower, + ap_copy_array, + ap_copy_array_hdr, + ap_copy_table, + ap_count_dirs, + ap_cpystrn, + ap_create_environment, + ap_create_mutex, + ap_create_per_dir_config, + ap_custom_response, + ap_default_port_for_request, + ap_default_port_for_scheme, + ap_default_type, + ap_destroy_mutex, + ap_destroy_pool, + ap_destroy_sub_req, + ap_die, + ap_discard_request_body, + ap_document_root, + ap_each_byterange, + ap_error_log2stderr, + ap_escape_html, + ap_escape_logitem, + ap_escape_path_segment, + ap_escape_quotes, + ap_escape_shell_cmd, + ap_exists_scoreboard_image, + ap_finalize_request_protocol, + ap_finalize_sub_req_protocol, + ap_find_command, + ap_find_command_in_modules, + ap_find_last_token, + ap_find_linked_module, + ap_find_module_name, + ap_find_path_info, + ap_find_token, + ap_get_basic_auth_pw, + ap_get_client_block, + ap_get_gmtoff, + ap_get_limit_req_body, + ap_get_remote_host, + ap_get_remote_logname, + ap_get_server_built, + ap_get_server_name, + ap_get_server_port, + ap_get_server_version, + ap_get_time, + ap_get_token, + ap_getparents, + ap_getword, + ap_getword_conf, + ap_getword_conf_nc, + ap_getword_nc, + ap_getword_nulls, + ap_getword_nulls_nc, + ap_getword_white, + ap_getword_white_nc, + ap_gm_timestr_822, + ap_gname2id, + ap_handle_command, + ap_hard_timeout, + ap_ht_time, + ap_ind, + ap_index_of_response, + ap_init_virtual_host, + ap_internal_redirect, + ap_internal_redirect_handler, + ap_is_directory, + ap_is_fnmatch, + ap_is_initial_req, + ap_is_matchexp, + ap_is_url, + ap_kill_cleanup, + ap_kill_cleanups_for_fd, + ap_kill_cleanups_for_socket, + ap_kill_timeout, + ap_log_assert, + ap_log_error_old, + ap_log_reason, + ap_log_unixerr, + ap_make_array, + ap_make_dirstr, + ap_make_dirstr_parent, + ap_make_dirstr_prefix, + ap_make_full_path, + ap_make_sub_pool, + ap_make_table, + ap_matches_request_vhost, + ap_md5, + ap_md5_binary, + ap_md5contextTo64, + ap_md5digest, + ap_meets_conditions, + ap_no2slash, + ap_note_auth_failure, + ap_note_basic_auth_failure, + ap_note_cleanups_for_fd, + ap_note_cleanups_for_file, + ap_note_cleanups_for_socket, + ap_note_digest_auth_failure, + ap_note_subprocess, + ap_open_mutex, + ap_open_piped_log, + ap_os_escape_path, + ap_overlap_tables, + ap_overlay_tables, + ap_palloc, + ap_parseHTTPdate, + ap_parse_hostinfo_components, + ap_parse_uri, + ap_parse_uri_components, + ap_pcalloc, + ap_pcfg_open_custom, + ap_pcfg_openfile, + ap_pclosedir, + ap_pclosef, + ap_pclosesocket, + ap_pduphostent, + ap_pfclose, + ap_pfdopen, + ap_pfopen, + ap_pgethostbyname, + ap_popendir, + ap_popenf, + ap_popenf_ex, + ap_pregcomp, + ap_pregfree, + ap_pregsub, + ap_psignature, + ap_psocket, + ap_psocket_ex, + ap_pstrdup, + ap_pstrndup, + ap_push_array, + ap_pvsprintf, + ap_rationalize_mtime, + ap_register_cleanup, + ap_release_mutex, + ap_remove_loaded_module, + ap_remove_module, + ap_requires, + ap_reset_timeout, + ap_rflush, + ap_rind, + ap_rputc, + ap_rputs, + ap_run_cleanup, + ap_run_sub_req, + ap_rwrite, + ap_satisfies, + ap_scan_script_header_err, + ap_scan_script_header_err_buff, + ap_scan_script_header_err_core, + ap_send_fb, + ap_send_fb_length, + ap_send_fd, + ap_send_fd_length, + ap_send_http_header, + ap_send_http_trace, + ap_send_mmap, + ap_send_size, + ap_server_root_relative, + ap_set_byterange, + ap_set_content_length, + ap_set_etag, + ap_set_keepalive, + ap_set_last_modified, + ap_setup_client_block, + ap_should_client_block, + ap_soft_timeout, + ap_some_auth_required, + ap_spawn_child, + ap_srm_command_loop, + ap_str_tolower, + ap_strcasecmp_match, + ap_strcmp_match, + ap_sub_req_lookup_file, + ap_sub_req_lookup_uri, + ap_sync_scoreboard_image, + ap_table_add, + ap_table_addn, + ap_table_get, + ap_table_merge, + ap_table_mergen, + ap_table_set, + ap_table_setn, + ap_table_unset, + ap_tm2sec, + ap_uname2id, + ap_unblock_alarms, + ap_unescape_url, + ap_unparse_uri_components, + ap_update_mtime, + ap_uudecode, + ap_uuencode, + ap_vbprintf, + ap_vformatter, + ap_vsnprintf, + regcomp, + regexec, + regfree, + access_module, + alias_module, + ap_bprintf, + ap_bvputs, + ap_day_snames, + ap_extended_status, + ap_limit_section, + ap_loaded_modules, + ap_log_error, + ap_log_printf, + ap_log_rerror, + ap_month_snames, + ap_null_cleanup, + ap_psprintf, + ap_pstrcat, + ap_restart_time, + ap_rprintf, + ap_rvputs, + ap_scoreboard_image, + ap_send_header_field, + ap_server_argv0, + ap_server_root, + ap_set_file_slot, + ap_set_flag_slot, + ap_set_string_slot, + ap_set_string_slot_lower, + ap_snprintf, + ap_suexec_enabled, + ap_table_do, + apache_main, + asis_module, + auth_module, + autoindex_module, + config_log_module, + core_module, + dir_module, + env_module, + imap_module, + includes_module, + mime_module, + negotiation_module, + setenvif_module, + so_module, + top_module, + ap_fnmatch, + ap_method_number_of, + ap_exists_config_define, + ap_single_module_configure, + ap_make_etag, + ap_array_pstrcat, + ap_find_list_item, + ap_MD5Encode, + ap_validate_password, + ap_size_list_item, + ap_get_list_item, + ap_scoreboard_fname, + ap_pid_fname, + ap_excess_requests_per_child, + ap_threads_per_child, + ap_max_requests_per_child, + ap_daemons_to_start, + ap_daemons_min_free, + ap_daemons_max_free, + ap_daemons_limit, + ap_user_name, + ap_user_id, + ap_group_id, + ap_standalone, + ap_server_confname, + ap_sub_req_method_uri, + ap_regerror, + ap_regexec, + ap_field_noparam, + ap_pbase64decode, + ap_pbase64encode, + ap_base64encode, + ap_base64encode_binary, + ap_base64encode_len, + ap_base64decode, + ap_base64decode_binary, + ap_base64decode_len, + ap_SHA1Init, + ap_SHA1Update_binary, + ap_SHA1Update, + ap_SHA1Final, + ap_sha1_base64, + ap_my_generation, + ap_get_virthost_addr, + ap_listeners, + ap_listenbacklog, + clean_parent_exit, + init_tsd, + ap_set_config_vectors, + ap_strcasestr, + ap_to64, + ap_vrprintf, + regerror, + ap_add_file_conf, + ap_configtestonly, + ap_is_rdirectory, + ap_remove_spaces, + ap_scan_script_header_err_strs, + ap_start_shutdown, + ap_start_restart, + ap_stripprefix, + ap_send_error_response, + ap_os_canonical_filename, + ap_os_case_canonical_filename, + ap_os_http_method, + ap_os_default_port, + ap_os_is_filename_valid, + os_readdir, + os_opendir, + os_closedir, + ap_update_vhost_from_headers, + ap_update_vhost_given_ip, + ap_set_name_virtual_host, + ap_parse_vhost_addrs, + ap_fini_vhost_config, + ap_init_vhost_config, + ap_check_access, + ap_check_auth, + ap_check_user_id, + ap_translate_name, + ap_find_types, + ap_run_fixups, + ap_invoke_handler, + ap_log_transaction, + ap_header_parse, + ap_run_post_read_request, + ap_single_module_configure, + ap_init_modules, + ap_child_init_modules, + ap_child_exit_modules, + ap_setup_prelinked_modules, + ap_show_directives, + ap_show_modules, + ap_parse_htaccess, + ap_process_resource_config, + ap_create_request_config, + ap_merge_per_dir_configs, + ap_bind_address, + ap_core_reorder_directories, + ap_coredump_dir, + ap_force_library_loading, + ap_get_local_host, + ap_get_virthost_addr, + ap_init_alloc, + ap_keepalive_timeout, + ap_lock_fname, + ap_log_pid, + ap_open_logs, + ap_process_request, + ap_read_config, + ap_read_request, + ap_response_code_string, + ap_rfc1413, + ap_send_http_options, + ap_server_config_defines, + ap_server_post_read_config, + ap_server_pre_read_config, + ap_set_callback_and_alarm, + ap_set_sub_req_protocol, + ap_update_child_status, + ap_sendwithtimeout, + ap_recvwithtimeout, + ap_getline, + ap_get_chunk_size, diff --git a/APACHE_1_3_42/src/os/netware/ApacheCoreNW.def b/APACHE_1_3_42/src/os/netware/ApacheCoreNW.def new file mode 100644 index 0000000000..6762ac5dfe --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheCoreNW.def @@ -0,0 +1,8 @@ +MODULE CLIB.NLM +MODULE WS2_32.NLM +IMPORT KillMe +IMPORT kMutexAlloc +IMPORT kMutexFree +IMPORT kMutexLock +IMPORT kMutexUnlock +EXPORT @apachecore.imp diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleAuthAnon.def b/APACHE_1_3_42/src/os/netware/ApacheModuleAuthAnon.def new file mode 100644 index 0000000000..7465f677d1 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleAuthAnon.def @@ -0,0 +1,2 @@ +EXPORT anon_auth_module + diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleAuthDBM.def b/APACHE_1_3_42/src/os/netware/ApacheModuleAuthDBM.def new file mode 100644 index 0000000000..a25efea00c --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleAuthDBM.def @@ -0,0 +1,2 @@ +EXPORT dbm_auth_module + diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleCERNMeta.def b/APACHE_1_3_42/src/os/netware/ApacheModuleCERNMeta.def new file mode 100644 index 0000000000..cb57210ebd --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleCERNMeta.def @@ -0,0 +1 @@ +EXPORT cern_meta_module diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleDigest.def b/APACHE_1_3_42/src/os/netware/ApacheModuleDigest.def new file mode 100644 index 0000000000..74575fff4f --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleDigest.def @@ -0,0 +1 @@ +EXPORT digest_module diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleExpires.def b/APACHE_1_3_42/src/os/netware/ApacheModuleExpires.def new file mode 100644 index 0000000000..b48301ca05 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleExpires.def @@ -0,0 +1 @@ +EXPORT expires_module diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleForensic.def b/APACHE_1_3_42/src/os/netware/ApacheModuleForensic.def new file mode 100644 index 0000000000..c6641c24a0 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleForensic.def @@ -0,0 +1 @@ +EXPORT log_forensic_module diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleHeaders.def b/APACHE_1_3_42/src/os/netware/ApacheModuleHeaders.def new file mode 100644 index 0000000000..5c765c286e --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleHeaders.def @@ -0,0 +1 @@ +EXPORT headers_module diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleInfo.def b/APACHE_1_3_42/src/os/netware/ApacheModuleInfo.def new file mode 100644 index 0000000000..6669099004 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleInfo.def @@ -0,0 +1,2 @@ +EXPORT info_module + diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleProxy.def b/APACHE_1_3_42/src/os/netware/ApacheModuleProxy.def new file mode 100644 index 0000000000..7b1c93b7d7 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleProxy.def @@ -0,0 +1 @@ +EXPORT proxy_module diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleRewrite.def b/APACHE_1_3_42/src/os/netware/ApacheModuleRewrite.def new file mode 100644 index 0000000000..2f7d7e8c11 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleRewrite.def @@ -0,0 +1 @@ +EXPORT rewrite_module diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleSpeling.def b/APACHE_1_3_42/src/os/netware/ApacheModuleSpeling.def new file mode 100644 index 0000000000..dec9ffc366 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleSpeling.def @@ -0,0 +1,2 @@ +EXPORT speling_module + diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleStatus.def b/APACHE_1_3_42/src/os/netware/ApacheModuleStatus.def new file mode 100644 index 0000000000..06f9577cea --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleStatus.def @@ -0,0 +1 @@ +EXPORT status_module diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleTLS.def b/APACHE_1_3_42/src/os/netware/ApacheModuleTLS.def new file mode 100644 index 0000000000..cd923a556e --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleTLS.def @@ -0,0 +1,3 @@ +MODULE wspssl +EXPORT tls_module + diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleUniqueID.def b/APACHE_1_3_42/src/os/netware/ApacheModuleUniqueID.def new file mode 100644 index 0000000000..95cfc83546 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleUniqueID.def @@ -0,0 +1 @@ +EXPORT unique_id_module diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleUserTrack.def b/APACHE_1_3_42/src/os/netware/ApacheModuleUserTrack.def new file mode 100644 index 0000000000..bd975910c2 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleUserTrack.def @@ -0,0 +1 @@ +EXPORT usertrack_module diff --git a/APACHE_1_3_42/src/os/netware/ApacheModuleVhostAlias.def b/APACHE_1_3_42/src/os/netware/ApacheModuleVhostAlias.def new file mode 100644 index 0000000000..09f5dc2eae --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/ApacheModuleVhostAlias.def @@ -0,0 +1 @@ +EXPORT vhost_alias_module diff --git a/APACHE_1_3_42/src/os/netware/NWGNUmakefile b/APACHE_1_3_42/src/os/netware/NWGNUmakefile new file mode 100644 index 0000000000..3625360b63 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/NWGNUmakefile @@ -0,0 +1,27 @@ +# +# Declare the sub-directories to be built here +# + +SUBDIRS = \ + $(EOLIST) + +# +# Get the 'head' of the build environment. This includes default targets and +# paths to tools +# + +include $(AP_WORK)\NWGNUhead.inc + +# +# build this level's files + +ifeq "$(wildcard NWGNUmakefile.mak)" "NWGNUmakefile.mak" +include NWGNUmakefile.mak +endif + +# +# You can use this target if all that is needed is to copy files to the +# installation area +# +install :: nlms FORCE + diff --git a/APACHE_1_3_42/src/os/netware/NWGNUmakefile.mak b/APACHE_1_3_42/src/os/netware/NWGNUmakefile.mak new file mode 100644 index 0000000000..b66cc406f4 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/NWGNUmakefile.mak @@ -0,0 +1,246 @@ +# +# Make sure all needed macro's are defined +# + +# +# Get the 'head' of the build environment if necessary. This includes default +# targets and paths to tools +# + +ifndef EnvironmentDefined +include $(AP_WORK)\NWGNUhead.inc +endif + +# +# These directories will be at the beginning of the include list, followed by +# INCDIRS +# +XINCDIRS += \ + $(SRC)\include \ + $(EOLIST) + +# +# These flags will come after CFLAGS +# +XCFLAGS += \ + $(EOLIST) + +# +# These defines will come after DEFINES +# +XDEFINES += \ + $(EOLIST) + +# +# These flags will be added to the link.opt file +# +XLFLAGS += \ + $(EOLIST) + +# +# These values will be appended to the correct variables based on the value of +# RELEASE +# +ifeq "$(RELEASE)" "debug" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +ifeq "$(RELEASE)" "noopt" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +ifeq "$(RELEASE)" "release" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +# +# These are used by the link target if an NLM is being generated +# This is used by the link 'name' directive to name the nlm. If left blank +# TARGET_nlm (see below) will be used. +# +NLM_NAME = mod_tls + +# +# This is used by the link '-desc ' directive. +# If left blank, NLM_NAME will be used. +# +NLM_DESCRIPTION = Apache TLS/SSL Module + +# +# This is used by the '-threadname' directive. If left blank, +# NLM_NAME Thread will be used. +# +NLM_THREAD_NAME = TLSModule + +# +# If this is specified, it will override VERSION value in +# $(AP_WORK)\NWGNUenvironment.inc +# +NLM_VERSION = 1,0,0 + +# +# If this is specified, it will override the default of 64K +# +NLM_STACK_SIZE = 8192 + +# +# If this is specified it will be used by the link '-entry' directive +# +NLM_ENTRY_SYM = _lib_start_ws + +# +# If this is specified it will be used by the link '-exit' directive +# +NLM_EXIT_SYM = _lib_stop_ws + +# +# If this is specified it will be used by the link '-flags' directive +# +NLM_FLAGS = + +# +# Declare all target files (you must add your files here) +# + +# +# If there is an NLM target, put it here +# +TARGET_nlm = \ + $(OBJDIR)/mod_tls.nlm \ + $(EOLIST) + +# +# If there is an LIB target, put it here +# +TARGET_lib = \ + $(OBJDIR)/NetWare.lib \ + $(EOLIST) + +# +# These are the OBJ files needed to create the NLM target above. +# Paths must all use the '/' character +# +FILES_nlm_objs = \ + $(OBJDIR)/mod_tls.o \ + $(EOLIST) + +# +# These are the LIB files needed to create the NLM target above. +# These will be added as a library command in the link.opt file. +# +FILES_nlm_libs = \ + $(NWOS)\$(OBJDIR)\libprews.o \ + $(EOLIST) + +# +# These are the modules that the above NLM target depends on to load. +# These will be added as a module command in the link.opt file. +# +FILES_nlm_modules = \ + wspssl \ + $(EOLIST) + +# +# If the nlm has a msg file, put it's path here +# +FILE_nlm_msg = + +# +# If the nlm has a hlp file put it's path here +# +FILE_nlm_hlp = + +# +# If this is specified, it will override $(NWOS)\copyright.txt. +# +FILE_nlm_copyright = + +# +# Any additional imports go here +# +FILES_nlm_Ximports = \ + @ws2nlm.imp \ + @threads.imp \ + @clib.imp \ + @ApacheCore.imp \ + $(EOLIST) + +# +# Any symbols exported to here +# +FILES_nlm_exports = \ + tls_module \ + $(EOLIST) + +# +# These are the OBJ files needed to create the LIB target above. +# Paths must all use the '/' character +# +FILES_lib_objs = \ + $(OBJDIR)/mod_nlm.o \ + $(OBJDIR)/os.o \ + $(OBJDIR)/getopt.o \ + $(OBJDIR)/modules.o \ + $(OBJDIR)/multithread.o \ + $(OBJDIR)/libpre.o \ + $(OBJDIR)/libprews.o \ + $(OBJDIR)/mod_tls.o \ + $(EOLIST) + +# +# implement targets and dependancies (leave this section alone) +# + +libs :: $(OBJDIR) $(TARGET_lib) + +nlms :: libs $(TARGET_nlm) + +# +# Updated this target to create necessary directories and copy files to the +# correct place. (See $(AP_WORK)\NWGNUhead.inc for examples) +# +install :: nlms FORCE + copy $(OBJDIR)\mod_tls.nlm $(INSTALL)\Apache\modules + +# +# Any specialized rules here +# + + +# +# Include the 'tail' makefile that has targets that depend on variables defined +# in this makefile +# + +include $(AP_WORK)\NWGNUtail.inc + diff --git a/APACHE_1_3_42/src/os/netware/apache.xdc b/APACHE_1_3_42/src/os/netware/apache.xdc Binary files differnew file mode 100644 index 0000000000..12a7f6ba2d --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/apache.xdc diff --git a/APACHE_1_3_42/src/os/netware/getopt.c b/APACHE_1_3_42/src/os/netware/getopt.c new file mode 100644 index 0000000000..8b04bf9803 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/getopt.c @@ -0,0 +1,177 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <stdio.h> +#include <string.h> +#include <assert.h> +#include <stdlib.h> + +#define OPTERRCOLON (1) +#define OPTERRNF (2) +#define OPTERRARG (3) + +char *optarg; +int optind = 1; +int opterr = 1; +int optopt; + +static int +optiserr(int argc, char * const *argv, int oint, const char *optstr, + int optchr, int err) +{ + if (opterr) { + fprintf(stderr, "Error in argument %d, char %d: ", oint, optchr + 1); + + switch (err) { + case OPTERRCOLON: + fprintf(stderr, ": in flags\n"); + break; + case OPTERRNF: + fprintf(stderr, "option not found %c\n", argv[oint][optchr]); + break; + case OPTERRARG: + fprintf(stderr, "no argument for option %c\n", argv[oint][optchr]); + break; + default: + fprintf(stderr, "unknown\n"); + break; + } + } + optopt = argv[oint][optchr]; + return('?'); +} + +int +getopt(int argc, char* const *argv, const char *optstr) +{ + static int optchr = 0; + static int dash = 0; /* have already seen the - */ + + char *cp; + + if (optind >= argc) + return(EOF); + + if (!dash && (argv[optind][0] != '-')) + return(EOF); + + if (!dash && (argv[optind][0] == '-') && !argv[optind][1]) { + /* + * use to specify stdin. Need to let pgm process this and + * the following args + */ + return(EOF); + } + + if ((argv[optind][0] == '-') && (argv[optind][1] == '-')) { + /* -- indicates end of args */ + optind++; + return(EOF); + } + + if (!dash) { + assert((argv[optind][0] == '-') && argv[optind][1]); + dash = 1; + optchr = 1; + } + + /* Check if the guy tries to do a -: kind of flag */ + assert(dash); + if (argv[optind][optchr] == ':') { + dash = 0; + optind++; + return(optiserr(argc, argv, optind-1, optstr, optchr, OPTERRCOLON)); + } + + if (!(cp = strchr(optstr, argv[optind][optchr]))) { + int errind = optind; + int errchr = optchr; + + if (!argv[optind][optchr+1]) { + dash = 0; + optind++; + } + else + optchr++; + return(optiserr(argc, argv, errind, optstr, errchr, OPTERRNF)); + } + + if (cp[1] == ':') { + dash = 0; + optind++; + + if(optind == argc) + return(optiserr(argc, argv, optind-1, optstr, optchr, OPTERRARG)); + optarg = argv[optind++]; + return(*cp); + } else { + if (!argv[optind][optchr+1]) { + dash = 0; + optind++; + } + else + optchr++; + return(*cp); + } + assert(0); + return(0); +} + +#ifdef TESTGETOPT +int main(int argc, char **argv) +{ + int c; + extern char *optarg; + extern int optind; + int aflg = 0; + int bflg = 0; + int errflg = 0; + char *ofile = NULL; + + while ((c = getopt(argc, argv, "abo:")) != EOF) + switch (c) { + case 'a': + if (bflg) + errflg++; + else + aflg++; + break; + case 'b': + if (aflg) + errflg++; + else + bflg++; + break; + case 'o': + ofile = optarg; + (void)printf("ofile = %s\n", ofile); + break; + case '?': + errflg++; + } + + if (errflg) { + (void)fprintf(stderr, "usage: cmd [-a|-b] [-o <filename>] files...\n"); + exit(2); + } + + for ( ; optind < argc; optind++) + (void)printf("%s\n", argv[optind]); + + return 0; +} + +#endif /* TESTGETOPT */ diff --git a/APACHE_1_3_42/src/os/netware/getopt.h b/APACHE_1_3_42/src/os/netware/getopt.h new file mode 100644 index 0000000000..9ab82d5142 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/getopt.h @@ -0,0 +1,26 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GETOPT_H +#define GETOPT_H + +extern char *optarg; +extern int optind; +extern int opterr; +extern int optopt; +int getopt(int argc, char* const *argv, const char *optstr); + +#endif /* GETOPT_H */ diff --git a/APACHE_1_3_42/src/os/netware/libpre.c b/APACHE_1_3_42/src/os/netware/libpre.c new file mode 100644 index 0000000000..e1e4c69c94 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/libpre.c @@ -0,0 +1,47 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*------------------------------------------------------------------ + These functions are to be called when the shared NLM starts and + stops. By using these functions instead of defining a main() + and calling ExitThread(TSR_THREAD, 0), the load time of the + shared NLM is faster and memory size reduced. + + You may also want to override these in your own Apache module + to do any cleanup other than the mechanism Apache modules + provide. +------------------------------------------------------------------*/ + +int _lib_start(); +int _lib_stop(); + +#ifdef __GNUC__ +#include <string.h> /* memset */ +extern char _edata, _end ; /* end of DATA (start of BSS), end of BSS */ +#endif + +int _lib_start() +{ +#ifdef __GNUC__ + memset (&_edata, 0, &_end - &_edata); +#endif + return 0; +} + +int _lib_stop() +{ + return 0; +} diff --git a/APACHE_1_3_42/src/os/netware/libprews.c b/APACHE_1_3_42/src/os/netware/libprews.c new file mode 100644 index 0000000000..7467d8d881 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/libprews.c @@ -0,0 +1,52 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*------------------------------------------------------------------ + These functions are to be called when the shared NLM starts and + stops. By using these functions instead of defining a main() + and calling ExitThread(TSR_THREAD, 0), the load time of the + shared NLM is faster and memory size reduced. + + You may also want to override these in your own Apache module + to do any cleanup other than the mechanism Apache modules + provide. +------------------------------------------------------------------*/ +#include "stddef.h" +#include "ws2nlm.h" + +int _lib_start_ws(); +int _lib_stop_ws(); + +#ifdef __GNUC__ +#include <string.h> /* memset */ +extern char _edata, _end ; /* end of DATA (start of BSS), end of BSS */ +#endif + +int _lib_start_ws() +{ + WSADATA wsaData; + +#ifdef __GNUC__ + memset (&_edata, 0, &_end - &_edata); +#endif + return WSAStartup((WORD) MAKEWORD(2, 0), &wsaData); +} + +int _lib_stop_ws() +{ + WSACleanup(); + return 0; +} diff --git a/APACHE_1_3_42/src/os/netware/main_nlm.c b/APACHE_1_3_42/src/os/netware/main_nlm.c new file mode 100644 index 0000000000..2172ec5c36 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/main_nlm.c @@ -0,0 +1,26 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* main_NLM.c - Apache executable stub file for NetWare + * This file's purpose in life is to load, and call the + * "real" main function, apache_main(), located in ApacheC.nlm + */ +int apache_main(int argc, char *argv[]); + +int main(int argc, char *argv[]) +{ + return apache_main(argc, argv); +} diff --git a/APACHE_1_3_42/src/os/netware/mod_log_nw.c b/APACHE_1_3_42/src/os/netware/mod_log_nw.c new file mode 100644 index 0000000000..b0e900418e --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/mod_log_nw.c @@ -0,0 +1,1256 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Modified by djm@va.pubnix.com: + * If no TransferLog is given explicitly, decline to log. + * + * This is module implements the TransferLog directive (same as the + * common log module), and additional directives, LogFormat and CustomLog. + * + * + * Syntax: + * + * TransferLog fn Logs transfers to fn in standard log format, unless + * a custom format is set with LogFormat + * LogFormat format Set a log format from TransferLog files + * CustomLog fn format + * Log to file fn with format given by the format + * argument + * + * CookieLog fn For backwards compatability with old Cookie + * logging module - now deprecated. + * + * There can be any number of TransferLog and CustomLog + * commands. Each request will be logged to _ALL_ the + * named files, in the appropriate format. + * + * If no TransferLog or CustomLog directive appears in a VirtualHost, + * the request will be logged to the log file(s) defined outside + * the virtual host section. If a TransferLog or CustomLog directive + * appears in the VirtualHost section, the log files defined outside + * the VirtualHost will _not_ be used. This makes this module compatable + * with the CLF and config log modules, where the use of TransferLog + * inside the VirtualHost section overrides its use outside. + * + * Examples: + * + * TransferLog logs/access_log + * <VirtualHost> + * LogFormat "... custom format ..." + * TransferLog log/virtual_only + * CustomLog log/virtual_useragents "%t %{user-agent}i" + * </VirtualHost> + * + * This will log using CLF to access_log any requests handled by the + * main server, while any requests to the virtual host will be logged + * with the "... custom format..." to virtual_only _AND_ using + * the custom user-agent log to virtual_useragents. + * + * Note that the NCSA referer and user-agent logs are easily added with + * CustomLog: + * CustomLog logs/referer "%{referer}i -> %U" + * CustomLog logs/agent "%{user-agent}i" + * + * RefererIgnore functionality can be obtained with conditional + * logging (SetEnvIf and CustomLog ... env=!VAR). + * + * But using this method allows much easier modification of the + * log format, e.g. to log hosts along with UA: + * CustomLog logs/referer "%{referer}i %U %h" + * + * The argument to LogFormat and CustomLog is a string, which can include + * literal characters copied into the log files, and '%' directives as + * follows: + * + * %...B: bytes sent, excluding HTTP headers. + * %...b: bytes sent, excluding HTTP headers in CLF format, i.e. a '-' + * when no bytes where sent (rather than a '0'. + * %...c: Status of the connection. + * 'X' = connection aborted before the response completed. + * '+' = connection may be kept alive after the response is sent. + * '-' = connection will be closed after the response is sent. + * %...{FOOBAR}e: The contents of the environment variable FOOBAR + * %...f: filename + * %...h: remote host + * %...a: remote IP-address + * %...A: local IP-address + * %...{Foobar}i: The contents of Foobar: header line(s) in the request + * sent to the client. + * %...l: remote logname (from identd, if supplied) + * %...{Foobar}n: The contents of note "Foobar" from another module. + * %...{Foobar}o: The contents of Foobar: header line(s) in the reply. + * %...p: the port the request was served to + * %...P: the process ID of the child that serviced the request. + * %...r: first line of request + * %...s: status. For requests that got internally redirected, this + * is status of the *original* request --- %...>s for the last. + * %...t: time, in common log format time format + * %...{format}t: The time, in the form given by format, which should + * be in strftime(3) format. + * %...T: the time taken to serve the request, in seconds. + * %...u: remote user (from auth; may be bogus if return status (%s) is 401) + * %...U: the URL path requested. + * %...v: the configured name of the server (i.e. which virtual host?) + * %...V: the server name according to the UseCanonicalName setting + * %...m: the request method + * %...H: the request protocol + * %...q: the query string prepended by "?", or empty if no query string + * + * The '...' can be nothing at all (e.g. "%h %u %r %s %b"), or it can + * indicate conditions for inclusion of the item (which will cause it + * to be replaced with '-' if the condition is not met). Note that + * there is no escaping performed on the strings from %r, %...i and + * %...o; some with long memories may remember that I thought this was + * a bad idea, once upon a time, and I'm still not comfortable with + * it, but it is difficult to see how to "do the right thing" with all + * of '%..i', unless we URL-escape everything and break with CLF. + * + * The forms of condition are a list of HTTP status codes, which may + * or may not be preceded by '!'. Thus, '%400,501{User-agent}i' logs + * User-agent: on 400 errors and 501 errors (Bad Request, Not + * Implemented) only; '%!200,304,302{Referer}i' logs Referer: on all + * requests which did *not* return some sort of normal status. + * + * The default LogFormat reproduces CLF; see below. + * + * The way this is supposed to work with virtual hosts is as follows: + * a virtual host can have its own LogFormat, or its own TransferLog. + * If it doesn't have its own LogFormat, it inherits from the main + * server. If it doesn't have its own TransferLog, it writes to the + * same descriptor (meaning the same process for "| ..."). + * + * --- rst */ + +#define DEFAULT_LOG_FORMAT "%h %l %u %t \"%r\" %>s %b" + +#include "httpd.h" +#include "http_config.h" +#include "http_core.h" /* For REMOTE_NAME */ +#include "http_log.h" +#include <limits.h> + +module MODULE_VAR_EXPORT config_log_module; + +static int xfer_flags = (O_WRONLY | O_APPEND | O_CREAT); +#if defined(OS2) || defined(WIN32) || defined(NETWARE) +/* OS/2 dosen't support users and groups */ +static mode_t xfer_mode = (S_IREAD | S_IWRITE); +#else +static mode_t xfer_mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); +#endif + +/* POSIX.1 defines PIPE_BUF as the maximum number of bytes that is + * guaranteed to be atomic when writing a pipe. And PIPE_BUF >= 512 + * is guaranteed. So we'll just guess 512 in the event the system + * doesn't have this. Now, for file writes there is actually no limit, + * the entire write is atomic. Whether all systems implement this + * correctly is another question entirely ... so we'll just use PIPE_BUF + * because it's probably a good guess as to what is implemented correctly + * everywhere. + */ +#ifdef PIPE_BUF +#define LOG_BUFSIZE PIPE_BUF +#else +#define LOG_BUFSIZE (512) +#endif + +/* + * multi_log_state is our per-(virtual)-server configuration. We store + * an array of the logs we are going to use, each of type config_log_state. + * If a default log format is given by LogFormat, store in default_format + * (backward compat. with mod_log_config). We also store for each virtual + * server a pointer to the logs specified for the main server, so that if this + * vhost has no logs defined, we can use the main server's logs instead. + * + * So, for the main server, config_logs contains a list of the log files + * and server_config_logs in empty. For a vhost, server_config_logs + * points to the same array as config_logs in the main server, and + * config_logs points to the array of logs defined inside this vhost, + * which might be empty. + */ + +typedef struct { + char *default_format_string; + array_header *default_format; + array_header *config_logs; + array_header *server_config_logs; + table *formats; + int rotatedaily; + int rotateinterval; +} multi_log_state; + +/* + * config_log_state holds the status of a single log file. fname might + * be NULL, which means this module does no logging for this + * request. format might be NULL, in which case the default_format + * from the multi_log_state should be used, or if that is NULL as + * well, use the CLF. log_fd is -1 before the log file is opened and + * set to a valid fd after it is opened. + */ + +typedef struct { + char *fname; + char *format_string; + array_header *format; + int log_fd; + char *condition_var; +#ifdef BUFFERED_LOGS + int outcnt; + char outbuf[LOG_BUFSIZE]; +#endif + time_t time_jump; +} config_log_state; + +/* + * Format items... + * Note that many of these could have ap_sprintfs replaced with static buffers. + */ + +typedef const char *(*item_key_func) (request_rec *, char *); + +typedef struct { + item_key_func func; + char *arg; + int condition_sense; + int want_orig; + array_header *conditions; +} log_format_item; + +static char *format_integer(pool *p, int i) +{ + return ap_psprintf(p, "%d", i); +} + +static char *pfmt(pool *p, int i) +{ + if (i <= 0) { + return "-"; + } + else { + return format_integer(p, i); + } +} + +static const char *constant_item(request_rec *dummy, char *stuff) +{ + return stuff; +} + +static const char *log_remote_host(request_rec *r, char *a) +{ + return ap_get_remote_host(r->connection, r->per_dir_config, + REMOTE_NAME); +} + +static const char *log_remote_address(request_rec *r, char *a) +{ + return r->connection->remote_ip; +} + +static const char *log_local_address(request_rec *r, char *a) +{ + return r->connection->local_ip; +} + +static const char *log_remote_logname(request_rec *r, char *a) +{ + return ap_get_remote_logname(r); +} + +static const char *log_remote_user(request_rec *r, char *a) +{ + char *rvalue = r->connection->user; + + if (rvalue == NULL) { + rvalue = "-"; + } + else if (strlen(rvalue) == 0) { + rvalue = "\"\""; + } + return rvalue; +} + +static const char *log_request_line(request_rec *r, char *a) +{ + /* NOTE: If the original request contained a password, we + * re-write the request line here to contain XXXXXX instead: + * (note the truncation before the protocol string for HTTP/0.9 requests) + * (note also that r->the_request contains the unmodified request) + */ + return (r->parsed_uri.password) ? ap_pstrcat(r->pool, r->method, " ", + ap_unparse_uri_components(r->pool, &r->parsed_uri, 0), + r->assbackwards ? NULL : " ", r->protocol, NULL) + : r->the_request; +} + +static const char *log_request_file(request_rec *r, char *a) +{ + return r->filename; +} +static const char *log_request_uri(request_rec *r, char *a) +{ + return r->uri; +} +static const char *log_request_method(request_rec *r, char *a) +{ + return r->method; +} +static const char *log_request_protocol(request_rec *r, char *a) +{ + return r->protocol; +} +static const char *log_request_query(request_rec *r, char *a) +{ + return (r->args != NULL) ? ap_pstrcat(r->pool, "?", r->args, NULL) + : ""; +} +static const char *log_status(request_rec *r, char *a) +{ + return pfmt(r->pool, r->status); +} + +static const char *clf_log_bytes_sent(request_rec *r, char *a) +{ + if (!r->sent_bodyct) { + return "-"; + } + else { + long int bs; + ap_bgetopt(r->connection->client, BO_BYTECT, &bs); + return ap_psprintf(r->pool, "%ld", bs); + } +} + +static const char *log_bytes_sent(request_rec *r, char *a) +{ + if (!r->sent_bodyct) { + return "0"; + } + else { + long int bs; + ap_bgetopt(r->connection->client, BO_BYTECT, &bs); + return ap_psprintf(r->pool, "%ld", bs); + } +} + + +static const char *log_header_in(request_rec *r, char *a) +{ + return ap_table_get(r->headers_in, a); +} + +static const char *log_header_out(request_rec *r, char *a) +{ + const char *cp = ap_table_get(r->headers_out, a); + if (!strcasecmp(a, "Content-type") && r->content_type) { + cp = ap_field_noparam(r->pool, r->content_type); + } + if (cp) { + return cp; + } + return ap_table_get(r->err_headers_out, a); +} + +static const char *log_note(request_rec *r, char *a) +{ + return ap_table_get(r->notes, a); +} +static const char *log_env_var(request_rec *r, char *a) +{ + return ap_table_get(r->subprocess_env, a); +} + +static const char *log_request_time(request_rec *r, char *a) +{ + int timz; + struct tm *t; + char tstr[MAX_STRING_LEN]; + + t = ap_get_gmtoff(&timz); + + if (a && *a) { /* Custom format */ + strftime(tstr, MAX_STRING_LEN, a, t); + } + else { /* CLF format */ + char sign = (timz < 0 ? '-' : '+'); + + if (timz < 0) { + timz = -timz; + } + ap_snprintf(tstr, sizeof(tstr), "[%02d/%s/%d:%02d:%02d:%02d %c%.2d%.2d]", + t->tm_mday, ap_month_snames[t->tm_mon], t->tm_year+1900, + t->tm_hour, t->tm_min, t->tm_sec, + sign, timz / 60, timz % 60); + } + + return ap_pstrdup(r->pool, tstr); +} + +static const char *log_request_duration(request_rec *r, char *a) +{ + return ap_psprintf(r->pool, "%ld", time(NULL) - r->request_time); +} + +/* These next two routines use the canonical name:port so that log + * parsers don't need to duplicate all the vhost parsing crud. + */ +static const char *log_virtual_host(request_rec *r, char *a) +{ + return r->server->server_hostname; +} + +static const char *log_server_port(request_rec *r, char *a) +{ + return ap_psprintf(r->pool, "%u", + r->server->port ? r->server->port : ap_default_port(r)); +} + +/* This respects the setting of UseCanonicalName so that + * the dynamic mass virtual hosting trick works better. + */ +static const char *log_server_name(request_rec *r, char *a) +{ + return ap_get_server_name(r); +} + +static const char *log_child_pid(request_rec *r, char *a) +{ + return ap_psprintf(r->pool, "%ld", (long) getpid()); +} +static const char *log_connection_status(request_rec *r, char *a) +{ + if (r->connection->aborted) + return "X"; + + if ((r->connection->keepalive) && + ((r->server->keep_alive_max - r->connection->keepalives) > 0)) { + return "+"; + } + + return "-"; +} +/***************************************************************** + * + * Parsing the log format string + */ + +static struct log_item_list { + char ch; + item_key_func func; + int want_orig_default; +} log_item_keys[] = { + + { + 'h', log_remote_host, 0 + }, + { + 'a', log_remote_address, 0 + }, + { + 'A', log_local_address, 0 + }, + { + 'l', log_remote_logname, 0 + }, + { + 'u', log_remote_user, 0 + }, + { + 't', log_request_time, 0 + }, + { + 'T', log_request_duration, 1 + }, + { + 'r', log_request_line, 1 + }, + { + 'f', log_request_file, 0 + }, + { + 'U', log_request_uri, 1 + }, + { + 's', log_status, 1 + }, + { + 'b', clf_log_bytes_sent, 0 + }, + { + 'B', log_bytes_sent, 0 + }, + { + 'i', log_header_in, 0 + }, + { + 'o', log_header_out, 0 + }, + { + 'n', log_note, 0 + }, + { + 'e', log_env_var, 0 + }, + { + 'V', log_server_name, 0 + }, + { + 'v', log_virtual_host, 0 + }, + { + 'p', log_server_port, 0 + }, + { + 'P', log_child_pid, 0 + }, + { + 'H', log_request_protocol, 0 + }, + { + 'm', log_request_method, 0 + }, + { + 'q', log_request_query, 0 + }, + { + 'c', log_connection_status, 0 + }, + { + '\0' + } +}; + +static struct log_item_list *find_log_func(char k) +{ + int i; + + for (i = 0; log_item_keys[i].ch; ++i) + if (k == log_item_keys[i].ch) { + return &log_item_keys[i]; + } + + return NULL; +} + +static char *parse_log_misc_string(pool *p, log_format_item *it, + const char **sa) +{ + const char *s; + char *d; + + it->func = constant_item; + it->conditions = NULL; + + s = *sa; + while (*s && *s != '%') { + s++; + } + /* + * This might allocate a few chars extra if there's a backslash + * escape in the format string. + */ + it->arg = ap_palloc(p, s - *sa + 1); + + d = it->arg; + s = *sa; + while (*s && *s != '%') { + if (*s != '\\') { + *d++ = *s++; + } + else { + s++; + switch (*s) { + case '\\': + *d++ = '\\'; + s++; + break; + case 'n': + *d++ = '\n'; + s++; + break; + case 't': + *d++ = '\t'; + s++; + break; + default: + /* copy verbatim */ + *d++ = '\\'; + /* + * Allow the loop to deal with this *s in the normal + * fashion so that it handles end of string etc. + * properly. + */ + break; + } + } + } + *d = '\0'; + + *sa = s; + return NULL; +} + +static char *parse_log_item(pool *p, log_format_item *it, const char **sa) +{ + const char *s = *sa; + + if (*s != '%') { + return parse_log_misc_string(p, it, sa); + } + + ++s; + it->condition_sense = 0; + it->conditions = NULL; + it->want_orig = -1; + it->arg = ""; /* For safety's sake... */ + + while (*s) { + int i; + struct log_item_list *l; + + switch (*s) { + case '!': + ++s; + it->condition_sense = !it->condition_sense; + break; + + case '<': + ++s; + it->want_orig = 1; + break; + + case '>': + ++s; + it->want_orig = 0; + break; + + case ',': + ++s; + break; + + case '{': + ++s; + it->arg = ap_getword(p, &s, '}'); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + i = *s - '0'; + while (ap_isdigit(*++s)) { + i = i * 10 + (*s) - '0'; + } + if (!it->conditions) { + it->conditions = ap_make_array(p, 4, sizeof(int)); + } + *(int *) ap_push_array(it->conditions) = i; + break; + + default: + l = find_log_func(*s++); + if (!l) { + char dummy[2]; + + dummy[0] = s[-1]; + dummy[1] = '\0'; + return ap_pstrcat(p, "Unrecognized LogFormat directive %", + dummy, NULL); + } + it->func = l->func; + if (it->want_orig == -1) { + it->want_orig = l->want_orig_default; + } + *sa = s; + return NULL; + } + } + + return "Ran off end of LogFormat parsing args to some directive"; +} + +static array_header *parse_log_string(pool *p, const char *s, const char **err) +{ + array_header *a = ap_make_array(p, 30, sizeof(log_format_item)); + char *res; + + while (*s) { + if ((res = parse_log_item(p, (log_format_item *) ap_push_array(a), &s))) { + *err = res; + return NULL; + } + } + + s = "\n"; + parse_log_item(p, (log_format_item *) ap_push_array(a), &s); + return a; +} + +/***************************************************************** + * + * Actually logging. + */ + +static const char *process_item(request_rec *r, request_rec *orig, + log_format_item *item) +{ + const char *cp; + + /* First, see if we need to process this thing at all... */ + + if (item->conditions && item->conditions->nelts != 0) { + int i; + int *conds = (int *) item->conditions->elts; + int in_list = 0; + + for (i = 0; i < item->conditions->nelts; ++i) { + if (r->status == conds[i]) { + in_list = 1; + break; + } + } + + if ((item->condition_sense && in_list) + || (!item->condition_sense && !in_list)) { + return "-"; + } + } + + /* We do. Do it... */ + + cp = (*item->func) (item->want_orig ? orig : r, item->arg); + return cp ? cp : "-"; +} + +#ifdef BUFFERED_LOGS +static void flush_log(config_log_state *cls) +{ + if (cls->outcnt && cls->log_fd != -1) { + write(cls->log_fd, cls->outbuf, cls->outcnt); + cls->outcnt = 0; + } +} +#endif + +static int config_log_transaction(request_rec *r, config_log_state *cls, + array_header *default_format) +{ + log_format_item *items; + char *str, *s; + const char **strs; + int *strl; + request_rec *orig; + int i; + int len = 0; + array_header *format; + char *envar; + int log_fd; + + multi_log_state *mls = ap_get_module_config(r->server->module_config,&config_log_module); + + if ((mls->rotatedaily || mls->rotateinterval) && + (r->request_time>=cls->time_jump) && + (*cls->fname!='|') && (strcmp(cls->fname,"/dev/null") != 0)) { + char * fname; + struct tm *time_tmp; + + if (mls->rotatedaily) { + time_tmp=localtime(&(r->request_time)); + cls->time_jump=r->request_time+((60-time_tmp->tm_sec)+60*(59-time_tmp->tm_min)+3600*(23-time_tmp->tm_hour)); + } + else + cls->time_jump = r->request_time + (60*mls->rotateinterval); + + fname = ap_pstrcat(r->pool, + ap_server_root_relative(r->pool, cls->fname), + "-", + ap_ht_time(r->pool,r->request_time,"%Y%m%d%H%M",0), + NULL + ); + + if ((log_fd = open(fname, xfer_flags, xfer_mode)) < 0) { + ap_log_error(APLOG_MARK, APLOG_ERR, r->server, + "could not open transfer log file %s.", fname); + } + else { + dup2 (log_fd, cls->log_fd); + close (log_fd); + } + } + + if (cls->fname == NULL) { + return DECLINED; + } + + /* + * See if we've got any conditional envariable-controlled logging decisions + * to make. + */ + if (cls->condition_var != NULL) { + envar = cls->condition_var; + if (*envar != '!') { + if (ap_table_get(r->subprocess_env, envar) == NULL) { + return DECLINED; + } + } + else { + if (ap_table_get(r->subprocess_env, &envar[1]) != NULL) { + return DECLINED; + } + } + } + + format = cls->format ? cls->format : default_format; + + strs = ap_palloc(r->pool, sizeof(char *) * (format->nelts)); + strl = ap_palloc(r->pool, sizeof(int) * (format->nelts)); + items = (log_format_item *) format->elts; + + orig = r; + while (orig->prev) { + orig = orig->prev; + } + while (r->next) { + r = r->next; + } + + for (i = 0; i < format->nelts; ++i) { + strs[i] = process_item(r, orig, &items[i]); + } + + for (i = 0; i < format->nelts; ++i) { + len += strl[i] = strlen(strs[i]); + } + +#ifdef BUFFERED_LOGS + if (len + cls->outcnt > LOG_BUFSIZE) { + flush_log(cls); + } + if (len >= LOG_BUFSIZE) { + str = ap_palloc(r->pool, len + 1); + for (i = 0, s = str; i < format->nelts; ++i) { + memcpy(s, strs[i], strl[i]); + s += strl[i]; + } + write(cls->log_fd, str, len); + } + else { + for (i = 0, s = &cls->outbuf[cls->outcnt]; i < format->nelts; ++i) { + memcpy(s, strs[i], strl[i]); + s += strl[i]; + } + cls->outcnt += len; + } +#else + str = ap_palloc(r->pool, len + 1); + + for (i = 0, s = str; i < format->nelts; ++i) { + memcpy(s, strs[i], strl[i]); + s += strl[i]; + } + + write(cls->log_fd, str, len); +#endif + + return OK; +} + +static int multi_log_transaction(request_rec *r) +{ + multi_log_state *mls = ap_get_module_config(r->server->module_config, + &config_log_module); + config_log_state *clsarray; + int i; + + /* + * Log this transaction.. + */ + if (mls->config_logs->nelts) { + clsarray = (config_log_state *) mls->config_logs->elts; + for (i = 0; i < mls->config_logs->nelts; ++i) { + config_log_state *cls = &clsarray[i]; + + config_log_transaction(r, cls, mls->default_format); + } + } + else if (mls->server_config_logs) { + clsarray = (config_log_state *) mls->server_config_logs->elts; + for (i = 0; i < mls->server_config_logs->nelts; ++i) { + config_log_state *cls = &clsarray[i]; + + config_log_transaction(r, cls, mls->default_format); + } + } + + return OK; +} + +/***************************************************************** + * + * Module glue... + */ + +static void *make_config_log_state(pool *p, server_rec *s) +{ + multi_log_state *mls; + + mls = (multi_log_state *) ap_palloc(p, sizeof(multi_log_state)); + mls->config_logs = ap_make_array(p, 1, sizeof(config_log_state)); + mls->default_format_string = NULL; + mls->default_format = NULL; + mls->server_config_logs = NULL; + mls->formats = ap_make_table(p, 4); + ap_table_setn(mls->formats, "CLF", DEFAULT_LOG_FORMAT); + mls->rotatedaily = 0; + mls->rotateinterval = 0; + + return mls; +} + +/* + * Use the merger to simply add a pointer from the vhost log state + * to the log of logs specified for the non-vhost configuration. Make sure + * vhosts inherit any globally-defined format names. + */ + +static void *merge_config_log_state(pool *p, void *basev, void *addv) +{ + multi_log_state *base = (multi_log_state *) basev; + multi_log_state *add = (multi_log_state *) addv; + + if (add->rotatedaily==0) { + add->rotatedaily=base->rotatedaily; + } + if (add->rotateinterval==0) { + add->rotateinterval=base->rotateinterval; + } + + add->server_config_logs = base->config_logs; + if (!add->default_format) { + add->default_format_string = base->default_format_string; + add->default_format = base->default_format; + } + add->formats = ap_overlay_tables(p, base->formats, add->formats); + + return add; +} + +/* + * Set the default logfile format, or define a nickname for a format string. + */ +static const char *log_format(cmd_parms *cmd, void *dummy, char *fmt, + char *name) +{ + const char *err_string = NULL; + multi_log_state *mls = ap_get_module_config(cmd->server->module_config, + &config_log_module); + + /* + * If we were given two arguments, the second is a name to be given to the + * format. This syntax just defines the nickname - it doesn't actually + * make the format the default. + */ + if (name != NULL) { + parse_log_string(cmd->pool, fmt, &err_string); + if (err_string == NULL) { + ap_table_setn(mls->formats, name, fmt); + } + } + else { + mls->default_format_string = fmt; + mls->default_format = parse_log_string(cmd->pool, fmt, &err_string); + } + return err_string; +} + + +static const char *add_custom_log(cmd_parms *cmd, void *dummy, char *fn, + char *fmt, char *envclause) +{ + const char *err_string = NULL; + multi_log_state *mls = ap_get_module_config(cmd->server->module_config, + &config_log_module); + config_log_state *cls; + + cls = (config_log_state *) ap_push_array(mls->config_logs); + cls->condition_var = NULL; + if (envclause != NULL) { + if (strncasecmp(envclause, "env=", 4) != 0) { + return "error in condition clause"; + } + if ((envclause[4] == '\0') + || ((envclause[4] == '!') && (envclause[5] == '\0'))) { + return "missing environment variable name"; + } + cls->condition_var = ap_pstrdup(cmd->pool, &envclause[4]); + } + + cls->fname = fn; + cls->format_string = fmt; + if (fmt == NULL) { + cls->format = NULL; + } + else { + cls->format = parse_log_string(cmd->pool, fmt, &err_string); + } + cls->log_fd = -1; + + return err_string; +} + +static const char *set_transfer_log(cmd_parms *cmd, void *dummy, char *fn) +{ + return add_custom_log(cmd, dummy, fn, NULL, NULL); +} + +static const char *set_cookie_log(cmd_parms *cmd, void *dummy, char *fn) +{ + return add_custom_log(cmd, dummy, fn, "%{Cookie}n \"%r\" %t", NULL); +} + +static const char *set_rotate_log_daily(cmd_parms *cmd, void *dummy, int arg) +{ + multi_log_state *mls = ap_get_module_config(cmd->server->module_config, + &config_log_module); + + mls->rotatedaily = arg; + if (mls->rotatedaily) + mls->rotateinterval = 0; + return NULL; +} + +static const char *set_rotate_log_interval(cmd_parms *cmd, void *dummy, char *arg) +{ + multi_log_state *mls = ap_get_module_config(cmd->server->module_config, + &config_log_module); + int interval = 0; + + if (arg) + interval = atoi(arg); + + if (interval < 0) + return NULL; + + mls->rotatedaily = 0; + mls->rotateinterval = interval; + return NULL; +} + +static const command_rec config_log_cmds[] = +{ + {"CustomLog", add_custom_log, NULL, RSRC_CONF, TAKE23, + "a file name, a custom log format string or format name, " + "and an optional \"env=\" clause (see docs)"}, + {"TransferLog", set_transfer_log, NULL, RSRC_CONF, TAKE1, + "the filename of the access log"}, + {"LogFormat", log_format, NULL, RSRC_CONF, TAKE12, + "a log format string (see docs) and an optional format name"}, + {"CookieLog", set_cookie_log, NULL, RSRC_CONF, TAKE1, + "the filename of the cookie log"}, + {"LogRotateDaily", set_rotate_log_daily, NULL, RSRC_CONF, FLAG, + "rotate logs daily (On:Off)"}, + {"LogRotateInterval", set_rotate_log_interval, NULL, RSRC_CONF, TAKE1, + "rotate logs every NNN minutes"}, + {NULL} +}; + +static config_log_state *open_config_log(server_rec *s, pool *p, + config_log_state *cls, + array_header *default_format) +{ + if (cls->log_fd > 0) { + return cls; /* virtual config shared w/main server */ + } + + if (cls->fname == NULL) { + return cls; /* Leave it NULL to decline. */ + } + + if (*cls->fname == '|') { + piped_log *pl; + + pl = ap_open_piped_log(p, cls->fname + 1); + if (pl == NULL) { + exit(1); + } + cls->log_fd = ap_piped_log_write_fd(pl); + } + else { + char * fname; + struct tm *time_tmp; + time_t time_now; + multi_log_state *mls = ap_get_module_config(s->module_config,&config_log_module); + + if ((mls->rotatedaily || mls->rotateinterval)&&(*cls->fname!='|')&&(strcmp(cls->fname,"/dev/null") != 0)) { + time_now=time(NULL); + if (mls->rotatedaily) { + time_tmp=localtime(&time_now); + cls->time_jump=time_now+((60-time_tmp->tm_sec)+60*(59-time_tmp->tm_min)+3600*(23-time_tmp->tm_hour)); + } + else + cls->time_jump = time_now + (60*mls->rotateinterval); + fname = ap_pstrcat(p, + ap_server_root_relative(p, cls->fname), + "-", + ap_ht_time(p,time_now,"%Y%m%d%H%M",0), + NULL + ); + } else { + fname = ap_server_root_relative(p, cls->fname); + } + + if ((cls->log_fd = ap_popenf_ex(p, fname, xfer_flags, xfer_mode, 1)) < 0) { + ap_log_error(APLOG_MARK, APLOG_ERR, s, + "could not open transfer log file %s.", fname); + exit(1); + } + } +#ifdef BUFFERED_LOGS + cls->outcnt = 0; +#endif + + return cls; +} + +static config_log_state *open_multi_logs(server_rec *s, pool *p) +{ + int i; + multi_log_state *mls = ap_get_module_config(s->module_config, + &config_log_module); + config_log_state *clsarray; + const char *dummy; + const char *format; + + if (mls->default_format_string) { + format = ap_table_get(mls->formats, mls->default_format_string); + if (format) { + mls->default_format = parse_log_string(p, format, &dummy); + } + } + + if (!mls->default_format) { + mls->default_format = parse_log_string(p, DEFAULT_LOG_FORMAT, &dummy); + } + + if (mls->config_logs->nelts) { + clsarray = (config_log_state *) mls->config_logs->elts; + for (i = 0; i < mls->config_logs->nelts; ++i) { + config_log_state *cls = &clsarray[i]; + + if (cls->format_string) { + format = ap_table_get(mls->formats, cls->format_string); + if (format) { + cls->format = parse_log_string(p, format, &dummy); + } + } + + cls = open_config_log(s, p, cls, mls->default_format); + } + } + else if (mls->server_config_logs) { + clsarray = (config_log_state *) mls->server_config_logs->elts; + for (i = 0; i < mls->server_config_logs->nelts; ++i) { + config_log_state *cls = &clsarray[i]; + + if (cls->format_string) { + format = ap_table_get(mls->formats, cls->format_string); + if (format) { + cls->format = parse_log_string(p, format, &dummy); + } + } + + cls = open_config_log(s, p, cls, mls->default_format); + } + } + + return NULL; +} + +static void init_config_log(server_rec *s, pool *p) +{ + /* First, do "physical" server, which gets default log fd and format + * for the virtual servers, if they don't override... + */ + + open_multi_logs(s, p); + + /* Then, virtual servers */ + + for (s = s->next; s; s = s->next) { + open_multi_logs(s, p); + } +} + +#ifdef BUFFERED_LOGS +static void flush_all_logs(server_rec *s, pool *p) +{ + multi_log_state *mls; + array_header *log_list; + config_log_state *clsarray; + int i; + + for (; s; s = s->next) { + mls = ap_get_module_config(s->module_config, &config_log_module); + log_list = NULL; + if (mls->config_logs->nelts) { + log_list = mls->config_logs; + } + else if (mls->server_config_logs) { + log_list = mls->server_config_logs; + } + if (log_list) { + clsarray = (config_log_state *) log_list->elts; + for (i = 0; i < log_list->nelts; ++i) { + flush_log(&clsarray[i]); + } + } + } +} +#endif + +module MODULE_VAR_EXPORT config_log_module = +{ + STANDARD_MODULE_STUFF, + init_config_log, /* initializer */ + NULL, /* create per-dir config */ + NULL, /* merge per-dir config */ + make_config_log_state, /* server config */ + merge_config_log_state, /* merge server config */ + config_log_cmds, /* command table */ + NULL, /* handlers */ + NULL, /* filename translation */ + NULL, /* check_user_id */ + NULL, /* check auth */ + NULL, /* check access */ + NULL, /* type_checker */ + NULL, /* fixups */ + multi_log_transaction, /* logger */ + NULL, /* header parser */ + NULL, /* child_init */ +#ifdef BUFFERED_LOGS + flush_all_logs, /* child_exit */ +#else + NULL, +#endif + NULL /* post read-request */ +}; diff --git a/APACHE_1_3_42/src/os/netware/mod_nlm.c b/APACHE_1_3_42/src/os/netware/mod_nlm.c new file mode 100644 index 0000000000..941849f166 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/mod_nlm.c @@ -0,0 +1,107 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "httpd.h" +#include "http_config.h" +#include <nwadv.h> + +module MODULE_VAR_EXPORT nlm_module; +static int been_there_done_that = 0; /* Loaded the modules yet? */ + +static const char *load_module(cmd_parms *cmd, void *dummy, char *modname, char *filename) +{ + module *modp; + int nlmHandle; + const char *szModuleFile = ap_server_root_relative(cmd->pool, filename); + + if (been_there_done_that) + return NULL; + + nlmHandle = FindNLMHandle(filename); + + if (nlmHandle == NULL) { + spawnlp(P_NOWAIT, szModuleFile, NULL); + nlmHandle = FindNLMHandle(filename); + + if (nlmHandle == NULL) + return ap_pstrcat(cmd->pool, "Cannot load ", szModuleFile, + " into server", NULL); + } + + modp = (module *) ImportSymbol(nlmHandle, modname); + + if (!modp) + return ap_pstrcat(cmd->pool, "Can't find module ", modname, + " in file ", filename, NULL); + + ap_add_module(modp); + + if (modp->create_server_config) + ((void**)cmd->server->module_config)[modp->module_index] = + (*modp->create_server_config)(cmd->pool, cmd->server); + + if (modp->create_dir_config) + ((void**)cmd->server->lookup_defaults)[modp->module_index] = + (*modp->create_dir_config)(cmd->pool, NULL); + + return NULL; +} + +static const char *load_file(cmd_parms *cmd, void *dummy, char *filename) +{ + if (been_there_done_that) + return NULL; + + if (spawnlp(P_NOWAIT, ap_server_root_relative(cmd->pool, filename), NULL)) + return ap_pstrcat(cmd->pool, "Cannot load ", filename, " into server", NULL); + + return NULL; +} + +void check_loaded_modules(server_rec *dummy, pool *p) +{ + if (been_there_done_that) + return; + + been_there_done_that = 1; +} + +command_rec nlm_cmds[] = { +{ "LoadModule", load_module, NULL, RSRC_CONF, TAKE2, + "a module name, and the name of a file to load it from"}, +{ "LoadFile", load_file, NULL, RSRC_CONF, ITERATE, + "files or libraries to link into the server at runtime"}, +{ NULL } +}; + +module nlm_module = { + STANDARD_MODULE_STUFF, + check_loaded_modules, /* initializer */ + NULL, /* create per-dir config */ + NULL, /* merge per-dir config */ + NULL, /* server config */ + NULL, /* merge server config */ + nlm_cmds, /* command table */ + NULL, /* handlers */ + NULL, /* filename translation */ + NULL, /* check_user_id */ + NULL, /* check auth */ + NULL, /* check access */ + NULL, /* type_checker */ + NULL, /* logger */ + NULL /* header parser */ +}; + diff --git a/APACHE_1_3_42/src/os/netware/mod_tls.c b/APACHE_1_3_42/src/os/netware/mod_tls.c new file mode 100644 index 0000000000..f711c6a6f7 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/mod_tls.c @@ -0,0 +1,374 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * mod_tls.c - Apache SSL/TLS module for NetWare by Mike Gardiner. + * + * This module gives Apache the ability to do SSL/TLS with a minimum amount + * of effort. All of the SSL/TLS logic is already on NetWare versions 5 and + * above and is interfaced through WinSock on NetWare. As you can see in + * the code below SSL/TLS sockets can be created with three WinSock calls. + * + * To load, simply place the module in the modules directory under the main + * apache tree. Then add a "SecureListen" with two arguments. The first + * argument is an address and/or port. The second argument is the key pair + * name as created in ConsoleOne. + * + * Examples: + * + * SecureListen 443 "SSL CertificateIP" + * SecureListen 123.45.67.89:443 mycert + */ + +#define CORE_PRIVATE +#define WS_SSL + +#define MAX_ADDRESS 512 +#define MAX_KEY 80 + +#include "httpd.h" +#include "http_config.h" +#include "http_conf_globals.h" +#include "http_log.h" +#include "http_main.h" + +module MODULE_VAR_EXPORT tls_module; + +typedef struct TLSSrvConfigRec TLSSrvConfigRec; +typedef struct seclisten_rec seclisten_rec; +static fd_set listenfds; + +struct seclisten_rec { + seclisten_rec *next; + struct sockaddr_in local_addr; /* local IP address and port */ + int fd; + int used; /* Only used during restart */ + char key[MAX_KEY]; + int mutual; +}; + +struct TLSSrvConfigRec { + table *sltable; +}; + +static seclisten_rec* ap_seclisteners = NULL; + +#define get_tls_cfg(srv) (TLSSrvConfigRec *) ap_get_module_config(srv->module_config, &tls_module) + + +static int find_secure_listener(seclisten_rec *lr) +{ + seclisten_rec *sl; + + for (sl = ap_seclisteners; sl; sl = sl->next) { + if (!memcmp(&sl->local_addr, &lr->local_addr, sizeof(sl->local_addr))) { + sl->used = 1; + return sl->fd; + } + } + return -1; +} + + +static int make_secure_socket(pool *p, const struct sockaddr_in *server, + char* key, int mutual, server_rec *server_conf) +{ + int s; + int one = 1; + char addr[MAX_ADDRESS]; + struct sslserveropts opts; + struct linger li; + unsigned int optParam; + WSAPROTOCOL_INFO SecureProtoInfo; + int no = 1; + + if (server->sin_addr.s_addr != htonl(INADDR_ANY)) + ap_snprintf(addr, sizeof(addr), "address %s port %d", + inet_ntoa(server->sin_addr), ntohs(server->sin_port)); + else + ap_snprintf(addr, sizeof(addr), "port %d", ntohs(server->sin_port)); + + /* note that because we're about to slack we don't use psocket */ + ap_block_alarms(); + memset(&SecureProtoInfo, 0, sizeof(WSAPROTOCOL_INFO)); + + SecureProtoInfo.iAddressFamily = AF_INET; + SecureProtoInfo.iSocketType = SOCK_STREAM; + SecureProtoInfo.iProtocol = IPPROTO_TCP; + SecureProtoInfo.iSecurityScheme = SECURITY_PROTOCOL_SSL; + + s = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, + (LPWSAPROTOCOL_INFO)&SecureProtoInfo, 0, 0); + + if (s == INVALID_SOCKET) { + errno = WSAGetLastError(); + ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, + "make_secure_socket: failed to get a socket for %s", addr); + ap_unblock_alarms(); + return -1; + } + + if (!mutual) { + optParam = SO_SSL_ENABLE | SO_SSL_SERVER; + + if (WSAIoctl(s, SO_SSL_SET_FLAGS, (char *)&optParam, + sizeof(optParam), NULL, 0, NULL, NULL, NULL)) { + errno = WSAGetLastError(); + ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, + "make_secure_socket: for %s, WSAIoctl: (SO_SSL_SET_FLAGS)", addr); + ap_unblock_alarms(); + return -1; + } + } + + opts.cert = key; + opts.certlen = strlen(key); + opts.sidtimeout = 0; + opts.sidentries = 0; + opts.siddir = NULL; + + if (WSAIoctl(s, SO_SSL_SET_SERVER, (char *)&opts, sizeof(opts), + NULL, 0, NULL, NULL, NULL) != 0) { + errno = WSAGetLastError(); + ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, + "make_secure_socket: for %s, WSAIoctl: (SO_SSL_SET_SERVER)", addr); + ap_unblock_alarms(); + return -1; + } + + if (mutual) { + optParam = 0x07; // SO_SSL_AUTH_CLIENT + + if(WSAIoctl(s, SO_SSL_SET_FLAGS, (char*)&optParam, + sizeof(optParam), NULL, 0, NULL, NULL, NULL)) { + errno = WSAGetLastError(); + ap_log_error( APLOG_MARK, APLOG_CRIT, server_conf, + "make_secure_socket: for %s, WSAIoctl: (SO_SSL_SET_FLAGS)", addr ); + ap_unblock_alarms(); + return -1; + } + } + + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *) &one, sizeof(int)) < 0) { + errno = WSAGetLastError(); + ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, + "make_secure_socket: for %s, setsockopt: (SO_REUSEADDR)", addr); + ap_unblock_alarms(); + return -1; + } + + one = 1; +#ifdef SO_KEEPALIVE + if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (char *) &one, sizeof(int)) < 0) { + errno = WSAGetLastError(); + ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, + "make_secure_socket: for %s, setsockopt: (SO_KEEPALIVE)", addr); +#endif + ap_unblock_alarms(); + return -1; + } + + if (server_conf->send_buffer_size) { + if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, + (char *) &server_conf->send_buffer_size, sizeof(int)) < 0) { + errno = WSAGetLastError(); + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, + "make_secure_socket: failed to set SendBufferSize for %s, " + "using default", addr); + ap_unblock_alarms(); + return -1; + } + } + + if (bind(s, (struct sockaddr *) server, sizeof(struct sockaddr_in)) == -1) { + errno = WSAGetLastError(); + ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, + "make_secure_socket: could not bind to %s", addr); + ap_unblock_alarms(); + return -1; + } + + if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &no, sizeof(int)) < 0) { + errno = WSAGetLastError(); + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, + "setsockopt: (TCP_NODELAY)"); + } + + if (listen(s, ap_listenbacklog) == -1) { + errno = WSAGetLastError(); + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + "make_secure_socket: unable to listen for connections on %s", addr); + ap_unblock_alarms(); + return -1; + } + + ap_unblock_alarms(); + return s; +} + +static const char *set_secure_listener(cmd_parms *cmd, void *dummy, char *ips, char* key, char* mutual) +{ + TLSSrvConfigRec* sc = get_tls_cfg(cmd->server); + const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); + char *ports; + unsigned short port; + seclisten_rec *new; + + + if (err != NULL) + return err; + + ports = strchr(ips, ':'); + + if (ports != NULL) { + if (ports == ips) + return "Missing IP address"; + else if (ports[1] == '\0') + return "Address must end in :<port-number>"; + + *(ports++) = '\0'; + } + else { + ports = ips; + } + + new = ap_pcalloc(cmd->pool, sizeof(seclisten_rec)); + new->local_addr.sin_family = AF_INET; + + if (ports == ips) + new->local_addr.sin_addr.s_addr = htonl(INADDR_ANY); + else + new->local_addr.sin_addr.s_addr = ap_get_virthost_addr(ips, NULL); + + port = atoi(ports); + + if (!port) + return "Port must be numeric"; + + ap_table_set(sc->sltable, ports, "T"); + + new->local_addr.sin_port = htons(port); + new->fd = -1; + new->used = 0; + new->next = ap_seclisteners; + strcpy(new->key, key); + new->mutual = (mutual) ? 1 : 0; + ap_seclisteners = new; + return NULL; +} + +static void InitTLS(server_rec *s, pool *p) +{ + seclisten_rec* sl; + listen_rec* lr; + + for (sl = ap_seclisteners; sl != NULL; sl = sl->next) { + sl->fd = find_secure_listener(sl); + + if (sl->fd < 0) + sl->fd = make_secure_socket(p, &sl->local_addr, sl->key, sl->mutual, s); + else + ap_note_cleanups_for_socket(p, sl->fd); + + if (sl->fd >= 0) { + FD_SET(sl->fd, &listenfds); + ap_note_cleanups_for_socket(p, sl->fd); + + lr = ap_pcalloc(p, sizeof(listen_rec)); + + if (lr) { + lr->local_addr = sl->local_addr; + lr->used = 0; + lr->fd = sl->fd; + lr->next = ap_listeners; + ap_listeners = lr; + } + } else { + clean_parent_exit(1); + } + } +} + +void *tls_config_server_create(pool *p, server_rec *s) +{ + TLSSrvConfigRec *new = ap_palloc(p, sizeof(TLSSrvConfigRec)); + new->sltable = ap_make_table(p, 5); + return new; +} + +void *tls_config_server_merge(pool *p, void *basev, void *addv) +{ + TLSSrvConfigRec *base = (TLSSrvConfigRec *)basev; + TLSSrvConfigRec *add = (TLSSrvConfigRec *)addv; + TLSSrvConfigRec *merged = (TLSSrvConfigRec *)ap_palloc(p, sizeof(TLSSrvConfigRec)); + return merged; +} + +int tls_hook_Fixup(request_rec *r) +{ + TLSSrvConfigRec *sc = get_tls_cfg(r->server); + table *e = r->subprocess_env; + const char *s_secure; + char port[8]; + + + /* For some reason r->server->port always return 80 rather than + * the current port. So for now we will get it straight from + * the horses mouth. + */ + /* itoa(r->server->port, port, 10); */ + itoa(ntohs(((r->connection)->local_addr).sin_port), port, 10); + s_secure = ap_table_get(sc->sltable, port); + + if (!s_secure) + return DECLINED; + + ap_table_set(e, "HTTPS", "on"); + + return DECLINED; +} + +static const command_rec tls_module_cmds[] = { + { "SecureListen", set_secure_listener, NULL, RSRC_CONF, TAKE23, + "specify an address and/or port with a key pair name.\n" + "Optional third parameter of MUTUAL configures the port for mutual authentication."}, + { NULL } +}; + +module MODULE_VAR_EXPORT tls_module = +{ + STANDARD_MODULE_STUFF, + InitTLS, /* initializer */ + NULL, /* dir config creater */ + NULL, /* dir merger --- default is to override */ + tls_config_server_create, /* server config */ + tls_config_server_merge, /* merge server config */ + tls_module_cmds, /* command table */ + NULL, /* handlers */ + NULL, /* filename translation */ + NULL, /* check_user_id */ + NULL, /* check auth */ + NULL, /* check access */ + NULL, /* type_checker */ + NULL, /* fixups */ + NULL, /* logger */ + NULL, /* header parser */ + NULL, /* child_init */ + NULL, /* child_exit */ + tls_hook_Fixup /* post read request */ +}; + + diff --git a/APACHE_1_3_42/src/os/netware/modules.c b/APACHE_1_3_42/src/os/netware/modules.c new file mode 100644 index 0000000000..3f697a2df5 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/modules.c @@ -0,0 +1,86 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* modules.c --- major modules compiled into Apache for NetWare. + * Only insert an entry for a module if it must be compiled into + * the core server + */ + +#include "httpd.h" +#include "http_config.h" + +extern module core_module; +extern module so_module; +extern module mime_module; +extern module access_module; +extern module auth_module; +extern module negotiation_module; +extern module includes_module; +extern module autoindex_module; +extern module dir_module; +// extern module cgi_module; +extern module userdir_module; +extern module alias_module; +extern module env_module; +extern module config_log_module; +extern module asis_module; +extern module imap_module; +extern module action_module; +extern module setenvif_module; + +module *ap_prelinked_modules[] = { + &core_module, + &so_module, + &mime_module, + &access_module, + &auth_module, + &negotiation_module, + &includes_module, + &autoindex_module, + &dir_module, +// &cgi_module, + &userdir_module, + &alias_module, + &env_module, + &config_log_module, + &asis_module, + &imap_module, + &action_module, + &setenvif_module, + NULL +}; + +module *ap_preloaded_modules[] = { + &core_module, + &so_module, + &mime_module, + &access_module, + &auth_module, + &negotiation_module, + &includes_module, + &autoindex_module, + &dir_module, +// &cgi_module, + &userdir_module, + &alias_module, + &env_module, + &config_log_module, + &asis_module, + &imap_module, + &action_module, + &setenvif_module, + NULL +}; diff --git a/APACHE_1_3_42/src/os/netware/multithread.c b/APACHE_1_3_42/src/os/netware/multithread.c new file mode 100644 index 0000000000..2ca928b70e --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/multithread.c @@ -0,0 +1,119 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ap_config.h" +#include "httpd.h" +#include "http_conf_globals.h" +#include "multithread.h" +#include <nwsemaph.h> + + +thread *create_thread(void (thread_fn)(void *), void *thread_arg) +{ + int rv; + + rv = BeginThreadGroup(thread_fn, NULL, ap_thread_stack_size, thread_arg); + return((thread *)rv); +} + +int kill_thread(thread *thread_id) +{ + return(0); +} + +int await_thread(thread *thread_id, int sec_to_wait) +{ + return(0); +} + +void exit_thread(int status) +{} + +void free_thread(thread *thread_id) +{} + + +mutex * ap_create_mutex(char *name) +{ + return (mutex*)kMutexAlloc(name); +} + +mutex * ap_open_mutex(char *name) +{ + return(NULL); +} + +int ap_acquire_mutex(mutex *mutex_id) +{ + return(kMutexLock(mutex_id)); +} + +int ap_release_mutex(mutex *mutex_id) +{ + if (kMutexUnlock(mutex_id)) + return 0; + else + return 1; +} + +void ap_destroy_mutex(mutex *mutex_id) +{ + kMutexFree(mutex_id); +} + + +semaphore *create_semaphore(int initial) +{ + return((semaphore*)OpenLocalSemaphore(initial)); +} +int acquire_semaphore(semaphore *semaphore_id) +{ + return(WaitOnLocalSemaphore((long)semaphore_id)); +} +int release_semaphore(semaphore *semaphore_id) +{ + return(SignalLocalSemaphore((long)semaphore_id)); +} +void destroy_semaphore(semaphore *semaphore_id) +{ + CloseLocalSemaphore((long)semaphore_id); +} + +event *create_event(int manual, int initial, char *name) +{ + return(NULL); +} +event *open_event(char *name) +{ + return(NULL); +} +int acquire_event(event *event_id) +{ + return(0); +} +int set_event(event *event_id) +{ + return(0); +} +int reset_event(event *event_id) +{ + return(0); +} +void destroy_event(event *event_id) +{} + + + diff --git a/APACHE_1_3_42/src/os/netware/os.c b/APACHE_1_3_42/src/os/netware/os.c new file mode 100644 index 0000000000..b45b373de2 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/os.c @@ -0,0 +1,467 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define WS_SSL + +#include "httpd.h" +#include "ap_config.h" +#include "http_config.h" +#include "http_log.h" +#include <dirent.h> + +extern char ap_server_root[MAX_STRING_LEN]; + +void ap_os_dso_init(void) +{ +} + +void *ap_os_dso_load(const char *path) +{ + unsigned int nlmHandle; + char *moduleName = NULL; + + moduleName = strrchr(path, '/'); + + if (moduleName) { + moduleName++; + } + + nlmHandle = FindNLMHandleInAddressSpace((char*)moduleName, NULL); + + if (nlmHandle == NULL) { + spawnlp(P_NOWAIT | P_SPAWN_IN_CURRENT_DOMAIN, path, NULL); + nlmHandle = FindNLMHandleInAddressSpace((char*)moduleName, NULL); + } + + return (void *)nlmHandle; +} + +void ap_os_dso_unload(void *handle) +{ + KillMe(handle); +} + +void *ap_os_dso_sym(void *handle, const char *symname) +{ + return ImportSymbol((int)GetNLMHandle(), (char *)symname); +} + +void ap_os_dso_unsym(void *handle, const char *symname) +{ + UnimportSymbol((int)GetNLMHandle(), (char *)symname); +} + +const char *ap_os_dso_error(void) +{ + return NULL; +} + +char *remove_filename(char* str) +{ + int i, len = strlen(str); + + for (i=len; i; i--) { + if (str[i] == '\\' || str[i] == '/') { + str[i] = NULL; + break; + } + } + return str; +} + +char *bslash2slash(char* str) +{ + int i, len = strlen(str); + + for (i=0; i<len; i++) { + if (str[i] == '\\') { + str[i] = '/'; + break; + } + } + return str; +} + +void check_clean_load(module *top_module) +{ + if (top_module != NULL) { + module *m; + + ap_log_error(APLOG_MARK, APLOG_CRIT, NULL, + "abnormal shutdown detected, performing a clean shutdown: please restart apache"); + for (m = top_module; m; m = m->next) + ap_os_dso_unload((ap_os_dso_handle_t)m->dynamic_load_handle); + exit(1); + } +} + +void init_name_space() +{ + UnAugmentAsterisk(TRUE); + SetCurrentNameSpace(NW_NS_LONG); + SetTargetNameSpace(NW_NS_LONG); +} + +/* Perform complete canonicalization. On NetWare we are just + lower casing the file name so that the comparisons will match. + NetWare assumes that all physical paths are fully qualified. + Each file path must include a volume name. + */ +static char *os_canonical_filename(pool *pPool, const char *szFile) +{ + char *pNewName = ap_pstrdup(pPool, szFile); + char *slash_test; + + bslash2slash(pNewName); + /* Don't try to canonicalize a filename that isn't even valid + This way we don't mess up proxy requests or other kinds + of special filenames. + */ + if (ap_os_is_filename_valid(pNewName)) { + if ((pNewName[0] == '/') && (strchr (pNewName, ':') == NULL)) + { + char vol[256]; + + _splitpath (ap_server_root, vol, NULL, NULL, NULL); + pNewName = ap_pstrcat (pPool, vol, pNewName, NULL); + } + if ((slash_test = strchr(pNewName, ':')) && (*(slash_test+1) != '/') + && (*(slash_test+1) != '\0')) + { + char vol[_MAX_VOLUME+1]; + + _splitpath (pNewName, vol, NULL, NULL, NULL); + pNewName = ap_pstrcat (pPool, vol, "/", pNewName+strlen(vol), NULL); + } + } + return pNewName; +} + +char *ap_os_canonical_filename(pool *pPool, const char *szFile) +{ + char *pNewName = os_canonical_filename(pPool, szFile); + + /* Lower case the name so that the interal string compares work */ + strlwr(pNewName); + return pNewName; +} + + +char *ap_os_case_canonical_filename(pool *pPool, const char *szFile) +{ + /* First thing we need to do is get a copy of the + canonicalized path */ + char *pNewName = os_canonical_filename(pPool, szFile); + int volnum=0; + long dirnum=0; + long pathcount=0; + char *path; + char vol[_MAX_VOLUME+1]; + int retval, x, y; + + /* See if path exists by trying to get the volume and directory number */ + retval = FEMapPathVolumeDirToVolumeDir(pNewName, 0, 0, &volnum, &dirnum); + if (retval == 0) { + /* allocate a buffer and ask the file system for the real name of + the directory and file */ + path = ap_palloc(pPool, strlen(pNewName)+2); + FEMapVolumeAndDirectoryToPath (volnum, dirnum, path, &pathcount); + + /* The file system gives it back in a lengh preceded string so we + need to convert it to a null terminated string. */ + x = 0; + while (pathcount-- > 0) { + y = path[x]; + path[x] = '/'; + x += y + 1; + } + path[x] = '\0'; /* null terminate the full path */ + + /* Get the name of the volume so that we can prepend it onto the path */ + FEMapVolumeNumberToName (volnum, vol); + vol[vol[0]+1] = '\0'; + pNewName = ap_pstrcat (pPool, &(vol[1]), ":", path, NULL); + } + + /* At this point we either have a real case accurate canonical path or + the original name canonicalized */ + return pNewName; +} + + +/* + * ap_os_is_filename_valid is given a filename, and returns 0 if the filename + * is not valid for use on this system. On NetWare, this means it fails any + * of the tests below. Otherwise returns 1. + * + * The tests are: + * + * 1) total path length greater than MAX_PATH + * + * 2) the file path must contain a volume specifier and no / or \ + * can appear before the volume specifier. + * + * 3) anything using the octets 0-31 or characters " < > | : + * (these are reserved for Windows use in filenames. In addition + * each file system has its own additional characters that are + * invalid. See KB article Q100108 for more details). + * + * 4) anything ending in "." (no matter how many) + * (filename doc, doc. and doc... all refer to the same file) + * + * 5) any segment in which the basename (before first period) matches + * one of the DOS device names + * (the list comes from KB article Q100108 although some people + * reports that additional names such as "COM5" are also special + * devices). + * + * If the path fails ANY of these tests, the result must be to deny access. + */ + +int ap_os_is_filename_valid(const char *file) +{ + const char *segstart; + unsigned int seglength; + const char *pos; + char *colonpos, *fslashpos, *bslashpos; + static const char * const invalid_characters = "?\"<>*|:"; + static const char * const invalid_filenames[] = { + "CON", "AUX", "COM1", "COM2", "COM3", + "COM4", "LPT1", "LPT2", "LPT3", "PRN", "NUL", NULL + }; + + /* First check to make sure that we have a file so that we don't abend */ + if (file == NULL) + return 0; + + /* Test 1 */ + if (strlen(file) >= _MAX_PATH) { + /* Path too long for Windows. Note that this test is not valid + * if the path starts with //?/ or \\?\. */ + return 0; + } + + pos = file; + + /* Skip any leading non-path components. This can be either a + * drive letter such as C:, or a UNC path such as \\SERVER\SHARE\. + * We continue and check the rest of the path based on the rules above. + * This means we could eliminate valid filenames from servers which + * are not running NT (such as Samba). + */ + + colonpos = strchr (file, ':'); + + if (!colonpos) + return 0; + + pos = ++colonpos; + if (!*pos) { + /* No path information */ + /* Same as specifying volume:\ */ + return 1; + } + + while (*pos) { + unsigned int idx; + unsigned int baselength; + + while (*pos == '/' || *pos == '\\') { + pos++; + } + if (*pos == '\0') { + break; + } + segstart = pos; /* start of segment */ + while (*pos && *pos != '/' && *pos != '\\') { + pos++; + } + seglength = pos - segstart; + /* + * Now we have a segment of the path, starting at position "segstart" + * and length "seglength" + */ + + /* Test 2 */ + for (idx = 0; idx < seglength; idx++) { + if ((segstart[idx] > 0 && segstart[idx] < 32) || + strchr(invalid_characters, segstart[idx])) { + return 0; + } + } + + /* Test 2.5 */ + if (seglength == 2) { + if ( (segstart[0] == '.') && (segstart[1] == '.') ) { + return 1; + } + + } + + /* Test 3 */ + if (segstart[seglength-1] == '.') { + return 0; + } + + /* Test 4 */ + for (baselength = 0; baselength < seglength; baselength++) { + if (segstart[baselength] == '.') { + break; + } + } + + /* baselength is the number of characters in the base path of + * the segment (which could be the same as the whole segment length, + * if it does not include any dot characters). */ + if (baselength == 3 || baselength == 4) { + for (idx = 0; invalid_filenames[idx]; idx++) { + if (strlen(invalid_filenames[idx]) == baselength && + !strnicmp(invalid_filenames[idx], segstart, baselength)) { + return 0; + } + } + } + } + + return 1; +} + +#undef opendir_411 +DIR *os_opendir (const char *pathname) +{ + struct stat s; + DIR *d = opendir_411 (pathname); + + if (d) { + strcpy (d->d_name, "<<**"); + } + + if (!d) { + /* Let's check if this is an empty directory */ + if (stat(pathname, &s) != 0) + return NULL; + if (!(S_ISDIR(s.st_mode))) + return NULL; + + /* If we are here, then this appears to be a directory */ + /* We allocate a name */ + d = NULL; + d = (DIR *)malloc(sizeof(DIR)); + if (d) { + memset(d, 0, sizeof(DIR)); + strcpy(d->d_name, "**<<"); + d->d_cdatetime = 50; + + } + + } + + return d; + +} + +#undef readdir_411 +DIR *os_readdir (DIR *dirP) +{ + +/* + * First three if statements added for empty directory support. + * + */ + if ( (dirP->d_cdatetime == 50) && (dirP->d_name[0] == '*') && + (dirP->d_name[2] == '<') ) + { + strcpy (dirP->d_name, "."); + strcpy (dirP->d_nameDOS, "."); + return (dirP); + } + else if ((dirP->d_cdatetime == 50) && + (dirP->d_name[0] == '.') && + (dirP->d_name[1] == '\0')) { + strcpy (dirP->d_name, ".."); + strcpy (dirP->d_nameDOS, ".."); + return (dirP); + } + else if ( (dirP->d_cdatetime == 50) && + (dirP->d_name[0] == '.') && + (dirP->d_name[1] == '.') && + (dirP->d_name[2] == '\0') ) { + return (NULL); + } + else if ((dirP->d_name[0] == '<') && (dirP->d_name[2] == '*')) { + strcpy (dirP->d_name, "."); + strcpy (dirP->d_nameDOS, "."); + return (dirP); + } + else if ((dirP->d_name[0] == '.') && (dirP->d_name[1] == '\0')) { + strcpy (dirP->d_name, ".."); + strcpy (dirP->d_nameDOS, ".."); + return (dirP); + } + else + return readdir_411 (dirP); +} + + +#undef closedir_510 +int os_closedir (DIR *dirP) +{ +/* + * Modified to handle empty directories. + * + */ + + if (dirP == NULL) { + return 0; + } + + if ( ( (dirP->d_cdatetime == 50) && (dirP->d_name[0] == '*') && + (dirP->d_name[2] == '<') + ) || + ( (dirP->d_cdatetime == 50) && (dirP->d_name[0] == '.') && + (dirP->d_name[1] == '\0') + ) || + ( (dirP->d_cdatetime == 50) && (dirP->d_name[0] == '.') && + (dirP->d_name[1] == '.') && (dirP->d_name[2] == '\0') + ) + ) + { + + free(dirP); + dirP = NULL; + return 0; + } + else { + return closedir_510(dirP); + } + + +} + +char *ap_os_http_method(void *r) +{ + int s = ((request_rec*)r)->connection->client->fd; + unsigned int optParam; + + if (!WSAIoctl(s, SO_SSL_GET_FLAGS, NULL, 0, &optParam, sizeof(optParam), NULL, NULL, NULL)) + if (optParam & (SO_SSL_ENABLE | SO_SSL_SERVER)) return "https"; + return "http"; +} + +unsigned short ap_os_default_port(void *r) +{ + return ap_default_port_for_scheme(ap_os_http_method(r)); +} diff --git a/APACHE_1_3_42/src/os/netware/os.h b/APACHE_1_3_42/src/os/netware/os.h new file mode 100644 index 0000000000..a61ccf1905 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/os.h @@ -0,0 +1,149 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_OS_H +#define APACHE_OS_H + +#define PLATFORM "NETWARE" +#define HAVE_CANONICAL_FILENAME + +/* + * This file in included in all Apache source code. It contains definitions + * of facilities available on _this_ operating system (HAVE_* macros), + * and prototypes of OS specific functions defined in os.c or os-inline.c + */ + +typedef signed long int32; +typedef int uid_t; +typedef int gid_t; +typedef int tid_t; + +#include "ap_config.h" +#include <string.h> +#include <stddef.h> +#include <nwthread.h> +#include <nwmalloc.h> +#include <nwnamspc.h> +#include <nwlib.h> +#include <nwadv.h> +#include <ws2nlm.h> +#include <winsock2.h> +#include <fcntl.h> +#include <dirent.h> + +#define NO_LINGCLOSE +#define NO_SLACK +#define HAVE_UNISTD_H +#define NO_SETSID +#define NO_KILLPG +#define NO_WRITEV +#define NO_GETTIMEOFDAY +#define NO_TIMES +#define NO_USE_SIGACTION +#define USE_LONGJMP +#define MULTITHREAD + +#define NO_RELIABLE_PIPED_LOGS +#define CASE_BLIND_FILESYSTEM +#define NO_OTHER_CHILD + +#define USE_HSREGEX +#define NETDB_USE_INTERNET +#define N_PLAT_NLM +#define APX386 +#define ALLOC_USE_MALLOC +#define OPTIMIZE_TIMEOUTS +#define FD_SETSIZE 128 +#define NO_DBM_REWRITEMAP + +#define crypt(buf,salt) (buf) +#define sleep(t) delay(t*1000) +#define getpid() ((pid_t)GetThreadGroupID()) +#define gettid() ((tid_t)GetThreadID()) +/* Netware doesn't have symlinks so S_ISLNK is always false */ +#define S_ISLNK(m) 0 +/* Netware doesn't have isnan,isinf so they always return false */ +#define isnan(m) 0 +#define isinf(m) 0 +#define lstat(x, y) stat(x, y) +#define strcasecmp(s1, s2) stricmp(s1, s2) +#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n) +#define mktemp(s) tmpnam(s) +#define _getch getch + +/* Watcom reports that ERANGE is returned properly for any out of bounds + * conditions, with a MIN/MAX_LONG value. This should be safe. + */ +#define ap_strtol strtol + +#define opendir_411(p) os_opendir(p) +#define opendir(p) os_opendir(p) +DIR *os_opendir (const char *pathname); + +#define readdir_411(p) os_readdir(p) +#define readdir(p) os_readdir(p) +DIR *os_readdir (DIR *dirP); + +#define closedir_510(p) os_closedir(p) +#define closedir(p) os_closedir(p) +int os_closedir (DIR *dirP); + +/* Prototypes */ +void AMCSocketCleanup(void); +void clean_parent_exit(int code); + +#ifdef __GNUC__ +static +#endif +inline int ap_os_is_path_absolute(const char *file) +{ + char *s = strstr (file, "://"); + + /* First make sure we aren't looking at a URL such as + a proxy:http://blah. + */ + if (!s) { + s = strchr (file, ':'); + + if (s) { + if (strncmp(s, "://", 3) != 0) + /* XXX: we assume that everything before the : is letters */ + return 1; + } + else { + if (file[0] == '/') + return 1; + } + } + + return 0; +} + +#define ap_os_dso_handle_t void * +void ap_os_dso_init(void); +void *ap_os_dso_load(const char *); +void ap_os_dso_unload(void *); +void *ap_os_dso_sym(void *, const char *); +void ap_os_dso_unsym(void *handle, const char *symname); +const char *ap_os_dso_error(void); +char *remove_filename(char*); +char *bslash2slash(char*); +void init_name_space(void); +int ap_os_is_filename_valid(const char *file); +char *ap_os_http_method(void *r); +unsigned short ap_os_default_port(void *r); +#endif /*! APACHE_OS_H*/ + diff --git a/APACHE_1_3_42/src/os/netware/precomp.h b/APACHE_1_3_42/src/os/netware/precomp.h new file mode 100644 index 0000000000..70abf45f37 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/precomp.h @@ -0,0 +1,27 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma precompile_target "precomp.mch" +#define NETWARE + +#ifndef __int64 +#define __int64 long long +#endif + + + + + diff --git a/APACHE_1_3_42/src/os/netware/test_char.h b/APACHE_1_3_42/src/os/netware/test_char.h new file mode 100644 index 0000000000..b8d4ad49e9 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/test_char.h @@ -0,0 +1,44 @@ +/* this file is automatically generated by gen_test_char, do not edit */ +/* this file is automatically generated by gen_test_char, do not edit */ +#define T_ESCAPE_SHELL_CMD 0x01 /* chars with special meaning in the shell */ +#define T_ESCAPE_PATH_SEGMENT 0x02 /* find path segment, as defined in RFC1808 */ +#define T_OS_ESCAPE_PATH 0x04 /* escape characters in a path or uri */ +#define T_HTTP_TOKEN_STOP 0x08 /* find http tokens, as defined in RFC2616 */ +#define T_ESCAPE_LOGITEM 0x10 /* filter what should go in the log file */ +#define T_ESCAPE_FORENSIC 0x20 /* filter what should go in the forensic log */ + +static const unsigned char test_char_table[256] = { + 0x20, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, /*0x00...0x07*/ + 0x3e, 0x3e, 0x3f, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, /*0x08...0x0f*/ + 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, /*0x10...0x17*/ + 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, /*0x18...0x1f*/ + 0x0e, 0x00, 0x17, 0x06, 0x01, 0x26, 0x01, 0x01, /*0x20...0x27*/ + 0x09, 0x09, 0x01, 0x00, 0x08, 0x00, 0x00, 0x0a, /*0x28...0x2f*/ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x30...0x37*/ + 0x00, 0x00, 0x28, 0x0f, 0x0f, 0x08, 0x0f, 0x0f, /*0x38...0x3f*/ + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x40...0x47*/ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x48...0x4f*/ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x50...0x57*/ + 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x0f, 0x07, 0x00, /*0x58...0x5f*/ + 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x60...0x67*/ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x68...0x6f*/ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x70...0x77*/ + 0x00, 0x00, 0x00, 0x0f, 0x27, 0x0f, 0x01, 0x3e, /*0x78...0x7f*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0x80...0x87*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0x88...0x8f*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0x90...0x97*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0x98...0x9f*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xa0...0xa7*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xa8...0xaf*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xb0...0xb7*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xb8...0xbf*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xc0...0xc7*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xc8...0xcf*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xd0...0xd7*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xd8...0xdf*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xe0...0xe7*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xe8...0xef*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, /*0xf0...0xf7*/ + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 /*0xf8...0xff*/ + +}; diff --git a/APACHE_1_3_42/src/os/netware/uri_delims.h b/APACHE_1_3_42/src/os/netware/uri_delims.h new file mode 100644 index 0000000000..0c855bf726 --- /dev/null +++ b/APACHE_1_3_42/src/os/netware/uri_delims.h @@ -0,0 +1,16 @@ +/* this file is automatically generated by gen_uri_delims, do not edit */ +static const unsigned char uri_delims[256] = { + T_NUL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,T_HASH,0,0,0,0, + 0,0,0,0,0,0,0,T_SLASH,0,0,0,0,0,0,0,0,0,0,T_COLON,0, + 0,0,0,T_QUESTION,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +}; |