mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
No functional change: simple detabbing of indented code.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@332305 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -46,7 +46,7 @@ static const command_rec authn_default_cmds[] =
|
|||||||
OR_AUTHCFG,
|
OR_AUTHCFG,
|
||||||
"Set to 'Off' to allow access control to be passed along to "
|
"Set to 'Off' to allow access control to be passed along to "
|
||||||
"lower modules if the UserID is not known to this module. "
|
"lower modules if the UserID is not known to this module. "
|
||||||
"(default is On)."),
|
"(default is On)."),
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ static int authenticate_no_user(request_rec *r)
|
|||||||
const char *type;
|
const char *type;
|
||||||
|
|
||||||
if (!(type = ap_auth_type(r))) {
|
if (!(type = ap_auth_type(r))) {
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fill in the r->user field */
|
/* fill in the r->user field */
|
||||||
@@ -74,7 +74,7 @@ static int authenticate_no_user(request_rec *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (conf->authoritative == 0) {
|
if (conf->authoritative == 0) {
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
|
@@ -246,7 +246,7 @@ static void authn_ldap_build_filter(char *filtbuf,
|
|||||||
*q++ = '5';
|
*q++ = '5';
|
||||||
*q++ = 'c';
|
*q++ = 'c';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*q++ = *p++;
|
*q++ = *p++;
|
||||||
|
@@ -76,5 +76,5 @@ void _NonAppStop( void )
|
|||||||
|
|
||||||
int _NonAppCheckUnload( void )
|
int _NonAppCheckUnload( void )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -113,7 +113,7 @@ struct seclistenup_rec {
|
|||||||
struct NWSSLSrvConfigRec {
|
struct NWSSLSrvConfigRec {
|
||||||
apr_table_t *sltable;
|
apr_table_t *sltable;
|
||||||
apr_table_t *slutable;
|
apr_table_t *slutable;
|
||||||
apr_pool_t *pPool;
|
apr_pool_t *pPool;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct secsocket_data {
|
struct secsocket_data {
|
||||||
@@ -266,7 +266,7 @@ static int make_secure_socket(apr_pool_t *pconf, const struct sockaddr_in *serve
|
|||||||
|
|
||||||
if (!mutual) {
|
if (!mutual) {
|
||||||
optParam = SO_SSL_ENABLE | SO_SSL_SERVER;
|
optParam = SO_SSL_ENABLE | SO_SSL_SERVER;
|
||||||
|
|
||||||
if (WSAIoctl(s, SO_SSL_SET_FLAGS, (char *)&optParam,
|
if (WSAIoctl(s, SO_SSL_SET_FLAGS, (char *)&optParam,
|
||||||
sizeof(optParam), NULL, 0, NULL, NULL, NULL)) {
|
sizeof(optParam), NULL, 0, NULL, NULL, NULL)) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_CRIT, WSAGetLastError(), sconf,
|
ap_log_error(APLOG_MARK, APLOG_CRIT, WSAGetLastError(), sconf,
|
||||||
@@ -311,9 +311,9 @@ static int make_secure_socket(apr_pool_t *pconf, const struct sockaddr_in *serve
|
|||||||
|
|
||||||
int convert_secure_socket(conn_rec *c, apr_socket_t *csd)
|
int convert_secure_socket(conn_rec *c, apr_socket_t *csd)
|
||||||
{
|
{
|
||||||
int rcode;
|
int rcode;
|
||||||
struct tlsclientopts sWS2Opts;
|
struct tlsclientopts sWS2Opts;
|
||||||
struct nwtlsopts sNWTLSOpts;
|
struct nwtlsopts sNWTLSOpts;
|
||||||
struct sslserveropts opts;
|
struct sslserveropts opts;
|
||||||
unsigned long ulFlags;
|
unsigned long ulFlags;
|
||||||
SOCKET sock;
|
SOCKET sock;
|
||||||
@@ -322,22 +322,22 @@ int convert_secure_socket(conn_rec *c, apr_socket_t *csd)
|
|||||||
apr_os_sock_get(&sock, csd);
|
apr_os_sock_get(&sock, csd);
|
||||||
|
|
||||||
/* zero out buffers */
|
/* zero out buffers */
|
||||||
memset((char *)&sWS2Opts, 0, sizeof(struct tlsclientopts));
|
memset((char *)&sWS2Opts, 0, sizeof(struct tlsclientopts));
|
||||||
memset((char *)&sNWTLSOpts, 0, sizeof(struct nwtlsopts));
|
memset((char *)&sNWTLSOpts, 0, sizeof(struct nwtlsopts));
|
||||||
|
|
||||||
/* turn on ssl for the socket */
|
/* turn on ssl for the socket */
|
||||||
ulFlags = (numcerts ? SO_TLS_ENABLE : SO_TLS_ENABLE | SO_TLS_BLIND_ACCEPT);
|
ulFlags = (numcerts ? SO_TLS_ENABLE : SO_TLS_ENABLE | SO_TLS_BLIND_ACCEPT);
|
||||||
rcode = WSAIoctl(sock, SO_TLS_SET_FLAGS, &ulFlags, sizeof(unsigned long),
|
rcode = WSAIoctl(sock, SO_TLS_SET_FLAGS, &ulFlags, sizeof(unsigned long),
|
||||||
NULL, 0, NULL, NULL, NULL);
|
NULL, 0, NULL, NULL, NULL);
|
||||||
if (SOCKET_ERROR == rcode)
|
if (SOCKET_ERROR == rcode)
|
||||||
{
|
{
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, c->base_server,
|
ap_log_error(APLOG_MARK, APLOG_ERR, 0, c->base_server,
|
||||||
"Error: %d with ioctlsocket(flag SO_TLS_ENABLE)", WSAGetLastError());
|
"Error: %d with ioctlsocket(flag SO_TLS_ENABLE)", WSAGetLastError());
|
||||||
return rcode;
|
return rcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
ulFlags = SO_TLS_UNCLEAN_SHUTDOWN;
|
ulFlags = SO_TLS_UNCLEAN_SHUTDOWN;
|
||||||
WSAIoctl(sock, SO_TLS_SET_FLAGS, &ulFlags, sizeof(unsigned long),
|
WSAIoctl(sock, SO_TLS_SET_FLAGS, &ulFlags, sizeof(unsigned long),
|
||||||
NULL, 0, NULL, NULL, NULL);
|
NULL, 0, NULL, NULL, NULL);
|
||||||
|
|
||||||
/* setup the socket for SSL */
|
/* setup the socket for SSL */
|
||||||
@@ -365,11 +365,11 @@ int convert_secure_socket(conn_rec *c, apr_socket_t *csd)
|
|||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
/* make sure that it was successfull */
|
/* make sure that it was successfull */
|
||||||
if(SOCKET_ERROR == rcode ){
|
if(SOCKET_ERROR == rcode ){
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, c->base_server,
|
ap_log_error(APLOG_MARK, APLOG_ERR, 0, c->base_server,
|
||||||
"Error: %d with ioctl (SO_TLS_SET_CLIENT)", WSAGetLastError());
|
"Error: %d with ioctl (SO_TLS_SET_CLIENT)", WSAGetLastError());
|
||||||
}
|
}
|
||||||
return rcode;
|
return rcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SSLize_Socket(SOCKET socketHnd, char *key, request_rec *r)
|
int SSLize_Socket(SOCKET socketHnd, char *key, request_rec *r)
|
||||||
@@ -879,19 +879,19 @@ static int isSecureConnUpgradeable (const server_rec *s, const conn_rec *c)
|
|||||||
|
|
||||||
static int isSecure (const request_rec *r)
|
static int isSecure (const request_rec *r)
|
||||||
{
|
{
|
||||||
return isSecureConn (r->server, r->connection);
|
return isSecureConn (r->server, r->connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int isSecureUpgradeable (const request_rec *r)
|
static int isSecureUpgradeable (const request_rec *r)
|
||||||
{
|
{
|
||||||
return isSecureConnUpgradeable (r->server, r->connection);
|
return isSecureConnUpgradeable (r->server, r->connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int isSecureUpgraded (const request_rec *r)
|
static int isSecureUpgraded (const request_rec *r)
|
||||||
{
|
{
|
||||||
secsocket_data *csd_data = (secsocket_data*)ap_get_module_config(r->connection->conn_config, &nwssl_module);
|
secsocket_data *csd_data = (secsocket_data*)ap_get_module_config(r->connection->conn_config, &nwssl_module);
|
||||||
|
|
||||||
return csd_data->is_secure;
|
return csd_data->is_secure;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nwssl_hook_Fixup(request_rec *r)
|
static int nwssl_hook_Fixup(request_rec *r)
|
||||||
@@ -1053,14 +1053,14 @@ char *ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r,
|
|||||||
*/
|
*/
|
||||||
if (result == NULL && c != NULL) {
|
if (result == NULL && c != NULL) {
|
||||||
|
|
||||||
/* XXX-Can't get specific SSL info from NetWare */
|
/* XXX-Can't get specific SSL info from NetWare */
|
||||||
/* SSLConnRec *sslconn = myConnConfig(c);
|
/* SSLConnRec *sslconn = myConnConfig(c);
|
||||||
if (strlen(var) > 4 && strcEQn(var, "SSL_", 4)
|
if (strlen(var) > 4 && strcEQn(var, "SSL_", 4)
|
||||||
&& sslconn && sslconn->ssl)
|
&& sslconn && sslconn->ssl)
|
||||||
result = ssl_var_lookup_ssl(p, c, var+4);*/
|
result = ssl_var_lookup_ssl(p, c, var+4);*/
|
||||||
|
|
||||||
if (strlen(var) > 4 && strcEQn(var, "SSL_", 4))
|
if (strlen(var) > 4 && strcEQn(var, "SSL_", 4))
|
||||||
result = NULL;
|
result = NULL;
|
||||||
else if (strcEQ(var, "REMOTE_ADDR"))
|
else if (strcEQ(var, "REMOTE_ADDR"))
|
||||||
result = c->remote_ip;
|
result = c->remote_ip;
|
||||||
}
|
}
|
||||||
@@ -1070,7 +1070,7 @@ char *ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r,
|
|||||||
*/
|
*/
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
if (strlen(var) > 12 && strcEQn(var, "SSL_VERSION_", 12))
|
if (strlen(var) > 12 && strcEQn(var, "SSL_VERSION_", 12))
|
||||||
result = NULL;
|
result = NULL;
|
||||||
/* XXX-Can't get specific SSL info from NetWare */
|
/* XXX-Can't get specific SSL info from NetWare */
|
||||||
/*result = ssl_var_lookup_ssl_version(p, var+12);*/
|
/*result = ssl_var_lookup_ssl_version(p, var+12);*/
|
||||||
else if (strcEQ(var, "SERVER_SOFTWARE"))
|
else if (strcEQ(var, "SERVER_SOFTWARE"))
|
||||||
|
@@ -136,20 +136,20 @@ static const char *isapi_cmd_cachefile(cmd_parms *cmd, void *dummy,
|
|||||||
*/
|
*/
|
||||||
fspec = ap_server_root_relative(cmd->pool, filename);
|
fspec = ap_server_root_relative(cmd->pool, filename);
|
||||||
if (!fspec) {
|
if (!fspec) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, APR_EBADPATH, cmd->server,
|
ap_log_error(APLOG_MARK, APLOG_WARNING, APR_EBADPATH, cmd->server,
|
||||||
"ISAPI: invalid module path, skipping %s", filename);
|
"ISAPI: invalid module path, skipping %s", filename);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ((rv = apr_stat(&tmp, fspec, APR_FINFO_TYPE,
|
if ((rv = apr_stat(&tmp, fspec, APR_FINFO_TYPE,
|
||||||
cmd->temp_pool)) != APR_SUCCESS) {
|
cmd->temp_pool)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, rv, cmd->server,
|
ap_log_error(APLOG_MARK, APLOG_WARNING, rv, cmd->server,
|
||||||
"ISAPI: unable to stat, skipping %s", fspec);
|
"ISAPI: unable to stat, skipping %s", fspec);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (tmp.filetype != APR_REG) {
|
if (tmp.filetype != APR_REG) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
|
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
|
||||||
"ISAPI: not a regular file, skipping %s", fspec);
|
"ISAPI: not a regular file, skipping %s", fspec);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load the extention as cached (with null request_rec) */
|
/* Load the extention as cached (with null request_rec) */
|
||||||
@@ -157,7 +157,7 @@ static const char *isapi_cmd_cachefile(cmd_parms *cmd, void *dummy,
|
|||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, rv, cmd->server,
|
ap_log_error(APLOG_MARK, APLOG_WARNING, rv, cmd->server,
|
||||||
"ISAPI: unable to cache, skipping %s", fspec);
|
"ISAPI: unable to cache, skipping %s", fspec);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -874,12 +874,12 @@ int APR_THREAD_FUNC ServerSupportFunction(isapi_cid *cid,
|
|||||||
apr_bucket_brigade *bb;
|
apr_bucket_brigade *bb;
|
||||||
apr_bucket *b;
|
apr_bucket *b;
|
||||||
bb = apr_brigade_create(cid->r->pool, c->bucket_alloc);
|
bb = apr_brigade_create(cid->r->pool, c->bucket_alloc);
|
||||||
b = apr_bucket_transient_create((char*) data_type + ate,
|
b = apr_bucket_transient_create((char*) data_type + ate,
|
||||||
headlen - ate, c->bucket_alloc);
|
headlen - ate, c->bucket_alloc);
|
||||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||||
b = apr_bucket_flush_create(c->bucket_alloc);
|
b = apr_bucket_flush_create(c->bucket_alloc);
|
||||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||||
ap_pass_brigade(cid->r->output_filters, bb);
|
ap_pass_brigade(cid->r->output_filters, bb);
|
||||||
cid->response_sent = 1;
|
cid->response_sent = 1;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1274,13 +1274,13 @@ int APR_THREAD_FUNC ServerSupportFunction(isapi_cid *cid,
|
|||||||
apr_bucket_brigade *bb;
|
apr_bucket_brigade *bb;
|
||||||
apr_bucket *b;
|
apr_bucket *b;
|
||||||
bb = apr_brigade_create(cid->r->pool, c->bucket_alloc);
|
bb = apr_brigade_create(cid->r->pool, c->bucket_alloc);
|
||||||
b = apr_bucket_transient_create(shi->pszHeader + ate,
|
b = apr_bucket_transient_create(shi->pszHeader + ate,
|
||||||
shi->cchHeader - ate,
|
shi->cchHeader - ate,
|
||||||
c->bucket_alloc);
|
c->bucket_alloc);
|
||||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||||
b = apr_bucket_flush_create(c->bucket_alloc);
|
b = apr_bucket_flush_create(c->bucket_alloc);
|
||||||
APR_BRIGADE_INSERT_TAIL(bb, b);
|
APR_BRIGADE_INSERT_TAIL(bb, b);
|
||||||
ap_pass_brigade(cid->r->output_filters, bb);
|
ap_pass_brigade(cid->r->output_filters, bb);
|
||||||
cid->response_sent = 1;
|
cid->response_sent = 1;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1608,8 +1608,8 @@ static int isapi_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte
|
|||||||
|
|
||||||
apr_pool_create_ex(&loaded.pool, pconf, NULL, NULL);
|
apr_pool_create_ex(&loaded.pool, pconf, NULL, NULL);
|
||||||
if (!loaded.pool) {
|
if (!loaded.pool) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, NULL,
|
ap_log_error(APLOG_MARK, APLOG_ERR, APR_EGENERAL, NULL,
|
||||||
"ISAPI: could not create the isapi cache pool");
|
"ISAPI: could not create the isapi cache pool");
|
||||||
return APR_EGENERAL;
|
return APR_EGENERAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
24
modules/cache/cache_hash.c
vendored
24
modules/cache/cache_hash.c
vendored
@@ -114,9 +114,9 @@ CACHE_DECLARE(cache_hash_index_t *) cache_hash_next(cache_hash_index_t *hi)
|
|||||||
{
|
{
|
||||||
hi->this = hi->next;
|
hi->this = hi->next;
|
||||||
while (!hi->this) {
|
while (!hi->this) {
|
||||||
if (hi->index > hi->ht->max)
|
if (hi->index > hi->ht->max)
|
||||||
return NULL;
|
return NULL;
|
||||||
hi->this = hi->ht->array[hi->index++];
|
hi->this = hi->ht->array[hi->index++];
|
||||||
}
|
}
|
||||||
hi->next = hi->this->next;
|
hi->next = hi->this->next;
|
||||||
return hi;
|
return hi;
|
||||||
@@ -216,15 +216,15 @@ static cache_hash_entry_t **find_entry(cache_hash_t *ht,
|
|||||||
|
|
||||||
/* scan linked list */
|
/* scan linked list */
|
||||||
for (hep = &ht->array[hash % ht->max], he = *hep;
|
for (hep = &ht->array[hash % ht->max], he = *hep;
|
||||||
he;
|
he;
|
||||||
hep = &he->next, he = *hep) {
|
hep = &he->next, he = *hep) {
|
||||||
if (he->hash == hash &&
|
if (he->hash == hash &&
|
||||||
he->klen == klen &&
|
he->klen == klen &&
|
||||||
memcmp(he->key, key, klen) == 0)
|
memcmp(he->key, key, klen) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (he || !val)
|
if (he || !val)
|
||||||
return hep;
|
return hep;
|
||||||
/* add a new entry for non-NULL values */
|
/* add a new entry for non-NULL values */
|
||||||
he = malloc(sizeof(*he));
|
he = malloc(sizeof(*he));
|
||||||
if (!he) {
|
if (!he) {
|
||||||
@@ -247,9 +247,9 @@ CACHE_DECLARE(void *) cache_hash_get(cache_hash_t *ht,
|
|||||||
cache_hash_entry_t *he;
|
cache_hash_entry_t *he;
|
||||||
he = *find_entry(ht, key, klen, NULL);
|
he = *find_entry(ht, key, klen, NULL);
|
||||||
if (he)
|
if (he)
|
||||||
return (void *)he->val;
|
return (void *)he->val;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CACHE_DECLARE(void *) cache_hash_set(cache_hash_t *ht,
|
CACHE_DECLARE(void *) cache_hash_set(cache_hash_t *ht,
|
||||||
|
6
modules/cache/cache_util.c
vendored
6
modules/cache/cache_util.c
vendored
@@ -209,9 +209,9 @@ CACHE_DECLARE(int) ap_cache_check_freshness(cache_handle_t *h,
|
|||||||
|| ap_cache_liststr(NULL, cc_req, "no-cache", NULL)) {
|
|| ap_cache_liststr(NULL, cc_req, "no-cache", NULL)) {
|
||||||
|
|
||||||
if (!conf->ignorecachecontrol) {
|
if (!conf->ignorecachecontrol) {
|
||||||
/* Treat as stale, causing revalidation */
|
/* Treat as stale, causing revalidation */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
|
||||||
"Incoming request is asking for a uncached version of "
|
"Incoming request is asking for a uncached version of "
|
||||||
|
34
modules/cache/mod_file_cache.c
vendored
34
modules/cache/mod_file_cache.c
vendored
@@ -43,9 +43,9 @@
|
|||||||
cachefile directives into your configuration to direct files to
|
cachefile directives into your configuration to direct files to
|
||||||
be cached.
|
be cached.
|
||||||
|
|
||||||
cachefile /path/to/file1
|
cachefile /path/to/file1
|
||||||
cachefile /path/to/file2
|
cachefile /path/to/file2
|
||||||
...
|
...
|
||||||
|
|
||||||
These files are only cached when the server is restarted, so if you
|
These files are only cached when the server is restarted, so if you
|
||||||
change the list, or if the files are changed, then you'll need to
|
change the list, or if the files are changed, then you'll need to
|
||||||
@@ -138,23 +138,23 @@ static void cache_the_file(cmd_parms *cmd, const char *filename, int mmap)
|
|||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, APR_EBADPATH, cmd->server,
|
ap_log_error(APLOG_MARK, APLOG_WARNING, APR_EBADPATH, cmd->server,
|
||||||
"mod_file_cache: invalid file path "
|
"mod_file_cache: invalid file path "
|
||||||
"%s, skipping", filename);
|
"%s, skipping", filename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((rc = apr_stat(&tmp.finfo, fspec, APR_FINFO_MIN,
|
if ((rc = apr_stat(&tmp.finfo, fspec, APR_FINFO_MIN,
|
||||||
cmd->temp_pool)) != APR_SUCCESS) {
|
cmd->temp_pool)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server,
|
ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server,
|
||||||
"mod_file_cache: unable to stat(%s), skipping", fspec);
|
"mod_file_cache: unable to stat(%s), skipping", fspec);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tmp.finfo.filetype != APR_REG) {
|
if (tmp.finfo.filetype != APR_REG) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
|
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
|
||||||
"mod_file_cache: %s isn't a regular file, skipping", fspec);
|
"mod_file_cache: %s isn't a regular file, skipping", fspec);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tmp.finfo.size > AP_MAX_SENDFILE) {
|
if (tmp.finfo.size > AP_MAX_SENDFILE) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
|
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
|
||||||
"mod_file_cache: %s is too large to cache, skipping", fspec);
|
"mod_file_cache: %s is too large to cache, skipping", fspec);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = apr_file_open(&fd, fspec, APR_READ | APR_BINARY | APR_XTHREAD,
|
rc = apr_file_open(&fd, fspec, APR_READ | APR_BINARY | APR_XTHREAD,
|
||||||
@@ -162,7 +162,7 @@ static void cache_the_file(cmd_parms *cmd, const char *filename, int mmap)
|
|||||||
if (rc != APR_SUCCESS) {
|
if (rc != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server,
|
ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server,
|
||||||
"mod_file_cache: unable to open(%s, O_RDONLY), skipping", fspec);
|
"mod_file_cache: unable to open(%s, O_RDONLY), skipping", fspec);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
apr_file_inherit_set(fd);
|
apr_file_inherit_set(fd);
|
||||||
|
|
||||||
@@ -248,12 +248,12 @@ static int file_cache_xlat(request_rec *r)
|
|||||||
|
|
||||||
/* we only operate when at least one cachefile directive was used */
|
/* we only operate when at least one cachefile directive was used */
|
||||||
if (!apr_hash_count(sconf->fileht)) {
|
if (!apr_hash_count(sconf->fileht)) {
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = ap_core_translate(r);
|
res = ap_core_translate(r);
|
||||||
if (res != OK || !r->filename) {
|
if (res != OK || !r->filename) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* search the cache */
|
/* search the cache */
|
||||||
@@ -329,7 +329,7 @@ static int file_cache_handler(request_rec *r)
|
|||||||
match = ap_get_module_config(r->request_config, &file_cache_module);
|
match = ap_get_module_config(r->request_config, &file_cache_module);
|
||||||
|
|
||||||
if (match == NULL) {
|
if (match == NULL) {
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* note that we would handle GET on this resource */
|
/* note that we would handle GET on this resource */
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -93,15 +93,15 @@ DAV_DECLARE(int) dav_do_find_liveprop(const char *ns_uri, const char *name,
|
|||||||
if (strcmp(ns_uri, uris[ns]) == 0)
|
if (strcmp(ns_uri, uris[ns]) == 0)
|
||||||
break;
|
break;
|
||||||
if (uris[ns] == NULL) {
|
if (uris[ns] == NULL) {
|
||||||
/* not our property (the namespace matched none of ours) */
|
/* not our property (the namespace matched none of ours) */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* second: look for the property in the liveprop specs */
|
/* second: look for the property in the liveprop specs */
|
||||||
for (scan = group->specs; scan->name != NULL; ++scan)
|
for (scan = group->specs; scan->name != NULL; ++scan)
|
||||||
if (ns == scan->ns && strcmp(name, scan->name) == 0) {
|
if (ns == scan->ns && strcmp(name, scan->name) == 0) {
|
||||||
*hooks = group->hooks;
|
*hooks = group->hooks;
|
||||||
return scan->propid;
|
return scan->propid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not our property (same namespace, but no matching prop name) */
|
/* not our property (same namespace, but no matching prop name) */
|
||||||
|
@@ -49,7 +49,7 @@ static void dumpit(ap_filter_t *f, apr_bucket *b)
|
|||||||
conn_rec *c = f->c;
|
conn_rec *c = f->c;
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
|
||||||
"mod_dumpio: %s (%s-%s): %" APR_SIZE_T_FMT " bytes",
|
"mod_dumpio: %s (%s-%s): %" APR_SIZE_T_FMT " bytes",
|
||||||
f->frec->name,
|
f->frec->name,
|
||||||
(APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data",
|
(APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data",
|
||||||
b->type->name,
|
b->type->name,
|
||||||
@@ -101,9 +101,9 @@ static int dumpio_input_filter (ap_filter_t *f, apr_bucket_brigade *bb,
|
|||||||
conn_rec *c = f->c;
|
conn_rec *c = f->c;
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
|
||||||
"mod_dumpio: %s [%s-%s] %" APR_OFF_T_FMT " readbytes",
|
"mod_dumpio: %s [%s-%s] %" APR_OFF_T_FMT " readbytes",
|
||||||
f->frec->name,
|
f->frec->name,
|
||||||
whichmode(mode),
|
whichmode(mode),
|
||||||
((block) == APR_BLOCK_READ) ? "blocking" : "nonblocking",
|
((block) == APR_BLOCK_READ) ? "blocking" : "nonblocking",
|
||||||
readbytes) ;
|
readbytes) ;
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ static int dumpio_input_filter (ap_filter_t *f, apr_bucket_brigade *bb,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
|
||||||
"mod_dumpio: %s - %d", f->frec->name, ret) ;
|
"mod_dumpio: %s - %d", f->frec->name, ret) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return APR_SUCCESS ;
|
return APR_SUCCESS ;
|
||||||
@@ -161,10 +161,10 @@ static void dumpio_register_hooks(apr_pool_t *p)
|
|||||||
* We know that SSL is CONNECTION + 5
|
* We know that SSL is CONNECTION + 5
|
||||||
*/
|
*/
|
||||||
ap_register_output_filter("DUMPIO_OUT", dumpio_output_filter,
|
ap_register_output_filter("DUMPIO_OUT", dumpio_output_filter,
|
||||||
NULL, AP_FTYPE_CONNECTION + 3) ;
|
NULL, AP_FTYPE_CONNECTION + 3) ;
|
||||||
|
|
||||||
ap_register_input_filter("DUMPIO_IN", dumpio_input_filter,
|
ap_register_input_filter("DUMPIO_IN", dumpio_input_filter,
|
||||||
NULL, AP_FTYPE_CONNECTION + 3) ;
|
NULL, AP_FTYPE_CONNECTION + 3) ;
|
||||||
|
|
||||||
ap_hook_pre_connection(dumpio_pre_conn, NULL, NULL, APR_HOOK_MIDDLE);
|
ap_hook_pre_connection(dumpio_pre_conn, NULL, NULL, APR_HOOK_MIDDLE);
|
||||||
}
|
}
|
||||||
@@ -205,11 +205,11 @@ static const command_rec dumpio_cmds[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
module AP_MODULE_DECLARE_DATA dumpio_module = {
|
module AP_MODULE_DECLARE_DATA dumpio_module = {
|
||||||
STANDARD20_MODULE_STUFF,
|
STANDARD20_MODULE_STUFF,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
dumpio_create_sconfig,
|
dumpio_create_sconfig,
|
||||||
NULL,
|
NULL,
|
||||||
dumpio_cmds,
|
dumpio_cmds,
|
||||||
dumpio_register_hooks
|
dumpio_register_hooks
|
||||||
};
|
};
|
||||||
|
@@ -44,16 +44,16 @@ static void *CaseFilterCreateServerConfig(apr_pool_t *p,server_rec *s)
|
|||||||
static void CaseFilterInsertFilter(request_rec *r)
|
static void CaseFilterInsertFilter(request_rec *r)
|
||||||
{
|
{
|
||||||
CaseFilterConfig *pConfig=ap_get_module_config(r->server->module_config,
|
CaseFilterConfig *pConfig=ap_get_module_config(r->server->module_config,
|
||||||
&case_filter_module);
|
&case_filter_module);
|
||||||
|
|
||||||
if(!pConfig->bEnabled)
|
if(!pConfig->bEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ap_add_output_filter(s_szCaseFilterName,NULL,r,r->connection);
|
ap_add_output_filter(s_szCaseFilterName,NULL,r,r->connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
static apr_status_t CaseFilterOutFilter(ap_filter_t *f,
|
static apr_status_t CaseFilterOutFilter(ap_filter_t *f,
|
||||||
apr_bucket_brigade *pbbIn)
|
apr_bucket_brigade *pbbIn)
|
||||||
{
|
{
|
||||||
request_rec *r = f->r;
|
request_rec *r = f->r;
|
||||||
conn_rec *c = r->connection;
|
conn_rec *c = r->connection;
|
||||||
@@ -65,31 +65,31 @@ static apr_status_t CaseFilterOutFilter(ap_filter_t *f,
|
|||||||
pbktIn != APR_BRIGADE_SENTINEL(pbbIn);
|
pbktIn != APR_BRIGADE_SENTINEL(pbbIn);
|
||||||
pbktIn = APR_BUCKET_NEXT(pbktIn))
|
pbktIn = APR_BUCKET_NEXT(pbktIn))
|
||||||
{
|
{
|
||||||
const char *data;
|
const char *data;
|
||||||
apr_size_t len;
|
apr_size_t len;
|
||||||
char *buf;
|
char *buf;
|
||||||
apr_size_t n;
|
apr_size_t n;
|
||||||
apr_bucket *pbktOut;
|
apr_bucket *pbktOut;
|
||||||
|
|
||||||
if(APR_BUCKET_IS_EOS(pbktIn))
|
if(APR_BUCKET_IS_EOS(pbktIn))
|
||||||
{
|
{
|
||||||
apr_bucket *pbktEOS=apr_bucket_eos_create(c->bucket_alloc);
|
apr_bucket *pbktEOS=apr_bucket_eos_create(c->bucket_alloc);
|
||||||
APR_BRIGADE_INSERT_TAIL(pbbOut,pbktEOS);
|
APR_BRIGADE_INSERT_TAIL(pbbOut,pbktEOS);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read */
|
/* read */
|
||||||
apr_bucket_read(pbktIn,&data,&len,APR_BLOCK_READ);
|
apr_bucket_read(pbktIn,&data,&len,APR_BLOCK_READ);
|
||||||
|
|
||||||
/* write */
|
/* write */
|
||||||
buf = apr_bucket_alloc(len, c->bucket_alloc);
|
buf = apr_bucket_alloc(len, c->bucket_alloc);
|
||||||
for(n=0 ; n < len ; ++n)
|
for(n=0 ; n < len ; ++n)
|
||||||
buf[n] = apr_toupper(data[n]);
|
buf[n] = apr_toupper(data[n]);
|
||||||
|
|
||||||
pbktOut = apr_bucket_heap_create(buf, len, apr_bucket_free,
|
pbktOut = apr_bucket_heap_create(buf, len, apr_bucket_free,
|
||||||
c->bucket_alloc);
|
c->bucket_alloc);
|
||||||
APR_BRIGADE_INSERT_TAIL(pbbOut,pbktOut);
|
APR_BRIGADE_INSERT_TAIL(pbbOut,pbktOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: is there any advantage to passing a brigade for each bucket? */
|
/* XXX: is there any advantage to passing a brigade for each bucket? */
|
||||||
return ap_pass_brigade(f->next,pbbOut);
|
return ap_pass_brigade(f->next,pbbOut);
|
||||||
@@ -98,7 +98,7 @@ static apr_status_t CaseFilterOutFilter(ap_filter_t *f,
|
|||||||
static const char *CaseFilterEnable(cmd_parms *cmd, void *dummy, int arg)
|
static const char *CaseFilterEnable(cmd_parms *cmd, void *dummy, int arg)
|
||||||
{
|
{
|
||||||
CaseFilterConfig *pConfig=ap_get_module_config(cmd->server->module_config,
|
CaseFilterConfig *pConfig=ap_get_module_config(cmd->server->module_config,
|
||||||
&case_filter_module);
|
&case_filter_module);
|
||||||
pConfig->bEnabled=arg;
|
pConfig->bEnabled=arg;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -115,7 +115,7 @@ static void CaseFilterRegisterHooks(apr_pool_t *p)
|
|||||||
{
|
{
|
||||||
ap_hook_insert_filter(CaseFilterInsertFilter,NULL,NULL,APR_HOOK_MIDDLE);
|
ap_hook_insert_filter(CaseFilterInsertFilter,NULL,NULL,APR_HOOK_MIDDLE);
|
||||||
ap_register_output_filter(s_szCaseFilterName,CaseFilterOutFilter,NULL,
|
ap_register_output_filter(s_szCaseFilterName,CaseFilterOutFilter,NULL,
|
||||||
AP_FTYPE_RESOURCE);
|
AP_FTYPE_RESOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
module AP_MODULE_DECLARE_DATA case_filter_module =
|
module AP_MODULE_DECLARE_DATA case_filter_module =
|
||||||
|
@@ -546,7 +546,7 @@ static int x_handler(request_rec *r)
|
|||||||
ap_rputs(" </H1>\n", r);
|
ap_rputs(" </H1>\n", r);
|
||||||
ap_rputs(" <P>\n", r);
|
ap_rputs(" <P>\n", r);
|
||||||
ap_rprintf(r, " Apache HTTP Server version: \"%s\"\n",
|
ap_rprintf(r, " Apache HTTP Server version: \"%s\"\n",
|
||||||
ap_get_server_version());
|
ap_get_server_version());
|
||||||
ap_rputs(" <BR>\n", r);
|
ap_rputs(" <BR>\n", r);
|
||||||
ap_rprintf(r, " Server built: \"%s\"\n", ap_get_server_built());
|
ap_rprintf(r, " Server built: \"%s\"\n", ap_get_server_built());
|
||||||
ap_rputs(" </P>\n", r);;
|
ap_rputs(" </P>\n", r);;
|
||||||
|
@@ -861,7 +861,7 @@ static apr_status_t xlate_out_filter(ap_filter_t *f, apr_bucket_brigade *bb)
|
|||||||
"can't open translation %s->%s",
|
"can't open translation %s->%s",
|
||||||
dc->charset_source, dc->charset_default);
|
dc->charset_source, dc->charset_default);
|
||||||
ctx->noop = 1;
|
ctx->noop = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ctx->noop = 1;
|
ctx->noop = 1;
|
||||||
|
@@ -36,43 +36,43 @@ static int asis_handler(request_rec *r)
|
|||||||
const char *location;
|
const char *location;
|
||||||
|
|
||||||
if(strcmp(r->handler,ASIS_MAGIC_TYPE) && strcmp(r->handler,"send-as-is"))
|
if(strcmp(r->handler,ASIS_MAGIC_TYPE) && strcmp(r->handler,"send-as-is"))
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
|
|
||||||
r->allowed |= (AP_METHOD_BIT << M_GET);
|
r->allowed |= (AP_METHOD_BIT << M_GET);
|
||||||
if (r->method_number != M_GET)
|
if (r->method_number != M_GET)
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
if (r->finfo.filetype == 0) {
|
if (r->finfo.filetype == 0) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"File does not exist: %s", r->filename);
|
"File does not exist: %s", r->filename);
|
||||||
return HTTP_NOT_FOUND;
|
return HTTP_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rv = apr_file_open(&f, r->filename, APR_READ,
|
if ((rv = apr_file_open(&f, r->filename, APR_READ,
|
||||||
APR_OS_DEFAULT, r->pool)) != APR_SUCCESS) {
|
APR_OS_DEFAULT, r->pool)) != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"file permissions deny server access: %s", r->filename);
|
"file permissions deny server access: %s", r->filename);
|
||||||
return HTTP_FORBIDDEN;
|
return HTTP_FORBIDDEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_scan_script_header_err(r, f, NULL);
|
ap_scan_script_header_err(r, f, NULL);
|
||||||
location = apr_table_get(r->headers_out, "Location");
|
location = apr_table_get(r->headers_out, "Location");
|
||||||
|
|
||||||
if (location && location[0] == '/' &&
|
if (location && location[0] == '/' &&
|
||||||
((r->status == HTTP_OK) || ap_is_HTTP_REDIRECT(r->status))) {
|
((r->status == HTTP_OK) || ap_is_HTTP_REDIRECT(r->status))) {
|
||||||
|
|
||||||
apr_file_close(f);
|
apr_file_close(f);
|
||||||
|
|
||||||
/* Internal redirect -- fake-up a pseudo-request */
|
/* Internal redirect -- fake-up a pseudo-request */
|
||||||
r->status = HTTP_OK;
|
r->status = HTTP_OK;
|
||||||
|
|
||||||
/* This redirect needs to be a GET no matter what the original
|
/* This redirect needs to be a GET no matter what the original
|
||||||
* method was.
|
* method was.
|
||||||
*/
|
*/
|
||||||
r->method = apr_pstrdup(r->pool, "GET");
|
r->method = apr_pstrdup(r->pool, "GET");
|
||||||
r->method_number = M_GET;
|
r->method_number = M_GET;
|
||||||
|
|
||||||
ap_internal_redirect_handler(location, r);
|
ap_internal_redirect_handler(location, r);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!r->header_only) {
|
if (!r->header_only) {
|
||||||
|
@@ -635,8 +635,8 @@ static int cgid_server(void *data)
|
|||||||
#if defined(ENETDOWN)
|
#if defined(ENETDOWN)
|
||||||
if (errno == ENETDOWN) {
|
if (errno == ENETDOWN) {
|
||||||
/* The network has been shut down, no need to continue. Die gracefully */
|
/* The network has been shut down, no need to continue. Die gracefully */
|
||||||
++daemon_should_exit;
|
++daemon_should_exit;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (errno != EINTR) {
|
if (errno != EINTR) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, errno,
|
ap_log_error(APLOG_MARK, APLOG_ERR, errno,
|
||||||
|
@@ -42,7 +42,7 @@ AP_DECLARE_DATA ap_filter_rec_t *ap_chunk_filter_handle;
|
|||||||
AP_DECLARE_DATA ap_filter_rec_t *ap_byterange_filter_handle;
|
AP_DECLARE_DATA ap_filter_rec_t *ap_byterange_filter_handle;
|
||||||
|
|
||||||
static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy,
|
static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
|
const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
|
||||||
if (err != NULL) {
|
if (err != NULL) {
|
||||||
@@ -54,7 +54,7 @@ static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *set_keep_alive(cmd_parms *cmd, void *dummy,
|
static const char *set_keep_alive(cmd_parms *cmd, void *dummy,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
|
const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
|
||||||
if (err != NULL) {
|
if (err != NULL) {
|
||||||
@@ -65,16 +65,16 @@ static const char *set_keep_alive(cmd_parms *cmd, void *dummy,
|
|||||||
* so we accept anything but "Off" or "0" as "On"
|
* so we accept anything but "Off" or "0" as "On"
|
||||||
*/
|
*/
|
||||||
if (!strcasecmp(arg, "off") || !strcmp(arg, "0")) {
|
if (!strcasecmp(arg, "off") || !strcmp(arg, "0")) {
|
||||||
cmd->server->keep_alive = 0;
|
cmd->server->keep_alive = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cmd->server->keep_alive = 1;
|
cmd->server->keep_alive = 1;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *set_keep_alive_max(cmd_parms *cmd, void *dummy,
|
static const char *set_keep_alive_max(cmd_parms *cmd, void *dummy,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
|
const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
|
||||||
if (err != NULL) {
|
if (err != NULL) {
|
||||||
|
@@ -782,7 +782,7 @@ AP_DECLARE_NONSTD(int) ap_send_http_trace(request_rec *r)
|
|||||||
&core_module);
|
&core_module);
|
||||||
|
|
||||||
if (conf->trace_enable == AP_TRACE_DISABLE) {
|
if (conf->trace_enable == AP_TRACE_DISABLE) {
|
||||||
apr_table_setn(r->notes, "error-notes",
|
apr_table_setn(r->notes, "error-notes",
|
||||||
"TRACE denied by server configuration");
|
"TRACE denied by server configuration");
|
||||||
return HTTP_FORBIDDEN;
|
return HTTP_FORBIDDEN;
|
||||||
}
|
}
|
||||||
@@ -804,7 +804,7 @@ AP_DECLARE_NONSTD(int) ap_send_http_trace(request_rec *r)
|
|||||||
|
|
||||||
if (r->remaining > 0) {
|
if (r->remaining > 0) {
|
||||||
if (r->remaining > 65536) {
|
if (r->remaining > 65536) {
|
||||||
apr_table_setn(r->notes, "error-notes",
|
apr_table_setn(r->notes, "error-notes",
|
||||||
"Extended TRACE request bodies cannot exceed 64k\n");
|
"Extended TRACE request bodies cannot exceed 64k\n");
|
||||||
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
||||||
}
|
}
|
||||||
@@ -829,7 +829,7 @@ AP_DECLARE_NONSTD(int) ap_send_http_trace(request_rec *r)
|
|||||||
/* discard_rest_of_request_body into our buffer */
|
/* discard_rest_of_request_body into our buffer */
|
||||||
while (ap_get_client_block(r, bodyread, bodylen) > 0)
|
while (ap_get_client_block(r, bodyread, bodylen) > 0)
|
||||||
;
|
;
|
||||||
apr_table_setn(r->notes, "error-notes",
|
apr_table_setn(r->notes, "error-notes",
|
||||||
"Extended TRACE request bodies cannot exceed 64k\n");
|
"Extended TRACE request bodies cannot exceed 64k\n");
|
||||||
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
||||||
}
|
}
|
||||||
|
@@ -309,15 +309,15 @@ static int uldap_connection_open(request_rec *r,
|
|||||||
result->rc = ldapssl_set_verify_mode(LDAPSSL_VERIFY_NONE);
|
result->rc = ldapssl_set_verify_mode(LDAPSSL_VERIFY_NONE);
|
||||||
}
|
}
|
||||||
#elif defined(LDAP_OPT_X_TLS_REQUIRE_CERT)
|
#elif defined(LDAP_OPT_X_TLS_REQUIRE_CERT)
|
||||||
/* This is not a per-connection setting so just pass NULL for the
|
/* This is not a per-connection setting so just pass NULL for the
|
||||||
Ldap connection handle */
|
Ldap connection handle */
|
||||||
if (st->verify_svr_cert) {
|
if (st->verify_svr_cert) {
|
||||||
int i = LDAP_OPT_X_TLS_DEMAND;
|
int i = LDAP_OPT_X_TLS_DEMAND;
|
||||||
result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
|
result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int i = LDAP_OPT_X_TLS_NEVER;
|
int i = LDAP_OPT_X_TLS_NEVER;
|
||||||
result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
|
result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -635,20 +635,20 @@ static int uldap_cache_comparedn(request_rec *r, util_ldap_connection_t *ldc,
|
|||||||
|
|
||||||
start_over:
|
start_over:
|
||||||
if (failures++ > 10) {
|
if (failures++ > 10) {
|
||||||
/* too many failures */
|
/* too many failures */
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make a server connection */
|
/* make a server connection */
|
||||||
if (LDAP_SUCCESS != (result = uldap_connection_open(r, ldc))) {
|
if (LDAP_SUCCESS != (result = uldap_connection_open(r, ldc))) {
|
||||||
/* connect to server failed */
|
/* connect to server failed */
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* search for reqdn */
|
/* search for reqdn */
|
||||||
if ((result = ldap_search_ext_s(ldc->ldap, (char *)reqdn, LDAP_SCOPE_BASE,
|
if ((result = ldap_search_ext_s(ldc->ldap, (char *)reqdn, LDAP_SCOPE_BASE,
|
||||||
"(objectclass=*)", NULL, 1,
|
"(objectclass=*)", NULL, 1,
|
||||||
NULL, NULL, NULL, -1, &res))
|
NULL, NULL, NULL, -1, &res))
|
||||||
== LDAP_SERVER_DOWN)
|
== LDAP_SERVER_DOWN)
|
||||||
{
|
{
|
||||||
ldc->reason = "DN Comparison ldap_search_ext_s() "
|
ldc->reason = "DN Comparison ldap_search_ext_s() "
|
||||||
@@ -924,9 +924,9 @@ start_over:
|
|||||||
|
|
||||||
/* try do the search */
|
/* try do the search */
|
||||||
if ((result = ldap_search_ext_s(ldc->ldap,
|
if ((result = ldap_search_ext_s(ldc->ldap,
|
||||||
(char *)basedn, scope,
|
(char *)basedn, scope,
|
||||||
(char *)filter, attrs, 0,
|
(char *)filter, attrs, 0,
|
||||||
NULL, NULL, NULL, -1, &res))
|
NULL, NULL, NULL, -1, &res))
|
||||||
== LDAP_SERVER_DOWN)
|
== LDAP_SERVER_DOWN)
|
||||||
{
|
{
|
||||||
ldc->reason = "ldap_search_ext_s() for user failed with server down";
|
ldc->reason = "ldap_search_ext_s() for user failed with server down";
|
||||||
@@ -1164,9 +1164,9 @@ start_over:
|
|||||||
|
|
||||||
/* try do the search */
|
/* try do the search */
|
||||||
if ((result = ldap_search_ext_s(ldc->ldap,
|
if ((result = ldap_search_ext_s(ldc->ldap,
|
||||||
(char *)basedn, scope,
|
(char *)basedn, scope,
|
||||||
(char *)filter, attrs, 0,
|
(char *)filter, attrs, 0,
|
||||||
NULL, NULL, NULL, -1, &res))
|
NULL, NULL, NULL, -1, &res))
|
||||||
== LDAP_SERVER_DOWN)
|
== LDAP_SERVER_DOWN)
|
||||||
{
|
{
|
||||||
ldc->reason = "ldap_search_ext_s() for user failed with server down";
|
ldc->reason = "ldap_search_ext_s() for user failed with server down";
|
||||||
@@ -1295,7 +1295,7 @@ static const char *util_ldap_set_cache_bytes(cmd_parms *cmd, void *dummy,
|
|||||||
{
|
{
|
||||||
util_ldap_state_t *st =
|
util_ldap_state_t *st =
|
||||||
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
||||||
&ldap_module);
|
&ldap_module);
|
||||||
|
|
||||||
st->cache_bytes = atol(bytes);
|
st->cache_bytes = atol(bytes);
|
||||||
|
|
||||||
@@ -1333,7 +1333,7 @@ static const char *util_ldap_set_cache_ttl(cmd_parms *cmd, void *dummy,
|
|||||||
{
|
{
|
||||||
util_ldap_state_t *st =
|
util_ldap_state_t *st =
|
||||||
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
||||||
&ldap_module);
|
&ldap_module);
|
||||||
|
|
||||||
st->search_cache_ttl = atol(ttl) * 1000000;
|
st->search_cache_ttl = atol(ttl) * 1000000;
|
||||||
|
|
||||||
@@ -1349,7 +1349,7 @@ static const char *util_ldap_set_cache_entries(cmd_parms *cmd, void *dummy,
|
|||||||
{
|
{
|
||||||
util_ldap_state_t *st =
|
util_ldap_state_t *st =
|
||||||
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
||||||
&ldap_module);
|
&ldap_module);
|
||||||
|
|
||||||
|
|
||||||
st->search_cache_size = atol(size);
|
st->search_cache_size = atol(size);
|
||||||
@@ -1369,7 +1369,7 @@ static const char *util_ldap_set_opcache_ttl(cmd_parms *cmd, void *dummy,
|
|||||||
{
|
{
|
||||||
util_ldap_state_t *st =
|
util_ldap_state_t *st =
|
||||||
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
||||||
&ldap_module);
|
&ldap_module);
|
||||||
|
|
||||||
st->compare_cache_ttl = atol(ttl) * 1000000;
|
st->compare_cache_ttl = atol(ttl) * 1000000;
|
||||||
|
|
||||||
@@ -1385,7 +1385,7 @@ static const char *util_ldap_set_opcache_entries(cmd_parms *cmd, void *dummy,
|
|||||||
{
|
{
|
||||||
util_ldap_state_t *st =
|
util_ldap_state_t *st =
|
||||||
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
||||||
&ldap_module);
|
&ldap_module);
|
||||||
|
|
||||||
st->compare_cache_size = atol(size);
|
st->compare_cache_size = atol(size);
|
||||||
if (st->compare_cache_size < 0) {
|
if (st->compare_cache_size < 0) {
|
||||||
@@ -1699,7 +1699,7 @@ static const char *util_ldap_set_connection_timeout(cmd_parms *cmd,
|
|||||||
{
|
{
|
||||||
util_ldap_state_t *st =
|
util_ldap_state_t *st =
|
||||||
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
|
||||||
&ldap_module);
|
&ldap_module);
|
||||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
|
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
|
||||||
|
|
||||||
if (err != NULL) {
|
if (err != NULL) {
|
||||||
|
@@ -247,8 +247,8 @@ int util_ldap_compare_node_compare(void *a, void *b)
|
|||||||
util_compare_node_t *nb = b;
|
util_compare_node_t *nb = b;
|
||||||
|
|
||||||
return (strcmp(na->dn, nb->dn) == 0 &&
|
return (strcmp(na->dn, nb->dn) == 0 &&
|
||||||
strcmp(na->attrib, nb->attrib) == 0 &&
|
strcmp(na->attrib, nb->attrib) == 0 &&
|
||||||
strcmp(na->value, nb->value) == 0);
|
strcmp(na->value, nb->value) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *util_ldap_compare_node_copy(util_ald_cache_t *cache, void *c)
|
void *util_ldap_compare_node_copy(util_ald_cache_t *cache, void *c)
|
||||||
|
@@ -78,7 +78,7 @@ static void *merge_action_dir_configs(apr_pool_t *p, void *basev, void *addv)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
new->action_types = apr_table_overlay(p, add->action_types,
|
new->action_types = apr_table_overlay(p, add->action_types,
|
||||||
base->action_types);
|
base->action_types);
|
||||||
|
|
||||||
for (i = 0; i < METHODS; ++i) {
|
for (i = 0; i < METHODS; ++i) {
|
||||||
new->scripted[i] = add->scripted[i] ? add->scripted[i]
|
new->scripted[i] = add->scripted[i] ? add->scripted[i]
|
||||||
@@ -173,7 +173,7 @@ static int action_handler(request_rec *r)
|
|||||||
|
|
||||||
/* Check for looping, which can happen if the CGI script isn't */
|
/* Check for looping, which can happen if the CGI script isn't */
|
||||||
if (script && r->prev && r->prev->prev)
|
if (script && r->prev && r->prev->prev)
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
|
|
||||||
/* Second, check for actions (which override the method scripts) */
|
/* Second, check for actions (which override the method scripts) */
|
||||||
action = r->handler ? r->handler :
|
action = r->handler ? r->handler :
|
||||||
@@ -195,7 +195,7 @@ static int action_handler(request_rec *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (script == NULL)
|
if (script == NULL)
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
|
|
||||||
ap_internal_redirect_handler(apr_pstrcat(r->pool, script,
|
ap_internal_redirect_handler(apr_pstrcat(r->pool, script,
|
||||||
ap_escape_uri(r->pool, r->uri),
|
ap_escape_uri(r->pool, r->uri),
|
||||||
|
@@ -181,8 +181,8 @@ static int pointinpoly(const double point[2], double pgon[MAXVERTS][2])
|
|||||||
double x = point[X], y = point[Y];
|
double x = point[X], y = point[Y];
|
||||||
|
|
||||||
for (numverts = 0; pgon[numverts][X] != -1 && numverts < MAXVERTS;
|
for (numverts = 0; pgon[numverts][X] != -1 && numverts < MAXVERTS;
|
||||||
numverts++) {
|
numverts++) {
|
||||||
/* just counting the vertexes */
|
/* just counting the vertexes */
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < numverts; i++) {
|
for (i = 0; i < numverts; i++) {
|
||||||
@@ -193,12 +193,12 @@ static int pointinpoly(const double point[2], double pgon[MAXVERTS][2])
|
|||||||
double d=(y - y1) * (x2 - x1) - (x - x1) * (y2 - y1);
|
double d=(y - y1) * (x2 - x1) - (x - x1) * (y2 - y1);
|
||||||
|
|
||||||
if ((y1 >= y) != (y2 >= y)) {
|
if ((y1 >= y) != (y2 >= y)) {
|
||||||
crossings +=y2 - y1 >= 0 ? d >= 0 : d <= 0;
|
crossings +=y2 - y1 >= 0 ? d >= 0 : d <= 0;
|
||||||
}
|
}
|
||||||
if (!d && fmin(x1,x2) <= x && x <= fmax(x1,x2)
|
if (!d && fmin(x1,x2) <= x && x <= fmax(x1,x2)
|
||||||
&& fmin(y1,y2) <= y && y <= fmax(y1,y2)) {
|
&& fmin(y1,y2) <= y && y <= fmax(y1,y2)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return crossings & 0x01;
|
return crossings & 0x01;
|
||||||
}
|
}
|
||||||
@@ -270,13 +270,13 @@ static double get_y_coord(const char *args)
|
|||||||
while (*start_of_y && !apr_isdigit(*start_of_y)) {
|
while (*start_of_y && !apr_isdigit(*start_of_y)) {
|
||||||
start_of_y++; /* jump to the first digit, but not
|
start_of_y++; /* jump to the first digit, but not
|
||||||
past the end */
|
past the end */
|
||||||
}
|
}
|
||||||
|
|
||||||
y_coord = strtod(start_of_y, &endptr);
|
y_coord = strtod(start_of_y, &endptr);
|
||||||
|
|
||||||
if (endptr > start_of_y) {
|
if (endptr > start_of_y) {
|
||||||
return (y_coord);
|
return (y_coord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (-1); /* if no conversion was made, or
|
return (-1); /* if no conversion was made, or
|
||||||
@@ -304,16 +304,16 @@ static void read_quoted(char **string, char **quoted_part)
|
|||||||
|
|
||||||
if (*strp == '"') { /* if that character is a double quote */
|
if (*strp == '"') { /* if that character is a double quote */
|
||||||
strp++; /* step over it */
|
strp++; /* step over it */
|
||||||
*quoted_part = strp; /* note where the quoted part begins */
|
*quoted_part = strp; /* note where the quoted part begins */
|
||||||
|
|
||||||
while (*strp && *strp != '"') {
|
while (*strp && *strp != '"') {
|
||||||
++strp; /* skip the quoted portion */
|
++strp; /* skip the quoted portion */
|
||||||
}
|
}
|
||||||
|
|
||||||
*strp = '\0'; /* end the string with a NUL */
|
*strp = '\0'; /* end the string with a NUL */
|
||||||
|
|
||||||
strp++; /* step over the last double quote */
|
strp++; /* step over the last double quote */
|
||||||
*string = strp;
|
*string = strp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ static char *imap_url(request_rec *r, const char *base, const char *value)
|
|||||||
char *my_base;
|
char *my_base;
|
||||||
|
|
||||||
if (!strcasecmp(value, "map") || !strcasecmp(value, "menu")) {
|
if (!strcasecmp(value, "map") || !strcasecmp(value, "menu")) {
|
||||||
return ap_construct_url(r->pool, r->uri, r);
|
return ap_construct_url(r->pool, r->uri, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcasecmp(value, "nocontent") || !strcasecmp(value, "error")) {
|
if (!strcasecmp(value, "nocontent") || !strcasecmp(value, "error")) {
|
||||||
@@ -342,11 +342,11 @@ static char *imap_url(request_rec *r, const char *base, const char *value)
|
|||||||
if (!strcasecmp(value, "referer")) {
|
if (!strcasecmp(value, "referer")) {
|
||||||
referer = apr_table_get(r->headers_in, "Referer");
|
referer = apr_table_get(r->headers_in, "Referer");
|
||||||
if (referer && *referer) {
|
if (referer && *referer) {
|
||||||
return apr_pstrdup(r->pool, referer);
|
return apr_pstrdup(r->pool, referer);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* XXX: This used to do *value = '\0'; ... which is totally bogus
|
/* XXX: This used to do *value = '\0'; ... which is totally bogus
|
||||||
* because it hammers the passed in value, which can be a string
|
* because it hammers the passed in value, which can be a string
|
||||||
* constant, or part of a config, or whatever. Total garbage.
|
* constant, or part of a config, or whatever. Total garbage.
|
||||||
* This works around that without changing the rest of this
|
* This works around that without changing the rest of this
|
||||||
* code much
|
* code much
|
||||||
@@ -358,21 +358,21 @@ static char *imap_url(request_rec *r, const char *base, const char *value)
|
|||||||
|
|
||||||
string_pos_const = value;
|
string_pos_const = value;
|
||||||
while (apr_isalpha(*string_pos_const)) {
|
while (apr_isalpha(*string_pos_const)) {
|
||||||
string_pos_const++; /* go along the URL from the map
|
string_pos_const++; /* go along the URL from the map
|
||||||
until a non-letter */
|
until a non-letter */
|
||||||
}
|
}
|
||||||
if (*string_pos_const == ':') {
|
if (*string_pos_const == ':') {
|
||||||
/* if letters and then a colon (like http:) */
|
/* if letters and then a colon (like http:) */
|
||||||
/* it's an absolute URL, so use it! */
|
/* it's an absolute URL, so use it! */
|
||||||
return apr_pstrdup(r->pool, value);
|
return apr_pstrdup(r->pool, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!base || !*base) {
|
if (!base || !*base) {
|
||||||
if (value && *value) {
|
if (value && *value) {
|
||||||
return apr_pstrdup(r->pool, value); /* no base: use what is given */
|
return apr_pstrdup(r->pool, value); /* no base: use what is given */
|
||||||
}
|
}
|
||||||
/* no base, no value: pick a simple default */
|
/* no base, no value: pick a simple default */
|
||||||
return ap_construct_url(r->pool, "/", r);
|
return ap_construct_url(r->pool, "/", r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* must be a relative URL to be combined with base */
|
/* must be a relative URL to be combined with base */
|
||||||
@@ -427,11 +427,11 @@ static char *imap_url(request_rec *r, const char *base, const char *value)
|
|||||||
|
|
||||||
if ((string_pos = strrchr(directory, '/'))) {
|
if ((string_pos = strrchr(directory, '/'))) {
|
||||||
*string_pos = '\0';
|
*string_pos = '\0';
|
||||||
}
|
}
|
||||||
clen = strlen(directory);
|
clen = strlen(directory);
|
||||||
if (clen == 0) {
|
if (clen == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
value += 2; /* jump over the '..' that we found in the
|
value += 2; /* jump over the '..' that we found in the
|
||||||
@@ -448,13 +448,13 @@ static char *imap_url(request_rec *r, const char *base, const char *value)
|
|||||||
to do. This way, we leave the starting
|
to do. This way, we leave the starting
|
||||||
'/' on value after the last '..', but get
|
'/' on value after the last '..', but get
|
||||||
rid of it otherwise */
|
rid of it otherwise */
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* by this point, value does not start
|
} /* by this point, value does not start
|
||||||
with '..' */
|
with '..' */
|
||||||
|
|
||||||
if (value && *value) {
|
if (value && *value) {
|
||||||
return apr_pstrcat(r->pool, my_base, value, NULL);
|
return apr_pstrcat(r->pool, my_base, value, NULL);
|
||||||
}
|
}
|
||||||
return my_base;
|
return my_base;
|
||||||
}
|
}
|
||||||
@@ -609,12 +609,12 @@ static int imap_handler_internal(request_rec *r)
|
|||||||
base = imap_url(r, NULL, imap_base); /* set base according
|
base = imap_url(r, NULL, imap_base); /* set base according
|
||||||
to default */
|
to default */
|
||||||
if (!base) {
|
if (!base) {
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
mapdflt = imap_url(r, NULL, imap_default); /* and default to
|
mapdflt = imap_url(r, NULL, imap_default); /* and default to
|
||||||
global default */
|
global default */
|
||||||
if (!mapdflt) {
|
if (!mapdflt) {
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
testpoint[X] = get_x_coord(r->args);
|
testpoint[X] = get_x_coord(r->args);
|
||||||
@@ -629,7 +629,7 @@ static int imap_handler_internal(request_rec *r)
|
|||||||
if (strncasecmp(imap_menu, "none", 2)) {
|
if (strncasecmp(imap_menu, "none", 2)) {
|
||||||
showmenu = 1; /* show the menu _unless_ ImapMenu is
|
showmenu = 1; /* show the menu _unless_ ImapMenu is
|
||||||
'none' or 'no' */
|
'none' or 'no' */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showmenu) { /* send start of imagemap menu if
|
if (showmenu) { /* send start of imagemap menu if
|
||||||
@@ -653,51 +653,51 @@ static int imap_handler_internal(request_rec *r)
|
|||||||
} /* blank lines and comments are ignored
|
} /* blank lines and comments are ignored
|
||||||
if we aren't printing a menu */
|
if we aren't printing a menu */
|
||||||
|
|
||||||
/* find the first two space delimited fields, recall that
|
/* find the first two space delimited fields, recall that
|
||||||
* ap_cfg_getline has removed leading/trailing whitespace.
|
* ap_cfg_getline has removed leading/trailing whitespace.
|
||||||
*
|
*
|
||||||
* note that we're tokenizing as we go... if we were to use the
|
* note that we're tokenizing as we go... if we were to use the
|
||||||
* ap_getword() class of functions we would end up allocating extra
|
* ap_getword() class of functions we would end up allocating extra
|
||||||
* memory for every line of the map file
|
* memory for every line of the map file
|
||||||
*/
|
*/
|
||||||
string_pos = input;
|
string_pos = input;
|
||||||
if (!*string_pos) { /* need at least two fields */
|
if (!*string_pos) { /* need at least two fields */
|
||||||
goto need_2_fields;
|
goto need_2_fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
directive = string_pos;
|
directive = string_pos;
|
||||||
while (*string_pos && !apr_isspace(*string_pos)) { /* past directive */
|
while (*string_pos && !apr_isspace(*string_pos)) { /* past directive */
|
||||||
++string_pos;
|
++string_pos;
|
||||||
}
|
}
|
||||||
if (!*string_pos) { /* need at least two fields */
|
if (!*string_pos) { /* need at least two fields */
|
||||||
goto need_2_fields;
|
goto need_2_fields;
|
||||||
}
|
}
|
||||||
*string_pos++ = '\0';
|
*string_pos++ = '\0';
|
||||||
|
|
||||||
if (!*string_pos) { /* need at least two fields */
|
if (!*string_pos) { /* need at least two fields */
|
||||||
goto need_2_fields;
|
goto need_2_fields;
|
||||||
}
|
}
|
||||||
while(*string_pos && apr_isspace(*string_pos)) { /* past whitespace */
|
while(*string_pos && apr_isspace(*string_pos)) { /* past whitespace */
|
||||||
++string_pos;
|
++string_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = string_pos;
|
value = string_pos;
|
||||||
while (*string_pos && !apr_isspace(*string_pos)) { /* past value */
|
while (*string_pos && !apr_isspace(*string_pos)) { /* past value */
|
||||||
++string_pos;
|
++string_pos;
|
||||||
}
|
}
|
||||||
if (apr_isspace(*string_pos)) {
|
if (apr_isspace(*string_pos)) {
|
||||||
*string_pos++ = '\0';
|
*string_pos++ = '\0';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* end of input, don't advance past it */
|
/* end of input, don't advance past it */
|
||||||
*string_pos = '\0';
|
*string_pos = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strncasecmp(directive, "base", 4)) { /* base, base_uri */
|
if (!strncasecmp(directive, "base", 4)) { /* base, base_uri */
|
||||||
base = imap_url(r, NULL, value);
|
base = imap_url(r, NULL, value);
|
||||||
if (!base) {
|
if (!base) {
|
||||||
goto menu_bail;
|
goto menu_bail;
|
||||||
}
|
}
|
||||||
continue; /* base is never printed to a menu */
|
continue; /* base is never printed to a menu */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,14 +705,14 @@ static int imap_handler_internal(request_rec *r)
|
|||||||
|
|
||||||
if (!strcasecmp(directive, "default")) { /* default */
|
if (!strcasecmp(directive, "default")) { /* default */
|
||||||
mapdflt = imap_url(r, NULL, value);
|
mapdflt = imap_url(r, NULL, value);
|
||||||
if (!mapdflt) {
|
if (!mapdflt) {
|
||||||
goto menu_bail;
|
goto menu_bail;
|
||||||
}
|
}
|
||||||
if (showmenu) { /* print the default if there's a menu */
|
if (showmenu) { /* print the default if there's a menu */
|
||||||
redirect = imap_url(r, base, mapdflt);
|
redirect = imap_url(r, base, mapdflt);
|
||||||
if (!redirect) {
|
if (!redirect) {
|
||||||
goto menu_bail;
|
goto menu_bail;
|
||||||
}
|
}
|
||||||
menu_default(r, imap_menu, redirect,
|
menu_default(r, imap_menu, redirect,
|
||||||
href_text ? href_text : mapdflt);
|
href_text ? href_text : mapdflt);
|
||||||
}
|
}
|
||||||
@@ -726,17 +726,17 @@ static int imap_handler_internal(request_rec *r)
|
|||||||
/* Now skip what we just read... we can't use ANSIism %n */
|
/* Now skip what we just read... we can't use ANSIism %n */
|
||||||
while (apr_isspace(*string_pos)) { /* past whitespace */
|
while (apr_isspace(*string_pos)) { /* past whitespace */
|
||||||
string_pos++;
|
string_pos++;
|
||||||
}
|
}
|
||||||
while (apr_isdigit(*string_pos)) { /* and the 1st number */
|
while (apr_isdigit(*string_pos)) { /* and the 1st number */
|
||||||
string_pos++;
|
string_pos++;
|
||||||
}
|
}
|
||||||
string_pos++; /* skip the ',' */
|
string_pos++; /* skip the ',' */
|
||||||
while (apr_isspace(*string_pos)) { /* past any more whitespace */
|
while (apr_isspace(*string_pos)) { /* past any more whitespace */
|
||||||
string_pos++;
|
string_pos++;
|
||||||
}
|
}
|
||||||
while (apr_isdigit(*string_pos)) { /* 2nd number */
|
while (apr_isdigit(*string_pos)) { /* 2nd number */
|
||||||
string_pos++;
|
string_pos++;
|
||||||
}
|
}
|
||||||
vertex++;
|
vertex++;
|
||||||
} /* so long as there are more vertices to
|
} /* so long as there are more vertices to
|
||||||
read, and we have room, read them in.
|
read, and we have room, read them in.
|
||||||
@@ -746,14 +746,14 @@ static int imap_handler_internal(request_rec *r)
|
|||||||
pointarray[vertex][X] = -1; /* signals the end of vertices */
|
pointarray[vertex][X] = -1; /* signals the end of vertices */
|
||||||
|
|
||||||
if (showmenu) {
|
if (showmenu) {
|
||||||
if (!href_text) {
|
if (!href_text) {
|
||||||
read_quoted(&string_pos, &href_text); /* href text could
|
read_quoted(&string_pos, &href_text); /* href text could
|
||||||
be here instead */
|
be here instead */
|
||||||
}
|
}
|
||||||
redirect = imap_url(r, base, value);
|
redirect = imap_url(r, base, value);
|
||||||
if (!redirect) {
|
if (!redirect) {
|
||||||
goto menu_bail;
|
goto menu_bail;
|
||||||
}
|
}
|
||||||
menu_directive(r, imap_menu, redirect,
|
menu_directive(r, imap_menu, redirect,
|
||||||
href_text ? href_text : value);
|
href_text ? href_text : value);
|
||||||
continue;
|
continue;
|
||||||
@@ -764,16 +764,16 @@ static int imap_handler_internal(request_rec *r)
|
|||||||
continue; /* don't try the following tests if testpoints
|
continue; /* don't try the following tests if testpoints
|
||||||
are invalid, or if there are no
|
are invalid, or if there are no
|
||||||
coordinates */
|
coordinates */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcasecmp(directive, "poly")) { /* poly */
|
if (!strcasecmp(directive, "poly")) { /* poly */
|
||||||
|
|
||||||
if (pointinpoly(testpoint, pointarray)) {
|
if (pointinpoly(testpoint, pointarray)) {
|
||||||
ap_cfg_closefile(imap);
|
ap_cfg_closefile(imap);
|
||||||
redirect = imap_url(r, base, value);
|
redirect = imap_url(r, base, value);
|
||||||
if (!redirect) {
|
if (!redirect) {
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
return (imap_reply(r, redirect));
|
return (imap_reply(r, redirect));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@@ -782,11 +782,11 @@ static int imap_handler_internal(request_rec *r)
|
|||||||
if (!strcasecmp(directive, "circle")) { /* circle */
|
if (!strcasecmp(directive, "circle")) { /* circle */
|
||||||
|
|
||||||
if (pointincircle(testpoint, pointarray)) {
|
if (pointincircle(testpoint, pointarray)) {
|
||||||
ap_cfg_closefile(imap);
|
ap_cfg_closefile(imap);
|
||||||
redirect = imap_url(r, base, value);
|
redirect = imap_url(r, base, value);
|
||||||
if (!redirect) {
|
if (!redirect) {
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
return (imap_reply(r, redirect));
|
return (imap_reply(r, redirect));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@@ -795,11 +795,11 @@ static int imap_handler_internal(request_rec *r)
|
|||||||
if (!strcasecmp(directive, "rect")) { /* rect */
|
if (!strcasecmp(directive, "rect")) { /* rect */
|
||||||
|
|
||||||
if (pointinrect(testpoint, pointarray)) {
|
if (pointinrect(testpoint, pointarray)) {
|
||||||
ap_cfg_closefile(imap);
|
ap_cfg_closefile(imap);
|
||||||
redirect = imap_url(r, base, value);
|
redirect = imap_url(r, base, value);
|
||||||
if (!redirect) {
|
if (!redirect) {
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
return (imap_reply(r, redirect));
|
return (imap_reply(r, redirect));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@@ -808,7 +808,7 @@ static int imap_handler_internal(request_rec *r)
|
|||||||
if (!strcasecmp(directive, "point")) { /* point */
|
if (!strcasecmp(directive, "point")) { /* point */
|
||||||
|
|
||||||
if (is_closer(testpoint, pointarray, &closest_yet)) {
|
if (is_closer(testpoint, pointarray, &closest_yet)) {
|
||||||
closest = apr_pstrdup(r->pool, value);
|
closest = apr_pstrdup(r->pool, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -826,18 +826,18 @@ static int imap_handler_internal(request_rec *r)
|
|||||||
|
|
||||||
if (closest) { /* if a 'point' directive has been seen */
|
if (closest) { /* if a 'point' directive has been seen */
|
||||||
redirect = imap_url(r, base, closest);
|
redirect = imap_url(r, base, closest);
|
||||||
if (!redirect) {
|
if (!redirect) {
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
return (imap_reply(r, redirect));
|
return (imap_reply(r, redirect));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapdflt) { /* a default should be defined, even if
|
if (mapdflt) { /* a default should be defined, even if
|
||||||
only 'nocontent' */
|
only 'nocontent' */
|
||||||
redirect = imap_url(r, base, mapdflt);
|
redirect = imap_url(r, base, mapdflt);
|
||||||
if (!redirect) {
|
if (!redirect) {
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
return (imap_reply(r, redirect));
|
return (imap_reply(r, redirect));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -846,18 +846,18 @@ static int imap_handler_internal(request_rec *r)
|
|||||||
|
|
||||||
need_2_fields:
|
need_2_fields:
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"map file %s, line %d syntax error: requires at "
|
"map file %s, line %d syntax error: requires at "
|
||||||
"least two fields", r->uri, imap->line_number);
|
"least two fields", r->uri, imap->line_number);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
menu_bail:
|
menu_bail:
|
||||||
ap_cfg_closefile(imap);
|
ap_cfg_closefile(imap);
|
||||||
if (showmenu) {
|
if (showmenu) {
|
||||||
/* There's not much else we can do ... we've already sent the headers
|
/* There's not much else we can do ... we've already sent the headers
|
||||||
* to the client.
|
* to the client.
|
||||||
*/
|
*/
|
||||||
ap_rputs("\n\n[an internal server error occured]\n", r);
|
ap_rputs("\n\n[an internal server error occured]\n", r);
|
||||||
menu_footer(r);
|
menu_footer(r);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
@@ -869,8 +869,8 @@ static int imap_handler(request_rec *r)
|
|||||||
* imagemaps
|
* imagemaps
|
||||||
*/
|
*/
|
||||||
if (r->method_number != M_GET || (strcmp(r->handler,IMAP_MAGIC_TYPE)
|
if (r->method_number != M_GET || (strcmp(r->handler,IMAP_MAGIC_TYPE)
|
||||||
&& strcmp(r->handler, "imap-file"))) {
|
&& strcmp(r->handler, "imap-file"))) {
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return imap_handler_internal(r);
|
return imap_handler_internal(r);
|
||||||
|
@@ -179,7 +179,7 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
|
|||||||
* Check both dynamically-loaded modules and statically-linked modules.
|
* Check both dynamically-loaded modules and statically-linked modules.
|
||||||
*/
|
*/
|
||||||
sconf = (so_server_conf *)ap_get_module_config(cmd->server->module_config,
|
sconf = (so_server_conf *)ap_get_module_config(cmd->server->module_config,
|
||||||
&so_module);
|
&so_module);
|
||||||
modie = (ap_module_symbol_t *)sconf->loaded_modules->elts;
|
modie = (ap_module_symbol_t *)sconf->loaded_modules->elts;
|
||||||
for (i = 0; i < sconf->loaded_modules->nelts; i++) {
|
for (i = 0; i < sconf->loaded_modules->nelts; i++) {
|
||||||
modi = &modie[i];
|
modi = &modie[i];
|
||||||
@@ -239,12 +239,12 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
|
|||||||
char my_error[256];
|
char my_error[256];
|
||||||
|
|
||||||
return apr_pstrcat(cmd->pool, "Cannot load ", szModuleFile,
|
return apr_pstrcat(cmd->pool, "Cannot load ", szModuleFile,
|
||||||
" into server: ",
|
" into server: ",
|
||||||
apr_dso_error(modhandle, my_error, sizeof(my_error)),
|
apr_dso_error(modhandle, my_error, sizeof(my_error)),
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, cmd->pool,
|
ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, cmd->pool,
|
||||||
"loaded module %s", modname);
|
"loaded module %s", modname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve the pointer to the module structure through the module name:
|
* Retrieve the pointer to the module structure through the module name:
|
||||||
@@ -254,10 +254,10 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
|
|||||||
if (apr_dso_sym(&modsym, modhandle, modname) != APR_SUCCESS) {
|
if (apr_dso_sym(&modsym, modhandle, modname) != APR_SUCCESS) {
|
||||||
char my_error[256];
|
char my_error[256];
|
||||||
|
|
||||||
return apr_pstrcat(cmd->pool, "Can't locate API module structure `",
|
return apr_pstrcat(cmd->pool, "Can't locate API module structure `",
|
||||||
modname, "' in file ", szModuleFile, ": ",
|
modname, "' in file ", szModuleFile, ": ",
|
||||||
apr_dso_error(modhandle, my_error, sizeof(my_error)),
|
apr_dso_error(modhandle, my_error, sizeof(my_error)),
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
modp = (module*) modsym;
|
modp = (module*) modsym;
|
||||||
modp->dynamic_load_handle = (apr_dso_handle_t *)modhandle;
|
modp->dynamic_load_handle = (apr_dso_handle_t *)modhandle;
|
||||||
@@ -316,14 +316,14 @@ static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)
|
|||||||
if (apr_dso_load(&handle, file, cmd->pool) != APR_SUCCESS) {
|
if (apr_dso_load(&handle, file, cmd->pool) != APR_SUCCESS) {
|
||||||
char my_error[256];
|
char my_error[256];
|
||||||
|
|
||||||
return apr_pstrcat(cmd->pool, "Cannot load ", filename,
|
return apr_pstrcat(cmd->pool, "Cannot load ", filename,
|
||||||
" into server: ",
|
" into server: ",
|
||||||
apr_dso_error(handle, my_error, sizeof(my_error)),
|
apr_dso_error(handle, my_error, sizeof(my_error)),
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
|
||||||
"loaded file %s", filename);
|
"loaded file %s", filename);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -395,7 +395,7 @@ static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *load_module(cmd_parms *cmd, void *dummy,
|
static const char *load_module(cmd_parms *cmd, void *dummy,
|
||||||
const char *modname, const char *filename)
|
const char *modname, const char *filename)
|
||||||
{
|
{
|
||||||
ap_log_perror(APLOG_MARK, APLOG_STARTUP, 0, cmd->pool,
|
ap_log_perror(APLOG_MARK, APLOG_STARTUP, 0, cmd->pool,
|
||||||
"WARNING: LoadModule not supported on this platform");
|
"WARNING: LoadModule not supported on this platform");
|
||||||
|
@@ -164,22 +164,22 @@ static sp_reason spdist(const char *s, const char *t)
|
|||||||
for (; apr_tolower(*s) == apr_tolower(*t); t++, s++) {
|
for (; apr_tolower(*s) == apr_tolower(*t); t++, s++) {
|
||||||
if (*t == '\0') {
|
if (*t == '\0') {
|
||||||
return SP_MISCAPITALIZED; /* exact match (sans case) */
|
return SP_MISCAPITALIZED; /* exact match (sans case) */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*s) {
|
if (*s) {
|
||||||
if (*t) {
|
if (*t) {
|
||||||
if (s[1] && t[1] && apr_tolower(*s) == apr_tolower(t[1])
|
if (s[1] && t[1] && apr_tolower(*s) == apr_tolower(t[1])
|
||||||
&& apr_tolower(*t) == apr_tolower(s[1])
|
&& apr_tolower(*t) == apr_tolower(s[1])
|
||||||
&& strcasecmp(s + 2, t + 2) == 0) {
|
&& strcasecmp(s + 2, t + 2) == 0) {
|
||||||
return SP_TRANSPOSITION; /* transposition */
|
return SP_TRANSPOSITION; /* transposition */
|
||||||
}
|
}
|
||||||
if (strcasecmp(s + 1, t + 1) == 0) {
|
if (strcasecmp(s + 1, t + 1) == 0) {
|
||||||
return SP_SIMPLETYPO; /* 1 char mismatch */
|
return SP_SIMPLETYPO; /* 1 char mismatch */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strcasecmp(s + 1, t) == 0) {
|
if (strcasecmp(s + 1, t) == 0) {
|
||||||
return SP_EXTRACHAR; /* extra character */
|
return SP_EXTRACHAR; /* extra character */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*t && strcasecmp(s, t + 1) == 0) {
|
if (*t && strcasecmp(s, t + 1) == 0) {
|
||||||
return SP_MISSINGCHAR; /* missing character */
|
return SP_MISSINGCHAR; /* missing character */
|
||||||
@@ -296,7 +296,7 @@ static int check_speling(request_rec *r)
|
|||||||
else if (strcasecmp(bad, dirent.name) == 0) {
|
else if (strcasecmp(bad, dirent.name) == 0) {
|
||||||
misspelled_file *sp_new;
|
misspelled_file *sp_new;
|
||||||
|
|
||||||
sp_new = (misspelled_file *) apr_array_push(candidates);
|
sp_new = (misspelled_file *) apr_array_push(candidates);
|
||||||
sp_new->name = apr_pstrdup(r->pool, dirent.name);
|
sp_new->name = apr_pstrdup(r->pool, dirent.name);
|
||||||
sp_new->quality = SP_MISCAPITALIZED;
|
sp_new->quality = SP_MISCAPITALIZED;
|
||||||
}
|
}
|
||||||
@@ -308,17 +308,17 @@ static int check_speling(request_rec *r)
|
|||||||
else if ((q = spdist(bad, dirent.name)) != SP_VERYDIFFERENT) {
|
else if ((q = spdist(bad, dirent.name)) != SP_VERYDIFFERENT) {
|
||||||
misspelled_file *sp_new;
|
misspelled_file *sp_new;
|
||||||
|
|
||||||
sp_new = (misspelled_file *) apr_array_push(candidates);
|
sp_new = (misspelled_file *) apr_array_push(candidates);
|
||||||
sp_new->name = apr_pstrdup(r->pool, dirent.name);
|
sp_new->name = apr_pstrdup(r->pool, dirent.name);
|
||||||
sp_new->quality = q;
|
sp_new->quality = q;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The spdist() should have found the majority of the misspelled
|
* The spdist() should have found the majority of the misspelled
|
||||||
* requests. It is of questionable use to continue looking for
|
* requests. It is of questionable use to continue looking for
|
||||||
* files with the same base name, but potentially of totally wrong
|
* files with the same base name, but potentially of totally wrong
|
||||||
* type (index.html <-> index.db).
|
* type (index.html <-> index.db).
|
||||||
* I would propose to not set the WANT_BASENAME_MATCH define.
|
* I would propose to not set the WANT_BASENAME_MATCH define.
|
||||||
* 08-Aug-1997 <Martin.Kraemer@Mch.SNI.De>
|
* 08-Aug-1997 <Martin.Kraemer@Mch.SNI.De>
|
||||||
*
|
*
|
||||||
* However, Alexei replied giving some reasons to add it anyway:
|
* However, Alexei replied giving some reasons to add it anyway:
|
||||||
@@ -326,12 +326,12 @@ static int check_speling(request_rec *r)
|
|||||||
* > extension-stripping-and-matching stuff is a good idea:
|
* > extension-stripping-and-matching stuff is a good idea:
|
||||||
* >
|
* >
|
||||||
* > If you're using MultiViews, and have a file named foobar.html,
|
* > If you're using MultiViews, and have a file named foobar.html,
|
||||||
* > which you refer to as "foobar", and someone tried to access
|
* > which you refer to as "foobar", and someone tried to access
|
||||||
* > "Foobar", mod_speling won't find it, because it won't find
|
* > "Foobar", mod_speling won't find it, because it won't find
|
||||||
* > anything matching that spelling. With the extension-munging,
|
* > anything matching that spelling. With the extension-munging,
|
||||||
* > it would locate "foobar.html". Not perfect, but I ran into
|
* > it would locate "foobar.html". Not perfect, but I ran into
|
||||||
* > that problem when I first wrote the module.
|
* > that problem when I first wrote the module.
|
||||||
*/
|
*/
|
||||||
else {
|
else {
|
||||||
#ifdef WANT_BASENAME_MATCH
|
#ifdef WANT_BASENAME_MATCH
|
||||||
/*
|
/*
|
||||||
@@ -348,13 +348,13 @@ static int check_speling(request_rec *r)
|
|||||||
int entloc = ap_ind(dirent.name, '.');
|
int entloc = ap_ind(dirent.name, '.');
|
||||||
if (entloc == -1) {
|
if (entloc == -1) {
|
||||||
entloc = strlen(dirent.name);
|
entloc = strlen(dirent.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dotloc == entloc)
|
if ((dotloc == entloc)
|
||||||
&& !strncasecmp(bad, dirent.name, dotloc)) {
|
&& !strncasecmp(bad, dirent.name, dotloc)) {
|
||||||
misspelled_file *sp_new;
|
misspelled_file *sp_new;
|
||||||
|
|
||||||
sp_new = (misspelled_file *) apr_array_push(candidates);
|
sp_new = (misspelled_file *) apr_array_push(candidates);
|
||||||
sp_new->name = apr_pstrdup(r->pool, dirent.name);
|
sp_new->name = apr_pstrdup(r->pool, dirent.name);
|
||||||
sp_new->quality = SP_VERYDIFFERENT;
|
sp_new->quality = SP_VERYDIFFERENT;
|
||||||
}
|
}
|
||||||
@@ -366,7 +366,7 @@ static int check_speling(request_rec *r)
|
|||||||
if (candidates->nelts != 0) {
|
if (candidates->nelts != 0) {
|
||||||
/* Wow... we found us a mispelling. Construct a fixed url */
|
/* Wow... we found us a mispelling. Construct a fixed url */
|
||||||
char *nuri;
|
char *nuri;
|
||||||
const char *ref;
|
const char *ref;
|
||||||
misspelled_file *variant = (misspelled_file *) candidates->elts;
|
misspelled_file *variant = (misspelled_file *) candidates->elts;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -379,27 +379,27 @@ static int check_speling(request_rec *r)
|
|||||||
* Conditions for immediate redirection:
|
* Conditions for immediate redirection:
|
||||||
* a) the first candidate was not found by stripping the suffix
|
* a) the first candidate was not found by stripping the suffix
|
||||||
* AND b) there exists only one candidate OR the best match is not
|
* AND b) there exists only one candidate OR the best match is not
|
||||||
* ambiguous
|
* ambiguous
|
||||||
* then return a redirection right away.
|
* then return a redirection right away.
|
||||||
*/
|
*/
|
||||||
if (variant[0].quality != SP_VERYDIFFERENT
|
if (variant[0].quality != SP_VERYDIFFERENT
|
||||||
&& (candidates->nelts == 1
|
&& (candidates->nelts == 1
|
||||||
|| variant[0].quality != variant[1].quality)) {
|
|| variant[0].quality != variant[1].quality)) {
|
||||||
|
|
||||||
nuri = ap_escape_uri(r->pool, apr_pstrcat(r->pool, url,
|
nuri = ap_escape_uri(r->pool, apr_pstrcat(r->pool, url,
|
||||||
variant[0].name,
|
variant[0].name,
|
||||||
r->path_info, NULL));
|
r->path_info, NULL));
|
||||||
if (r->parsed_uri.query)
|
if (r->parsed_uri.query)
|
||||||
nuri = apr_pstrcat(r->pool, nuri, "?", r->parsed_uri.query, NULL);
|
nuri = apr_pstrcat(r->pool, nuri, "?", r->parsed_uri.query, NULL);
|
||||||
|
|
||||||
apr_table_setn(r->headers_out, "Location",
|
apr_table_setn(r->headers_out, "Location",
|
||||||
ap_construct_url(r->pool, nuri, r));
|
ap_construct_url(r->pool, nuri, r));
|
||||||
|
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_INFO, APR_SUCCESS,
|
ap_log_rerror(APLOG_MARK, APLOG_INFO, APR_SUCCESS,
|
||||||
r,
|
r,
|
||||||
ref ? "Fixed spelling: %s to %s from %s"
|
ref ? "Fixed spelling: %s to %s from %s"
|
||||||
: "Fixed spelling: %s to %s",
|
: "Fixed spelling: %s to %s",
|
||||||
r->uri, nuri, ref);
|
r->uri, nuri, ref);
|
||||||
|
|
||||||
return HTTP_MOVED_PERMANENTLY;
|
return HTTP_MOVED_PERMANENTLY;
|
||||||
}
|
}
|
||||||
@@ -410,9 +410,9 @@ static int check_speling(request_rec *r)
|
|||||||
else {
|
else {
|
||||||
apr_pool_t *p;
|
apr_pool_t *p;
|
||||||
apr_table_t *notes;
|
apr_table_t *notes;
|
||||||
apr_pool_t *sub_pool;
|
apr_pool_t *sub_pool;
|
||||||
apr_array_header_t *t;
|
apr_array_header_t *t;
|
||||||
apr_array_header_t *v;
|
apr_array_header_t *v;
|
||||||
|
|
||||||
|
|
||||||
if (r->main == NULL) {
|
if (r->main == NULL) {
|
||||||
@@ -424,49 +424,49 @@ static int check_speling(request_rec *r)
|
|||||||
notes = r->main->notes;
|
notes = r->main->notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (apr_pool_create(&sub_pool, p) != APR_SUCCESS)
|
if (apr_pool_create(&sub_pool, p) != APR_SUCCESS)
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
|
|
||||||
t = apr_array_make(sub_pool, candidates->nelts * 8 + 8,
|
t = apr_array_make(sub_pool, candidates->nelts * 8 + 8,
|
||||||
sizeof(char *));
|
sizeof(char *));
|
||||||
v = apr_array_make(sub_pool, candidates->nelts * 5,
|
v = apr_array_make(sub_pool, candidates->nelts * 5,
|
||||||
sizeof(char *));
|
sizeof(char *));
|
||||||
|
|
||||||
/* Generate the response text. */
|
/* Generate the response text. */
|
||||||
|
|
||||||
*(const char **)apr_array_push(t) =
|
*(const char **)apr_array_push(t) =
|
||||||
"The document name you requested (<code>";
|
"The document name you requested (<code>";
|
||||||
*(const char **)apr_array_push(t) = ap_escape_html(sub_pool, r->uri);
|
*(const char **)apr_array_push(t) = ap_escape_html(sub_pool, r->uri);
|
||||||
*(const char **)apr_array_push(t) =
|
*(const char **)apr_array_push(t) =
|
||||||
"</code>) could not be found on this server.\n"
|
"</code>) could not be found on this server.\n"
|
||||||
"However, we found documents with names similar "
|
"However, we found documents with names similar "
|
||||||
"to the one you requested.<p>"
|
"to the one you requested.<p>"
|
||||||
"Available documents:\n<ul>\n";
|
"Available documents:\n<ul>\n";
|
||||||
|
|
||||||
for (i = 0; i < candidates->nelts; ++i) {
|
for (i = 0; i < candidates->nelts; ++i) {
|
||||||
char *vuri;
|
char *vuri;
|
||||||
const char *reason;
|
const char *reason;
|
||||||
|
|
||||||
reason = sp_reason_str[(int) (variant[i].quality)];
|
reason = sp_reason_str[(int) (variant[i].quality)];
|
||||||
/* The format isn't very neat... */
|
/* The format isn't very neat... */
|
||||||
vuri = apr_pstrcat(sub_pool, url, variant[i].name, r->path_info,
|
vuri = apr_pstrcat(sub_pool, url, variant[i].name, r->path_info,
|
||||||
(r->parsed_uri.query != NULL) ? "?" : "",
|
(r->parsed_uri.query != NULL) ? "?" : "",
|
||||||
(r->parsed_uri.query != NULL)
|
(r->parsed_uri.query != NULL)
|
||||||
? r->parsed_uri.query : "",
|
? r->parsed_uri.query : "",
|
||||||
NULL);
|
NULL);
|
||||||
*(const char **)apr_array_push(v) = "\"";
|
*(const char **)apr_array_push(v) = "\"";
|
||||||
*(const char **)apr_array_push(v) = ap_escape_uri(sub_pool, vuri);
|
*(const char **)apr_array_push(v) = ap_escape_uri(sub_pool, vuri);
|
||||||
*(const char **)apr_array_push(v) = "\";\"";
|
*(const char **)apr_array_push(v) = "\";\"";
|
||||||
*(const char **)apr_array_push(v) = reason;
|
*(const char **)apr_array_push(v) = reason;
|
||||||
*(const char **)apr_array_push(v) = "\"";
|
*(const char **)apr_array_push(v) = "\"";
|
||||||
|
|
||||||
*(const char **)apr_array_push(t) = "<li><a href=\"";
|
*(const char **)apr_array_push(t) = "<li><a href=\"";
|
||||||
*(const char **)apr_array_push(t) = ap_escape_uri(sub_pool, vuri);
|
*(const char **)apr_array_push(t) = ap_escape_uri(sub_pool, vuri);
|
||||||
*(const char **)apr_array_push(t) = "\">";
|
*(const char **)apr_array_push(t) = "\">";
|
||||||
*(const char **)apr_array_push(t) = ap_escape_html(sub_pool, vuri);
|
*(const char **)apr_array_push(t) = ap_escape_html(sub_pool, vuri);
|
||||||
*(const char **)apr_array_push(t) = "</a> (";
|
*(const char **)apr_array_push(t) = "</a> (";
|
||||||
*(const char **)apr_array_push(t) = reason;
|
*(const char **)apr_array_push(t) = reason;
|
||||||
*(const char **)apr_array_push(t) = ")\n";
|
*(const char **)apr_array_push(t) = ")\n";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* when we have printed the "close matches" and there are
|
* when we have printed the "close matches" and there are
|
||||||
@@ -478,36 +478,36 @@ static int check_speling(request_rec *r)
|
|||||||
if (i > 0 && i < candidates->nelts - 1
|
if (i > 0 && i < candidates->nelts - 1
|
||||||
&& variant[i].quality != SP_VERYDIFFERENT
|
&& variant[i].quality != SP_VERYDIFFERENT
|
||||||
&& variant[i + 1].quality == SP_VERYDIFFERENT) {
|
&& variant[i + 1].quality == SP_VERYDIFFERENT) {
|
||||||
*(const char **)apr_array_push(t) =
|
*(const char **)apr_array_push(t) =
|
||||||
"</ul>\nFurthermore, the following related "
|
"</ul>\nFurthermore, the following related "
|
||||||
"documents were found:\n<ul>\n";
|
"documents were found:\n<ul>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*(const char **)apr_array_push(t) = "</ul>\n";
|
*(const char **)apr_array_push(t) = "</ul>\n";
|
||||||
|
|
||||||
/* If we know there was a referring page, add a note: */
|
/* If we know there was a referring page, add a note: */
|
||||||
if (ref != NULL) {
|
if (ref != NULL) {
|
||||||
*(const char **)apr_array_push(t) =
|
*(const char **)apr_array_push(t) =
|
||||||
"Please consider informing the owner of the "
|
"Please consider informing the owner of the "
|
||||||
"<a href=\"";
|
"<a href=\"";
|
||||||
*(const char **)apr_array_push(t) = ap_escape_uri(sub_pool, ref);
|
*(const char **)apr_array_push(t) = ap_escape_uri(sub_pool, ref);
|
||||||
*(const char **)apr_array_push(t) = "\">referring page</a> "
|
*(const char **)apr_array_push(t) = "\">referring page</a> "
|
||||||
"about the broken link.\n";
|
"about the broken link.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Pass our apr_table_t to http_protocol.c (see mod_negotiation): */
|
/* Pass our apr_table_t to http_protocol.c (see mod_negotiation): */
|
||||||
apr_table_setn(notes, "variant-list", apr_array_pstrcat(p, t, 0));
|
apr_table_setn(notes, "variant-list", apr_array_pstrcat(p, t, 0));
|
||||||
|
|
||||||
apr_table_mergen(r->subprocess_env, "VARIANTS",
|
apr_table_mergen(r->subprocess_env, "VARIANTS",
|
||||||
apr_array_pstrcat(p, v, ','));
|
apr_array_pstrcat(p, v, ','));
|
||||||
|
|
||||||
apr_pool_destroy(sub_pool);
|
apr_pool_destroy(sub_pool);
|
||||||
|
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
|
||||||
ref ? "Spelling fix: %s: %d candidates from %s"
|
ref ? "Spelling fix: %s: %d candidates from %s"
|
||||||
: "Spelling fix: %s: %d candidates",
|
: "Spelling fix: %s: %d candidates",
|
||||||
r->uri, candidates->nelts, ref);
|
r->uri, candidates->nelts, ref);
|
||||||
|
|
||||||
return HTTP_MULTIPLE_CHOICES;
|
return HTTP_MULTIPLE_CHOICES;
|
||||||
}
|
}
|
||||||
|
@@ -89,20 +89,20 @@ static void *mva_merge_server_config(apr_pool_t *p, void *parentv, void *childv)
|
|||||||
|
|
||||||
conf = (mva_sconf_t *) apr_pcalloc(p, sizeof(*conf));
|
conf = (mva_sconf_t *) apr_pcalloc(p, sizeof(*conf));
|
||||||
if (child->doc_root_mode == VHOST_ALIAS_UNSET) {
|
if (child->doc_root_mode == VHOST_ALIAS_UNSET) {
|
||||||
conf->doc_root_mode = parent->doc_root_mode;
|
conf->doc_root_mode = parent->doc_root_mode;
|
||||||
conf->doc_root = parent->doc_root;
|
conf->doc_root = parent->doc_root;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
conf->doc_root_mode = child->doc_root_mode;
|
conf->doc_root_mode = child->doc_root_mode;
|
||||||
conf->doc_root = child->doc_root;
|
conf->doc_root = child->doc_root;
|
||||||
}
|
}
|
||||||
if (child->cgi_root_mode == VHOST_ALIAS_UNSET) {
|
if (child->cgi_root_mode == VHOST_ALIAS_UNSET) {
|
||||||
conf->cgi_root_mode = parent->cgi_root_mode;
|
conf->cgi_root_mode = parent->cgi_root_mode;
|
||||||
conf->cgi_root = parent->cgi_root;
|
conf->cgi_root = parent->cgi_root;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
conf->cgi_root_mode = child->cgi_root_mode;
|
conf->cgi_root_mode = child->cgi_root_mode;
|
||||||
conf->cgi_root = child->cgi_root;
|
conf->cgi_root = child->cgi_root;
|
||||||
}
|
}
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
@@ -125,87 +125,87 @@ static const char *vhost_alias_set(cmd_parms *cmd, void *dummy, const char *map)
|
|||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
conf = (mva_sconf_t *) ap_get_module_config(cmd->server->module_config,
|
conf = (mva_sconf_t *) ap_get_module_config(cmd->server->module_config,
|
||||||
&vhost_alias_module);
|
&vhost_alias_module);
|
||||||
/* there ought to be a better way of doing this */
|
/* there ought to be a better way of doing this */
|
||||||
if (&vhost_alias_set_doc_root_ip == cmd->info) {
|
if (&vhost_alias_set_doc_root_ip == cmd->info) {
|
||||||
mode = VHOST_ALIAS_IP;
|
mode = VHOST_ALIAS_IP;
|
||||||
pmap = &conf->doc_root;
|
pmap = &conf->doc_root;
|
||||||
pmode = &conf->doc_root_mode;
|
pmode = &conf->doc_root_mode;
|
||||||
}
|
}
|
||||||
else if (&vhost_alias_set_cgi_root_ip == cmd->info) {
|
else if (&vhost_alias_set_cgi_root_ip == cmd->info) {
|
||||||
mode = VHOST_ALIAS_IP;
|
mode = VHOST_ALIAS_IP;
|
||||||
pmap = &conf->cgi_root;
|
pmap = &conf->cgi_root;
|
||||||
pmode = &conf->cgi_root_mode;
|
pmode = &conf->cgi_root_mode;
|
||||||
}
|
}
|
||||||
else if (&vhost_alias_set_doc_root_name == cmd->info) {
|
else if (&vhost_alias_set_doc_root_name == cmd->info) {
|
||||||
mode = VHOST_ALIAS_NAME;
|
mode = VHOST_ALIAS_NAME;
|
||||||
pmap = &conf->doc_root;
|
pmap = &conf->doc_root;
|
||||||
pmode = &conf->doc_root_mode;
|
pmode = &conf->doc_root_mode;
|
||||||
}
|
}
|
||||||
else if (&vhost_alias_set_cgi_root_name == cmd->info) {
|
else if (&vhost_alias_set_cgi_root_name == cmd->info) {
|
||||||
mode = VHOST_ALIAS_NAME;
|
mode = VHOST_ALIAS_NAME;
|
||||||
pmap = &conf->cgi_root;
|
pmap = &conf->cgi_root;
|
||||||
pmode = &conf->cgi_root_mode;
|
pmode = &conf->cgi_root_mode;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "INTERNAL ERROR: unknown command info";
|
return "INTERNAL ERROR: unknown command info";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ap_os_is_path_absolute(cmd->pool, map)) {
|
if (!ap_os_is_path_absolute(cmd->pool, map)) {
|
||||||
if (strcasecmp(map, "none")) {
|
if (strcasecmp(map, "none")) {
|
||||||
return "format string must be an absolute path, or 'none'";
|
return "format string must be an absolute path, or 'none'";
|
||||||
}
|
}
|
||||||
*pmap = NULL;
|
*pmap = NULL;
|
||||||
*pmode = VHOST_ALIAS_NONE;
|
*pmode = VHOST_ALIAS_NONE;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
p = map;
|
p = map;
|
||||||
while (*p != '\0') {
|
while (*p != '\0') {
|
||||||
if (*p++ != '%') {
|
if (*p++ != '%') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* we just found a '%' */
|
/* we just found a '%' */
|
||||||
if (*p == 'p' || *p == '%') {
|
if (*p == 'p' || *p == '%') {
|
||||||
++p;
|
++p;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* optional dash */
|
/* optional dash */
|
||||||
if (*p == '-') {
|
if (*p == '-') {
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
/* digit N */
|
/* digit N */
|
||||||
if (apr_isdigit(*p)) {
|
if (apr_isdigit(*p)) {
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "syntax error in format string";
|
return "syntax error in format string";
|
||||||
}
|
}
|
||||||
/* optional plus */
|
/* optional plus */
|
||||||
if (*p == '+') {
|
if (*p == '+') {
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
/* do we end here? */
|
/* do we end here? */
|
||||||
if (*p != '.') {
|
if (*p != '.') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
++p;
|
++p;
|
||||||
/* optional dash */
|
/* optional dash */
|
||||||
if (*p == '-') {
|
if (*p == '-') {
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
/* digit M */
|
/* digit M */
|
||||||
if (apr_isdigit(*p)) {
|
if (apr_isdigit(*p)) {
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "syntax error in format string";
|
return "syntax error in format string";
|
||||||
}
|
}
|
||||||
/* optional plus */
|
/* optional plus */
|
||||||
if (*p == '+') {
|
if (*p == '+') {
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*pmap = map;
|
*pmap = map;
|
||||||
*pmode = mode;
|
*pmode = mode;
|
||||||
@@ -235,23 +235,23 @@ static const command_rec mva_commands[] =
|
|||||||
* but C is too feeble to support them.
|
* but C is too feeble to support them.
|
||||||
*/
|
*/
|
||||||
static APR_INLINE void vhost_alias_checkspace(request_rec *r, char *buf,
|
static APR_INLINE void vhost_alias_checkspace(request_rec *r, char *buf,
|
||||||
char **pdest, int size)
|
char **pdest, int size)
|
||||||
{
|
{
|
||||||
/* XXX: what if size > HUGE_STRING_LEN? */
|
/* XXX: what if size > HUGE_STRING_LEN? */
|
||||||
if (*pdest + size > buf + HUGE_STRING_LEN) {
|
if (*pdest + size > buf + HUGE_STRING_LEN) {
|
||||||
**pdest = '\0';
|
**pdest = '\0';
|
||||||
if (r->filename) {
|
if (r->filename) {
|
||||||
r->filename = apr_pstrcat(r->pool, r->filename, buf, NULL);
|
r->filename = apr_pstrcat(r->pool, r->filename, buf, NULL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
r->filename = apr_pstrdup(r->pool, buf);
|
r->filename = apr_pstrdup(r->pool, buf);
|
||||||
}
|
}
|
||||||
*pdest = buf;
|
*pdest = buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vhost_alias_interpolate(request_rec *r, const char *name,
|
static void vhost_alias_interpolate(request_rec *r, const char *name,
|
||||||
const char *map, const char *uri)
|
const char *map, const char *uri)
|
||||||
{
|
{
|
||||||
/* 0..9 9..0 */
|
/* 0..9 9..0 */
|
||||||
enum { MAXDOTS = 19 };
|
enum { MAXDOTS = 19 };
|
||||||
@@ -269,9 +269,9 @@ static void vhost_alias_interpolate(request_rec *r, const char *name,
|
|||||||
ndots = 0;
|
ndots = 0;
|
||||||
dots[ndots++] = name-1; /* slightly naughty */
|
dots[ndots++] = name-1; /* slightly naughty */
|
||||||
for (p = name; *p; ++p){
|
for (p = name; *p; ++p){
|
||||||
if (*p == '.' && ndots < MAXDOTS) {
|
if (*p == '.' && ndots < MAXDOTS) {
|
||||||
dots[ndots++] = p;
|
dots[ndots++] = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dots[ndots] = p;
|
dots[ndots] = p;
|
||||||
|
|
||||||
@@ -280,103 +280,103 @@ static void vhost_alias_interpolate(request_rec *r, const char *name,
|
|||||||
dest = buf;
|
dest = buf;
|
||||||
last = '\0';
|
last = '\0';
|
||||||
while (*map) {
|
while (*map) {
|
||||||
if (*map != '%') {
|
if (*map != '%') {
|
||||||
/* normal characters */
|
/* normal characters */
|
||||||
vhost_alias_checkspace(r, buf, &dest, 1);
|
vhost_alias_checkspace(r, buf, &dest, 1);
|
||||||
last = *dest++ = *map++;
|
last = *dest++ = *map++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* we are in a format specifier */
|
/* we are in a format specifier */
|
||||||
++map;
|
++map;
|
||||||
/* can't be a slash */
|
/* can't be a slash */
|
||||||
last = '\0';
|
last = '\0';
|
||||||
/* %% -> % */
|
/* %% -> % */
|
||||||
if (*map == '%') {
|
if (*map == '%') {
|
||||||
++map;
|
++map;
|
||||||
vhost_alias_checkspace(r, buf, &dest, 1);
|
vhost_alias_checkspace(r, buf, &dest, 1);
|
||||||
*dest++ = '%';
|
*dest++ = '%';
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* port number */
|
/* port number */
|
||||||
if (*map == 'p') {
|
if (*map == 'p') {
|
||||||
++map;
|
++map;
|
||||||
/* no. of decimal digits in a short plus one */
|
/* no. of decimal digits in a short plus one */
|
||||||
vhost_alias_checkspace(r, buf, &dest, 7);
|
vhost_alias_checkspace(r, buf, &dest, 7);
|
||||||
dest += apr_snprintf(dest, 7, "%d", ap_get_server_port(r));
|
dest += apr_snprintf(dest, 7, "%d", ap_get_server_port(r));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* deal with %-N+.-M+ -- syntax is already checked */
|
/* deal with %-N+.-M+ -- syntax is already checked */
|
||||||
N = M = 0; /* value */
|
N = M = 0; /* value */
|
||||||
Np = Mp = 0; /* is there a plus? */
|
Np = Mp = 0; /* is there a plus? */
|
||||||
Nd = Md = 0; /* is there a dash? */
|
Nd = Md = 0; /* is there a dash? */
|
||||||
if (*map == '-') ++map, Nd = 1;
|
if (*map == '-') ++map, Nd = 1;
|
||||||
N = *map++ - '0';
|
N = *map++ - '0';
|
||||||
if (*map == '+') ++map, Np = 1;
|
if (*map == '+') ++map, Np = 1;
|
||||||
if (*map == '.') {
|
if (*map == '.') {
|
||||||
++map;
|
++map;
|
||||||
if (*map == '-') {
|
if (*map == '-') {
|
||||||
++map, Md = 1;
|
++map, Md = 1;
|
||||||
}
|
}
|
||||||
M = *map++ - '0';
|
M = *map++ - '0';
|
||||||
if (*map == '+') {
|
if (*map == '+') {
|
||||||
++map, Mp = 1;
|
++map, Mp = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* note that N and M are one-based indices, not zero-based */
|
/* note that N and M are one-based indices, not zero-based */
|
||||||
start = dots[0]+1; /* ptr to the first character */
|
start = dots[0]+1; /* ptr to the first character */
|
||||||
end = dots[ndots]; /* ptr to the character after the last one */
|
end = dots[ndots]; /* ptr to the character after the last one */
|
||||||
if (N != 0) {
|
if (N != 0) {
|
||||||
if (N > ndots) {
|
if (N > ndots) {
|
||||||
start = "_";
|
start = "_";
|
||||||
end = start+1;
|
end = start+1;
|
||||||
}
|
}
|
||||||
else if (!Nd) {
|
else if (!Nd) {
|
||||||
start = dots[N-1]+1;
|
start = dots[N-1]+1;
|
||||||
if (!Np) {
|
if (!Np) {
|
||||||
end = dots[N];
|
end = dots[N];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!Np) {
|
if (!Np) {
|
||||||
start = dots[ndots-N]+1;
|
start = dots[ndots-N]+1;
|
||||||
}
|
}
|
||||||
end = dots[ndots-N+1];
|
end = dots[ndots-N+1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (M != 0) {
|
if (M != 0) {
|
||||||
if (M > end - start) {
|
if (M > end - start) {
|
||||||
start = "_";
|
start = "_";
|
||||||
end = start+1;
|
end = start+1;
|
||||||
}
|
}
|
||||||
else if (!Md) {
|
else if (!Md) {
|
||||||
start = start+M-1;
|
start = start+M-1;
|
||||||
if (!Mp) {
|
if (!Mp) {
|
||||||
end = start+1;
|
end = start+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!Mp) {
|
if (!Mp) {
|
||||||
start = end-M;
|
start = end-M;
|
||||||
}
|
}
|
||||||
end = end-M+1;
|
end = end-M+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vhost_alias_checkspace(r, buf, &dest, end - start);
|
vhost_alias_checkspace(r, buf, &dest, end - start);
|
||||||
for (p = start; p < end; ++p) {
|
for (p = start; p < end; ++p) {
|
||||||
*dest++ = apr_tolower(*p);
|
*dest++ = apr_tolower(*p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*dest = '\0';
|
*dest = '\0';
|
||||||
/* no double slashes */
|
/* no double slashes */
|
||||||
if (last == '/') {
|
if (last == '/') {
|
||||||
++uri;
|
++uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r->filename) {
|
if (r->filename) {
|
||||||
r->filename = apr_pstrcat(r->pool, r->filename, buf, uri, NULL);
|
r->filename = apr_pstrcat(r->pool, r->filename, buf, uri, NULL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
r->filename = apr_pstrcat(r->pool, buf, uri, NULL);
|
r->filename = apr_pstrcat(r->pool, buf, uri, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,36 +388,36 @@ static int mva_translate(request_rec *r)
|
|||||||
const char *cgi;
|
const char *cgi;
|
||||||
|
|
||||||
conf = (mva_sconf_t *) ap_get_module_config(r->server->module_config,
|
conf = (mva_sconf_t *) ap_get_module_config(r->server->module_config,
|
||||||
&vhost_alias_module);
|
&vhost_alias_module);
|
||||||
cgi = NULL;
|
cgi = NULL;
|
||||||
if (conf->cgi_root) {
|
if (conf->cgi_root) {
|
||||||
cgi = strstr(r->uri, "cgi-bin/");
|
cgi = strstr(r->uri, "cgi-bin/");
|
||||||
if (cgi && (cgi != r->uri + strspn(r->uri, "/"))) {
|
if (cgi && (cgi != r->uri + strspn(r->uri, "/"))) {
|
||||||
cgi = NULL;
|
cgi = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cgi) {
|
if (cgi) {
|
||||||
mode = conf->cgi_root_mode;
|
mode = conf->cgi_root_mode;
|
||||||
map = conf->cgi_root;
|
map = conf->cgi_root;
|
||||||
uri = cgi + strlen("cgi-bin");
|
uri = cgi + strlen("cgi-bin");
|
||||||
}
|
}
|
||||||
else if (r->uri[0] == '/') {
|
else if (r->uri[0] == '/') {
|
||||||
mode = conf->doc_root_mode;
|
mode = conf->doc_root_mode;
|
||||||
map = conf->doc_root;
|
map = conf->doc_root;
|
||||||
uri = r->uri;
|
uri = r->uri;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == VHOST_ALIAS_NAME) {
|
if (mode == VHOST_ALIAS_NAME) {
|
||||||
name = ap_get_server_name(r);
|
name = ap_get_server_name(r);
|
||||||
}
|
}
|
||||||
else if (mode == VHOST_ALIAS_IP) {
|
else if (mode == VHOST_ALIAS_IP) {
|
||||||
name = r->connection->local_ip;
|
name = r->connection->local_ip;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ### There is an optimization available here to determine the
|
/* ### There is an optimization available here to determine the
|
||||||
@@ -429,9 +429,9 @@ static int mva_translate(request_rec *r)
|
|||||||
vhost_alias_interpolate(r, name, map, uri);
|
vhost_alias_interpolate(r, name, map, uri);
|
||||||
|
|
||||||
if (cgi) {
|
if (cgi) {
|
||||||
/* see is_scriptaliased() in mod_cgi */
|
/* see is_scriptaliased() in mod_cgi */
|
||||||
r->handler = "cgi-script";
|
r->handler = "cgi-script";
|
||||||
apr_table_setn(r->notes, "alias-forced-type", r->handler);
|
apr_table_setn(r->notes, "alias-forced-type", r->handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
@@ -375,7 +375,7 @@ static void *merge_expires_dir_configs(apr_pool_t *p, void *basev, void *addv)
|
|||||||
new->expiresdefault = add->expiresdefault;
|
new->expiresdefault = add->expiresdefault;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
new->expiresdefault = base->expiresdefault;
|
new->expiresdefault = base->expiresdefault;
|
||||||
}
|
}
|
||||||
new->wildcards = add->wildcards;
|
new->wildcards = add->wildcards;
|
||||||
new->expiresbytype = apr_table_overlay(p, add->expiresbytype,
|
new->expiresbytype = apr_table_overlay(p, add->expiresbytype,
|
||||||
@@ -399,13 +399,13 @@ static int set_expiration_fields(request_rec *r, const char *code,
|
|||||||
|
|
||||||
switch (code[0]) {
|
switch (code[0]) {
|
||||||
case 'M':
|
case 'M':
|
||||||
if (r->finfo.filetype == 0) {
|
if (r->finfo.filetype == 0) {
|
||||||
/* file doesn't exist on disk, so we can't do anything based on
|
/* file doesn't exist on disk, so we can't do anything based on
|
||||||
* modification time. Note that this does _not_ log an error.
|
* modification time. Note that this does _not_ log an error.
|
||||||
*/
|
*/
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
base = r->finfo.mtime;
|
base = r->finfo.mtime;
|
||||||
additional_sec = atoi(&code[1]);
|
additional_sec = atoi(&code[1]);
|
||||||
additional = apr_time_from_sec(additional_sec);
|
additional = apr_time_from_sec(additional_sec);
|
||||||
break;
|
break;
|
||||||
|
@@ -534,11 +534,11 @@ static void do_headers_fixup(request_rec *r, apr_table_t *headers,
|
|||||||
header_entry *hdr = &((header_entry *) (fixup->elts))[i];
|
header_entry *hdr = &((header_entry *) (fixup->elts))[i];
|
||||||
const char *envar = hdr->condition_var;
|
const char *envar = hdr->condition_var;
|
||||||
|
|
||||||
/* ignore early headers in late calls */
|
/* ignore early headers in late calls */
|
||||||
if (!early && (envar == condition_early)) {
|
if (!early && (envar == condition_early)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* ignore late headers in early calls */
|
/* ignore late headers in early calls */
|
||||||
else if (early && (envar != condition_early)) {
|
else if (early && (envar != condition_early)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -253,7 +253,7 @@ static const char *non_regex_pattern(apr_pool_t *p, const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
|
static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
|
||||||
char *fname, const char *args)
|
char *fname, const char *args)
|
||||||
{
|
{
|
||||||
char *regex;
|
char *regex;
|
||||||
const char *simple_pattern;
|
const char *simple_pattern;
|
||||||
@@ -274,7 +274,7 @@ static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
|
|||||||
sconf = (cmd->path != NULL)
|
sconf = (cmd->path != NULL)
|
||||||
? (sei_cfg_rec *) mconfig
|
? (sei_cfg_rec *) mconfig
|
||||||
: (sei_cfg_rec *) ap_get_module_config(cmd->server->module_config,
|
: (sei_cfg_rec *) ap_get_module_config(cmd->server->module_config,
|
||||||
&setenvif_module);
|
&setenvif_module);
|
||||||
entries = (sei_entry *) sconf->conditionals->elts;
|
entries = (sei_entry *) sconf->conditionals->elts;
|
||||||
/* get regex */
|
/* get regex */
|
||||||
regex = ap_getword_conf(cmd->pool, &args);
|
regex = ap_getword_conf(cmd->pool, &args);
|
||||||
@@ -427,7 +427,7 @@ static const char *add_setenvif_core(cmd_parms *cmd, void *mconfig,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *add_setenvif(cmd_parms *cmd, void *mconfig,
|
static const char *add_setenvif(cmd_parms *cmd, void *mconfig,
|
||||||
const char *args)
|
const char *args)
|
||||||
{
|
{
|
||||||
char *fname;
|
char *fname;
|
||||||
|
|
||||||
|
@@ -284,8 +284,8 @@ static int gen_unique_id(request_rec *r)
|
|||||||
*/
|
*/
|
||||||
unique_id_rec new_unique_id;
|
unique_id_rec new_unique_id;
|
||||||
struct {
|
struct {
|
||||||
unique_id_rec foo;
|
unique_id_rec foo;
|
||||||
unsigned char pad[2];
|
unsigned char pad[2];
|
||||||
} paddedbuf;
|
} paddedbuf;
|
||||||
unsigned char *x,*y;
|
unsigned char *x,*y;
|
||||||
unsigned short counter;
|
unsigned short counter;
|
||||||
@@ -296,8 +296,8 @@ static int gen_unique_id(request_rec *r)
|
|||||||
* actually called for sub requests, so we don't need to test for
|
* actually called for sub requests, so we don't need to test for
|
||||||
* them) */
|
* them) */
|
||||||
if (r->prev && (e = apr_table_get(r->subprocess_env, "REDIRECT_UNIQUE_ID"))) {
|
if (r->prev && (e = apr_table_get(r->subprocess_env, "REDIRECT_UNIQUE_ID"))) {
|
||||||
apr_table_setn(r->subprocess_env, "UNIQUE_ID", e);
|
apr_table_setn(r->subprocess_env, "UNIQUE_ID", e);
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_unique_id.in_addr = cur_unique_id.in_addr;
|
new_unique_id.in_addr = cur_unique_id.in_addr;
|
||||||
|
@@ -95,12 +95,12 @@ typedef struct {
|
|||||||
static void make_cookie(request_rec *r)
|
static void make_cookie(request_rec *r)
|
||||||
{
|
{
|
||||||
cookie_log_state *cls = ap_get_module_config(r->server->module_config,
|
cookie_log_state *cls = ap_get_module_config(r->server->module_config,
|
||||||
&usertrack_module);
|
&usertrack_module);
|
||||||
/* 1024 == hardcoded constant */
|
/* 1024 == hardcoded constant */
|
||||||
char cookiebuf[1024];
|
char cookiebuf[1024];
|
||||||
char *new_cookie;
|
char *new_cookie;
|
||||||
const char *rname = ap_get_remote_host(r->connection, r->per_dir_config,
|
const char *rname = ap_get_remote_host(r->connection, r->per_dir_config,
|
||||||
REMOTE_NAME, NULL);
|
REMOTE_NAME, NULL);
|
||||||
cookie_dir_rec *dcfg;
|
cookie_dir_rec *dcfg;
|
||||||
|
|
||||||
dcfg = ap_get_module_config(r->per_dir_config, &usertrack_module);
|
dcfg = ap_get_module_config(r->per_dir_config, &usertrack_module);
|
||||||
@@ -116,7 +116,7 @@ static void make_cookie(request_rec *r)
|
|||||||
dcfg->cookie_name, cookiebuf);
|
dcfg->cookie_name, cookiebuf);
|
||||||
|
|
||||||
if ((dcfg->style == CT_UNSET) || (dcfg->style == CT_NETSCAPE)) {
|
if ((dcfg->style == CT_UNSET) || (dcfg->style == CT_NETSCAPE)) {
|
||||||
apr_time_exp_t tms;
|
apr_time_exp_t tms;
|
||||||
apr_time_exp_gmt(&tms, r->request_time
|
apr_time_exp_gmt(&tms, r->request_time
|
||||||
+ apr_time_from_sec(cls->expires));
|
+ apr_time_from_sec(cls->expires));
|
||||||
new_cookie = apr_psprintf(r->pool,
|
new_cookie = apr_psprintf(r->pool,
|
||||||
@@ -207,7 +207,7 @@ static void set_and_comp_regexp(cookie_dir_rec *dcfg,
|
|||||||
static int spot_cookie(request_rec *r)
|
static int spot_cookie(request_rec *r)
|
||||||
{
|
{
|
||||||
cookie_dir_rec *dcfg = ap_get_module_config(r->per_dir_config,
|
cookie_dir_rec *dcfg = ap_get_module_config(r->per_dir_config,
|
||||||
&usertrack_module);
|
&usertrack_module);
|
||||||
const char *cookie_header;
|
const char *cookie_header;
|
||||||
ap_regmatch_t regm[NUM_SUBS];
|
ap_regmatch_t regm[NUM_SUBS];
|
||||||
|
|
||||||
@@ -308,7 +308,7 @@ static const char *set_cookie_exp(cmd_parms *parms, void *dummy,
|
|||||||
/* {<num> <type>}* */
|
/* {<num> <type>}* */
|
||||||
while (word[0]) {
|
while (word[0]) {
|
||||||
/* <num> */
|
/* <num> */
|
||||||
if (apr_isdigit(word[0]))
|
if (apr_isdigit(word[0]))
|
||||||
num = atoi(word);
|
num = atoi(word);
|
||||||
else
|
else
|
||||||
return "bad expires code, numeric value expected.";
|
return "bad expires code, numeric value expected.";
|
||||||
|
@@ -144,7 +144,7 @@ static const command_rec ssl_config_cmds[] = {
|
|||||||
SSL_CMD_SRV(HonorCipherOrder, FLAG,
|
SSL_CMD_SRV(HonorCipherOrder, FLAG,
|
||||||
"Use the server's cipher ordering preference")
|
"Use the server's cipher ordering preference")
|
||||||
SSL_CMD_ALL(UserName, TAKE1,
|
SSL_CMD_ALL(UserName, TAKE1,
|
||||||
"Set user name to SSL variable value")
|
"Set user name to SSL variable value")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Proxy configuration for remote SSL connections
|
* Proxy configuration for remote SSL connections
|
||||||
|
@@ -1404,7 +1404,7 @@ const char *ssl_cmd_SSLProxyMachineCertificatePath(cmd_parms *cmd,
|
|||||||
|
|
||||||
|
|
||||||
const char *ssl_cmd_SSLUserName(cmd_parms *cmd, void *dcfg,
|
const char *ssl_cmd_SSLUserName(cmd_parms *cmd, void *dcfg,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
SSLDirConfigRec *dc = (SSLDirConfigRec *)dcfg;
|
SSLDirConfigRec *dc = (SSLDirConfigRec *)dcfg;
|
||||||
dc->szUserName = arg;
|
dc->szUserName = arg;
|
||||||
|
@@ -182,7 +182,7 @@ static int bio_filter_destroy(BIO *bio)
|
|||||||
*/
|
*/
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bio_filter_out_read(BIO *bio, char *out, int outl)
|
static int bio_filter_out_read(BIO *bio, char *out, int outl)
|
||||||
{
|
{
|
||||||
/* this is never called */
|
/* this is never called */
|
||||||
|
@@ -596,16 +596,16 @@ static int pipe_get_passwd_cb(char *buf, int length, char *prompt, int verify)
|
|||||||
apr_file_puts(APR_EOL_STR, writetty);
|
apr_file_puts(APR_EOL_STR, writetty);
|
||||||
|
|
||||||
if (rc != APR_SUCCESS || apr_file_eof(readtty)) {
|
if (rc != APR_SUCCESS || apr_file_eof(readtty)) {
|
||||||
memset(buf, 0, length);
|
memset(buf, 0, length);
|
||||||
return 1; /* failure */
|
return 1; /* failure */
|
||||||
}
|
}
|
||||||
if ((p = strchr(buf, '\n')) != NULL) {
|
if ((p = strchr(buf, '\n')) != NULL) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
/* XXX: apr_sometest */
|
/* XXX: apr_sometest */
|
||||||
if ((p = strchr(buf, '\r')) != NULL) {
|
if ((p = strchr(buf, '\r')) != NULL) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
@@ -676,7 +676,7 @@ int ssl_pphrase_Handle_CB(char *buf, int bufsize, int verify, void *srv)
|
|||||||
ap_log_error(APLOG_MARK, APLOG_INFO, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_INFO, 0, s,
|
||||||
"Init: Creating pass phrase dialog pipe child "
|
"Init: Creating pass phrase dialog pipe child "
|
||||||
"'%s'", sc->server->pphrase_dialog_path);
|
"'%s'", sc->server->pphrase_dialog_path);
|
||||||
if (ssl_pipe_child_create(p, sc->server->pphrase_dialog_path)
|
if (ssl_pipe_child_create(p, sc->server->pphrase_dialog_path)
|
||||||
!= APR_SUCCESS) {
|
!= APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
|
||||||
"Init: Failed to create pass phrase pipe '%s'",
|
"Init: Failed to create pass phrase pipe '%s'",
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -44,7 +44,7 @@ void ssl_scache_dbm_init(server_rec *s, apr_pool_t *p)
|
|||||||
/* open it once to create it and to make sure it _can_ be created */
|
/* open it once to create it and to make sure it _can_ be created */
|
||||||
ssl_mutex_on(s);
|
ssl_mutex_on(s);
|
||||||
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||||
"Cannot create SSLSessionCache DBM file `%s'",
|
"Cannot create SSLSessionCache DBM file `%s'",
|
||||||
mc->szSessionCacheDataFile);
|
mc->szSessionCacheDataFile);
|
||||||
@@ -159,7 +159,7 @@ BOOL ssl_scache_dbm_store(server_rec *s, UCHAR *id, int idlen, time_t expiry, SS
|
|||||||
/* and store it to the DBM file */
|
/* and store it to the DBM file */
|
||||||
ssl_mutex_on(s);
|
ssl_mutex_on(s);
|
||||||
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||||
"Cannot open SSLSessionCache DBM file `%s' for writing "
|
"Cannot open SSLSessionCache DBM file `%s' for writing "
|
||||||
"(store)",
|
"(store)",
|
||||||
@@ -215,7 +215,7 @@ SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *s, UCHAR *id, int idlen)
|
|||||||
*/
|
*/
|
||||||
ssl_mutex_on(s);
|
ssl_mutex_on(s);
|
||||||
if ((rc = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
if ((rc = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
|
||||||
"Cannot open SSLSessionCache DBM file `%s' for reading "
|
"Cannot open SSLSessionCache DBM file `%s' for reading "
|
||||||
"(fetch)",
|
"(fetch)",
|
||||||
@@ -278,7 +278,7 @@ void ssl_scache_dbm_remove(server_rec *s, UCHAR *id, int idlen)
|
|||||||
/* and delete it from the DBM file */
|
/* and delete it from the DBM file */
|
||||||
ssl_mutex_on(s);
|
ssl_mutex_on(s);
|
||||||
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE, mc->pPool)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||||
"Cannot open SSLSessionCache DBM file `%s' for writing "
|
"Cannot open SSLSessionCache DBM file `%s' for writing "
|
||||||
"(delete)",
|
"(delete)",
|
||||||
@@ -384,7 +384,7 @@ static void ssl_scache_dbm_expire(server_rec *s)
|
|||||||
|
|
||||||
/* pass 2: delete expired elements */
|
/* pass 2: delete expired elements */
|
||||||
if (apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
if (apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||||
APR_DBM_RWCREATE,SSL_DBM_FILE_MODE, p) != APR_SUCCESS) {
|
APR_DBM_RWCREATE,SSL_DBM_FILE_MODE, p) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||||
"Cannot re-open SSLSessionCache DBM file `%s' for "
|
"Cannot re-open SSLSessionCache DBM file `%s' for "
|
||||||
"expiring",
|
"expiring",
|
||||||
@@ -431,7 +431,7 @@ void ssl_scache_dbm_status(request_rec *r, int flags, apr_pool_t *p)
|
|||||||
* XXX - Check what pool is to be used - TBD
|
* XXX - Check what pool is to be used - TBD
|
||||||
*/
|
*/
|
||||||
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
if ((rv = apr_dbm_open(&dbm, mc->szSessionCacheDataFile,
|
||||||
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE,
|
APR_DBM_RWCREATE, SSL_DBM_FILE_MODE,
|
||||||
mc->pPool)) != APR_SUCCESS) {
|
mc->pPool)) != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"Cannot open SSLSessionCache DBM file `%s' for status "
|
"Cannot open SSLSessionCache DBM file `%s' for status "
|
||||||
|
@@ -210,35 +210,35 @@ typedef struct {
|
|||||||
static unsigned int shmcb_get_safe_uint(unsigned int *);
|
static unsigned int shmcb_get_safe_uint(unsigned int *);
|
||||||
static void shmcb_set_safe_uint_ex(unsigned char *, const unsigned char *);
|
static void shmcb_set_safe_uint_ex(unsigned char *, const unsigned char *);
|
||||||
#define shmcb_set_safe_uint(pdest, src) \
|
#define shmcb_set_safe_uint(pdest, src) \
|
||||||
do { \
|
do { \
|
||||||
unsigned int tmp_uint = src; \
|
unsigned int tmp_uint = src; \
|
||||||
shmcb_set_safe_uint_ex((unsigned char *)pdest, \
|
shmcb_set_safe_uint_ex((unsigned char *)pdest, \
|
||||||
(const unsigned char *)(&tmp_uint)); \
|
(const unsigned char *)(&tmp_uint)); \
|
||||||
} while(0)
|
} while(0)
|
||||||
#if 0 /* Unused so far */
|
#if 0 /* Unused so far */
|
||||||
static unsigned long shmcb_get_safe_ulong(unsigned long *);
|
static unsigned long shmcb_get_safe_ulong(unsigned long *);
|
||||||
static void shmcb_set_safe_ulong_ex(unsigned char *, const unsigned char *);
|
static void shmcb_set_safe_ulong_ex(unsigned char *, const unsigned char *);
|
||||||
#define shmcb_set_safe_ulong(pdest, src) \
|
#define shmcb_set_safe_ulong(pdest, src) \
|
||||||
do { \
|
do { \
|
||||||
unsigned long tmp_ulong = src; \
|
unsigned long tmp_ulong = src; \
|
||||||
shmcb_set_safe_ulong_ex((unsigned char *)pdest, \
|
shmcb_set_safe_ulong_ex((unsigned char *)pdest, \
|
||||||
(const unsigned char *)(&tmp_ulong)); \
|
(const unsigned char *)(&tmp_ulong)); \
|
||||||
} while(0)
|
} while(0)
|
||||||
#endif
|
#endif
|
||||||
static time_t shmcb_get_safe_time(time_t *);
|
static time_t shmcb_get_safe_time(time_t *);
|
||||||
static void shmcb_set_safe_time_ex(unsigned char *, const unsigned char *);
|
static void shmcb_set_safe_time_ex(unsigned char *, const unsigned char *);
|
||||||
#define shmcb_set_safe_time(pdest, src) \
|
#define shmcb_set_safe_time(pdest, src) \
|
||||||
do { \
|
do { \
|
||||||
time_t tmp_time = src; \
|
time_t tmp_time = src; \
|
||||||
shmcb_set_safe_time_ex((unsigned char *)pdest, \
|
shmcb_set_safe_time_ex((unsigned char *)pdest, \
|
||||||
(const unsigned char *)(&tmp_time)); \
|
(const unsigned char *)(&tmp_time)); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/* This is necessary simply so that the size passed to memset() is not a
|
/* This is necessary simply so that the size passed to memset() is not a
|
||||||
* compile-time constant, preventing the compiler from optimising it. */
|
* compile-time constant, preventing the compiler from optimising it. */
|
||||||
static void shmcb_safe_clear(void *ptr, size_t size)
|
static void shmcb_safe_clear(void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
memset(ptr, 0, size);
|
memset(ptr, 0, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Underlying functions for session-caching */
|
/* Underlying functions for session-caching */
|
||||||
@@ -279,12 +279,12 @@ static unsigned int shmcb_get_safe_uint(unsigned int *ptr)
|
|||||||
{
|
{
|
||||||
unsigned int ret;
|
unsigned int ret;
|
||||||
shmcb_set_safe_uint_ex((unsigned char *)(&ret),
|
shmcb_set_safe_uint_ex((unsigned char *)(&ret),
|
||||||
(const unsigned char *)ptr);
|
(const unsigned char *)ptr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shmcb_set_safe_uint_ex(unsigned char *dest,
|
static void shmcb_set_safe_uint_ex(unsigned char *dest,
|
||||||
const unsigned char *src)
|
const unsigned char *src)
|
||||||
{
|
{
|
||||||
memcpy(dest, src, sizeof(unsigned int));
|
memcpy(dest, src, sizeof(unsigned int));
|
||||||
}
|
}
|
||||||
@@ -294,12 +294,12 @@ static unsigned long shmcb_get_safe_ulong(unsigned long *ptr)
|
|||||||
{
|
{
|
||||||
unsigned long ret;
|
unsigned long ret;
|
||||||
shmcb_set_safe_ulong_ex((unsigned char *)(&ret),
|
shmcb_set_safe_ulong_ex((unsigned char *)(&ret),
|
||||||
(const unsigned char *)ptr);
|
(const unsigned char *)ptr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shmcb_set_safe_ulong_ex(unsigned char *dest,
|
static void shmcb_set_safe_ulong_ex(unsigned char *dest,
|
||||||
const unsigned char *src)
|
const unsigned char *src)
|
||||||
{
|
{
|
||||||
memcpy(dest, src, sizeof(unsigned long));
|
memcpy(dest, src, sizeof(unsigned long));
|
||||||
}
|
}
|
||||||
@@ -309,12 +309,12 @@ static time_t shmcb_get_safe_time(time_t * ptr)
|
|||||||
{
|
{
|
||||||
time_t ret;
|
time_t ret;
|
||||||
shmcb_set_safe_time_ex((unsigned char *)(&ret),
|
shmcb_set_safe_time_ex((unsigned char *)(&ret),
|
||||||
(const unsigned char *)ptr);
|
(const unsigned char *)ptr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shmcb_set_safe_time_ex(unsigned char *dest,
|
static void shmcb_set_safe_time_ex(unsigned char *dest,
|
||||||
const unsigned char *src)
|
const unsigned char *src)
|
||||||
{
|
{
|
||||||
memcpy(dest, src, sizeof(time_t));
|
memcpy(dest, src, sizeof(time_t));
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
static int TestOptionalFn(const char *szStr)
|
static int TestOptionalFn(const char *szStr)
|
||||||
{
|
{
|
||||||
ap_log_error(APLOG_MARK,APLOG_ERR,OK,NULL,
|
ap_log_error(APLOG_MARK,APLOG_ERR,OK,NULL,
|
||||||
"Optional function test said: %s",szStr);
|
"Optional function test said: %s",szStr);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@ static APR_OPTIONAL_FN_TYPE(TestOptionalFn) *pfn;
|
|||||||
static int ImportLogTransaction(request_rec *r)
|
static int ImportLogTransaction(request_rec *r)
|
||||||
{
|
{
|
||||||
if(pfn)
|
if(pfn)
|
||||||
return pfn(r->the_request);
|
return pfn(r->the_request);
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
#include "http_protocol.h"
|
#include "http_protocol.h"
|
||||||
|
|
||||||
AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(int,optional_hook_test,(const char *szStr),
|
AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(int,optional_hook_test,(const char *szStr),
|
||||||
(szStr),OK,DECLINED)
|
(szStr),OK,DECLINED)
|
||||||
|
|
||||||
static int ExportLogTransaction(request_rec *r)
|
static int ExportLogTransaction(request_rec *r)
|
||||||
{
|
{
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
static int ImportOptionalHookTestHook(const char *szStr)
|
static int ImportOptionalHookTestHook(const char *szStr)
|
||||||
{
|
{
|
||||||
ap_log_error(APLOG_MARK,APLOG_ERR,OK,NULL,"Optional hook test said: %s",
|
ap_log_error(APLOG_MARK,APLOG_ERR,OK,NULL,"Optional hook test said: %s",
|
||||||
szStr);
|
szStr);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ static int ImportOptionalHookTestHook(const char *szStr)
|
|||||||
static void ImportRegisterHooks(apr_pool_t *p)
|
static void ImportRegisterHooks(apr_pool_t *p)
|
||||||
{
|
{
|
||||||
AP_OPTIONAL_HOOK(optional_hook_test,ImportOptionalHookTestHook,NULL,
|
AP_OPTIONAL_HOOK(optional_hook_test,ImportOptionalHookTestHook,NULL,
|
||||||
NULL,APR_HOOK_MIDDLE);
|
NULL,APR_HOOK_MIDDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
module AP_MODULE_DECLARE_DATA optional_hook_import_module=
|
module AP_MODULE_DECLARE_DATA optional_hook_import_module=
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
#if APR_CHARSET_EBCDIC
|
#if APR_CHARSET_EBCDIC
|
||||||
#include "ebcdic.h"
|
#include "ebcdic.h"
|
||||||
/*
|
/*
|
||||||
Initial Port for Apache-1.3 by <Martin.Kraemer Mch.SNI.De>
|
Initial Port for Apache-1.3 by <Martin.Kraemer Mch.SNI.De>
|
||||||
|
|
||||||
"BS2000 OSD" is a POSIX on a main frame. It is made by Siemens AG, Germany.
|
"BS2000 OSD" is a POSIX on a main frame. It is made by Siemens AG, Germany.
|
||||||
Within the POSIX subsystem, the same character set was chosen as in
|
Within the POSIX subsystem, the same character set was chosen as in
|
||||||
@@ -149,37 +149,37 @@ f0 8c 49 cd ce cb cf cc e1 70 c0 de db dc 8d 8e df *................*
|
|||||||
*/
|
*/
|
||||||
const unsigned char os_toebcdic[256] = {
|
const unsigned char os_toebcdic[256] = {
|
||||||
/*00*/ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
|
/*00*/ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
|
||||||
0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
|
0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
|
||||||
/*10*/ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
|
/*10*/ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
|
||||||
0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
|
0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
|
||||||
/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
|
/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
|
||||||
0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
|
0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
|
||||||
/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
||||||
0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/
|
0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/
|
||||||
/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
||||||
0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/
|
0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/
|
||||||
/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
|
/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
|
||||||
0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/
|
0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/
|
||||||
/*60*/ 0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
/*60*/ 0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||||
0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/
|
0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/
|
||||||
/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
|
/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
|
||||||
0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/
|
0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/
|
||||||
/*80*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08,
|
/*80*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08,
|
||||||
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/
|
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/
|
||||||
/*90*/ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17,
|
/*90*/ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17,
|
||||||
0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/
|
0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/
|
||||||
/*a0*/ 0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
|
/*a0*/ 0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
|
||||||
0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/
|
0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/
|
||||||
/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
|
/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
|
||||||
0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/
|
0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/
|
||||||
/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
|
/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
|
||||||
0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/
|
0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/
|
||||||
/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
|
/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
|
||||||
0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/
|
0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/
|
||||||
/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
|
/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
|
||||||
0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/
|
0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/
|
||||||
/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
|
/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
|
||||||
0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/
|
0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset)
|
/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset)
|
||||||
@@ -189,22 +189,22 @@ const unsigned char os_toebcdic[256] = {
|
|||||||
void
|
void
|
||||||
ebcdic2ascii(unsigned char *dest, const unsigned char *srce, size_t count)
|
ebcdic2ascii(unsigned char *dest, const unsigned char *srce, size_t count)
|
||||||
{
|
{
|
||||||
while (count-- != 0) {
|
while (count-- != 0) {
|
||||||
*dest++ = os_toascii[*srce++];
|
*dest++ = os_toascii[*srce++];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
ebcdic2ascii_strictly(unsigned char *dest, const unsigned char *srce, size_t count)
|
ebcdic2ascii_strictly(unsigned char *dest, const unsigned char *srce, size_t count)
|
||||||
{
|
{
|
||||||
while (count-- != 0) {
|
while (count-- != 0) {
|
||||||
*dest++ = os_toascii_strictly[*srce++];
|
*dest++ = os_toascii_strictly[*srce++];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
ascii2ebcdic(unsigned char *dest, const unsigned char *srce, size_t count)
|
ascii2ebcdic(unsigned char *dest, const unsigned char *srce, size_t count)
|
||||||
{
|
{
|
||||||
while (count-- != 0) {
|
while (count-- != 0) {
|
||||||
*dest++ = os_toebcdic[*srce++];
|
*dest++ = os_toebcdic[*srce++];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /*APR_CHARSET_EBCDIC*/
|
#endif /*APR_CHARSET_EBCDIC*/
|
||||||
|
@@ -44,8 +44,8 @@ static bs2_ForkType forktype = bs2_unknown;
|
|||||||
static void ap_str_toupper(char *str)
|
static void ap_str_toupper(char *str)
|
||||||
{
|
{
|
||||||
while (*str) {
|
while (*str) {
|
||||||
*str = apr_toupper(*str);
|
*str = apr_toupper(*str);
|
||||||
++str;
|
++str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,12 +90,12 @@ int os_init_job_environment(server_rec *server, const char *user_name, int one_p
|
|||||||
|
|
||||||
if (one_process) {
|
if (one_process) {
|
||||||
|
|
||||||
type = forktype = bs2_noFORK;
|
type = forktype = bs2_noFORK;
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, server,
|
ap_log_error(APLOG_MARK, APLOG_ERR, 0, server,
|
||||||
"The debug mode of Apache should only "
|
"The debug mode of Apache should only "
|
||||||
"be started by an unprivileged user!");
|
"be started by an unprivileged user!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -110,27 +110,27 @@ pid_t os_fork(const char *user)
|
|||||||
switch (os_forktype(0)) {
|
switch (os_forktype(0)) {
|
||||||
|
|
||||||
case bs2_FORK:
|
case bs2_FORK:
|
||||||
pid = fork();
|
pid = fork();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case bs2_UFORK:
|
case bs2_UFORK:
|
||||||
apr_cpystrn(username, user, sizeof username);
|
apr_cpystrn(username, user, sizeof username);
|
||||||
|
|
||||||
/* Make user name all upper case - for some versions of ufork() */
|
/* Make user name all upper case - for some versions of ufork() */
|
||||||
ap_str_toupper(username);
|
ap_str_toupper(username);
|
||||||
|
|
||||||
pid = ufork(username);
|
pid = ufork(username);
|
||||||
if (pid == -1 && errno == EPERM) {
|
if (pid == -1 && errno == EPERM) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
|
ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
|
||||||
NULL, "ufork: Possible mis-configuration "
|
NULL, "ufork: Possible mis-configuration "
|
||||||
"for user %s - Aborting.", user);
|
"for user %s - Aborting.", user);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
pid = 0;
|
pid = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
|
@@ -37,13 +37,13 @@ AP_DECLARE(apr_status_t) ap_os_create_privileged_process(
|
|||||||
|
|
||||||
int _NonAppCheckUnload( void )
|
int _NonAppCheckUnload( void )
|
||||||
{
|
{
|
||||||
return nlmUnloadSignaled(1);
|
return nlmUnloadSignaled(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// down server event callback
|
// down server event callback
|
||||||
void ap_down_server_cb(void *, void *)
|
void ap_down_server_cb(void *, void *)
|
||||||
{
|
{
|
||||||
nlmUnloadSignaled(0);
|
nlmUnloadSignaled(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
160
os/unix/unixd.c
160
os/unix/unixd.c
@@ -63,49 +63,49 @@ unixd_config_rec unixd_config;
|
|||||||
static int set_group_privs(void)
|
static int set_group_privs(void)
|
||||||
{
|
{
|
||||||
if (!geteuid()) {
|
if (!geteuid()) {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
/* Get username if passed as a uid */
|
/* Get username if passed as a uid */
|
||||||
|
|
||||||
if (unixd_config.user_name[0] == '#') {
|
if (unixd_config.user_name[0] == '#') {
|
||||||
struct passwd *ent;
|
struct passwd *ent;
|
||||||
uid_t uid = atoi(&unixd_config.user_name[1]);
|
uid_t uid = atoi(&unixd_config.user_name[1]);
|
||||||
|
|
||||||
if ((ent = getpwuid(uid)) == NULL) {
|
if ((ent = getpwuid(uid)) == NULL) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||||
"getpwuid: couldn't determine user name from uid %u, "
|
"getpwuid: couldn't determine user name from uid %u, "
|
||||||
"you probably need to modify the User directive",
|
"you probably need to modify the User directive",
|
||||||
(unsigned)uid);
|
(unsigned)uid);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
name = ent->pw_name;
|
name = ent->pw_name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
name = unixd_config.user_name;
|
name = unixd_config.user_name;
|
||||||
|
|
||||||
#if !defined(OS2) && !defined(TPF)
|
#if !defined(OS2) && !defined(TPF)
|
||||||
/* OS/2 and TPF don't support groups. */
|
/* OS/2 and TPF don't support groups. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the GID before initgroups(), since on some platforms
|
* Set the GID before initgroups(), since on some platforms
|
||||||
* setgid() is known to zap the group list.
|
* setgid() is known to zap the group list.
|
||||||
*/
|
*/
|
||||||
if (setgid(unixd_config.group_id) == -1) {
|
if (setgid(unixd_config.group_id) == -1) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||||
"setgid: unable to set group id to Group %u",
|
"setgid: unable to set group id to Group %u",
|
||||||
(unsigned)unixd_config.group_id);
|
(unsigned)unixd_config.group_id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset `groups' attributes. */
|
/* Reset `groups' attributes. */
|
||||||
|
|
||||||
if (initgroups(name, unixd_config.group_id) == -1) {
|
if (initgroups(name, unixd_config.group_id) == -1) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||||
"initgroups: unable to set groups for User %s "
|
"initgroups: unable to set groups for User %s "
|
||||||
"and Group %u", name, (unsigned)unixd_config.group_id);
|
"and Group %u", name, (unsigned)unixd_config.group_id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif /* !defined(OS2) && !defined(TPF) */
|
#endif /* !defined(OS2) && !defined(TPF) */
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -115,32 +115,32 @@ static int set_group_privs(void)
|
|||||||
AP_DECLARE(int) unixd_setup_child(void)
|
AP_DECLARE(int) unixd_setup_child(void)
|
||||||
{
|
{
|
||||||
if (set_group_privs()) {
|
if (set_group_privs()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#ifdef MPE
|
#ifdef MPE
|
||||||
/* Only try to switch if we're running as MANAGER.SYS */
|
/* Only try to switch if we're running as MANAGER.SYS */
|
||||||
if (geteuid() == 1 && unixd_config.user_id > 1) {
|
if (geteuid() == 1 && unixd_config.user_id > 1) {
|
||||||
GETPRIVMODE();
|
GETPRIVMODE();
|
||||||
if (setuid(unixd_config.user_id) == -1) {
|
if (setuid(unixd_config.user_id) == -1) {
|
||||||
GETUSERMODE();
|
GETUSERMODE();
|
||||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||||
"setuid: unable to change to uid: %ld",
|
"setuid: unable to change to uid: %ld",
|
||||||
(long) unixd_config.user_id);
|
(long) unixd_config.user_id);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
GETUSERMODE();
|
GETUSERMODE();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* Only try to switch if we're running as root */
|
/* Only try to switch if we're running as root */
|
||||||
if (!geteuid() && (
|
if (!geteuid() && (
|
||||||
#ifdef _OSD_POSIX
|
#ifdef _OSD_POSIX
|
||||||
os_init_job_environment(NULL, unixd_config.user_name, ap_exists_config_define("DEBUG")) != 0 ||
|
os_init_job_environment(NULL, unixd_config.user_name, ap_exists_config_define("DEBUG")) != 0 ||
|
||||||
#endif
|
#endif
|
||||||
setuid(unixd_config.user_id) == -1)) {
|
setuid(unixd_config.user_id) == -1)) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
|
||||||
"setuid: unable to change to uid: %ld",
|
"setuid: unable to change to uid: %ld",
|
||||||
(long) unixd_config.user_id);
|
(long) unixd_config.user_id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
|
#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
|
||||||
/* this applies to Linux 2.4+ */
|
/* this applies to Linux 2.4+ */
|
||||||
@@ -171,15 +171,15 @@ AP_DECLARE(const char *) unixd_set_user(cmd_parms *cmd, void *dummy,
|
|||||||
unixd_config.user_id = ap_uname2id(arg);
|
unixd_config.user_id = ap_uname2id(arg);
|
||||||
#if !defined (BIG_SECURITY_HOLE) && !defined (OS2)
|
#if !defined (BIG_SECURITY_HOLE) && !defined (OS2)
|
||||||
if (unixd_config.user_id == 0) {
|
if (unixd_config.user_id == 0) {
|
||||||
return "Error:\tApache has not been designed to serve pages while\n"
|
return "Error:\tApache has not been designed to serve pages while\n"
|
||||||
"\trunning as root. There are known race conditions that\n"
|
"\trunning as root. There are known race conditions that\n"
|
||||||
"\twill allow any local user to read any file on the system.\n"
|
"\twill allow any local user to read any file on the system.\n"
|
||||||
"\tIf you still desire to serve pages as root then\n"
|
"\tIf you still desire to serve pages as root then\n"
|
||||||
"\tadd -DBIG_SECURITY_HOLE to the CFLAGS env variable\n"
|
"\tadd -DBIG_SECURITY_HOLE to the CFLAGS env variable\n"
|
||||||
"\tand then rebuild the server.\n"
|
"\tand then rebuild the server.\n"
|
||||||
"\tIt is strongly suggested that you instead modify the User\n"
|
"\tIt is strongly suggested that you instead modify the User\n"
|
||||||
"\tdirective in your httpd.conf file to list a non-root\n"
|
"\tdirective in your httpd.conf file to list a non-root\n"
|
||||||
"\tuser.\n";
|
"\tuser.\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -330,7 +330,7 @@ static apr_status_t ap_unix_create_privileged_process(
|
|||||||
if (args) {
|
if (args) {
|
||||||
while (args[i]) {
|
while (args[i]) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* allocate space for 4 new args, the input args, and a null terminator */
|
/* allocate space for 4 new args, the input args, and a null terminator */
|
||||||
newargs = apr_palloc(p, sizeof(char *) * (i + 4));
|
newargs = apr_palloc(p, sizeof(char *) * (i + 4));
|
||||||
@@ -622,8 +622,8 @@ static bs2_ForkType forktype = bs2_unknown;
|
|||||||
static void ap_str_toupper(char *str)
|
static void ap_str_toupper(char *str)
|
||||||
{
|
{
|
||||||
while (*str) {
|
while (*str) {
|
||||||
*str = apr_toupper(*str);
|
*str = apr_toupper(*str);
|
||||||
++str;
|
++str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -668,12 +668,12 @@ int os_init_job_environment(server_rec *server, const char *user_name, int one_p
|
|||||||
|
|
||||||
if (one_process) {
|
if (one_process) {
|
||||||
|
|
||||||
type = forktype = bs2_noFORK;
|
type = forktype = bs2_noFORK;
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, server,
|
ap_log_error(APLOG_MARK, APLOG_ERR, 0, server,
|
||||||
"The debug mode of Apache should only "
|
"The debug mode of Apache should only "
|
||||||
"be started by an unprivileged user!");
|
"be started by an unprivileged user!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -688,27 +688,27 @@ pid_t os_fork(const char *user)
|
|||||||
switch (os_forktype(0)) {
|
switch (os_forktype(0)) {
|
||||||
|
|
||||||
case bs2_FORK:
|
case bs2_FORK:
|
||||||
pid = fork();
|
pid = fork();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case bs2_UFORK:
|
case bs2_UFORK:
|
||||||
apr_cpystrn(username, user, sizeof username);
|
apr_cpystrn(username, user, sizeof username);
|
||||||
|
|
||||||
/* Make user name all upper case - for some versions of ufork() */
|
/* Make user name all upper case - for some versions of ufork() */
|
||||||
ap_str_toupper(username);
|
ap_str_toupper(username);
|
||||||
|
|
||||||
pid = ufork(username);
|
pid = ufork(username);
|
||||||
if (pid == -1 && errno == EPERM) {
|
if (pid == -1 && errno == EPERM) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
|
ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
|
||||||
NULL, "ufork: Possible mis-configuration "
|
NULL, "ufork: Possible mis-configuration "
|
||||||
"for user %s - Aborting.", user);
|
"for user %s - Aborting.", user);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
pid = 0;
|
pid = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
|
@@ -121,13 +121,13 @@ PSECURITY_ATTRIBUTES GetNullACL()
|
|||||||
}
|
}
|
||||||
apr_set_os_error(0);
|
apr_set_os_error(0);
|
||||||
if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION)
|
if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION)
|
||||||
|| apr_get_os_error()) {
|
|| apr_get_os_error()) {
|
||||||
LocalFree( pSD );
|
LocalFree( pSD );
|
||||||
LocalFree( sa );
|
LocalFree( sa );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!SetSecurityDescriptorDacl(pSD, TRUE, (PACL) NULL, FALSE)
|
if (!SetSecurityDescriptorDacl(pSD, TRUE, (PACL) NULL, FALSE)
|
||||||
|| apr_get_os_error()) {
|
|| apr_get_os_error()) {
|
||||||
LocalFree( pSD );
|
LocalFree( pSD );
|
||||||
LocalFree( sa );
|
LocalFree( sa );
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -34,8 +34,8 @@
|
|||||||
|
|
||||||
APR_HOOK_STRUCT(
|
APR_HOOK_STRUCT(
|
||||||
APR_HOOK_LINK(create_connection)
|
APR_HOOK_LINK(create_connection)
|
||||||
APR_HOOK_LINK(process_connection)
|
APR_HOOK_LINK(process_connection)
|
||||||
APR_HOOK_LINK(pre_connection)
|
APR_HOOK_LINK(pre_connection)
|
||||||
)
|
)
|
||||||
AP_IMPLEMENT_HOOK_RUN_FIRST(conn_rec *,create_connection,
|
AP_IMPLEMENT_HOOK_RUN_FIRST(conn_rec *,create_connection,
|
||||||
(apr_pool_t *p, server_rec *server, apr_socket_t *csd, long conn_id, void *sbh, apr_bucket_alloc_t *alloc),
|
(apr_pool_t *p, server_rec *server, apr_socket_t *csd, long conn_id, void *sbh, apr_bucket_alloc_t *alloc),
|
||||||
|
@@ -260,7 +260,7 @@ static void *merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(new->override_opts & OPT_UNSET)) {
|
if (!(new->override_opts & OPT_UNSET)) {
|
||||||
conf->override_opts = new->override_opts;
|
conf->override_opts = new->override_opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new->ap_default_type) {
|
if (new->ap_default_type) {
|
||||||
@@ -750,7 +750,7 @@ char *ap_response_code_string(request_rec *r, int error_index)
|
|||||||
&core_module);
|
&core_module);
|
||||||
|
|
||||||
if (dirconf->response_code_strings == NULL) {
|
if (dirconf->response_code_strings == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirconf->response_code_strings[error_index] == &errordocument_default) {
|
if (dirconf->response_code_strings[error_index] == &errordocument_default) {
|
||||||
@@ -1343,21 +1343,21 @@ static const char *set_override(cmd_parms *cmd, void *d_, const char *l)
|
|||||||
while (l[0]) {
|
while (l[0]) {
|
||||||
w = ap_getword_conf(cmd->pool, &l);
|
w = ap_getword_conf(cmd->pool, &l);
|
||||||
|
|
||||||
k = w;
|
k = w;
|
||||||
v = strchr(k, '=');
|
v = strchr(k, '=');
|
||||||
if (v) {
|
if (v) {
|
||||||
*v++ = '\0';
|
*v++ = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcasecmp(w, "Limit")) {
|
if (!strcasecmp(w, "Limit")) {
|
||||||
d->override |= OR_LIMIT;
|
d->override |= OR_LIMIT;
|
||||||
}
|
}
|
||||||
else if (!strcasecmp(k, "Options")) {
|
else if (!strcasecmp(k, "Options")) {
|
||||||
d->override |= OR_OPTIONS;
|
d->override |= OR_OPTIONS;
|
||||||
if (v)
|
if (v)
|
||||||
set_allow_opts(cmd, &(d->override_opts), v);
|
set_allow_opts(cmd, &(d->override_opts), v);
|
||||||
else
|
else
|
||||||
d->override_opts = OPT_ALL;
|
d->override_opts = OPT_ALL;
|
||||||
}
|
}
|
||||||
else if (!strcasecmp(w, "FileInfo")) {
|
else if (!strcasecmp(w, "FileInfo")) {
|
||||||
d->override |= OR_FILEINFO;
|
d->override |= OR_FILEINFO;
|
||||||
@@ -1437,8 +1437,8 @@ static const char *set_options(cmd_parms *cmd, void *d_, const char *l)
|
|||||||
return apr_pstrcat(cmd->pool, "Illegal option ", w, NULL);
|
return apr_pstrcat(cmd->pool, "Illegal option ", w, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(cmd->override_opts & opt) && opt != OPT_NONE) {
|
if (!(cmd->override_opts & opt) && opt != OPT_NONE) {
|
||||||
return apr_pstrcat(cmd->pool, "Option ", w, " not allowed here", NULL);
|
return apr_pstrcat(cmd->pool, "Option ", w, " not allowed here", NULL);
|
||||||
}
|
}
|
||||||
else if (action == '-') {
|
else if (action == '-') {
|
||||||
/* we ensure the invariant (d->opts_add & d->opts_remove) == 0 */
|
/* we ensure the invariant (d->opts_add & d->opts_remove) == 0 */
|
||||||
|
@@ -296,7 +296,7 @@ static apr_status_t beos_accept(void **accepted, ap_listen_rec *lr, apr_pool_t *
|
|||||||
if (APR_STATUS_IS_EINTR(status)) {
|
if (APR_STATUS_IS_EINTR(status)) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
/* This switch statement provides us with better error details. */
|
/* This switch statement provides us with better error details. */
|
||||||
switch (status) {
|
switch (status) {
|
||||||
#ifdef ECONNABORTED
|
#ifdef ECONNABORTED
|
||||||
case ECONNABORTED:
|
case ECONNABORTED:
|
||||||
@@ -376,7 +376,7 @@ static void set_signals(void)
|
|||||||
/* These next two are handled by sig_term */
|
/* These next two are handled by sig_term */
|
||||||
sa.sa_handler = sig_term;
|
sa.sa_handler = sig_term;
|
||||||
if (sigaction(SIGTERM, &sa, NULL) < 0)
|
if (sigaction(SIGTERM, &sa, NULL) < 0)
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
|
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
|
||||||
if (sigaction(SIGINT, &sa, NULL) < 0)
|
if (sigaction(SIGINT, &sa, NULL) < 0)
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)");
|
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)");
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ static void set_signals(void)
|
|||||||
if (sigaction(SIGHUP, &sa, NULL) < 0)
|
if (sigaction(SIGHUP, &sa, NULL) < 0)
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
|
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
|
||||||
if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
|
if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(" AP_SIG_GRACEFUL_STRING ")");
|
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(" AP_SIG_GRACEFUL_STRING ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
@@ -489,7 +489,7 @@ static int32 worker_thread(void *dummy)
|
|||||||
|
|
||||||
mpm_state = AP_MPMQ_RUNNING;
|
mpm_state = AP_MPMQ_RUNNING;
|
||||||
|
|
||||||
while (!this_worker_should_exit) {
|
while (!this_worker_should_exit) {
|
||||||
conn_rec *current_conn;
|
conn_rec *current_conn;
|
||||||
void *csd;
|
void *csd;
|
||||||
|
|
||||||
@@ -603,7 +603,7 @@ static int make_worker(int slot)
|
|||||||
thread_id tid;
|
thread_id tid;
|
||||||
|
|
||||||
if (slot + 1 > ap_max_child_assigned)
|
if (slot + 1 > ap_max_child_assigned)
|
||||||
ap_max_child_assigned = slot + 1;
|
ap_max_child_assigned = slot + 1;
|
||||||
|
|
||||||
(void) ap_update_child_status_from_indexes(0, slot, SERVER_STARTING, (request_rec*)NULL);
|
(void) ap_update_child_status_from_indexes(0, slot, SERVER_STARTING, (request_rec*)NULL);
|
||||||
|
|
||||||
@@ -663,7 +663,7 @@ static void startup_threads(int number_to_start)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (make_worker(i) < 0)
|
if (make_worker(i) < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
--number_to_start;
|
--number_to_start;
|
||||||
}
|
}
|
||||||
@@ -704,23 +704,23 @@ static void perform_idle_server_maintenance(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i >= ap_max_child_assigned && free_length >= spawn_rate) {
|
if (i >= ap_max_child_assigned && free_length >= spawn_rate) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ap_max_child_assigned = last_non_dead + 1;
|
ap_max_child_assigned = last_non_dead + 1;
|
||||||
|
|
||||||
if (free_length > 0) {
|
if (free_length > 0) {
|
||||||
for (i = 0; i < free_length; ++i) {
|
for (i = 0; i < free_length; ++i) {
|
||||||
make_worker(free_slots[i]);
|
make_worker(free_slots[i]);
|
||||||
}
|
}
|
||||||
/* the next time around we want to spawn twice as many if this
|
/* the next time around we want to spawn twice as many if this
|
||||||
* wasn't good enough, but not if we've just done a graceful
|
* wasn't good enough, but not if we've just done a graceful
|
||||||
*/
|
*/
|
||||||
if (hold_off_on_exponential_spawning) {
|
if (hold_off_on_exponential_spawning) {
|
||||||
--hold_off_on_exponential_spawning;
|
--hold_off_on_exponential_spawning;
|
||||||
} else if (spawn_rate < MAX_SPAWN_RATE) {
|
} else if (spawn_rate < MAX_SPAWN_RATE) {
|
||||||
spawn_rate *= 2;
|
spawn_rate *= 2;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
spawn_rate = 1;
|
spawn_rate = 1;
|
||||||
}
|
}
|
||||||
@@ -759,13 +759,13 @@ static void server_main_loop(int remaining_threads_to_start)
|
|||||||
(request_rec*)NULL);
|
(request_rec*)NULL);
|
||||||
|
|
||||||
if (remaining_threads_to_start
|
if (remaining_threads_to_start
|
||||||
&& child_slot < ap_thread_limit) {
|
&& child_slot < ap_thread_limit) {
|
||||||
/* we're still doing a 1-for-1 replacement of dead
|
/* we're still doing a 1-for-1 replacement of dead
|
||||||
* children with new children
|
* children with new children
|
||||||
*/
|
*/
|
||||||
make_worker(child_slot);
|
make_worker(child_slot);
|
||||||
--remaining_threads_to_start;
|
--remaining_threads_to_start;
|
||||||
}
|
}
|
||||||
/* TODO
|
/* TODO
|
||||||
#if APR_HAS_OTHER_CHILD
|
#if APR_HAS_OTHER_CHILD
|
||||||
}
|
}
|
||||||
@@ -779,9 +779,9 @@ static void server_main_loop(int remaining_threads_to_start)
|
|||||||
* child.
|
* child.
|
||||||
*/
|
*/
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ap_server_conf,
|
||||||
"long lost child came home! (pid %ld)", pid.pid);
|
"long lost child came home! (pid %ld)", pid.pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't perform idle maintenance when a child dies,
|
/* Don't perform idle maintenance when a child dies,
|
||||||
* only do it when there's a timeout. Remember only a
|
* only do it when there's a timeout. Remember only a
|
||||||
* finite number of children can die, and it's pretty
|
* finite number of children can die, and it's pretty
|
||||||
@@ -789,7 +789,7 @@ static void server_main_loop(int remaining_threads_to_start)
|
|||||||
*/
|
*/
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (remaining_threads_to_start) {
|
else if (remaining_threads_to_start) {
|
||||||
/* we hit a 1 second timeout in which none of the previous
|
/* we hit a 1 second timeout in which none of the previous
|
||||||
* generation of children needed to be reaped... so assume
|
* generation of children needed to be reaped... so assume
|
||||||
* they're all done, and pick up the slack if any is left.
|
* they're all done, and pick up the slack if any is left.
|
||||||
@@ -913,7 +913,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
|||||||
remaining_threads_to_start = ap_threads_to_start;
|
remaining_threads_to_start = ap_threads_to_start;
|
||||||
/* sanity check on the number to start... */
|
/* sanity check on the number to start... */
|
||||||
if (remaining_threads_to_start > ap_thread_limit) {
|
if (remaining_threads_to_start > ap_thread_limit) {
|
||||||
remaining_threads_to_start = ap_thread_limit;
|
remaining_threads_to_start = ap_thread_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're doing the single process thing or we're in a graceful_restart
|
/* If we're doing the single process thing or we're in a graceful_restart
|
||||||
@@ -922,11 +922,11 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
|||||||
* do we??
|
* do we??
|
||||||
*/
|
*/
|
||||||
if (!is_graceful && !one_process) {
|
if (!is_graceful && !one_process) {
|
||||||
startup_threads(remaining_threads_to_start);
|
startup_threads(remaining_threads_to_start);
|
||||||
remaining_threads_to_start = 0;
|
remaining_threads_to_start = 0;
|
||||||
} else {
|
} else {
|
||||||
/* give the system some time to recover before kicking into
|
/* give the system some time to recover before kicking into
|
||||||
* exponential mode */
|
* exponential mode */
|
||||||
hold_off_on_exponential_spawning = 10;
|
hold_off_on_exponential_spawning = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -934,11 +934,11 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
|||||||
* record that we've entered the world !
|
* record that we've entered the world !
|
||||||
*/
|
*/
|
||||||
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
|
||||||
"%s configured -- resuming normal operations",
|
"%s configured -- resuming normal operations",
|
||||||
ap_get_server_version());
|
ap_get_server_version());
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_INFO, 0, ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_INFO, 0, ap_server_conf,
|
||||||
"Server built: %s", ap_get_server_built());
|
"Server built: %s", ap_get_server_built());
|
||||||
|
|
||||||
restart_pending = shutdown_pending = 0;
|
restart_pending = shutdown_pending = 0;
|
||||||
|
|
||||||
@@ -1003,16 +1003,16 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
|||||||
|
|
||||||
if (is_graceful) {
|
if (is_graceful) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
|
||||||
AP_SIG_GRACEFUL_STRING " received. Doing graceful restart");
|
AP_SIG_GRACEFUL_STRING " received. Doing graceful restart");
|
||||||
} else {
|
} else {
|
||||||
/* Kill 'em all. Since the child acts the same on the parents SIGTERM
|
/* Kill 'em all. Since the child acts the same on the parents SIGTERM
|
||||||
* and a SIGHUP, we may as well use the same signal, because some user
|
* and a SIGHUP, we may as well use the same signal, because some user
|
||||||
* pthreads are stealing signals from us left and right.
|
* pthreads are stealing signals from us left and right.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ap_reclaim_child_processes(1); /* Start with SIGTERM */
|
ap_reclaim_child_processes(1); /* Start with SIGTERM */
|
||||||
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
|
||||||
"SIGHUP received. Attempting to restart");
|
"SIGHUP received. Attempting to restart");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* just before we go, tidy up the lock we created to prevent a
|
/* just before we go, tidy up the lock we created to prevent a
|
||||||
@@ -1070,7 +1070,7 @@ static int beos_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptem
|
|||||||
ap_pid_fname = DEFAULT_PIDLOG;
|
ap_pid_fname = DEFAULT_PIDLOG;
|
||||||
ap_max_requests_per_thread = DEFAULT_MAX_REQUESTS_PER_THREAD;
|
ap_max_requests_per_thread = DEFAULT_MAX_REQUESTS_PER_THREAD;
|
||||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
||||||
|
@@ -26,7 +26,7 @@ typedef struct recycled_pool
|
|||||||
struct fd_queue_info_t
|
struct fd_queue_info_t
|
||||||
{
|
{
|
||||||
apr_int32_t idlers; /**
|
apr_int32_t idlers; /**
|
||||||
* 0 or positive: number of idle worker threads
|
* 0 or positive: number of idle worker threads
|
||||||
* negative: number of threads blocked waiting
|
* negative: number of threads blocked waiting
|
||||||
* for an idle worker
|
* for an idle worker
|
||||||
*/
|
*/
|
||||||
|
@@ -1534,9 +1534,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
|||||||
"Server built: %s", ap_get_server_built());
|
"Server built: %s", ap_get_server_built());
|
||||||
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
||||||
"AcceptMutex: %s (default: %s)",
|
"AcceptMutex: %s (default: %s)",
|
||||||
apr_proc_mutex_name(accept_mutex),
|
apr_proc_mutex_name(accept_mutex),
|
||||||
apr_proc_mutex_defname());
|
apr_proc_mutex_defname());
|
||||||
#endif
|
#endif
|
||||||
restart_pending = shutdown_pending = 0;
|
restart_pending = shutdown_pending = 0;
|
||||||
mpm_state = AP_MPMQ_RUNNING;
|
mpm_state = AP_MPMQ_RUNNING;
|
||||||
@@ -1550,9 +1550,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
|||||||
* (By "gracefully" we don't mean graceful in the same sense as
|
* (By "gracefully" we don't mean graceful in the same sense as
|
||||||
* "apachectl graceful" where we allow old connections to finish.)
|
* "apachectl graceful" where we allow old connections to finish.)
|
||||||
*/
|
*/
|
||||||
if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
|
if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM");
|
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM");
|
||||||
}
|
}
|
||||||
ap_reclaim_child_processes(1); /* Start with SIGTERM */
|
ap_reclaim_child_processes(1); /* Start with SIGTERM */
|
||||||
|
|
||||||
if (!child_fatal) {
|
if (!child_fatal) {
|
||||||
@@ -1726,7 +1726,7 @@ static int leader_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
|
|||||||
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
||||||
ap_extended_status = 0;
|
ap_extended_status = 0;
|
||||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
||||||
@@ -1918,9 +1918,9 @@ static const char *set_server_limit (cmd_parms *cmd, void *dummy, const char *ar
|
|||||||
server_limit = MAX_SERVER_LIMIT;
|
server_limit = MAX_SERVER_LIMIT;
|
||||||
}
|
}
|
||||||
else if (server_limit < 1) {
|
else if (server_limit < 1) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
"WARNING: Require ServerLimit > 0, setting to 1");
|
"WARNING: Require ServerLimit > 0, setting to 1");
|
||||||
server_limit = 1;
|
server_limit = 1;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1958,9 +1958,9 @@ static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *ar
|
|||||||
thread_limit = MAX_THREAD_LIMIT;
|
thread_limit = MAX_THREAD_LIMIT;
|
||||||
}
|
}
|
||||||
else if (thread_limit < 1) {
|
else if (thread_limit < 1) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
"WARNING: Require ThreadLimit > 0, setting to 1");
|
"WARNING: Require ThreadLimit > 0, setting to 1");
|
||||||
thread_limit = 1;
|
thread_limit = 1;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -1319,9 +1319,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
|||||||
"Server built: %s", ap_get_server_built());
|
"Server built: %s", ap_get_server_built());
|
||||||
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
||||||
"AcceptMutex: %s (default: %s)",
|
"AcceptMutex: %s (default: %s)",
|
||||||
apr_proc_mutex_name(process_accept_mutex),
|
apr_proc_mutex_name(process_accept_mutex),
|
||||||
apr_proc_mutex_defname());
|
apr_proc_mutex_defname());
|
||||||
#endif
|
#endif
|
||||||
restart_pending = shutdown_pending = 0;
|
restart_pending = shutdown_pending = 0;
|
||||||
|
|
||||||
@@ -1497,7 +1497,7 @@ static int perchild_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptem
|
|||||||
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
||||||
curr_child_num = 0;
|
curr_child_num = 0;
|
||||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
||||||
@@ -1956,9 +1956,9 @@ static const char *set_server_limit (cmd_parms *cmd, void *dummy, const char *ar
|
|||||||
server_limit = MAX_SERVER_LIMIT;
|
server_limit = MAX_SERVER_LIMIT;
|
||||||
}
|
}
|
||||||
else if (server_limit < 1) {
|
else if (server_limit < 1) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
"WARNING: Require ServerLimit > 0, setting to 1");
|
"WARNING: Require ServerLimit > 0, setting to 1");
|
||||||
server_limit = 1;
|
server_limit = 1;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1996,9 +1996,9 @@ static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *ar
|
|||||||
thread_limit = MAX_THREAD_LIMIT;
|
thread_limit = MAX_THREAD_LIMIT;
|
||||||
}
|
}
|
||||||
else if (thread_limit < 1) {
|
else if (thread_limit < 1) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
"WARNING: Require ThreadLimit > 0, setting to 1");
|
"WARNING: Require ThreadLimit > 0, setting to 1");
|
||||||
thread_limit = 1;
|
thread_limit = 1;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -1783,9 +1783,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
|||||||
"Server built: %s", ap_get_server_built());
|
"Server built: %s", ap_get_server_built());
|
||||||
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
||||||
"AcceptMutex: %s (default: %s)",
|
"AcceptMutex: %s (default: %s)",
|
||||||
apr_proc_mutex_name(accept_mutex),
|
apr_proc_mutex_name(accept_mutex),
|
||||||
apr_proc_mutex_defname());
|
apr_proc_mutex_defname());
|
||||||
#endif
|
#endif
|
||||||
restart_pending = shutdown_pending = 0;
|
restart_pending = shutdown_pending = 0;
|
||||||
mpm_state = AP_MPMQ_RUNNING;
|
mpm_state = AP_MPMQ_RUNNING;
|
||||||
@@ -1980,7 +1980,7 @@ static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
|
|||||||
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
||||||
ap_extended_status = 0;
|
ap_extended_status = 0;
|
||||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
||||||
@@ -2172,9 +2172,9 @@ static const char *set_server_limit (cmd_parms *cmd, void *dummy, const char *ar
|
|||||||
server_limit = MAX_SERVER_LIMIT;
|
server_limit = MAX_SERVER_LIMIT;
|
||||||
}
|
}
|
||||||
else if (server_limit < 1) {
|
else if (server_limit < 1) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
"WARNING: Require ServerLimit > 0, setting to 1");
|
"WARNING: Require ServerLimit > 0, setting to 1");
|
||||||
server_limit = 1;
|
server_limit = 1;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -2212,9 +2212,9 @@ static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *ar
|
|||||||
thread_limit = MAX_THREAD_LIMIT;
|
thread_limit = MAX_THREAD_LIMIT;
|
||||||
}
|
}
|
||||||
else if (thread_limit < 1) {
|
else if (thread_limit < 1) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
"WARNING: Require ThreadLimit > 0, setting to 1");
|
"WARNING: Require ThreadLimit > 0, setting to 1");
|
||||||
thread_limit = 1;
|
thread_limit = 1;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -269,15 +269,15 @@ static char master_main()
|
|||||||
|
|
||||||
ap_scoreboard_image->global->restart_time = apr_time_now();
|
ap_scoreboard_image->global->restart_time = apr_time_now();
|
||||||
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
|
||||||
"%s configured -- resuming normal operations",
|
"%s configured -- resuming normal operations",
|
||||||
ap_get_server_version());
|
ap_get_server_version());
|
||||||
ap_log_error(APLOG_MARK, APLOG_INFO, 0, ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_INFO, 0, ap_server_conf,
|
||||||
"Server built: %s", ap_get_server_built());
|
"Server built: %s", ap_get_server_built());
|
||||||
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
||||||
"AcceptMutex: %s (default: %s)",
|
"AcceptMutex: %s (default: %s)",
|
||||||
apr_proc_mutex_name(accept_mutex),
|
apr_proc_mutex_name(accept_mutex),
|
||||||
apr_proc_mutex_defname());
|
apr_proc_mutex_defname());
|
||||||
#endif
|
#endif
|
||||||
if (one_process) {
|
if (one_process) {
|
||||||
ap_scoreboard_image->parent[0].pid = getpid();
|
ap_scoreboard_image->parent[0].pid = getpid();
|
||||||
@@ -398,7 +398,7 @@ static void set_signals()
|
|||||||
sa.sa_handler = sig_term;
|
sa.sa_handler = sig_term;
|
||||||
|
|
||||||
if (sigaction(SIGTERM, &sa, NULL) < 0)
|
if (sigaction(SIGTERM, &sa, NULL) < 0)
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
|
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
|
||||||
|
|
||||||
if (sigaction(SIGINT, &sa, NULL) < 0)
|
if (sigaction(SIGINT, &sa, NULL) < 0)
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)");
|
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)");
|
||||||
@@ -471,7 +471,7 @@ static int mpmt_os2_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *
|
|||||||
ap_min_spare_threads = DEFAULT_MIN_SPARE_THREAD;
|
ap_min_spare_threads = DEFAULT_MIN_SPARE_THREAD;
|
||||||
ap_max_spare_threads = DEFAULT_MAX_SPARE_THREAD;
|
ap_max_spare_threads = DEFAULT_MAX_SPARE_THREAD;
|
||||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@@ -501,7 +501,7 @@ static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, const char
|
|||||||
|
|
||||||
|
|
||||||
static const char *set_min_spare_threads(cmd_parms *cmd, void *dummy,
|
static const char *set_min_spare_threads(cmd_parms *cmd, void *dummy,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
|
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
|
||||||
|
|
||||||
@@ -527,7 +527,7 @@ static const char *set_min_spare_threads(cmd_parms *cmd, void *dummy,
|
|||||||
|
|
||||||
|
|
||||||
static const char *set_max_spare_threads(cmd_parms *cmd, void *dummy,
|
static const char *set_max_spare_threads(cmd_parms *cmd, void *dummy,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
|
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
|
||||||
|
|
||||||
|
@@ -81,7 +81,7 @@ static void server_maintenance(void *vpArg);
|
|||||||
static void clean_child_exit(int code)
|
static void clean_child_exit(int code)
|
||||||
{
|
{
|
||||||
if (pchild) {
|
if (pchild) {
|
||||||
apr_pool_destroy(pchild);
|
apr_pool_destroy(pchild);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(code);
|
exit(code);
|
||||||
@@ -471,10 +471,10 @@ static void set_signals()
|
|||||||
sa.sa_handler = sig_term;
|
sa.sa_handler = sig_term;
|
||||||
|
|
||||||
if (sigaction(SIGTERM, &sa, NULL) < 0)
|
if (sigaction(SIGTERM, &sa, NULL) < 0)
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
|
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
|
||||||
|
|
||||||
sa.sa_handler = sig_hup;
|
sa.sa_handler = sig_hup;
|
||||||
|
|
||||||
if (sigaction(SIGHUP, &sa, NULL) < 0)
|
if (sigaction(SIGHUP, &sa, NULL) < 0)
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
|
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
|
||||||
}
|
}
|
||||||
|
@@ -1127,7 +1127,7 @@ static int CommandLineInterpreter(scr_t screenID, const char *commandLine)
|
|||||||
ap_show_modules();
|
ap_show_modules();
|
||||||
}
|
}
|
||||||
else if (!strnicmp("DIRECTIVES",&szcommandLine[iCommandLen],3)) {
|
else if (!strnicmp("DIRECTIVES",&szcommandLine[iCommandLen],3)) {
|
||||||
ap_show_directives();
|
ap_show_directives();
|
||||||
}
|
}
|
||||||
else if (!strnicmp("SHUTDOWN",&szcommandLine[iCommandLen],3)) {
|
else if (!strnicmp("SHUTDOWN",&szcommandLine[iCommandLen],3)) {
|
||||||
printf("Shutdown Requested...\n");
|
printf("Shutdown Requested...\n");
|
||||||
|
@@ -276,7 +276,7 @@ static void add_job(SOCKET sock)
|
|||||||
|
|
||||||
new_job = (joblist *) malloc(sizeof(joblist));
|
new_job = (joblist *) malloc(sizeof(joblist));
|
||||||
if (new_job == NULL) {
|
if (new_job == NULL) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
"Ouch! Out of memory in add_job()!");
|
"Ouch! Out of memory in add_job()!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -286,10 +286,10 @@ static void add_job(SOCKET sock)
|
|||||||
apr_thread_mutex_lock(allowed_globals.jobmutex);
|
apr_thread_mutex_lock(allowed_globals.jobmutex);
|
||||||
|
|
||||||
if (allowed_globals.jobtail != NULL)
|
if (allowed_globals.jobtail != NULL)
|
||||||
allowed_globals.jobtail->next = new_job;
|
allowed_globals.jobtail->next = new_job;
|
||||||
allowed_globals.jobtail = new_job;
|
allowed_globals.jobtail = new_job;
|
||||||
if (!allowed_globals.jobhead)
|
if (!allowed_globals.jobhead)
|
||||||
allowed_globals.jobhead = new_job;
|
allowed_globals.jobhead = new_job;
|
||||||
allowed_globals.jobcount++;
|
allowed_globals.jobcount++;
|
||||||
ReleaseSemaphore(allowed_globals.jobsemaphore, 1, NULL);
|
ReleaseSemaphore(allowed_globals.jobsemaphore, 1, NULL);
|
||||||
|
|
||||||
@@ -307,13 +307,13 @@ static SOCKET remove_job(void)
|
|||||||
|
|
||||||
if (shutdown_in_progress && !allowed_globals.jobhead) {
|
if (shutdown_in_progress && !allowed_globals.jobhead) {
|
||||||
apr_thread_mutex_unlock(allowed_globals.jobmutex);
|
apr_thread_mutex_unlock(allowed_globals.jobmutex);
|
||||||
return (INVALID_SOCKET);
|
return (INVALID_SOCKET);
|
||||||
}
|
}
|
||||||
job = allowed_globals.jobhead;
|
job = allowed_globals.jobhead;
|
||||||
ap_assert(job);
|
ap_assert(job);
|
||||||
allowed_globals.jobhead = job->next;
|
allowed_globals.jobhead = job->next;
|
||||||
if (allowed_globals.jobhead == NULL)
|
if (allowed_globals.jobhead == NULL)
|
||||||
allowed_globals.jobtail = NULL;
|
allowed_globals.jobtail = NULL;
|
||||||
apr_thread_mutex_unlock(allowed_globals.jobmutex);
|
apr_thread_mutex_unlock(allowed_globals.jobmutex);
|
||||||
sock = job->sock;
|
sock = job->sock;
|
||||||
free(job);
|
free(job);
|
||||||
@@ -356,9 +356,9 @@ static unsigned int __stdcall win9x_accept(void * dummy)
|
|||||||
head_listener = ap_listeners;
|
head_listener = ap_listeners;
|
||||||
|
|
||||||
while (!shutdown_in_progress) {
|
while (!shutdown_in_progress) {
|
||||||
tv.tv_sec = wait_time;
|
tv.tv_sec = wait_time;
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
memcpy(&main_fds, &listenfds, sizeof(fd_set));
|
memcpy(&main_fds, &listenfds, sizeof(fd_set));
|
||||||
|
|
||||||
/* First parameter of select() is ignored on Windows */
|
/* First parameter of select() is ignored on Windows */
|
||||||
rc = select(0, &main_fds, NULL, NULL, &tv);
|
rc = select(0, &main_fds, NULL, NULL, &tv);
|
||||||
@@ -381,30 +381,30 @@ static unsigned int __stdcall win9x_accept(void * dummy)
|
|||||||
"Too many errors in select loop. Child process exiting.");
|
"Too many errors in select loop. Child process exiting.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ap_listen_rec *lr;
|
ap_listen_rec *lr;
|
||||||
|
|
||||||
lr = find_ready_listener(&main_fds);
|
lr = find_ready_listener(&main_fds);
|
||||||
if (lr != NULL) {
|
if (lr != NULL) {
|
||||||
/* fetch the native socket descriptor */
|
/* fetch the native socket descriptor */
|
||||||
apr_os_sock_get(&nsd, lr->sd);
|
apr_os_sock_get(&nsd, lr->sd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
clen = sizeof(sa_client);
|
clen = sizeof(sa_client);
|
||||||
csd = accept(nsd, (struct sockaddr *) &sa_client, &clen);
|
csd = accept(nsd, (struct sockaddr *) &sa_client, &clen);
|
||||||
} while (csd < 0 && APR_STATUS_IS_EINTR(apr_get_netos_error()));
|
} while (csd < 0 && APR_STATUS_IS_EINTR(apr_get_netos_error()));
|
||||||
|
|
||||||
if (csd < 0) {
|
if (csd < 0) {
|
||||||
if (APR_STATUS_IS_ECONNABORTED(apr_get_netos_error())) {
|
if (APR_STATUS_IS_ECONNABORTED(apr_get_netos_error())) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_netos_error(), ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_netos_error(), ap_server_conf,
|
||||||
"accept: (client socket)");
|
"accept: (client socket)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
add_job(csd);
|
add_job(csd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SetEvent(exit_event);
|
SetEvent(exit_event);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -809,7 +809,7 @@ static void cleanup_thread(HANDLE *handles, int *thread_cnt, int thread_to_clean
|
|||||||
|
|
||||||
CloseHandle(handles[thread_to_clean]);
|
CloseHandle(handles[thread_to_clean]);
|
||||||
for (i = thread_to_clean; i < ((*thread_cnt) - 1); i++)
|
for (i = thread_to_clean; i < ((*thread_cnt) - 1); i++)
|
||||||
handles[i] = handles[i + 1];
|
handles[i] = handles[i + 1];
|
||||||
(*thread_cnt)--;
|
(*thread_cnt)--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -132,9 +132,9 @@ static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, char *arg
|
|||||||
ap_threads_per_child = thread_limit;
|
ap_threads_per_child = thread_limit;
|
||||||
}
|
}
|
||||||
else if (ap_threads_per_child < 1) {
|
else if (ap_threads_per_child < 1) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
"WARNING: Require ThreadsPerChild > 0, setting to 1");
|
"WARNING: Require ThreadsPerChild > 0, setting to 1");
|
||||||
ap_threads_per_child = 1;
|
ap_threads_per_child = 1;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -171,9 +171,9 @@ static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *ar
|
|||||||
thread_limit = MAX_THREAD_LIMIT;
|
thread_limit = MAX_THREAD_LIMIT;
|
||||||
}
|
}
|
||||||
else if (thread_limit < 1) {
|
else if (thread_limit < 1) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
"WARNING: Require ThreadLimit > 0, setting to 1");
|
"WARNING: Require ThreadLimit > 0, setting to 1");
|
||||||
thread_limit = 1;
|
thread_limit = 1;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -244,9 +244,9 @@ void setup_signal_names(char *prefix)
|
|||||||
{
|
{
|
||||||
apr_snprintf(signal_name_prefix, sizeof(signal_name_prefix), prefix);
|
apr_snprintf(signal_name_prefix, sizeof(signal_name_prefix), prefix);
|
||||||
apr_snprintf(signal_shutdown_name, sizeof(signal_shutdown_name),
|
apr_snprintf(signal_shutdown_name, sizeof(signal_shutdown_name),
|
||||||
"%s_shutdown", signal_name_prefix);
|
"%s_shutdown", signal_name_prefix);
|
||||||
apr_snprintf(signal_restart_name, sizeof(signal_restart_name),
|
apr_snprintf(signal_restart_name, sizeof(signal_restart_name),
|
||||||
"%s_restart", signal_name_prefix);
|
"%s_restart", signal_name_prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
int volatile is_graceful = 0;
|
int volatile is_graceful = 0;
|
||||||
@@ -277,7 +277,7 @@ AP_DECLARE(void) ap_signal_parent(ap_signal_parent_e type)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
@@ -300,19 +300,19 @@ AP_DECLARE(void) ap_signal_parent(ap_signal_parent_e type)
|
|||||||
|
|
||||||
e = OpenEvent(EVENT_MODIFY_STATE, FALSE, signal_name);
|
e = OpenEvent(EVENT_MODIFY_STATE, FALSE, signal_name);
|
||||||
if (!e) {
|
if (!e) {
|
||||||
/* Um, problem, can't signal the parent, which means we can't
|
/* Um, problem, can't signal the parent, which means we can't
|
||||||
* signal ourselves to die. Ignore for now...
|
* signal ourselves to die. Ignore for now...
|
||||||
*/
|
*/
|
||||||
ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), ap_server_conf,
|
||||||
"OpenEvent on %s event", signal_name);
|
"OpenEvent on %s event", signal_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SetEvent(e) == 0) {
|
if (SetEvent(e) == 0) {
|
||||||
/* Same problem as above */
|
/* Same problem as above */
|
||||||
ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), ap_server_conf,
|
||||||
"SetEvent on %s event", signal_name);
|
"SetEvent on %s event", signal_name);
|
||||||
CloseHandle(e);
|
CloseHandle(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CloseHandle(e);
|
CloseHandle(e);
|
||||||
}
|
}
|
||||||
@@ -390,7 +390,7 @@ void get_handles_from_parent(server_rec *s, HANDLE *child_exit_event,
|
|||||||
|
|
||||||
rv = ap_reopen_scoreboard(s->process->pool, scoreboard_shm, 1);
|
rv = ap_reopen_scoreboard(s->process->pool, scoreboard_shm, 1);
|
||||||
if (rv || !(sb_shared = apr_shm_baseaddr_get(*scoreboard_shm))) {
|
if (rv || !(sb_shared = apr_shm_baseaddr_get(*scoreboard_shm))) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
|
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
|
||||||
"Child %d: Unable to reopen the scoreboard from the parent", my_pid);
|
"Child %d: Unable to reopen the scoreboard from the parent", my_pid);
|
||||||
exit(APEXIT_CHILDINIT);
|
exit(APEXIT_CHILDINIT);
|
||||||
}
|
}
|
||||||
@@ -1402,7 +1402,7 @@ static int winnt_pre_config(apr_pool_t *pconf_, apr_pool_t *plog, apr_pool_t *pt
|
|||||||
ap_pid_fname = DEFAULT_PIDLOG;
|
ap_pid_fname = DEFAULT_PIDLOG;
|
||||||
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
||||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||||
#endif
|
#endif
|
||||||
/* use_acceptex which is enabled by default is not available on Win9x.
|
/* use_acceptex which is enabled by default is not available on Win9x.
|
||||||
*/
|
*/
|
||||||
|
@@ -181,9 +181,9 @@ static LRESULT CALLBACK monitor_service_9x_proc(HWND hWnd, UINT msg,
|
|||||||
&& (die_on_logoff || (lParam != ENDSESSION_LOGOFF)))
|
&& (die_on_logoff || (lParam != ENDSESSION_LOGOFF)))
|
||||||
{
|
{
|
||||||
ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
|
ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
|
||||||
if (wParam)
|
if (wParam)
|
||||||
/* Don't leave this message until we are dead! */
|
/* Don't leave this message until we are dead! */
|
||||||
WaitForSingleObject(globdat.mpm_thread, 30000);
|
WaitForSingleObject(globdat.mpm_thread, 30000);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (DefWindowProc(hWnd, msg, wParam, lParam));
|
return (DefWindowProc(hWnd, msg, wParam, lParam));
|
||||||
@@ -214,9 +214,9 @@ static DWORD WINAPI monitor_service_9x_thread(void *service_name)
|
|||||||
wc.hbrBackground = NULL;
|
wc.hbrBackground = NULL;
|
||||||
wc.lpszMenuName = NULL;
|
wc.lpszMenuName = NULL;
|
||||||
if (service_name)
|
if (service_name)
|
||||||
wc.lpszClassName = "ApacheWin95ServiceMonitor";
|
wc.lpszClassName = "ApacheWin95ServiceMonitor";
|
||||||
else
|
else
|
||||||
wc.lpszClassName = "ApacheWin95SystemMonitor";
|
wc.lpszClassName = "ApacheWin95SystemMonitor";
|
||||||
|
|
||||||
die_on_logoff = service_name ? FALSE : TRUE;
|
die_on_logoff = service_name ? FALSE : TRUE;
|
||||||
|
|
||||||
@@ -255,8 +255,8 @@ static DWORD WINAPI monitor_service_9x_thread(void *service_name)
|
|||||||
if (msg.message == WM_CLOSE)
|
if (msg.message == WM_CLOSE)
|
||||||
DestroyWindow(hwndMain);
|
DestroyWindow(hwndMain);
|
||||||
else {
|
else {
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
globdat.service_thread_id = 0;
|
globdat.service_thread_id = 0;
|
||||||
@@ -397,7 +397,7 @@ static int ReportStatusToSCMgr(int currentState, int exitCode, int waitHint)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
globdat.ssStatus.dwCheckPoint = ++checkPoint;
|
globdat.ssStatus.dwCheckPoint = ++checkPoint;
|
||||||
globdat.ssStatus.dwControlsAccepted = 0;
|
globdat.ssStatus.dwControlsAccepted = 0;
|
||||||
if(waitHint)
|
if(waitHint)
|
||||||
globdat.ssStatus.dwWaitHint = waitHint;
|
globdat.ssStatus.dwWaitHint = waitHint;
|
||||||
}
|
}
|
||||||
@@ -797,7 +797,7 @@ apr_status_t mpm_service_install(apr_pool_t *ptemp, int argc,
|
|||||||
apr_status_t rv;
|
apr_status_t rv;
|
||||||
|
|
||||||
fprintf(stderr,reconfig ? "Reconfiguring the %s service\n"
|
fprintf(stderr,reconfig ? "Reconfiguring the %s service\n"
|
||||||
: "Installing the %s service\n", mpm_display_name);
|
: "Installing the %s service\n", mpm_display_name);
|
||||||
|
|
||||||
/* ###: utf-ize */
|
/* ###: utf-ize */
|
||||||
if (GetModuleFileName(NULL, exe_path, sizeof(exe_path)) == 0)
|
if (GetModuleFileName(NULL, exe_path, sizeof(exe_path)) == 0)
|
||||||
@@ -844,10 +844,10 @@ apr_status_t mpm_service_install(apr_pool_t *ptemp, int argc,
|
|||||||
ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_ERR,
|
ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_ERR,
|
||||||
apr_get_os_error(), NULL,
|
apr_get_os_error(), NULL,
|
||||||
"ChangeServiceConfig failed");
|
"ChangeServiceConfig failed");
|
||||||
/* !schService aborts configuration below */
|
/* !schService aborts configuration below */
|
||||||
CloseServiceHandle(schService);
|
CloseServiceHandle(schService);
|
||||||
schService = NULL;
|
schService = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* RPCSS is the Remote Procedure Call (RPC) Locator required
|
/* RPCSS is the Remote Procedure Call (RPC) Locator required
|
||||||
@@ -880,7 +880,7 @@ apr_status_t mpm_service_install(apr_pool_t *ptemp, int argc,
|
|||||||
return (rv);
|
return (rv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseServiceHandle(schService);
|
CloseServiceHandle(schService);
|
||||||
CloseServiceHandle(schSCManager);
|
CloseServiceHandle(schSCManager);
|
||||||
}
|
}
|
||||||
@@ -980,7 +980,7 @@ apr_status_t mpm_service_uninstall(void)
|
|||||||
if (!schService) {
|
if (!schService) {
|
||||||
rv = apr_get_os_error();
|
rv = apr_get_os_error();
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
|
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
|
||||||
"%s: OpenService failed", mpm_display_name);
|
"%s: OpenService failed", mpm_display_name);
|
||||||
return (rv);
|
return (rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -996,7 +996,7 @@ apr_status_t mpm_service_uninstall(void)
|
|||||||
|
|
||||||
if (DeleteService(schService) == 0) {
|
if (DeleteService(schService) == 0) {
|
||||||
rv = apr_get_os_error();
|
rv = apr_get_os_error();
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
|
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
|
||||||
"%s: Failed to delete the service.", mpm_display_name);
|
"%s: Failed to delete the service.", mpm_display_name);
|
||||||
return (rv);
|
return (rv);
|
||||||
}
|
}
|
||||||
@@ -1019,7 +1019,7 @@ apr_status_t mpm_service_uninstall(void)
|
|||||||
ap_regkey_close(key);
|
ap_regkey_close(key);
|
||||||
}
|
}
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
|
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
|
||||||
"%s: Failed to remove the RunServices registry "
|
"%s: Failed to remove the RunServices registry "
|
||||||
"entry.", mpm_display_name);
|
"entry.", mpm_display_name);
|
||||||
}
|
}
|
||||||
|
@@ -1714,9 +1714,9 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
|
|||||||
"Server built: %s", ap_get_server_built());
|
"Server built: %s", ap_get_server_built());
|
||||||
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
|
||||||
"AcceptMutex: %s (default: %s)",
|
"AcceptMutex: %s (default: %s)",
|
||||||
apr_proc_mutex_name(accept_mutex),
|
apr_proc_mutex_name(accept_mutex),
|
||||||
apr_proc_mutex_defname());
|
apr_proc_mutex_defname());
|
||||||
#endif
|
#endif
|
||||||
restart_pending = shutdown_pending = 0;
|
restart_pending = shutdown_pending = 0;
|
||||||
mpm_state = AP_MPMQ_RUNNING;
|
mpm_state = AP_MPMQ_RUNNING;
|
||||||
@@ -1959,7 +1959,7 @@ static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
|
|||||||
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
|
||||||
ap_extended_status = 0;
|
ap_extended_status = 0;
|
||||||
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
|
||||||
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
|
||||||
@@ -2151,9 +2151,9 @@ static const char *set_server_limit (cmd_parms *cmd, void *dummy, const char *ar
|
|||||||
server_limit = MAX_SERVER_LIMIT;
|
server_limit = MAX_SERVER_LIMIT;
|
||||||
}
|
}
|
||||||
else if (server_limit < 1) {
|
else if (server_limit < 1) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
"WARNING: Require ServerLimit > 0, setting to 1");
|
"WARNING: Require ServerLimit > 0, setting to 1");
|
||||||
server_limit = 1;
|
server_limit = 1;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -2191,9 +2191,9 @@ static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *ar
|
|||||||
thread_limit = MAX_THREAD_LIMIT;
|
thread_limit = MAX_THREAD_LIMIT;
|
||||||
}
|
}
|
||||||
else if (thread_limit < 1) {
|
else if (thread_limit < 1) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
|
||||||
"WARNING: Require ThreadLimit > 0, setting to 1");
|
"WARNING: Require ThreadLimit > 0, setting to 1");
|
||||||
thread_limit = 1;
|
thread_limit = 1;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -1049,7 +1049,7 @@ void ap_mpm_rewrite_args(process_rec *process)
|
|||||||
apr_uint32_t ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
apr_uint32_t ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
|
||||||
|
|
||||||
const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy,
|
const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
long value;
|
long value;
|
||||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
|
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
|
||||||
@@ -1111,7 +1111,7 @@ const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cmd->server->is_virtual) {
|
if (cmd->server->is_virtual) {
|
||||||
return "EnableExceptionHook directive not allowed in <VirtualHost>";
|
return "EnableExceptionHook directive not allowed in <VirtualHost>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcasecmp(arg, "on") == 0) {
|
if (strcasecmp(arg, "on") == 0) {
|
||||||
|
@@ -825,7 +825,7 @@ AP_DECLARE(int) ap_directory_walk(request_rec *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
res = ap_parse_htaccess(&htaccess_conf, r, opts.override,
|
res = ap_parse_htaccess(&htaccess_conf, r, opts.override,
|
||||||
opts.override_opts,
|
opts.override_opts,
|
||||||
apr_pstrdup(r->pool, r->filename),
|
apr_pstrdup(r->pool, r->filename),
|
||||||
sconf->access_name);
|
sconf->access_name);
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@@ -343,7 +343,7 @@ static ap_filter_t *add_any_filter_handle(ap_filter_rec_t *frec, void *ctx,
|
|||||||
fscan = fscan->next;
|
fscan = fscan->next;
|
||||||
|
|
||||||
f->next = fscan->next;
|
f->next = fscan->next;
|
||||||
fscan->next = f;
|
fscan->next = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frec->ftype < AP_FTYPE_CONNECTION && (*r_filters == *c_filters)) {
|
if (frec->ftype < AP_FTYPE_CONNECTION && (*r_filters == *c_filters)) {
|
||||||
|
@@ -70,8 +70,8 @@ AP_DECLARE(char *) ap_md5_binary(apr_pool_t *p, const unsigned char *buf, int le
|
|||||||
apr_md5_final(hash, &my_md5);
|
apr_md5_final(hash, &my_md5);
|
||||||
|
|
||||||
for (i = 0, r = result; i < APR_MD5_DIGESTSIZE; i++) {
|
for (i = 0, r = result; i < APR_MD5_DIGESTSIZE; i++) {
|
||||||
*r++ = hex[hash[i] >> 4];
|
*r++ = hex[hash[i] >> 4];
|
||||||
*r++ = hex[hash[i] & 0xF];
|
*r++ = hex[hash[i] & 0xF];
|
||||||
}
|
}
|
||||||
*r = '\0';
|
*r = '\0';
|
||||||
|
|
||||||
@@ -142,10 +142,10 @@ AP_DECLARE(char *) ap_md5contextTo64(apr_pool_t *a, apr_md5_ctx_t *context)
|
|||||||
|
|
||||||
p = encodedDigest;
|
p = encodedDigest;
|
||||||
for (i = 0; i < sizeof(digest); i += 3) {
|
for (i = 0; i < sizeof(digest); i += 3) {
|
||||||
*p++ = basis_64[digest[i] >> 2];
|
*p++ = basis_64[digest[i] >> 2];
|
||||||
*p++ = basis_64[((digest[i] & 0x3) << 4) | ((int) (digest[i + 1] & 0xF0) >> 4)];
|
*p++ = basis_64[((digest[i] & 0x3) << 4) | ((int) (digest[i + 1] & 0xF0) >> 4)];
|
||||||
*p++ = basis_64[((digest[i + 1] & 0xF) << 2) | ((int) (digest[i + 2] & 0xC0) >> 6)];
|
*p++ = basis_64[((digest[i + 1] & 0xF) << 2) | ((int) (digest[i + 2] & 0xC0) >> 6)];
|
||||||
*p++ = basis_64[digest[i + 2] & 0x3F];
|
*p++ = basis_64[digest[i + 2] & 0x3F];
|
||||||
}
|
}
|
||||||
*p-- = '\0';
|
*p-- = '\0';
|
||||||
*p-- = '=';
|
*p-- = '=';
|
||||||
@@ -163,7 +163,7 @@ AP_DECLARE(char *) ap_md5digest(apr_pool_t *p, apr_file_t *infile)
|
|||||||
apr_md5_init(&context);
|
apr_md5_init(&context);
|
||||||
nbytes = sizeof(buf);
|
nbytes = sizeof(buf);
|
||||||
while (apr_file_read(infile, buf, &nbytes) == APR_SUCCESS) {
|
while (apr_file_read(infile, buf, &nbytes) == APR_SUCCESS) {
|
||||||
apr_md5_update(&context, buf, nbytes);
|
apr_md5_update(&context, buf, nbytes);
|
||||||
nbytes = sizeof(buf);
|
nbytes = sizeof(buf);
|
||||||
}
|
}
|
||||||
apr_file_seek(infile, APR_SET, &offset);
|
apr_file_seek(infile, APR_SET, &offset);
|
||||||
|
@@ -726,12 +726,12 @@ static void fix_hostname(request_rec *r)
|
|||||||
}
|
}
|
||||||
else if (port) {
|
else if (port) {
|
||||||
/* Don't throw the Host: header's port number away:
|
/* Don't throw the Host: header's port number away:
|
||||||
save it in parsed_uri -- ap_get_server_port() needs it! */
|
save it in parsed_uri -- ap_get_server_port() needs it! */
|
||||||
/* @@@ XXX there should be a better way to pass the port.
|
/* @@@ XXX there should be a better way to pass the port.
|
||||||
* Like r->hostname, there should be a r->portno
|
* Like r->hostname, there should be a r->portno
|
||||||
*/
|
*/
|
||||||
r->parsed_uri.port = port;
|
r->parsed_uri.port = port;
|
||||||
r->parsed_uri.port_str = apr_itoa(r->pool, (int)port);
|
r->parsed_uri.port_str = apr_itoa(r->pool, (int)port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if the hostname is an IPv6 numeric address string, it was validated
|
/* if the hostname is an IPv6 numeric address string, it was validated
|
||||||
|
@@ -824,7 +824,7 @@ int main(int argc, const char * const argv[])
|
|||||||
}
|
}
|
||||||
benice = 1;
|
benice = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
if (deldirs) {
|
if (deldirs) {
|
||||||
usage();
|
usage();
|
||||||
|
@@ -214,7 +214,7 @@ int main(int argc, const char * const argv[])
|
|||||||
|
|
||||||
/* Check if this could even be an IP address */
|
/* Check if this could even be an IP address */
|
||||||
if (!apr_isxdigit(line[0]) && line[0] != ':') {
|
if (!apr_isxdigit(line[0]) && line[0] != ':') {
|
||||||
withname++;
|
withname++;
|
||||||
apr_file_puts(line, outfile);
|
apr_file_puts(line, outfile);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ int main(int argc, const char * const argv[])
|
|||||||
hostname = (char *) apr_hash_get(cache, line, APR_HASH_KEY_STRING);
|
hostname = (char *) apr_hash_get(cache, line, APR_HASH_KEY_STRING);
|
||||||
if (hostname) {
|
if (hostname) {
|
||||||
apr_file_printf(outfile, "%s %s", hostname, space + 1);
|
apr_file_printf(outfile, "%s %s", hostname, space + 1);
|
||||||
cachehits++;
|
cachehits++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ int main(int argc, const char * const argv[])
|
|||||||
status = apr_sockaddr_info_get(&ip, line, APR_UNSPEC ,0, 0, pool);
|
status = apr_sockaddr_info_get(&ip, line, APR_UNSPEC ,0, 0, pool);
|
||||||
if (status != APR_SUCCESS) {
|
if (status != APR_SUCCESS) {
|
||||||
/* Not an IP address */
|
/* Not an IP address */
|
||||||
withname++;
|
withname++;
|
||||||
*space = ' ';
|
*space = ' ';
|
||||||
apr_file_puts(line, outfile);
|
apr_file_puts(line, outfile);
|
||||||
continue;
|
continue;
|
||||||
@@ -246,7 +246,7 @@ int main(int argc, const char * const argv[])
|
|||||||
* "parsed as an IP address". It does not mean we actually resolved
|
* "parsed as an IP address". It does not mean we actually resolved
|
||||||
* the IP address into a hostname.
|
* the IP address into a hostname.
|
||||||
*/
|
*/
|
||||||
resolves++;
|
resolves++;
|
||||||
|
|
||||||
/* From here on our we cache each result, even if it was not
|
/* From here on our we cache each result, even if it was not
|
||||||
* succesful
|
* succesful
|
||||||
|
@@ -136,7 +136,7 @@ int main(int argc, char** argv)
|
|||||||
case '?':
|
case '?':
|
||||||
printf(options, arg0);
|
printf(options, arg0);
|
||||||
exit(1);
|
exit(1);
|
||||||
default:
|
default:
|
||||||
printf("wintty option %s not recognized, use -? for help.\n\n", *argv);
|
printf("wintty option %s not recognized, use -? for help.\n\n", *argv);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -214,7 +214,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
if (isservice) {
|
if (isservice) {
|
||||||
#ifdef WE_EVER_FIGURE_OUT_WHY_THIS_DOESNT_WORK
|
#ifdef WE_EVER_FIGURE_OUT_WHY_THIS_DOESNT_WORK
|
||||||
hsavedesk = GetThreadDesktop(GetCurrentThreadId());
|
hsavedesk = GetThreadDesktop(GetCurrentThreadId());
|
||||||
if (!hsavedesk || hsavedesk == INVALID_HANDLE_VALUE) {
|
if (!hsavedesk || hsavedesk == INVALID_HANDLE_VALUE) {
|
||||||
printerr("GetThreadDesktop(GetTID()) failed (%d)\n", GetLastError());
|
printerr("GetThreadDesktop(GetTID()) failed (%d)\n", GetLastError());
|
||||||
}
|
}
|
||||||
|
188
test/cls.c
188
test/cls.c
@@ -35,32 +35,32 @@ static int checkmask(const char *data, const char *mask)
|
|||||||
int i, ch, d;
|
int i, ch, d;
|
||||||
|
|
||||||
for (i = 0; mask[i] != '\0' && mask[i] != '*'; i++) {
|
for (i = 0; mask[i] != '\0' && mask[i] != '*'; i++) {
|
||||||
ch = mask[i];
|
ch = mask[i];
|
||||||
d = data[i];
|
d = data[i];
|
||||||
if (ch == '@') {
|
if (ch == '@') {
|
||||||
if (!isupper(d))
|
if (!isupper(d))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (ch == '$') {
|
else if (ch == '$') {
|
||||||
if (!islower(d))
|
if (!islower(d))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (ch == '#') {
|
else if (ch == '#') {
|
||||||
if (!isdigit(d))
|
if (!isdigit(d))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (ch == '&') {
|
else if (ch == '&') {
|
||||||
if (!isxdigit(d))
|
if (!isxdigit(d))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (ch != d)
|
else if (ch != d)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mask[i] == '*')
|
if (mask[i] == '*')
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return (data[i] == '\0');
|
return (data[i] == '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -72,19 +72,19 @@ static int hex2sec(const char *x)
|
|||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
for (i = 0, j = 0; i < 8; i++) {
|
for (i = 0, j = 0; i < 8; i++) {
|
||||||
ch = x[i];
|
ch = x[i];
|
||||||
j <<= 4;
|
j <<= 4;
|
||||||
if (isdigit(ch))
|
if (isdigit(ch))
|
||||||
j |= ch - '0';
|
j |= ch - '0';
|
||||||
else if (isupper(ch))
|
else if (isupper(ch))
|
||||||
j |= ch - ('A' - 10);
|
j |= ch - ('A' - 10);
|
||||||
else
|
else
|
||||||
j |= ch - ('a' - 10);
|
j |= ch - ('a' - 10);
|
||||||
}
|
}
|
||||||
if (j == 0xffffffff)
|
if (j == 0xffffffff)
|
||||||
return -1; /* so that it works with 8-byte ints */
|
return -1; /* so that it works with 8-byte ints */
|
||||||
else
|
else
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
@@ -103,78 +103,78 @@ int main(int argc, char **argv)
|
|||||||
const char time_format[] = "%e %b %Y %R";
|
const char time_format[] = "%e %b %Y %R";
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
printf("Usage: cls directory\n");
|
printf("Usage: cls directory\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
d = opendir(argv[1]);
|
d = opendir(argv[1]);
|
||||||
if (d == NULL) {
|
if (d == NULL) {
|
||||||
perror("opendir");
|
perror("opendir");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
e = readdir(d);
|
e = readdir(d);
|
||||||
if (e == NULL)
|
if (e == NULL)
|
||||||
break;
|
break;
|
||||||
s = e->d_name;
|
s = e->d_name;
|
||||||
if (s[0] == '.' || s[0] == '#')
|
if (s[0] == '.' || s[0] == '#')
|
||||||
continue;
|
continue;
|
||||||
sprintf(path, "%s/%s", argv[1], s);
|
sprintf(path, "%s/%s", argv[1], s);
|
||||||
fp = fopen(path, "r");
|
fp = fopen(path, "r");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
perror("fopen");
|
perror("fopen");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (fgets(line, 1034, fp) == NULL) {
|
if (fgets(line, 1034, fp) == NULL) {
|
||||||
perror("fgets");
|
perror("fgets");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!checkmask(line, "&&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&&\n")) {
|
if (!checkmask(line, "&&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&& &&&&&&&&\n")) {
|
||||||
fprintf(stderr, "Bad cache file\n");
|
fprintf(stderr, "Bad cache file\n");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
date = hex2sec(line);
|
date = hex2sec(line);
|
||||||
lmod = hex2sec(line + 9);
|
lmod = hex2sec(line + 9);
|
||||||
expire = hex2sec(line + 18);
|
expire = hex2sec(line + 18);
|
||||||
ver = hex2sec(line + 27);
|
ver = hex2sec(line + 27);
|
||||||
len = hex2sec(line + 35);
|
len = hex2sec(line + 35);
|
||||||
if (fgets(line, 1034, fp) == NULL) {
|
if (fgets(line, 1034, fp) == NULL) {
|
||||||
perror("fgets");
|
perror("fgets");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
i = strlen(line);
|
i = strlen(line);
|
||||||
if (strncmp(line, "X-URL: ", 7) != 0 || line[i - 1] != '\n') {
|
if (strncmp(line, "X-URL: ", 7) != 0 || line[i - 1] != '\n') {
|
||||||
fprintf(stderr, "Bad cache file\n");
|
fprintf(stderr, "Bad cache file\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
line[i - 1] = '\0';
|
line[i - 1] = '\0';
|
||||||
if (date != -1) {
|
if (date != -1) {
|
||||||
ts = *gmtime(&date);
|
ts = *gmtime(&date);
|
||||||
strftime(sdate, 30, time_format, &ts);
|
strftime(sdate, 30, time_format, &ts);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strcpy(sdate, "-");
|
strcpy(sdate, "-");
|
||||||
|
|
||||||
if (lmod != -1) {
|
if (lmod != -1) {
|
||||||
ts = *gmtime(&lmod);
|
ts = *gmtime(&lmod);
|
||||||
strftime(slmod, 30, time_format, &ts);
|
strftime(slmod, 30, time_format, &ts);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strcpy(slmod, "-");
|
strcpy(slmod, "-");
|
||||||
|
|
||||||
if (expire != -1) {
|
if (expire != -1) {
|
||||||
ts = *gmtime(&expire);
|
ts = *gmtime(&expire);
|
||||||
strftime(sexpire, 30, time_format, &ts);
|
strftime(sexpire, 30, time_format, &ts);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strcpy(sexpire, "-");
|
strcpy(sexpire, "-");
|
||||||
|
|
||||||
printf("%s: %d; %s %s %s\n", line + 7, ver, sdate, slmod, sexpire);
|
printf("%s: %d; %s %s %s\n", line + 7, ver, sdate, slmod, sexpire);
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(d);
|
closedir(d);
|
||||||
|
@@ -57,36 +57,36 @@ void main( int argc, char **argv )
|
|||||||
|
|
||||||
if( argc != 3 ) {
|
if( argc != 3 ) {
|
||||||
usage:
|
usage:
|
||||||
fprintf( stderr, "usage: test-writev a.b.c.d port#\n" );
|
fprintf( stderr, "usage: test-writev a.b.c.d port#\n" );
|
||||||
exit( 1 );
|
exit( 1 );
|
||||||
}
|
}
|
||||||
server_addr.sin_family = AF_INET;
|
server_addr.sin_family = AF_INET;
|
||||||
server_addr.sin_addr.s_addr = inet_addr( argv[1] );
|
server_addr.sin_addr.s_addr = inet_addr( argv[1] );
|
||||||
if( server_addr.sin_addr.s_addr == INADDR_NONE ) {
|
if( server_addr.sin_addr.s_addr == INADDR_NONE ) {
|
||||||
fprintf( stderr, "bogus address\n" );
|
fprintf( stderr, "bogus address\n" );
|
||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
server_addr.sin_port = htons( atoi( argv[2] ) );
|
server_addr.sin_port = htons( atoi( argv[2] ) );
|
||||||
|
|
||||||
s = socket( AF_INET, SOCK_STREAM, 0 );
|
s = socket( AF_INET, SOCK_STREAM, 0 );
|
||||||
if( s < 0 ) {
|
if( s < 0 ) {
|
||||||
perror("socket");
|
perror("socket");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if( connect( s, (struct sockaddr *)&server_addr, sizeof( server_addr ) )
|
if( connect( s, (struct sockaddr *)&server_addr, sizeof( server_addr ) )
|
||||||
!= 0 ) {
|
!= 0 ) {
|
||||||
perror("connect");
|
perror("connect");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char*)&just_say_no,
|
if( setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char*)&just_say_no,
|
||||||
sizeof(just_say_no)) != 0 ) {
|
sizeof(just_say_no)) != 0 ) {
|
||||||
perror( "TCP_NODELAY" );
|
perror( "TCP_NODELAY" );
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
/* now build up a two part writev and write it out */
|
/* now build up a two part writev and write it out */
|
||||||
for( i = 0; i < sizeof( buf ); ++i ) {
|
for( i = 0; i < sizeof( buf ); ++i ) {
|
||||||
buf[i] = 'x';
|
buf[i] = 'x';
|
||||||
}
|
}
|
||||||
vector[0].iov_base = buf;
|
vector[0].iov_base = buf;
|
||||||
vector[0].iov_len = sizeof(buf);
|
vector[0].iov_len = sizeof(buf);
|
||||||
|
192
test/time-sem.c
192
test/time-sem.c
@@ -23,16 +23,16 @@ to be used:
|
|||||||
- NFS filesystems absolutely suck for fcntl() and flock()
|
- NFS filesystems absolutely suck for fcntl() and flock()
|
||||||
|
|
||||||
- uslock absolutely sucks on single-processor IRIX boxes, but
|
- uslock absolutely sucks on single-processor IRIX boxes, but
|
||||||
absolutely rocks on multi-processor boxes. The converse
|
absolutely rocks on multi-processor boxes. The converse
|
||||||
is true for fcntl. sysvsem seems a moderate balance.
|
is true for fcntl. sysvsem seems a moderate balance.
|
||||||
|
|
||||||
- Under Solaris you can't have too many processes use SEM_UNDO, there
|
- Under Solaris you can't have too many processes use SEM_UNDO, there
|
||||||
might be a tuneable somewhere that increases the limit from 29.
|
might be a tuneable somewhere that increases the limit from 29.
|
||||||
We're not sure what the tunable is, so there's a define
|
We're not sure what the tunable is, so there's a define
|
||||||
NO_SEM_UNDO which can be used to simulate us trapping/blocking
|
NO_SEM_UNDO which can be used to simulate us trapping/blocking
|
||||||
signals to be able to properly release the semaphore on a clean
|
signals to be able to properly release the semaphore on a clean
|
||||||
child death. You'll also need to define NEED_UNION_SEMUN
|
child death. You'll also need to define NEED_UNION_SEMUN
|
||||||
under solaris.
|
under solaris.
|
||||||
|
|
||||||
You'll need to define USE_SHMGET_SCOREBOARD if anonymous shared mmap()
|
You'll need to define USE_SHMGET_SCOREBOARD if anonymous shared mmap()
|
||||||
doesn't work on your system (i.e. linux).
|
doesn't work on your system (i.e. linux).
|
||||||
@@ -101,9 +101,9 @@ accept_mutex_init(void)
|
|||||||
fcntl_fd = open("test-lock-thing", O_CREAT | O_WRONLY | O_EXCL, 0644);
|
fcntl_fd = open("test-lock-thing", O_CREAT | O_WRONLY | O_EXCL, 0644);
|
||||||
if (fcntl_fd == -1)
|
if (fcntl_fd == -1)
|
||||||
{
|
{
|
||||||
perror ("open");
|
perror ("open");
|
||||||
fprintf (stderr, "Cannot open lock file: %s\n", "test-lock-thing");
|
fprintf (stderr, "Cannot open lock file: %s\n", "test-lock-thing");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
unlink("test-lock-thing");
|
unlink("test-lock-thing");
|
||||||
}
|
}
|
||||||
@@ -113,11 +113,11 @@ void accept_mutex_on(void)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
while ((ret = fcntl(fcntl_fd, F_SETLKW, &lock_it)) < 0 && errno == EINTR)
|
while ((ret = fcntl(fcntl_fd, F_SETLKW, &lock_it)) < 0 && errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
perror ("fcntl lock_it");
|
perror ("fcntl lock_it");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,8 +125,8 @@ void accept_mutex_off(void)
|
|||||||
{
|
{
|
||||||
if (fcntl (fcntl_fd, F_SETLKW, &unlock_it) < 0)
|
if (fcntl (fcntl_fd, F_SETLKW, &unlock_it) < 0)
|
||||||
{
|
{
|
||||||
perror ("fcntl unlock_it");
|
perror ("fcntl unlock_it");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,9 +149,9 @@ void accept_mutex_init(void)
|
|||||||
flock_fd = open(FNAME, O_CREAT | O_WRONLY | O_EXCL, 0644);
|
flock_fd = open(FNAME, O_CREAT | O_WRONLY | O_EXCL, 0644);
|
||||||
if (flock_fd == -1)
|
if (flock_fd == -1)
|
||||||
{
|
{
|
||||||
perror ("open");
|
perror ("open");
|
||||||
fprintf (stderr, "Cannot open lock file: %s\n", "test-lock-thing");
|
fprintf (stderr, "Cannot open lock file: %s\n", "test-lock-thing");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,8 +159,8 @@ void accept_mutex_child_init(void)
|
|||||||
{
|
{
|
||||||
flock_fd = open(FNAME, O_WRONLY, 0600);
|
flock_fd = open(FNAME, O_WRONLY, 0600);
|
||||||
if (flock_fd == -1) {
|
if (flock_fd == -1) {
|
||||||
perror("open");
|
perror("open");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,11 +174,11 @@ void accept_mutex_on(void)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
while ((ret = flock(flock_fd, LOCK_EX)) < 0 && errno == EINTR)
|
while ((ret = flock(flock_fd, LOCK_EX)) < 0 && errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
perror ("flock(LOCK_EX)");
|
perror ("flock(LOCK_EX)");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,8 +186,8 @@ void accept_mutex_off(void)
|
|||||||
{
|
{
|
||||||
if (flock (flock_fd, LOCK_UN) < 0)
|
if (flock (flock_fd, LOCK_UN) < 0)
|
||||||
{
|
{
|
||||||
perror ("flock(LOCK_UN)");
|
perror ("flock(LOCK_UN)");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,9 +211,9 @@ void accept_mutex_init(void)
|
|||||||
#ifdef NEED_UNION_SEMUN
|
#ifdef NEED_UNION_SEMUN
|
||||||
/* believe it or not, you need to define this under solaris */
|
/* believe it or not, you need to define this under solaris */
|
||||||
union semun {
|
union semun {
|
||||||
int val;
|
int val;
|
||||||
struct semid_ds *buf;
|
struct semid_ds *buf;
|
||||||
ushort *array;
|
ushort *array;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -243,8 +243,8 @@ void accept_mutex_on()
|
|||||||
|
|
||||||
#ifdef NO_SEM_UNDO
|
#ifdef NO_SEM_UNDO
|
||||||
if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) {
|
if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) {
|
||||||
perror("sigprocmask(SIG_BLOCK)");
|
perror("sigprocmask(SIG_BLOCK)");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
op.sem_flg = 0;
|
op.sem_flg = 0;
|
||||||
#else
|
#else
|
||||||
@@ -253,8 +253,8 @@ void accept_mutex_on()
|
|||||||
op.sem_num = 0;
|
op.sem_num = 0;
|
||||||
op.sem_op = -1;
|
op.sem_op = -1;
|
||||||
if (semop(sem_id, &op, 1) < 0) {
|
if (semop(sem_id, &op, 1) < 0) {
|
||||||
perror ("accept_mutex_on");
|
perror ("accept_mutex_on");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,13 +270,13 @@ void accept_mutex_off()
|
|||||||
op.sem_flg = SEM_UNDO;
|
op.sem_flg = SEM_UNDO;
|
||||||
#endif
|
#endif
|
||||||
if (semop(sem_id, &op, 1) < 0) {
|
if (semop(sem_id, &op, 1) < 0) {
|
||||||
perror ("accept_mutex_off");
|
perror ("accept_mutex_off");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
#ifdef NO_SEM_UNDO
|
#ifdef NO_SEM_UNDO
|
||||||
if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) {
|
if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) {
|
||||||
perror("sigprocmask(SIG_SETMASK)");
|
perror("sigprocmask(SIG_SETMASK)");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -304,27 +304,27 @@ void accept_mutex_init(void)
|
|||||||
|
|
||||||
fd = open ("/dev/zero", O_RDWR);
|
fd = open ("/dev/zero", O_RDWR);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
perror ("open(/dev/zero)");
|
perror ("open(/dev/zero)");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
mutex = (pthread_mutex_t *)mmap ((caddr_t)0, sizeof (*mutex),
|
mutex = (pthread_mutex_t *)mmap ((caddr_t)0, sizeof (*mutex),
|
||||||
PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
|
PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
if (mutex == (void *)(caddr_t)-1) {
|
if (mutex == (void *)(caddr_t)-1) {
|
||||||
perror ("mmap");
|
perror ("mmap");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
close (fd);
|
close (fd);
|
||||||
if (pthread_mutexattr_init(&mattr)) {
|
if (pthread_mutexattr_init(&mattr)) {
|
||||||
perror ("pthread_mutexattr_init");
|
perror ("pthread_mutexattr_init");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
if (pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED)) {
|
if (pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED)) {
|
||||||
perror ("pthread_mutexattr_setpshared");
|
perror ("pthread_mutexattr_setpshared");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
if (pthread_mutex_init(mutex, &mattr)) {
|
if (pthread_mutex_init(mutex, &mattr)) {
|
||||||
perror ("pthread_mutex_init");
|
perror ("pthread_mutex_init");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
sigfillset(&accept_block_mask);
|
sigfillset(&accept_block_mask);
|
||||||
sigdelset(&accept_block_mask, SIGHUP);
|
sigdelset(&accept_block_mask, SIGHUP);
|
||||||
@@ -335,24 +335,24 @@ void accept_mutex_init(void)
|
|||||||
void accept_mutex_on()
|
void accept_mutex_on()
|
||||||
{
|
{
|
||||||
if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) {
|
if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) {
|
||||||
perror("sigprocmask(SIG_BLOCK)");
|
perror("sigprocmask(SIG_BLOCK)");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
if (pthread_mutex_lock (mutex)) {
|
if (pthread_mutex_lock (mutex)) {
|
||||||
perror ("pthread_mutex_lock");
|
perror ("pthread_mutex_lock");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void accept_mutex_off()
|
void accept_mutex_off()
|
||||||
{
|
{
|
||||||
if (pthread_mutex_unlock (mutex)) {
|
if (pthread_mutex_unlock (mutex)) {
|
||||||
perror ("pthread_mutex_unlock");
|
perror ("pthread_mutex_unlock");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) {
|
if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) {
|
||||||
perror("sigprocmask(SIG_SETMASK)");
|
perror("sigprocmask(SIG_SETMASK)");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,10 +423,10 @@ static void *get_shared_mem(apr_size_t size)
|
|||||||
|
|
||||||
/* allocate shared memory for the shared_counter */
|
/* allocate shared memory for the shared_counter */
|
||||||
result = (unsigned long *)mmap ((caddr_t)0, size,
|
result = (unsigned long *)mmap ((caddr_t)0, size,
|
||||||
PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
|
PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
|
||||||
if (result == (void *)(caddr_t)-1) {
|
if (result == (void *)(caddr_t)-1) {
|
||||||
perror ("mmap");
|
perror ("mmap");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -448,8 +448,8 @@ static void *get_shared_mem(apr_size_t size)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((shmid = shmget(shmkey, size, IPC_CREAT | SHM_R | SHM_W)) == -1) {
|
if ((shmid = shmget(shmkey, size, IPC_CREAT | SHM_R | SHM_W)) == -1) {
|
||||||
perror("shmget");
|
perror("shmget");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MOVEBREAK
|
#ifdef MOVEBREAK
|
||||||
@@ -463,29 +463,29 @@ static void *get_shared_mem(apr_size_t size)
|
|||||||
* attach the segment and then move break back down. Ugly
|
* attach the segment and then move break back down. Ugly
|
||||||
*/
|
*/
|
||||||
if ((obrk = sbrk(MOVEBREAK)) == (char *) -1) {
|
if ((obrk = sbrk(MOVEBREAK)) == (char *) -1) {
|
||||||
perror("sbrk");
|
perror("sbrk");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BADSHMAT ((void *)(-1))
|
#define BADSHMAT ((void *)(-1))
|
||||||
if ((result = shmat(shmid, 0, 0)) == BADSHMAT) {
|
if ((result = shmat(shmid, 0, 0)) == BADSHMAT) {
|
||||||
perror("shmat");
|
perror("shmat");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* We must avoid leaving segments in the kernel's
|
* We must avoid leaving segments in the kernel's
|
||||||
* (small) tables.
|
* (small) tables.
|
||||||
*/
|
*/
|
||||||
if (shmctl(shmid, IPC_RMID, NULL) != 0) {
|
if (shmctl(shmid, IPC_RMID, NULL) != 0) {
|
||||||
perror("shmctl(IPC_RMID)");
|
perror("shmctl(IPC_RMID)");
|
||||||
}
|
}
|
||||||
if (result == BADSHMAT) /* now bailout */
|
if (result == BADSHMAT) /* now bailout */
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
#ifdef MOVEBREAK
|
#ifdef MOVEBREAK
|
||||||
if (obrk == (char *) -1)
|
if (obrk == (char *) -1)
|
||||||
return; /* nothing else to do */
|
return; /* nothing else to do */
|
||||||
if (sbrk(-(MOVEBREAK)) == (char *) -1) {
|
if (sbrk(-(MOVEBREAK)) == (char *) -1) {
|
||||||
perror("sbrk 2");
|
perror("sbrk 2");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
@@ -513,8 +513,8 @@ void main (int argc, char **argv)
|
|||||||
unsigned long *shared_counter;
|
unsigned long *shared_counter;
|
||||||
|
|
||||||
if (argc != 3) {
|
if (argc != 3) {
|
||||||
fprintf (stderr, "Usage: time-sem num-child num iter\n");
|
fprintf (stderr, "Usage: time-sem num-child num iter\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
num_child = atoi (argv[1]);
|
num_child = atoi (argv[1]);
|
||||||
@@ -532,54 +532,54 @@ void main (int argc, char **argv)
|
|||||||
accept_mutex_on ();
|
accept_mutex_on ();
|
||||||
|
|
||||||
for (i = 0; i < num_child; ++i) {
|
for (i = 0; i < num_child; ++i) {
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
/* child, do our thing */
|
/* child, do our thing */
|
||||||
accept_mutex_child_init();
|
accept_mutex_child_init();
|
||||||
for (i = 0; i < num_iter; ++i) {
|
for (i = 0; i < num_iter; ++i) {
|
||||||
unsigned long tmp;
|
unsigned long tmp;
|
||||||
|
|
||||||
accept_mutex_on ();
|
accept_mutex_on ();
|
||||||
tmp = *shared_counter;
|
tmp = *shared_counter;
|
||||||
YIELD;
|
YIELD;
|
||||||
*shared_counter = tmp + 1;
|
*shared_counter = tmp + 1;
|
||||||
accept_mutex_off ();
|
accept_mutex_off ();
|
||||||
}
|
}
|
||||||
exit (0);
|
exit (0);
|
||||||
} else if (pid == -1) {
|
} else if (pid == -1) {
|
||||||
perror ("fork");
|
perror ("fork");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* a quick test to see that nothing is screwed up */
|
/* a quick test to see that nothing is screwed up */
|
||||||
if (*shared_counter != 0) {
|
if (*shared_counter != 0) {
|
||||||
puts ("WTF! shared_counter != 0 before the children have been started!");
|
puts ("WTF! shared_counter != 0 before the children have been started!");
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
gettimeofday (&first, NULL);
|
gettimeofday (&first, NULL);
|
||||||
/* launch children into action */
|
/* launch children into action */
|
||||||
accept_mutex_off ();
|
accept_mutex_off ();
|
||||||
for (i = 0; i < num_child; ++i) {
|
for (i = 0; i < num_child; ++i) {
|
||||||
if (wait(NULL) == -1) {
|
if (wait(NULL) == -1) {
|
||||||
perror ("wait");
|
perror ("wait");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gettimeofday (&last, NULL);
|
gettimeofday (&last, NULL);
|
||||||
|
|
||||||
if (*shared_counter != num_child * num_iter) {
|
if (*shared_counter != num_child * num_iter) {
|
||||||
printf ("WTF! shared_counter != num_child * num_iter!\n"
|
printf ("WTF! shared_counter != num_child * num_iter!\n"
|
||||||
"shared_counter = %lu\nnum_child = %d\nnum_iter=%d\n",
|
"shared_counter = %lu\nnum_child = %d\nnum_iter=%d\n",
|
||||||
*shared_counter,
|
*shared_counter,
|
||||||
num_child, num_iter);
|
num_child, num_iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
last.tv_sec -= first.tv_sec;
|
last.tv_sec -= first.tv_sec;
|
||||||
ms = last.tv_usec - first.tv_usec;
|
ms = last.tv_usec - first.tv_usec;
|
||||||
if (ms < 0) {
|
if (ms < 0) {
|
||||||
--last.tv_sec;
|
--last.tv_sec;
|
||||||
ms += 1000000;
|
ms += 1000000;
|
||||||
}
|
}
|
||||||
last.tv_usec = ms;
|
last.tv_usec = ms;
|
||||||
printf ("%8lu.%06lu\n", last.tv_sec, last.tv_usec);
|
printf ("%8lu.%06lu\n", last.tv_sec, last.tv_usec);
|
||||||
|
86
test/zb.c
86
test/zb.c
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
/* ZeusBench V1.01
|
/* ZeusBench V1.01
|
||||||
===============
|
===============
|
||||||
|
|
||||||
This program is Copyright (C) Zeus Technology Limited 1996.
|
This program is Copyright (C) Zeus Technology Limited 1996.
|
||||||
|
|
||||||
@@ -196,11 +196,11 @@ void output_results()
|
|||||||
printf("Document Length: %d\n", doclen);
|
printf("Document Length: %d\n", doclen);
|
||||||
printf("Concurency Level: %d\n", concurrency);
|
printf("Concurency Level: %d\n", concurrency);
|
||||||
printf("Time taken for tests: %d.%03d seconds\n",
|
printf("Time taken for tests: %d.%03d seconds\n",
|
||||||
timetaken/1000, timetaken%1000);
|
timetaken/1000, timetaken%1000);
|
||||||
printf("Complete requests: %d\n", done);
|
printf("Complete requests: %d\n", done);
|
||||||
printf("Failed requests: %d\n", bad);
|
printf("Failed requests: %d\n", bad);
|
||||||
if(bad) printf(" (Connect: %d, Length: %d, Exceptions: %d)\n",
|
if(bad) printf(" (Connect: %d, Length: %d, Exceptions: %d)\n",
|
||||||
err_conn, err_length, err_except);
|
err_conn, err_length, err_except);
|
||||||
if(keepalive) printf("Keep-Alive requests: %d\n", doneka);
|
if(keepalive) printf("Keep-Alive requests: %d\n", doneka);
|
||||||
printf("Bytes transferred: %d\n", totalread);
|
printf("Bytes transferred: %d\n", totalread);
|
||||||
printf("HTML transferred: %d\n", totalbread);
|
printf("HTML transferred: %d\n", totalbread);
|
||||||
@@ -209,7 +209,7 @@ void output_results()
|
|||||||
if(timetaken) {
|
if(timetaken) {
|
||||||
printf("Requests per seconds: %.2f\n", 1000*(float)(done)/timetaken);
|
printf("Requests per seconds: %.2f\n", 1000*(float)(done)/timetaken);
|
||||||
printf("Transfer rate: %.2f kb/s\n",
|
printf("Transfer rate: %.2f kb/s\n",
|
||||||
(float)(totalread)/timetaken);
|
(float)(totalread)/timetaken);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -266,8 +266,8 @@ void start_connect(struct connection *c)
|
|||||||
close(c->fd);
|
close(c->fd);
|
||||||
err_conn++;
|
err_conn++;
|
||||||
if(bad++>10) {
|
if(bad++>10) {
|
||||||
printf("\nTest aborted after 10 failures\n\n");
|
printf("\nTest aborted after 10 failures\n\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
start_connect(c);
|
start_connect(c);
|
||||||
}
|
}
|
||||||
@@ -352,44 +352,44 @@ void read_connection(struct connection *c)
|
|||||||
if(!s) {
|
if(!s) {
|
||||||
/* read rest next time */
|
/* read rest next time */
|
||||||
if(space)
|
if(space)
|
||||||
return;
|
return;
|
||||||
else {
|
else {
|
||||||
/* header is in invalid or too big - close connection */
|
/* header is in invalid or too big - close connection */
|
||||||
close(c->fd);
|
close(c->fd);
|
||||||
if(bad++>10) {
|
if(bad++>10) {
|
||||||
printf("\nTest aborted after 10 failures\n\n");
|
printf("\nTest aborted after 10 failures\n\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
FD_CLR(c->fd, &writebits);
|
FD_CLR(c->fd, &writebits);
|
||||||
start_connect(c);
|
start_connect(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* have full header */
|
/* have full header */
|
||||||
if(!good) {
|
if(!good) {
|
||||||
/* this is first time, extract some interesting info */
|
/* this is first time, extract some interesting info */
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
p = strstr(c->cbuff, "Server:");
|
p = strstr(c->cbuff, "Server:");
|
||||||
q = server_name;
|
q = server_name;
|
||||||
if(p) { p+=8; while(*p>32) *q++ = *p++; }
|
if(p) { p+=8; while(*p>32) *q++ = *p++; }
|
||||||
*q = 0;
|
*q = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->gotheader = 1;
|
c->gotheader = 1;
|
||||||
*s = 0; /* terminate at end of header */
|
*s = 0; /* terminate at end of header */
|
||||||
if(keepalive &&
|
if(keepalive &&
|
||||||
(strstr(c->cbuff, "Keep-Alive")
|
(strstr(c->cbuff, "Keep-Alive")
|
||||||
|| strstr(c->cbuff, "keep-alive"))) /* for benefit of MSIIS */
|
|| strstr(c->cbuff, "keep-alive"))) /* for benefit of MSIIS */
|
||||||
{
|
{
|
||||||
char *cl;
|
char *cl;
|
||||||
cl = strstr(c->cbuff, "Content-Length:");
|
cl = strstr(c->cbuff, "Content-Length:");
|
||||||
/* for cacky servers like NCSA which break the spec and send a
|
/* for cacky servers like NCSA which break the spec and send a
|
||||||
lower case 'l' */
|
lower case 'l' */
|
||||||
if(!cl) cl = strstr(c->cbuff, "Content-length:");
|
if(!cl) cl = strstr(c->cbuff, "Content-length:");
|
||||||
if(cl) {
|
if(cl) {
|
||||||
c->keepalive=1;
|
c->keepalive=1;
|
||||||
c->length = atoi(cl+16);
|
c->length = atoi(cl+16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c->bread += c->cbx - (s+l-c->cbuff) + r-tocopy;
|
c->bread += c->cbx - (s+l-c->cbuff) + r-tocopy;
|
||||||
totalbread += c->bread;
|
totalbread += c->bread;
|
||||||
@@ -454,8 +454,8 @@ int test()
|
|||||||
|
|
||||||
/* setup request */
|
/* setup request */
|
||||||
sprintf(request,"GET %s HTTP/1.0\r\nUser-Agent: ZeusBench/1.0\r\n"
|
sprintf(request,"GET %s HTTP/1.0\r\nUser-Agent: ZeusBench/1.0\r\n"
|
||||||
"%sHost: %s\r\nAccept: */*\r\n\r\n", file,
|
"%sHost: %s\r\nAccept: */*\r\n\r\n", file,
|
||||||
keepalive?"Connection: Keep-Alive\r\n":"", machine );
|
keepalive?"Connection: Keep-Alive\r\n":"", machine );
|
||||||
|
|
||||||
reqlen = strlen(request);
|
reqlen = strlen(request);
|
||||||
|
|
||||||
@@ -491,10 +491,10 @@ int test()
|
|||||||
for(i=0; i<concurrency; i++) {
|
for(i=0; i<concurrency; i++) {
|
||||||
int s = con[i].fd;
|
int s = con[i].fd;
|
||||||
if(FD_ISSET(s, &sel_except)) {
|
if(FD_ISSET(s, &sel_except)) {
|
||||||
bad++;
|
bad++;
|
||||||
err_except++;
|
err_except++;
|
||||||
start_connect(&con[i]);
|
start_connect(&con[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(FD_ISSET(s, &sel_read)) read_connection(&con[i]);
|
if(FD_ISSET(s, &sel_read)) read_connection(&con[i]);
|
||||||
if(FD_ISSET(s, &sel_write)) write_request(&con[i]);
|
if(FD_ISSET(s, &sel_write)) write_request(&con[i]);
|
||||||
@@ -511,7 +511,7 @@ int test()
|
|||||||
void usage(char *progname) {
|
void usage(char *progname) {
|
||||||
printf("\nZeusBench v1.0\n\n");
|
printf("\nZeusBench v1.0\n\n");
|
||||||
printf("Usage: %s <machine> <file> [-k] [-n requests | -t timelimit (sec)]"
|
printf("Usage: %s <machine> <file> [-k] [-n requests | -t timelimit (sec)]"
|
||||||
"\n\t\t[-c concurrency] [-p port] \n",progname);
|
"\n\t\t[-c concurrency] [-p port] \n",progname);
|
||||||
printf("Filename should start with a '/' e.g. /index.html\n\n");
|
printf("Filename should start with a '/' e.g. /index.html\n\n");
|
||||||
exit(EINVAL);
|
exit(EINVAL);
|
||||||
}
|
}
|
||||||
@@ -534,8 +534,8 @@ int main(int argc, char **argv) {
|
|||||||
case 'n':
|
case 'n':
|
||||||
requests = atoi(optarg);
|
requests = atoi(optarg);
|
||||||
if(!requests) {
|
if(!requests) {
|
||||||
printf("Invalid number of requests\n");
|
printf("Invalid number of requests\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
|
Reference in New Issue
Block a user