|
fred-mod-whoisd-3.12.2
|
#include "httpd.h"#include "http_log.h"#include "http_config.h"#include "http_connection.h"#include "apr.h"#include "apr_buckets.h"#include "apr_file_io.h"#include "apr_general.h"#include "apr_lib.h"#include "apr_pools.h"#include "apr_strings.h"#include "apr_time.h"#include "apr_hash.h"#include "apr_getopt.h"#include "apr_want.h"#include "scoreboard.h"#include "util_filter.h"#include "whois-client.h"
Data Structures | |
| struct | whoisd_server_conf |
| Configuration structure of whoisd module. More... | |
Macros | |
| #define | CORE_PRIVATE |
| #define | APR_FOPEN_READ APR_READ |
| #define | APR_WANT_STRFUNC |
| #define | client_ip(r) ((r)->remote_ip) |
| #define | ap_unixd_set_global_mutex_perms unixd_set_global_mutex_perms |
| #define | DEFAULT_DISCLAIMER "Domain Information over Whois protocol\n" |
| This default disclaimer should never be used in production release. | |
| #define | INT_ERROR_MSG "Internal error occured when processing your \request.\nPlease try again later.\n" |
| Message displayed bellow disclaimer when query cannot be answered becauseof an error. | |
| #define | MAXARGS 20 |
| Maximal number of whois arguments. | |
| #define | MAXTYPELEN 15 |
| Maximal length of object type identifier. | |
| #define | MAXAXELEN 15 |
| Maximal length of search axe identifier. | |
| #define | MAXQPARLEN 15 |
| Maximal length of -q parameter. | |
| #define | MIN_WHOIS_REQUEST_LENGTH 1 |
| Minimal length of input line. | |
| #define | MAX_WHOIS_REQUEST_LENGTH 1000 |
| Maximal length of input line. | |
| #define | ap_log_cerror(mark, level, status, c, ...) ap_log_error(mark, level, status, (c)->base_server, __VA_ARGS__) |
| This is wrapper function for compatibility reason. More... | |
| #define | IS_SEARCH_SET(wr) ((wr)->axe || (wr)->norecursion || (wr)->type) |
| checks if there is any kind of search set in the query | |
| #define | SAFE_PRINTF(fmt, str) if (str != NULL) apr_brigade_printf(bb, NULL, NULL, fmt, str); |
| #define | SAFE_PRINTF(fmt, str) if (str != NULL) apr_brigade_printf(bb, NULL, NULL, fmt, str); |
| #define | SAFE_PRINTF(fmt, str) if (str != NULL) apr_brigade_printf(bb, NULL, NULL, fmt, str); |
| #define | SAFE_PRINTF(fmt, str) if (str != NULL) apr_brigade_printf(bb, NULL, NULL, fmt, str); |
| #define | SAFE_PRINTF(fmt, str) if (str != NULL) apr_brigade_printf(bb, NULL, NULL, fmt, str); |
Functions | |
| void | whois_log_status (conn_rec *c, service_Logger service, const char *content, ccReg_RequestProperties *properties, ccReg_TID log_entry_id, CORBA_long result_code) |
| static void | print_intro (apr_bucket_brigade *bb, conn_rec *c, const char *disclaimer, const char *timestamp) |
| Print whois disclaimer into the bucket brigade. | |
| static void | send_error (conn_rec *c, const char *disclaimer, int nerr) |
| Routine trigerred upon error. More... | |
| static void | print_domain_object (apr_bucket_brigade *bb, obj_domain *d) |
| Function prints domain information to bucket brigade. More... | |
| static void | print_nsset_object (apr_bucket_brigade *bb, obj_nsset *n) |
| Function prints nsset information to bucket brigade. More... | |
| static void | print_keyset_object (apr_bucket_brigade *bb, obj_keyset *k) |
| Function prints keyset information to bucket brigade. More... | |
| static void | print_contact_object (apr_bucket_brigade *bb, obj_contact *c) |
| Function prints contact information to bucket brigade. More... | |
| static void | print_registrar_object (apr_bucket_brigade *bb, obj_registrar *r) |
| Function prints registrar information to bucket brigade. More... | |
| static void * | get_corba_service (conn_rec *c, char *name) |
| static apr_status_t | process_whois_query (conn_rec *c, whoisd_server_conf *sc, whois_request *wr, ccReg_TID log_entry_id) |
| Whois request processor. More... | |
| static char * | read_request (conn_rec *c, int *http_status) |
| This will read whois request (one line of text). More... | |
| static int | getobjtype (int *bittype, const char *strtype) |
| Function converts object type from string form to bit form. More... | |
| static char * | wrap_str (const char *str) |
| Function wraps strings passed from XML parser into strings accepted by CORBA. More... | |
| static apr_status_t | log_whois_request (whois_request *wr, conn_rec *c, char *content, whoisd_server_conf *sc, ccReg_TID *log_entry_id) |
| Call fred-logd now it mostly returns APR_SUCCESS because logger failure isn't fatal to whois itself only if memory allocation fails, it returns HTTP_INTERNAL_SERVER_ERROR. More... | |
| static int | process_whois_connection (conn_rec *c) |
| Connection handler of mod_whoisd module. More... | |
| static apr_status_t | whois_output_filter (ap_filter_t *f, apr_bucket_brigade *bb) |
| Whois output filter inserts in front of every <LF>, which is not preceeded by <CR>, <CR>. More... | |
| static int | whois_postconfig_hook (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) |
| Postconfig hook is a good occasion to check consistency of mod_whoisd configuration and to initialize CORBA component. More... | |
| static const char * | set_whois_protocol (cmd_parms *cmd, void *dummy, int flag) |
| Routine disables or enables the operation of mod_whois. More... | |
| static const char * | set_disclaimer_file (cmd_parms *cmd, void *dummy, const char *a1) |
| Routine accepts name of file with disclaimer, it also reads the file and stores disclaimer in server configuration struct. More... | |
| static const char * | set_logger_object (cmd_parms *cmd, void *dummy, const char *name) |
| Routine sets name under which logger object is registered by nameservice. More... | |
| static const char * | set_whois_object (cmd_parms *cmd, void *dummy, const char *name) |
| Routine sets name under which is registered whois object by nameservice. More... | |
| static void * | create_whoisd_config (apr_pool_t *p, server_rec *s) |
| Create server configuration for whoisd module. More... | |
| static void | register_hooks (apr_pool_t *p) |
| Function registering hooks of whoisd module. More... | |
Variables | |
| module AP_MODULE_DECLARE_DATA | whoisd_module |
| Whois module declaration. More... | |
| static const char * | usagestr |
| Error message in case of incorrect usage. | |
| static const char * | indexlist |
| List of attributes which can be used in search, this is displayed with -q indexes. More... | |
| static const char * | templatelist |
| List of templates for all five object types. | |
| static const command_rec | whoisd_cmds [] |
| Structure defining configuration options for whoisd module. More... | |
Module implementing whois service.
Whois daemon accepts requests containing object name and returns information about that object. The only object, which this server serves information about, is currently a domain.
The module serves only as a proxy, translating whois requests to CORBA requests and back. CORBA functionality is implemented in whois-client.c.
| #define ap_log_cerror | ( | mark, | |
| level, | |||
| status, | |||
| c, | |||
| ... | |||
| ) | ap_log_error(mark, level, status, (c)->base_server, __VA_ARGS__) |
This is wrapper function for compatibility reason.
Apache 2.0 does not have ap_log_cerror, instead we will use ap_log_error.
|
static |
Create server configuration for whoisd module.
| p | Pool used for allocations. |
| s | Server structure. |
|
static |
| c | Connection. |
| name | Name of the service. |
References ap_log_cerror.
Referenced by log_whois_request(), and process_whois_query().
|
static |
Function converts object type from string form to bit form.
If the object type is not recognized the bit array is unchanged.
| bittype | Number where each object type has its own bit. |
| strtype | Object type token. |
Referenced by process_whois_connection().
|
static |
Call fred-logd now it mostly returns APR_SUCCESS because logger failure isn't fatal to whois itself only if memory allocation fails, it returns HTTP_INTERNAL_SERVER_ERROR.
| wr | Request data. |
| c | Incomnig connection. |
| content | Request string. |
| sc | Server config. |
| log_entry_id | Output of entry ID from event logger. |
References ap_log_cerror, whois_request::axe, get_corba_service(), whoisd_server_conf::logger_object, MAX_ERROR_MSG_LEN, and wrap_str().
|
static |
Function prints contact information to bucket brigade.
| bb | Bucket brigade. |
| c | Contact object. |
|
static |
Function prints domain information to bucket brigade.
| bb | Bucket brigade. |
| d | Domain object. |
|
static |
Function prints keyset information to bucket brigade.
| bb | Bucket brigade. |
| k | Keyset object. |
|
static |
Function prints nsset information to bucket brigade.
| bb | Bucket brigade. |
| n | Nsset object. |
|
static |
Function prints registrar information to bucket brigade.
| bb | Bucket brigade. |
| r | Registrar object. |
|
static |
Connection handler of mod_whoisd module.
If mod_whoisd is for server enabled, the request is read (assuming it is whois request) and processed in request handler, which is called from inside of this function.
| c | Incomming connection. |
References ap_log_cerror, whois_request::axe, whoisd_server_conf::disclaimer, getobjtype(), MAX_WHOIS_REQUEST_LENGTH, MAXARGS, MAXAXELEN, whois_request::norecursion, read_request(), send_error(), whois_request::type, whoisd_server_conf::whoisd_enabled, and whoisd_module.
Referenced by register_hooks().
|
static |
Whois request processor.
This function is called from connection handler. It performs a CORBA call through CORBA backend and then processes data and sends a whois answer.
| c | Connection. |
| sc | Server configuration. |
| wr | Whois request data |
| log_entry_id | Entry ID from event logger |
References ap_log_cerror, CORBA_SERVICE_FAILED, whoisd_server_conf::disclaimer, get_corba_service(), whoisd_server_conf::logger_object, MAX_ERROR_MSG_LEN, MAX_OBJECT_COUNT, whoisd_server_conf::object, send_error(), TIME_BUFFER_LENGTH, whois_request::value, and whois_corba_call().
|
static |
This will read whois request (one line of text).
| c | Connection structure. |
| http_status | HTTP error code. |
References ap_log_cerror, MAX_WHOIS_REQUEST_LENGTH, and MIN_WHOIS_REQUEST_LENGTH.
Referenced by process_whois_connection().
|
static |
Function registering hooks of whoisd module.
| p | Pool used for allocations. |
References process_whois_connection(), whois_output_filter(), and whois_postconfig_hook().
|
static |
Routine trigerred upon error.
| c | Connection. |
| disclaimer | Disclaimer. |
| nerr | Number of error. |
References ap_log_cerror, print_intro(), and usagestr.
Referenced by process_whois_connection(), and process_whois_query().
|
static |
Routine accepts name of file with disclaimer, it also reads the file and stores disclaimer in server configuration struct.
| cmd | Command. |
| dummy | Not used arg. |
| a1 | The value. |
References whoisd_server_conf::disclaimer_filename, and whoisd_module.
|
static |
Routine sets name under which logger object is registered by nameservice.
| cmd | Command. |
| dummy | Not used arg. |
| name | The value. |
References whoisd_server_conf::logger_object, and whoisd_module.
|
static |
Routine sets name under which is registered whois object by nameservice.
| cmd | Command. |
| dummy | Not used arg. |
| name | The value. |
References whoisd_server_conf::object, and whoisd_module.
|
static |
Routine disables or enables the operation of mod_whois.
| cmd | Command. |
| dummy | Not used arg. |
| flag | The value. |
References whoisd_server_conf::whoisd_enabled, and whoisd_module.
|
static |
Whois output filter inserts in front of every <LF>, which is not preceeded by <CR>, <CR>.
| f | Chain of filters. |
| bb | Bucket brigade to be filtered. |
Referenced by register_hooks().
|
static |
Postconfig hook is a good occasion to check consistency of mod_whoisd configuration and to initialize CORBA component.
| p | Pool to allocate from. |
| plog | Pool used for logging. |
| ptemp | Temporary pool. |
| s | Server struct. |
References DEFAULT_DISCLAIMER, whoisd_server_conf::disclaimer, whoisd_server_conf::disclaimer_filename, whoisd_server_conf::object, whoisd_server_conf::whoisd_enabled, and whoisd_module.
Referenced by register_hooks().
|
static |
Function wraps strings passed from XML parser into strings accepted by CORBA.
Null strings are transformed to empty strings. The resulting string must be freed with CORBA_free().
| str | Input string. |
Referenced by log_whois_request().
|
static |
List of attributes which can be used in search, this is displayed with -q indexes.
|
static |
Structure defining configuration options for whoisd module.
| module AP_MODULE_DECLARE_DATA whoisd_module |
Whois module declaration.
Definition of whoisd module.
Referenced by process_whois_connection(), set_disclaimer_file(), set_logger_object(), set_whois_object(), set_whois_protocol(), and whois_postconfig_hook().
1.8.17