* AllowMethods GET HEAD OPTIONS POST
* </Directory>
* Non-matching methods will be returned a status 405 (method not allowed)
- *
+ *
* To allow all methods, and effectively turn off mod_allowmethods, use:
* AllowMethods reset
*/
{
int method = r->method_number;
am_conf_t *conf;
-
+
conf = (am_conf_t *) ap_get_module_config(r->per_dir_config,
&allowmethods_module);
if (!conf || conf->allowed == 0) {
return DECLINED;
}
-
+
r->allowed = conf->allowed;
if (conf->allowed & (AP_METHOD_BIT << method)) {
return DECLINED;
}
-
+
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"client method denied by server configuration: '%s' to %s%s",
r->method,
r->filename ? "" : "uri ",
r->filename ? r->filename : r->uri);
-
+
return HTTP_METHOD_NOT_ALLOWED;
}
static void *am_create_conf(apr_pool_t * p, char *dummy)
{
am_conf_t *conf = apr_pcalloc(p, sizeof(am_conf_t));
-
+
conf->allowed = 0;
conf->allowed_set = 0;
return conf;
am_conf_t* base = (am_conf_t*) a;
am_conf_t* add = (am_conf_t*) b;
am_conf_t* conf = apr_palloc(pool, sizeof(am_conf_t));
-
+
if (add->allowed_set) {
conf->allowed = add->allowed;
conf->allowed_set = add->allowed_set;
{
unsigned long idx;
apr_status_t sts;
- const char *tempdir;
+ const char *tempdir;
/* set up client list */
sts = apr_temp_dir_get(&tempdir, ctx);
if (APR_SUCCESS != sts) {
- ap_log_error(APLOG_MARK, APLOG_ERR, sts, s,
+ ap_log_error(APLOG_MARK, APLOG_ERR, sts, s,
"Failed to find temporary directory");
log_error_and_cleanup("failed to find temp dir", sts, s);
return HTTP_INTERNAL_SERVER_ERROR;
/* Create the shared memory segment */
- /*
- * Create a unique filename using our pid. This information is
+ /*
+ * Create a unique filename using our pid. This information is
* stashed in the global variable so the children inherit it.
*/
- client_shm_filename = apr_psprintf(ctx, "%s/authdigest_shm.%"APR_PID_T_FMT, tempdir,
+ client_shm_filename = apr_psprintf(ctx, "%s/authdigest_shm.%"APR_PID_T_FMT, tempdir,
getpid());
/* Now create that segment */
sts = apr_shm_create(&client_shm, shmem_size,
client_shm_filename, ctx);
if (APR_SUCCESS != sts) {
- ap_log_error(APLOG_MARK, APLOG_ERR, sts, s,
- "Failed to create shared memory segment on file %s",
+ ap_log_error(APLOG_MARK, APLOG_ERR, sts, s,
+ "Failed to create shared memory segment on file %s",
client_shm_filename);
log_error_and_cleanup("failed to initialize shm", sts, s);
return HTTP_INTERNAL_SERVER_ERROR;
num_buckets = 1;
}
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, cmd->server,
- "Digest: Set shmem-size: %" APR_SIZE_T_FMT ", num-buckets: %ld",
+ "Digest: Set shmem-size: %" APR_SIZE_T_FMT ", num-buckets: %ld",
shmem_size, num_buckets);
return NULL;
/* construct key
* look it up
* if found, test password
- *
+ *
* mutexing here would be a big performance drag.
* It's definitely unnecessary with some backends (like ndbm or gdbm)
* Is there a risk in the general case? I guess the only risk we
return APR_SUCCESS;
}
-static int set_request_vars(request_rec *r, enum auth_ldap_phase phase) {
+static int set_request_vars(request_rec *r, enum auth_ldap_phase phase) {
char *prefix = NULL;
int prefix_len;
int remote_user_attribute_set = 0;
/* handle remote_user_attribute, if set */
if ((phase == LDAP_AUTHN) &&
- sec->remote_user_attribute &&
+ sec->remote_user_attribute &&
!strcmp(sec->remote_user_attribute, sec->attributes[i])) {
r->user = (char *)apr_pstrdup(r->pool, vals[i]);
remote_user_attribute_set = 1;
set_request_vars(r, LDAP_AUTHZ);
return AUTHZ_GRANTED;
}
- case LDAP_NO_SUCH_ATTRIBUTE:
+ case LDAP_NO_SUCH_ATTRIBUTE:
case LDAP_COMPARE_FALSE: {
/* nested groups need searches and compares, so grab a new handle */
authnz_ldap_cleanup_connection_close(ldc);
const void **parsed_require_line)
{
/*
- * If the argument to the 'all' provider is 'granted' then just let
+ * If the argument to the 'all' provider is 'granted' then just let
* everybody in. This would be equivalent to the previous syntax of
* 'allow from all'. If the argument is 'denied' we reject everbody,
* which is equivalent to 'deny from all'.
* to deal with those when we successfully login/logout at the server
*
* XXX: WHY would this be specific to dbd_authz? Why wouldn't we track
- * this across all authz user providers in a lower level mod, such as
+ * this across all authz user providers in a lower level mod, such as
* mod_auth_basic/digest?
*/
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(authz_dbd, AUTHZ_DBD, int, client_login,
/* no groups available, so exit immediately */
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"Authorization of user %s to access %s failed, reason: "
- "user doesn't appear in DBM group file (%s).",
+ "user doesn't appear in DBM group file (%s).",
r->user, r->uri, conf->grpfile);
return AUTHZ_DENIED;
}
/* no groups available, so exit immediately */
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"Authorization of user %s to access %s failed, reason: "
- "user doesn't appear in DBM group file (%s).",
+ "user doesn't appear in DBM group file (%s).",
r->user, r->uri, conf->grpfile);
return AUTHZ_DENIED;
}
r->connection->remote_addr)
|| apr_ipsubnet_test(localhost_v4, r->connection->remote_addr)
#if APR_HAVE_IPV6
- || apr_ipsubnet_test(localhost_v6, r->connection->remote_addr)
+ || apr_ipsubnet_test(localhost_v6, r->connection->remote_addr)
#endif
)
{
return APR_SUCCESS;
}
-static int
+static int
netware_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_t *ptemp)
{
}
-static int
+static int
unixd_drop_privileges(apr_pool_t *pool, server_rec *s)
{
int rv = set_group_privs();
return NULL;
}
-static const char*
+static const char*
unixd_set_group(cmd_parms *cmd, void *dummy,
const char *arg)
{
return NULL;
}
-static const char*
+static const char*
unixd_set_chroot_dir(cmd_parms *cmd, void *dummy,
const char *arg)
{
return NULL;
}
-static int
+static int
unixd_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_t *ptemp)
{
cid->ecb->dwHttpStatusCode = cid->r->status;
}
else {
- /* None of dwHttpStatusCode, the parser's r->status nor the
+ /* None of dwHttpStatusCode, the parser's r->status nor the
* old value of r->status were helpful, and nothing was decoded
- * from Status: string passed to us. Let's just say HTTP_OK
+ * from Status: string passed to us. Let's just say HTTP_OK
* and get the data out, this was the isapi dev's oversight.
*/
cid->r->status = HTTP_OK;
&& (file[len - 1] != '/'))
file = apr_pstrcat(cid->r->pool, subreq->filename, "/", NULL);
else
- file = apr_pstrcat(cid->r->pool, subreq->filename,
+ file = apr_pstrcat(cid->r->pool, subreq->filename,
subreq->path_info, NULL);
ap_destroy_sub_req(subreq);
/* XXX: Many authors issue their next HSE_REQ_ASYNC_READ_CLIENT
* within the completion logic. An example is MS's own PSDK
* sample web/iis/extensions/io/ASyncRead. This potentially
- * leads to stack exhaustion. To refactor, the notification
+ * leads to stack exhaustion. To refactor, the notification
* logic needs to move to isapi_handler() - differentiating
- * the cid->completed event with a new flag to indicate
+ * the cid->completed event with a new flag to indicate
* an async-notice versus the async request completed.
*/
if (res >= 0) {
default:
ap_log_rerror(APLOG_MARK, APLOG_WARNING, apr_get_os_error(), r,
"ISAPI: unrecognized result code %d "
- "from HttpExtensionProc(): %s ",
+ "from HttpExtensionProc(): %s ",
rv, r->filename);
r->status = HTTP_INTERNAL_SERVER_ERROR;
break;
static void socache_dbm_expire(ap_socache_instance_t *ctx, server_rec *s);
-static apr_status_t socache_dbm_remove(ap_socache_instance_t *ctx,
- server_rec *s, const unsigned char *id,
+static apr_status_t socache_dbm_remove(ap_socache_instance_t *ctx,
+ server_rec *s, const unsigned char *id,
unsigned int idlen, apr_pool_t *p);
-static const char *socache_dbm_create(ap_socache_instance_t **context,
- const char *arg,
+static const char *socache_dbm_create(ap_socache_instance_t **context,
+ const char *arg,
apr_pool_t *tmp, apr_pool_t *p)
{
ap_socache_instance_t *ctx;
return NULL;
}
-static apr_status_t socache_dbm_init(ap_socache_instance_t *ctx,
- const char *namespace,
+static apr_status_t socache_dbm_init(ap_socache_instance_t *ctx,
+ const char *namespace,
const struct ap_socache_hints *hints,
server_rec *s, apr_pool_t *p)
{
}
apr_dbm_close(dbm);
- ctx->expiry_interval = (hints && hints->expiry_interval
+ ctx->expiry_interval = (hints && hints->expiry_interval
? hints->expiry_interval : apr_time_from_sec(30));
#if AP_NEED_SET_MUTEX_PERMS
return;
}
-static apr_status_t socache_dbm_store(ap_socache_instance_t *ctx,
- server_rec *s, const unsigned char *id,
- unsigned int idlen, apr_time_t expiry,
- unsigned char *ucaData,
+static apr_status_t socache_dbm_store(ap_socache_instance_t *ctx,
+ server_rec *s, const unsigned char *id,
+ unsigned int idlen, apr_time_t expiry,
+ unsigned char *ucaData,
unsigned int nData, apr_pool_t *pool)
{
apr_dbm_t *dbm;
return APR_SUCCESS;
}
-static apr_status_t socache_dbm_retrieve(ap_socache_instance_t *ctx, server_rec *s,
+static apr_status_t socache_dbm_retrieve(ap_socache_instance_t *ctx, server_rec *s,
const unsigned char *id, unsigned int idlen,
unsigned char *dest, unsigned int *destlen,
apr_pool_t *p)
* do the apr_dbm_close? This would make the code a bit cleaner.
*/
apr_pool_clear(ctx->pool);
- if ((rc = apr_dbm_open(&dbm, ctx->data_file, APR_DBM_RWCREATE,
+ if ((rc = apr_dbm_open(&dbm, ctx->data_file, APR_DBM_RWCREATE,
DBM_FILE_MODE, ctx->pool)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
"Cannot open socache DBM file `%s' for reading "
if (nData > *destlen) {
apr_dbm_close(dbm);
return APR_ENOSPC;
- }
+ }
*destlen = nData;
memcpy(&expiry, dbmval.dptr, sizeof(apr_time_t));
return APR_SUCCESS;
}
-static apr_status_t socache_dbm_remove(ap_socache_instance_t *ctx,
+static apr_status_t socache_dbm_remove(ap_socache_instance_t *ctx,
server_rec *s, const unsigned char *id,
unsigned int idlen, apr_pool_t *p)
{
/* and delete it from the DBM file */
apr_pool_clear(ctx->pool);
- if ((rv = apr_dbm_open(&dbm, ctx->data_file, APR_DBM_RWCREATE,
+ if ((rv = apr_dbm_open(&dbm, ctx->data_file, APR_DBM_RWCREATE,
DBM_FILE_MODE, ctx->pool)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
"Cannot open socache DBM file `%s' for writing "
elts, elts-deleted, deleted);
}
-static void socache_dbm_status(ap_socache_instance_t *ctx, request_rec *r,
+static void socache_dbm_status(ap_socache_instance_t *ctx, request_rec *r,
int flags)
{
apr_dbm_t *dbm;
size = 0;
apr_pool_clear(ctx->pool);
- if ((rv = apr_dbm_open(&dbm, ctx->data_file, APR_DBM_RWCREATE,
+ if ((rv = apr_dbm_open(&dbm, ctx->data_file, APR_DBM_RWCREATE,
DBM_FILE_MODE, ctx->pool)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"Cannot open socache DBM file `%s' for status "
static void register_hooks(apr_pool_t *p)
{
- ap_register_provider(p, AP_SOCACHE_PROVIDER_GROUP, "dbm",
+ ap_register_provider(p, AP_SOCACHE_PROVIDER_GROUP, "dbm",
AP_SOCACHE_PROVIDER_VERSION,
&socache_dbm);
}
DC_CTX *dc;
};
-static const char *socache_dc_create(ap_socache_instance_t **context,
- const char *arg,
+static const char *socache_dc_create(ap_socache_instance_t **context,
+ const char *arg,
apr_pool_t *tmp, apr_pool_t *p)
{
struct ap_socache_instance_t *ctx;
ctx = *context = apr_palloc(p, sizeof *ctx);
-
+
ctx->target = apr_pstrdup(p, arg);
return NULL;
}
-static apr_status_t socache_dc_init(ap_socache_instance_t *ctx,
- const char *namespace,
- const struct ap_socache_hints *hints,
+static apr_status_t socache_dc_init(ap_socache_instance_t *ctx,
+ const char *namespace,
+ const struct ap_socache_hints *hints,
server_rec *s, apr_pool_t *p)
{
#if 0
}
}
-static apr_status_t socache_dc_store(ap_socache_instance_t *ctx, server_rec *s,
+static apr_status_t socache_dc_store(ap_socache_instance_t *ctx, server_rec *s,
const unsigned char *id, unsigned int idlen,
apr_time_t expiry,
unsigned char *der, unsigned int der_len,
apr_pool_t *p)
{
- /* !@#$%^ - why do we deal with *absolute* time anyway???
+ /* !@#$%^ - why do we deal with *absolute* time anyway???
* Uhm - because most things expire things at a specific time?
* Were the API were thought out expiry - r->request_time is a good approximation
*/
return APR_SUCCESS;
}
-static apr_status_t socache_dc_retrieve(ap_socache_instance_t *ctx, server_rec *s,
+static apr_status_t socache_dc_retrieve(ap_socache_instance_t *ctx, server_rec *s,
const unsigned char *id, unsigned int idlen,
unsigned char *dest, unsigned int *destlen,
apr_pool_t *p)
return APR_SUCCESS;
}
-static apr_status_t socache_dc_remove(ap_socache_instance_t *ctx,
- server_rec *s, const unsigned char *id,
+static apr_status_t socache_dc_remove(ap_socache_instance_t *ctx,
+ server_rec *s, const unsigned char *id,
unsigned int idlen, apr_pool_t *p)
{
/* Remove any corresponding session from the distributed cache context */
static void register_hooks(apr_pool_t *p)
{
- ap_register_provider(p, AP_SOCACHE_PROVIDER_GROUP, "dc",
+ ap_register_provider(p, AP_SOCACHE_PROVIDER_GROUP, "dc",
AP_SOCACHE_PROVIDER_VERSION,
&socache_dc);
}
apr_size_t taglen; /* strlen(tag) + 1 */
};
-static const char *socache_mc_create(ap_socache_instance_t **context,
- const char *arg,
+static const char *socache_mc_create(ap_socache_instance_t **context,
+ const char *arg,
apr_pool_t *tmp, apr_pool_t *p)
{
ap_socache_instance_t *ctx;
-
+
*context = ctx = apr_palloc(p, sizeof *ctx);
if (!arg || !*arg) {
return "List of server names required to create memcache socache.";
}
-
+
ctx->servers = apr_pstrdup(p, arg);
return NULL;
}
-static apr_status_t socache_mc_init(ap_socache_instance_t *ctx,
+static apr_status_t socache_mc_init(ap_socache_instance_t *ctx,
const char *namespace,
const struct ap_socache_hints *hints,
server_rec *s, apr_pool_t *p)
rv = apr_memcache_create(p, nservers, 0, &ctx->mc);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
- "socache: Failed to create Memcache Object of '%d' size.",
+ "socache: Failed to create Memcache Object of '%d' size.",
nservers);
return rv;
}
&st);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
- "socache: Failed to Create memcache Server: %s:%d",
+ "socache: Failed to Create memcache Server: %s:%d",
host_str, port);
return rv;
}
rv = apr_memcache_add_server(ctx->mc, st);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
- "socache: Failed to Add memcache Server: %s:%d",
+ "socache: Failed to Add memcache Server: %s:%d",
host_str, port);
return rv;
}
return 0;
}
-static apr_status_t socache_mc_store(ap_socache_instance_t *ctx, server_rec *s,
+static apr_status_t socache_mc_store(ap_socache_instance_t *ctx, server_rec *s,
const unsigned char *id, unsigned int idlen,
apr_time_t expiry,
unsigned char *ucaData, unsigned int nData,
return APR_SUCCESS;
}
-static apr_status_t socache_mc_retrieve(ap_socache_instance_t *ctx, server_rec *s,
+static apr_status_t socache_mc_retrieve(ap_socache_instance_t *ctx, server_rec *s,
const unsigned char *id, unsigned int idlen,
unsigned char *dest, unsigned int *destlen,
apr_pool_t *p)
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
"scache_mc: 'retrieve' OVERFLOW");
return APR_ENOMEM;
- }
+ }
memcpy(dest, data, data_len);
*destlen = data_len;
return APR_SUCCESS;
}
-static apr_status_t socache_mc_remove(ap_socache_instance_t *ctx, server_rec *s,
- const unsigned char *id,
+static apr_status_t socache_mc_remove(ap_socache_instance_t *ctx, server_rec *s,
+ const unsigned char *id,
unsigned int idlen, apr_pool_t *p)
{
char buf[MC_KEY_LEN];
static void register_hooks(apr_pool_t *p)
{
#ifdef HAVE_APU_MEMCACHE
- ap_register_provider(p, AP_SOCACHE_PROVIDER_GROUP, "mc",
+ ap_register_provider(p, AP_SOCACHE_PROVIDER_GROUP, "mc",
AP_SOCACHE_PROVIDER_VERSION,
&socache_mc);
#endif
unsigned int subcache_data_size;
} SHMCBHeader;
-/*
+/*
* Subcache structure - the start of each subcache, followed by
* indexes then data
*/
unsigned int data_pos, data_used;
} SHMCBSubcache;
-/*
+/*
* Index structure - each subcache has an array of these
*/
typedef struct {
*
* Each in-use SHMCBIndex structure represents a single cached object.
* The ID and data segment are stored consecutively in the subcache's
- * cyclic data buffer. The "Data" segment can thus be seen to
+ * cyclic data buffer. The "Data" segment can thus be seen to
* look like this, for example
*
* offset: [ 0 1 2 3 4 5 6 ...
* SRC_LEN against the contents of cyclic buffer DATA (which is of
* size BUF_SIZE), starting at offset DEST_OFFSET. Got that? Good. */
static int shmcb_cyclic_memcmp(unsigned int buf_size, unsigned char *data,
- unsigned int dest_offset,
+ unsigned int dest_offset,
const unsigned char *src,
unsigned int src_len)
{
else {
/* Compare the two splits */
int diff;
-
+
diff = memcmp(data + dest_offset, src, buf_size - dest_offset);
if (diff) {
return diff;
/* Prototypes for low-level subcache operations */
static void shmcb_subcache_expire(server_rec *, SHMCBHeader *, SHMCBSubcache *,
apr_time_t);
-/* Returns zero on success, non-zero on failure. */
+/* Returns zero on success, non-zero on failure. */
static int shmcb_subcache_store(server_rec *s, SHMCBHeader *header,
- SHMCBSubcache *subcache,
+ SHMCBSubcache *subcache,
unsigned char *data, unsigned int data_len,
const unsigned char *id, unsigned int id_len,
apr_time_t expiry);
-/* Returns zero on success, non-zero on failure. */
+/* Returns zero on success, non-zero on failure. */
static int shmcb_subcache_retrieve(server_rec *, SHMCBHeader *, SHMCBSubcache *,
const unsigned char *id, unsigned int idlen,
unsigned char *data, unsigned int *datalen);
-/* Returns zero on success, non-zero on failure. */
+/* Returns zero on success, non-zero on failure. */
static int shmcb_subcache_remove(server_rec *, SHMCBHeader *, SHMCBSubcache *,
const unsigned char *, unsigned int);
*/
static const char *socache_shmcb_create(ap_socache_instance_t **context,
- const char *arg,
+ const char *arg,
apr_pool_t *tmp, apr_pool_t *p)
{
ap_socache_instance_t *ctx;
/* Allocate the context. */
*context = ctx = apr_pcalloc(p, sizeof *ctx);
-
+
ctx->shm_size = 1024*512; /* 512KB */
if (!arg || *arg == '\0') {
/* Use defaults. */
return NULL;
}
-
+
ctx->data_file = path = ap_server_root_relative(p, arg);
cp = strrchr(path, '(');
}
*cp++ = '\0';
*cp2 = '\0';
-
-
+
+
ctx->shm_size = strtol(cp, &endptr, 10);
if (endptr != cp2) {
return "Invalid argument: cache size not numerical";
}
-
+
if (ctx->shm_size < 8192) {
return "Invalid argument: size has to be >= 8192 bytes";
-
+
}
-
+
if (ctx->shm_size >= SHMCB_MAX_SIZE) {
return apr_psprintf(tmp,
"Invalid argument: size has "
- "to be < %d bytes on this platform",
+ "to be < %d bytes on this platform",
SHMCB_MAX_SIZE);
-
+
}
}
else if (cp2 >= path && *cp2 == ')') {
}
static apr_status_t socache_shmcb_init(ap_socache_instance_t *ctx,
- const char *namespace,
+ const char *namespace,
const struct ap_socache_hints *hints,
server_rec *s, apr_pool_t *p)
{
/* Create shared memory segment */
if (ctx->data_file == NULL) {
- const char *path = apr_pstrcat(p, DEFAULT_SHMCB_PREFIX, namespace,
+ const char *path = apr_pstrcat(p, DEFAULT_SHMCB_PREFIX, namespace,
DEFAULT_SHMCB_SUFFIX, NULL);
ctx->data_file = ap_server_root_relative(p, path);
num_subcache /= 2;
num_idx /= num_subcache;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
- "for %" APR_SIZE_T_FMT " bytes (%" APR_SIZE_T_FMT
+ "for %" APR_SIZE_T_FMT " bytes (%" APR_SIZE_T_FMT
" including header), recommending %u subcaches, "
"%u indexes each", shm_segsize,
shm_segsize + sizeof(SHMCBHeader), num_subcache, num_idx);
}
}
-static apr_status_t socache_shmcb_store(ap_socache_instance_t *ctx,
- server_rec *s, const unsigned char *id,
- unsigned int idlen, apr_time_t expiry,
+static apr_status_t socache_shmcb_store(ap_socache_instance_t *ctx,
+ server_rec *s, const unsigned char *id,
+ unsigned int idlen, apr_time_t expiry,
unsigned char *encoded,
unsigned int len_encoded,
apr_pool_t *p)
return APR_SUCCESS;
}
-static apr_status_t socache_shmcb_retrieve(ap_socache_instance_t *ctx,
- server_rec *s,
+static apr_status_t socache_shmcb_retrieve(ap_socache_instance_t *ctx,
+ server_rec *s,
const unsigned char *id, unsigned int idlen,
unsigned char *dest, unsigned int *destlen,
apr_pool_t *p)
return rv == 0 ? APR_SUCCESS : APR_NOTFOUND;
}
-static apr_status_t socache_shmcb_remove(ap_socache_instance_t *ctx,
+static apr_status_t socache_shmcb_remove(ap_socache_instance_t *ctx,
server_rec *s, const unsigned char *id,
unsigned int idlen, apr_pool_t *p)
{
return rv;
}
-static void socache_shmcb_status(ap_socache_instance_t *ctx,
+static void socache_shmcb_status(ap_socache_instance_t *ctx,
request_rec *r, int flags)
{
server_rec *s = r->server;
}
/*
- * Subcache-level cache operations
+ * Subcache-level cache operations
*/
static void shmcb_subcache_expire(server_rec *s, SHMCBHeader *header,
}
static int shmcb_subcache_store(server_rec *s, SHMCBHeader *header,
- SHMCBSubcache *subcache,
+ SHMCBSubcache *subcache,
unsigned char *data, unsigned int data_len,
const unsigned char *id, unsigned int id_len,
apr_time_t expiry)
idx->removed = 0;
subcache->idx_used++;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
- "insert happened at idx=%d, data=(%u:%u)", new_idx,
+ "insert happened at idx=%d, data=(%u:%u)", new_idx,
id_offset, data_offset);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
"finished insert, subcache: idx_pos/idx_used=%d/%d, "
}
static int shmcb_subcache_retrieve(server_rec *s, SHMCBHeader *header,
- SHMCBSubcache *subcache,
+ SHMCBSubcache *subcache,
const unsigned char *id, unsigned int idlen,
unsigned char *dest, unsigned int *destlen)
{
/* Only consider 'idx' if the id matches, and the "removed"
* flag isn't set, and the record is not expired.
- * Check the data length too to avoid a buffer overflow
+ * Check the data length too to avoid a buffer overflow
* in case of corruption, which should be impossible,
* but it's cheap to be safe. */
if (!idx->removed
unsigned int data_offset;
/* Find the offset of the data segment, after the id */
- data_offset = SHMCB_CYCLIC_INCREMENT(idx->data_pos,
+ data_offset = SHMCB_CYCLIC_INCREMENT(idx->data_pos,
idx->id_len,
header->subcache_data_size);
apr_size_t buf_req;
/* Find the offset of the data segment, after the id */
- data_offset = SHMCB_CYCLIC_INCREMENT(idx->data_pos,
+ data_offset = SHMCB_CYCLIC_INCREMENT(idx->data_pos,
idx->id_len,
header->subcache_data_size);
dest_len = idx->data_used - idx->id_len;
- buf_req = APR_ALIGN_DEFAULT(idx->id_len + 1)
+ buf_req = APR_ALIGN_DEFAULT(idx->id_len + 1)
+ APR_ALIGN_DEFAULT(dest_len + 1);
if (buf_req > *buf_len) {
static void register_hooks(apr_pool_t *p)
{
- ap_register_provider(p, AP_SOCACHE_PROVIDER_GROUP, "shmcb",
+ ap_register_provider(p, AP_SOCACHE_PROVIDER_GROUP, "shmcb",
AP_SOCACHE_PROVIDER_VERSION,
&socache_shmcb);
/* Also register shmcb under the default provider name. */
- ap_register_provider(p, AP_SOCACHE_PROVIDER_GROUP,
+ ap_register_provider(p, AP_SOCACHE_PROVIDER_GROUP,
AP_SOCACHE_DEFAULT_PROVIDER,
AP_SOCACHE_PROVIDER_VERSION,
&socache_shmcb);
apr_brigade_cleanup(tmpbb);
if (APR_BRIGADE_EMPTY(bb)) {
break;
- }
+ }
rv = apr_brigade_split_line(tmpbb, bb,
APR_BLOCK_READ, sizeof(buf));
-
+
if (rv) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s,
"Heartmonitor: Unable to read from file: %s", ctx->storage_path);
/* copy things we can't process */
apr_file_printf(fp, "%s\n", buf);
} else if (strcmp(ip, s->ip) !=0 ) {
- hm_server_t node;
+ hm_server_t node;
apr_time_t seen;
/* Update seen time according to the last file modification */
apr_table_clear(hbt);
if (apr_table_get(hbt, "lastseen")) {
node.seen = atoi(apr_table_get(hbt, "lastseen"));
} else {
- node.seen = SEEN_TIMEOUT;
+ node.seen = SEEN_TIMEOUT;
}
seen = fage + node.seen;
if (apr_table_get(hbt, "port")) {
node.port = atoi(apr_table_get(hbt, "port"));
} else {
- node.port = 80;
+ node.port = 80;
}
apr_file_printf(fp, "%s &ready=%u&busy=%u&lastseen=%u&port=%u\n",
ip, node.ready, node.busy, (unsigned int) seen, node.port);
"Heartmonitor: Unable to close file: %s", path);
return rv;
}
-
+
rv = apr_file_perms_set(path,
APR_FPROT_UREAD | APR_FPROT_GREAD |
APR_FPROT_WREAD);
"Heartmonitor: Unable to close file: %s", path);
return rv;
}
-
+
rv = apr_file_perms_set(path,
APR_FPROT_UREAD | APR_FPROT_GREAD |
APR_FPROT_WREAD);
if (apr_table_get(tbl, "port") != NULL)
port = atoi(apr_table_get(tbl, "port"));
-
+
s = hm_get_server(ctx, ip, port);
s->busy = atoi(apr_table_get(tbl, "busy"));
maxworkers = atoi(data);
if (maxworkers <= 10)
- return "HeartbeatMaxServers: Should be bigger than 10";
+ return "HeartbeatMaxServers: Should be bigger than 10";
return NULL;
}
"is garbled - expected signature %08lx but saw "
"%08lx - perhaps this is not an Apache module DSO, "
"or was compiled for a different Apache version?",
- modname, szModuleFile,
+ modname, szModuleFile,
MODULE_MAGIC_COOKIE, modp->magic);
}
/*
* prefix for temporary files
*/
-#define DAV_FS_TMP_PREFIX ".davfs.tmp"
+#define DAV_FS_TMP_PREFIX ".davfs.tmp"
static const dav_liveprop_spec dav_fs_props[] =
{
dav_set_bufsize(p, pbuf, DAV_FS_COPY_BLOCKSIZE);
- if ((status = apr_file_open(&inf, src, APR_READ | APR_BINARY,
+ if ((status = apr_file_open(&inf, src, APR_READ | APR_BINARY,
APR_OS_DEFAULT, p)) != APR_SUCCESS) {
/* ### use something besides 500? */
return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, status,
/* ### ACK! Inconsistent state... */
/* ### use something besides 500? */
- return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
+ return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
lcl_status,
"Could not delete output after read "
"failure. Server is now in an "
"server may be in an "
"inconsistent state.", src, dst));
return err;
- }
+ }
else if ((lcl_status = apr_file_remove(dst, p)) != APR_SUCCESS) {
/* ### ACK. this creates an inconsistency. do more!? */
APR_WRITE | APR_CREATE | APR_BINARY | APR_EXCL,
APR_OS_DEFAULT, p);
} while (APR_STATUS_IS_EEXIST(rv));
-
+
return rv;
}
/* DAV header additions registered by external modules */
extensions = ap_list_provider_names(r->pool, DAV_OPTIONS_EXTENSION_GROUP, "0");
entry = (ap_list_provider_names_t *)extensions->elts;
-
+
for (i = 0; i < extensions->nelts; i++, entry++) {
- const dav_options_provider *options =
+ const dav_options_provider *options =
dav_get_options_providers(entry->provider_name);
-
+
if (options && options->dav_header) {
apr_text_header hoptions = { 0 };
-
+
options->dav_header(r, resource, &hoptions);
for (t = hoptions.first; t && t->text; t = t->next)
dav_level = apr_pstrcat(r->pool, dav_level, ",", t->text, NULL);
- }
+ }
}
/* ###
/* additional methods registered by external modules */
extensions = ap_list_provider_names(r->pool, DAV_OPTIONS_EXTENSION_GROUP, "0");
entry = (ap_list_provider_names_t *)extensions->elts;
-
+
for (i = 0; i < extensions->nelts; i++, entry++) {
- const dav_options_provider *options =
+ const dav_options_provider *options =
dav_get_options_providers(entry->provider_name);
-
+
if (options && options->dav_method) {
apr_text_header hoptions = { 0 };
-
+
options->dav_method(r, resource, &hoptions);
for (t = hoptions.first; t && t->text; t = t->next)
apr_table_addn(methods, t->text, "");
- }
+ }
}
/* Generate the Allow header */
err = dav_new_error(r->pool, HTTP_CONFLICT, 0, 0,
apr_psprintf(r->pool,
"The parent resource of %s does not "
- "exist or is not a collection.",
+ "exist or is not a collection.",
ap_escape_html(r->pool, r->uri)));
return dav_handle_err(r, err, NULL);
}
retVal = ap_meets_conditions(r);
- /* If-None-Match '*' fix. If-None-Match '*' request should succeed
+ /* If-None-Match '*' fix. If-None-Match '*' request should succeed
* if the resource does not exist. */
if (retVal == HTTP_PRECONDITION_FAILED) {
/* Note. If if_none_match != NULL, if_none_match is the culprit.
- * Since, in presence of If-None-Match,
+ * Since, in presence of If-None-Match,
* other If-* headers are undefined. */
if ((if_none_match =
apr_table_get(r->headers_in, "If-None-Match")) != NULL) {
}
-static int update_echo_child_status(ap_sb_handle_t *sbh,
+static int update_echo_child_status(ap_sb_handle_t *sbh,
int status, conn_rec *c,
apr_bucket_brigade *last_echoed)
{
/* initial pass only, please - in the name of efficiency */
if (c) {
- apr_cpystrn(ws->client,
+ apr_cpystrn(ws->client,
ap_get_remote_host(c, c->base_server->lookup_defaults,
REMOTE_NOLOOKUP, NULL),
sizeof(ws->client));
/* each subsequent WRITE pass, let's update what we echoed */
if (last_echoed) {
- brigade_peek(last_echoed, ws->request + sizeof("ECHO ") - 1,
+ brigade_peek(last_echoed, ws->request + sizeof("ECHO ") - 1,
sizeof(ws->request) - sizeof("ECHO ") + 1);
}
if (!pConfig->bEnabled) {
return DECLINED;
}
-
+
ap_time_process_request(c->sbh, START_PREQUEST);
update_echo_child_status(c->sbh, SERVER_BUSY_READ, c, NULL);
ap_log_error(APLOG_MARK, APLOG_INFO, rv, c->base_server,
"ProtocolEcho: Failure writing to %s",
c->remote_ip);
- break;
+ break;
}
apr_brigade_cleanup(bb);
APR_BRIGADE_INSERT_TAIL(pbbOut,pbktOut);
}
- /* Q: is there any advantage to passing a brigade for each bucket?
+ /* Q: is there any advantage to passing a brigade for each bucket?
* A: obviously, it can cut down server resource consumption, if this
* experimental module was fed a file of 4MB, it would be using 8MB for
* the 'read' buckets and the 'write' buckets.
*
* To use mod_example_hooks, configure the Apache build with
* --enable-example and compile. Set up a <Location> block in your
- * configuration file like so:
- *
+ * configuration file like so:
+ *
* <Location /example>
* SetHandler example-hooks-handler
- * </Location>
- *
- * When you look at that location on your server, you will see a backtrace of
- * the callbacks that have been invoked up to that point. See the ErrorLog for
- * more information on code paths that touch mod_example_hooks.
+ * </Location>
+ *
+ * When you look at that location on your server, you will see a backtrace of
+ * the callbacks that have been invoked up to that point. See the ErrorLog for
+ * more information on code paths that touch mod_example_hooks.
*
* IMPORTANT NOTES
* ===============
- *
+ *
* Do NOT use this module on a production server. It attaches itself to every
* phase of the server runtime operations including startup, shutdown and
- * request processing, and produces copious amounts of logging data. This will
- * negatively affect server performance.
- *
+ * request processing, and produces copious amounts of logging data. This will
+ * negatively affect server performance.
+ *
* Do NOT use mod_example_hooks as the basis for your own code. This module
* implements every callback hook offered by the Apache core, and your
* module will almost certainly not have to implement this much. If you
- * want a simple module skeleton to start development, use apxs -g.
- *
+ * want a simple module skeleton to start development, use apxs -g.
+ *
* XXX TO DO XXX
* =============
*
- * * Enable HTML backtrace entries for more callbacks that are not directly
+ * * Enable HTML backtrace entries for more callbacks that are not directly
* associated with a request
* * Make sure every callback that posts an HTML backtrace entry does so in the * right category, so nothing gets overwritten
- * * Implement some logic to show what happens in the parent, and what in the
+ * * Implement some logic to show what happens in the parent, and what in the
* child(ren)
*/
} x_cfg;
/*
- * String pointer to hold the startup trace. No harm working with a global until
- * the server is (may be) multi-threaded.
+ * String pointer to hold the startup trace. No harm working with a global until
+ * the server is (may be) multi-threaded.
*/
static const char *trace = NULL;
return (x_cfg *) ap_get_module_config(r->per_dir_config, &example_hooks_module);
}
-/*
- * The following utility routines are not used in the module. Don't
- * compile them so -Wall doesn't complain about functions that are
- * defined but not used.
+/*
+ * The following utility routines are not used in the module. Don't
+ * compile them so -Wall doesn't complain about functions that are
+ * defined but not used.
*/
#if 0
/*
* these co-routines are called for every single request, and the impact
* on the size (and readability) of the error_log is considerable.
*/
-#ifndef EXAMPLE_LOG_EACH
+#ifndef EXAMPLE_LOG_EACH
#define EXAMPLE_LOG_EACH 0
#endif
-#if EXAMPLE_LOG_EACH
+#if EXAMPLE_LOG_EACH
static void example_log_each(apr_pool_t *p, server_rec *s, const char *note)
{
if (s != NULL) {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "mod_example: %s",
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "mod_example: %s",
note);
} else {
apr_file_t *out = NULL;
}
#endif
-/*
- * This utility routine traces the hooks called when the server starts up.
- * It leaves a trace in a global variable, so it should not be called from
- * a hook handler that runs in a multi-threaded situation.
+/*
+ * This utility routine traces the hooks called when the server starts up.
+ * It leaves a trace in a global variable, so it should not be called from
+ * a hook handler that runs in a multi-threaded situation.
*/
-static void trace_startup(apr_pool_t *p, server_rec *s, x_cfg *mconfig,
+static void trace_startup(apr_pool_t *p, server_rec *s, x_cfg *mconfig,
const char *note)
{
const char *sofar;
char *where, *addon;
-#if EXAMPLE_LOG_EACH
+#if EXAMPLE_LOG_EACH
example_log_each(p, s, note);
#endif
" </li>\n",
NULL);
- /*
- * Make sure that we start with a valid string, even if we have never been
- * called.
+ /*
+ * Make sure that we start with a valid string, even if we have never been
+ * called.
*/
sofar = (trace == NULL) ? "" : trace;
-
+
trace = apr_pstrcat(p, sofar, addon, NULL);
}
/*
- * This utility route traces the hooks called as a request is handled.
- * It takes the current request as argument
+ * This utility route traces the hooks called as a request is handled.
+ * It takes the current request as argument
*/
#define TRACE_NOTE "example-hooks-trace"
-
+
static void trace_request(const request_rec *r, const char *note)
{
const char *trace_copy, *sofar;
char *addon, *where;
x_cfg *cfg;
-
+
#if EXAMPLE_LOG_EACH
example_log_each(r->pool, r->server, note);
#endif
if ((sofar = apr_table_get(r->notes, TRACE_NOTE)) == NULL) {
sofar = "";
}
-
+
cfg = our_dconfig(r);
-
+
where = (cfg != NULL) ? cfg->loc : "nowhere";
where = (where != NULL) ? where : "";
-
- addon = apr_pstrcat(r->pool,
+
+ addon = apr_pstrcat(r->pool,
" <li>\n"
" <dl>\n"
" <dt><samp>", note, "</samp></dt>\n"
}
/*
- * This utility routine traces the hooks called while processing a
- * Connection. Its trace is kept in the pool notes of the pool associated
+ * This utility routine traces the hooks called while processing a
+ * Connection. Its trace is kept in the pool notes of the pool associated
* with the Connection.
*/
-/*
+/*
* Key to get and set the userdata. We should be able to get away
* with a constant key, since in prefork mode the process will have
* the connection and its pool to itself entirely, and in
*/
#define CONN_NOTE "example-hooks-connection"
-static void trace_connection(conn_rec *c, const char *note)
+static void trace_connection(conn_rec *c, const char *note)
{
const char *trace_copy, *sofar;
char *addon, *where;
where = (cfg != NULL) ? cfg->loc : "nowhere";
where = (where != NULL) ? where : "";
-
- addon = apr_pstrcat(c->pool,
+
+ addon = apr_pstrcat(c->pool,
" <li>\n"
" <dl>\n"
" <dt><samp>", note, "</samp></dt>\n"
/* Tack addon onto copy */
trace_copy = apr_pstrcat(c->pool, sofar, addon, NULL);
- /*
+ /*
* Stash copy back into pool notes. This call has a cleanup
* parameter, but we're not using it because the string has been
* allocated from that same pool. There is also an unused return
* occur, and will have to check for the existence of this data on
* the other end.
*/
- apr_pool_userdata_set((const void *) trace_copy, CONN_NOTE,
+ apr_pool_userdata_set((const void *) trace_copy, CONN_NOTE,
NULL, c->pool);
}
-static void trace_nocontext(apr_pool_t *p, const char *file, int line,
+static void trace_nocontext(apr_pool_t *p, const char *file, int line,
const char *note)
{
- /*
+ /*
* Since we have no request or connection to trace, or any idea
* from where this routine was called, there's really not much we
* can do. If we are not logging everything by way of the
*/
dname = (dname != NULL) ? dname : "";
cfg->loc = apr_pstrcat(p, "DIR(", dname, ")", NULL);
- note = apr_psprintf(p, "x_create_dir_config(p == %pp, dirspec == %s)",
+ note = apr_psprintf(p, "x_create_dir_config(p == %pp, dirspec == %s)",
(void*) p, dirspec);
trace_startup(p, NULL, cfg, note);
return (void *) cfg;
* Now just record our being called in the trace list. Include the
* locations we were asked to merge.
*/
- note = apr_psprintf(p, "x_merge_dir_config(p == %pp, parent_conf == "
+ note = apr_psprintf(p, "x_merge_dir_config(p == %pp, parent_conf == "
"%pp, newloc_conf == %pp)", (void*) p,
(void*) parent_conf, (void*) newloc_conf);
trace_startup(p, NULL, merged_config, note);
* phase and just before the process exits. At this point the module
* may output any information useful in configuration testing.
*
- * This is a VOID hook: all defined handlers get called.
+ * This is a VOID hook: all defined handlers get called.
*/
static void x_test_config(apr_pool_t *pconf, server_rec *s)
{
apr_file_open_stderr(&out, pconf);
apr_file_printf(out, "Example module configuration test routine\n");
-
+
trace_startup(pconf, s, NULL, "x_test_config()");
}
/*
* All our process initialiser does is add its trace to the log.
*
- * This is a VOID hook: all defined handlers get called.
+ * This is a VOID hook: all defined handlers get called.
*/
static void x_child_init(apr_pool_t *p, server_rec *s)
{
}
/*
- * The hook runner for ap_hook_http_scheme is aliased to ap_http_scheme(),
- * a routine that the core and other modules call when they need to know
+ * The hook runner for ap_hook_http_scheme is aliased to ap_http_scheme(),
+ * a routine that the core and other modules call when they need to know
* the URL scheme for the request. For instance, mod_ssl returns "https"
- * if the server_rec associated with the request has SSL enabled.
+ * if the server_rec associated with the request has SSL enabled.
*
- * This hook was named 'ap_hook_http_method' in httpd 2.0.
+ * This hook was named 'ap_hook_http_method' in httpd 2.0.
*
- * This is a RUN_FIRST hook: the first handler to return a non NULL
- * value aborts the handler chain. The http_core module inserts a
+ * This is a RUN_FIRST hook: the first handler to return a non NULL
+ * value aborts the handler chain. The http_core module inserts a
* fallback handler (with APR_HOOK_REALLY_LAST preference) that returns
- * "http".
+ * "http".
*/
static const char *x_http_scheme(const request_rec *r)
{
/*
* The runner for this hook is aliased to ap_default_port(), which the
* core and other modules call when they need to know the default port
- * for a particular server. This is used for instance to omit the
+ * for a particular server. This is used for instance to omit the
* port number from a Redirect response Location header URL if the port
- * number is equal to the default port for the service (like 80 for http).
+ * number is equal to the default port for the service (like 80 for http).
*
- * This is a RUN_FIRST hook: the first handler to return a non-zero
- * value is the last one executed. The http_core module inserts a
+ * This is a RUN_FIRST hook: the first handler to return a non-zero
+ * value is the last one executed. The http_core module inserts a
* fallback handler (with APR_HOOK_REALLY_LAST order specifier) that
- * returns 80.
+ * returns 80.
*/
static apr_port_t x_default_port(const request_rec *r)
{
/*
* This routine is called just before the handler gets invoked. It allows
- * a module to insert a previously defined filter into the filter chain.
- *
+ * a module to insert a previously defined filter into the filter chain.
+ *
* No filter has been defined by this module, so we just log the call
- * and exit.
+ * and exit.
*
- * This is a VOID hook: all defined handlers get called.
+ * This is a VOID hook: all defined handlers get called.
*/
static void x_insert_filter(request_rec *r)
{
/*
* Log the call and exit.
*/
- trace_request(r, "x_insert_filter()");
+ trace_request(r, "x_insert_filter()");
}
-/*
- * This routine is called to insert a previously defined error filter into
- * the filter chain as the request is being processed.
- *
- * For the purpose of this example, we don't have a filter to insert,
- * so just add to the trace and exit.
- *
- * This is a VOID hook: all defined handlers get called.
+/*
+ * This routine is called to insert a previously defined error filter into
+ * the filter chain as the request is being processed.
+ *
+ * For the purpose of this example, we don't have a filter to insert,
+ * so just add to the trace and exit.
+ *
+ * This is a VOID hook: all defined handlers get called.
*/
static void x_insert_error_filter(request_rec *r)
{
/*
* Sample content handler. All this does is display the call list that has
* been built up so far.
- *
+ *
* This routine gets called for every request, unless another handler earlier
- * in the callback chain has already handled the request. It is up to us to
- * test the request_rec->handler field and see whether we are meant to handle
- * this request.
+ * in the callback chain has already handled the request. It is up to us to
+ * test the request_rec->handler field and see whether we are meant to handle
+ * this request.
*
- * The content handler gets to write directly to the client using calls like
+ * The content handler gets to write directly to the client using calls like
* ap_rputs() and ap_rprintf()
*
- * This is a RUN_FIRST hook.
+ * This is a RUN_FIRST hook.
*/
static int x_handler(request_rec *r)
{
x_cfg *dcfg;
- char *note;
+ char *note;
void *conn_data;
apr_status_t status;
dcfg = our_dconfig(r);
- /*
- * Add our trace to the log, and whether we get to write
- * content for this request.
+ /*
+ * Add our trace to the log, and whether we get to write
+ * content for this request.
*/
- note = apr_pstrcat(r->pool, "x_handler(), handler is \"",
+ note = apr_pstrcat(r->pool, "x_handler(), handler is \"",
r->handler, "\"", NULL);
trace_request(r, note);
}
/*
- * Set the Content-type header. Note that we do not actually have to send
- * the headers: this is done by the http core.
+ * Set the Content-type header. Note that we do not actually have to send
+ * the headers: this is done by the http core.
*/
ap_set_content_type(r, "text/html");
/*
trace);
ap_rputs(" <H2>Connection-specific callbacks so far:</H2>\n", r);
- status = apr_pool_userdata_get(&conn_data, CONN_NOTE,
+ status = apr_pool_userdata_get(&conn_data, CONN_NOTE,
r->connection->pool);
if ((status == APR_SUCCESS) && conn_data) {
ap_rprintf(r, " <OL>\n%s </OL>\n", (char *) conn_data);
}
/*
- * The quick_handler hook presents modules with a very powerful opportunity to
- * serve their content in a very early request phase. Note that this handler
- * can not serve any requests from the file system because hooks like
- * map_to_storage have not run. The quick_handler hook also runs before any
- * authentication and access control.
+ * The quick_handler hook presents modules with a very powerful opportunity to
+ * serve their content in a very early request phase. Note that this handler
+ * can not serve any requests from the file system because hooks like
+ * map_to_storage have not run. The quick_handler hook also runs before any
+ * authentication and access control.
*
- * This hook is used by mod_cache to serve cached content.
+ * This hook is used by mod_cache to serve cached content.
*
- * This is a RUN_FIRST hook. Return OK if you have served the request,
- * DECLINED if you want processing to continue, or a HTTP_* error code to stop
- * processing the request.
+ * This is a RUN_FIRST hook. Return OK if you have served the request,
+ * DECLINED if you want processing to continue, or a HTTP_* error code to stop
+ * processing the request.
*/
static int x_quick_handler(request_rec *r, int lookup_uri)
{
*/
static int x_pre_connection(conn_rec *c, void *csd)
{
- char *note;
+ char *note;
/*
* Log the call and exit.
*/
- note = apr_psprintf(c->pool, "x_pre_connection(c = %pp, p = %pp)",
+ note = apr_psprintf(c->pool, "x_pre_connection(c = %pp, p = %pp)",
(void*) c, (void*) c->pool);
trace_connection(c, note);
static int x_process_connection(conn_rec *c)
{
trace_connection(c, "x_process_connection()");
-
+
return DECLINED;
}
* to the filename. For example this phase can be used to block evil
* clients, while little resources were wasted on these.
*
- * This is a RUN_ALL hook.
+ * This is a RUN_ALL hook.
*/
static int x_header_parser(request_rec *r)
{
* example.)
*
* This is a RUN_ALL hook. The first handler to return a status other than OK
- * or DECLINED (for instance, HTTP_FORBIDDEN) aborts the callback chain.
+ * or DECLINED (for instance, HTTP_FORBIDDEN) aborts the callback chain.
*/
static int x_check_access(request_rec *r)
{
* the request (such as looking up the user in a database and verifying that
* the [encrypted] password sent matches the one in the database).
*
- * This is a RUN_FIRST hook. The return value is OK, DECLINED, or some
- * HTTP_mumble error (typically HTTP_UNAUTHORIZED).
+ * This is a RUN_FIRST hook. The return value is OK, DECLINED, or some
+ * HTTP_mumble error (typically HTTP_UNAUTHORIZED).
*/
static int x_check_authn(request_rec *r)
{
* This routine is called to check to see if the resource being requested
* requires authorisation.
*
- * This is a RUN_FIRST hook. The return value is OK, DECLINED, or
- * HTTP_mumble. If we return OK, no other modules are called during this
+ * This is a RUN_FIRST hook. The return value is OK, DECLINED, or
+ * HTTP_mumble. If we return OK, no other modules are called during this
* phase.
*
* If *all* modules return DECLINED, the request is aborted with a server
* This routine is called to perform any module-specific logging activities
* over and above the normal server things.
*
- * This is a RUN_ALL hook.
+ * This is a RUN_ALL hook.
*/
static int x_log_transaction(request_rec *r)
{
/*
* This routine is called to find out under which user id to run suexec
- * Unless our module runs CGI programs, there is no reason for us to
- * mess with this information.
- *
- * This is a RUN_FIRST hook. The return value is a pointer to an
- * ap_unix_identity_t or NULL.
+ * Unless our module runs CGI programs, there is no reason for us to
+ * mess with this information.
+ *
+ * This is a RUN_FIRST hook. The return value is a pointer to an
+ * ap_unix_identity_t or NULL.
*/
-static ap_unix_identity_t *x_get_suexec_identity(const request_rec *r)
+static ap_unix_identity_t *x_get_suexec_identity(const request_rec *r)
{
trace_request(r, "x_get_suexec_identity()");
return NULL;
/*
* This routine is called to create a connection. This hook is implemented
- * by the Apache core: there is no known reason a module should override
- * it.
- *
- * This is a RUN_FIRST hook.
- *
- * Return NULL to decline, a valid conn_rec pointer to accept.
- */
-static conn_rec *x_create_connection(apr_pool_t *p, server_rec *server,
- apr_socket_t *csd, long conn_id,
- void *sbh, apr_bucket_alloc_t *alloc)
+ * by the Apache core: there is no known reason a module should override
+ * it.
+ *
+ * This is a RUN_FIRST hook.
+ *
+ * Return NULL to decline, a valid conn_rec pointer to accept.
+ */
+static conn_rec *x_create_connection(apr_pool_t *p, server_rec *server,
+ apr_socket_t *csd, long conn_id,
+ void *sbh, apr_bucket_alloc_t *alloc)
{
trace_nocontext(p, __FILE__, __LINE__, "x_create_connection()");
- return NULL;
+ return NULL;
}
/*
- * This hook is defined in server/core.c, but it is not actually called
- * or documented.
- *
- * This is a RUN_ALL hook.
+ * This hook is defined in server/core.c, but it is not actually called
+ * or documented.
+ *
+ * This is a RUN_ALL hook.
*/
static int x_get_mgmt_items(apr_pool_t *p, const char *val, apr_hash_t *ht)
{
/*
* This routine gets called shortly after the request_rec structure
- * is created. It provides the opportunity to manipulae the request
- * at a very early stage.
+ * is created. It provides the opportunity to manipulae the request
+ * at a very early stage.
*
- * This is a RUN_ALL hook.
+ * This is a RUN_ALL hook.
*/
static int x_create_request(request_rec *r)
{
- /*
+ /*
* We have a request_rec, but it is not filled in enough to give
* us a usable configuration. So, add a trace without context.
*/
}
/*
- * This routine gets called during the startup of the MPM.
- * No known existing module implements this hook.
- *
- * This is a RUN_ALL hook.
+ * This routine gets called during the startup of the MPM.
+ * No known existing module implements this hook.
+ *
+ * This is a RUN_ALL hook.
*/
static int x_pre_mpm(apr_pool_t *p, ap_scoreboard_e sb_type)
{
/*
* This hook gets run periodically by a maintenance function inside
- * the MPM. Its exact purpose is unknown and undocumented at this time.
- *
- * This is a RUN_ALL hook.
+ * the MPM. Its exact purpose is unknown and undocumented at this time.
+ *
+ * This is a RUN_ALL hook.
*/
static int x_monitor(apr_pool_t *p, server_rec *s)
{
ap_hook_get_mgmt_items(x_get_mgmt_items, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_create_request(x_create_request, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_pre_mpm(x_pre_mpm, NULL, NULL, APR_HOOK_MIDDLE);
- ap_hook_monitor(x_monitor, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_monitor(x_monitor, NULL, NULL, APR_HOOK_MIDDLE);
}
/*--------------------------------------------------------------------------*/
* limitations under the License.
*/
-/*
- * mod_example_ipc -- Apache sample module
- *
+/*
+ * mod_example_ipc -- Apache sample module
+ *
* This module illustrates the use in an Apache 2.x module of the Interprocess
- * Communications routines that come with APR. It is example code, and not meant
- * to be used in a production server.
+ * Communications routines that come with APR. It is example code, and not meant
+ * to be used in a production server.
*
* To play with this sample module first compile it into a DSO file and install
* it into Apache's modules directory by running:
* The module allocates a counter in shared memory, which is incremented by the
* request handler under a mutex. After installation, activate the handler by
* hitting the URL configured above with ab at various concurrency levels to see
- * how mutex contention affects server performance.
- */
+ * how mutex contention affects server performance.
+ */
#include "apr.h"
#include "apr_strings.h"
/* Data structure for shared memory block */
typedef struct exipc_data {
- apr_uint64_t counter;
+ apr_uint64_t counter;
/* More fields if necessary */
} exipc_data;
-/*
- * Clean up the shared memory block. This function is registered as
+/*
+ * Clean up the shared memory block. This function is registered as
* cleanup function for the configuration pool, which gets called
- * on restarts. It assures that the new children will not talk to a stale
- * shared memory segment.
+ * on restarts. It assures that the new children will not talk to a stale
+ * shared memory segment.
*/
static apr_status_t shm_cleanup_wrapper(void *unused) {
if (exipc_shm)
* adjust the mutex settings using the Mutex directive.
*/
-static int exipc_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
+static int exipc_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_t *ptemp)
{
ap_mutex_register(pconf, exipc_mutex_type, NULL, APR_LOCK_DEFAULT, 0);
return OK;
}
-/*
+/*
* This routine is called in the parent, so we'll set up the shared
- * memory segment and mutex here.
+ * memory segment and mutex here.
*/
-static int exipc_post_config(apr_pool_t *pconf, apr_pool_t *plog,
+static int exipc_post_config(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s)
{
apr_status_t rs;
exipc_data *base;
- const char *tempdir;
+ const char *tempdir;
- /*
+ /*
* Do nothing if we are not creating the final configuration.
* The parent process gets initialized a couple of times as the
* server starts up, and we don't want to create any more mutexes
- * and shared memory segments than we're actually going to use.
- */
+ * and shared memory segments than we're actually going to use.
+ */
if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG)
return OK;
- /*
+ /*
* The shared memory allocation routines take a file name.
* Depending on system-specific implementation of these
* routines, that file may or may not actually be created. We'd
*/
rs = apr_temp_dir_get(&tempdir, pconf);
if (APR_SUCCESS != rs) {
- ap_log_error(APLOG_MARK, APLOG_ERR, rs, s,
+ ap_log_error(APLOG_MARK, APLOG_ERR, rs, s,
"Failed to find temporary directory");
return HTTP_INTERNAL_SERVER_ERROR;
}
/* Create the shared memory segment */
- /*
- * Create a unique filename using our pid. This information is
+ /*
+ * Create a unique filename using our pid. This information is
* stashed in the global variable so the children inherit it.
*/
- shmfilename = apr_psprintf(pconf, "%s/httpd_shm.%ld", tempdir,
+ shmfilename = apr_psprintf(pconf, "%s/httpd_shm.%ld", tempdir,
(long int)getpid());
/* Now create that segment */
- rs = apr_shm_create(&exipc_shm, sizeof(exipc_data),
+ rs = apr_shm_create(&exipc_shm, sizeof(exipc_data),
(const char *) shmfilename, pconf);
if (APR_SUCCESS != rs) {
- ap_log_error(APLOG_MARK, APLOG_ERR, rs, s,
- "Failed to create shared memory segment on file %s",
+ ap_log_error(APLOG_MARK, APLOG_ERR, rs, s,
+ "Failed to create shared memory segment on file %s",
shmfilename);
return HTTP_INTERNAL_SERVER_ERROR;
}
return HTTP_INTERNAL_SERVER_ERROR;
}
- /*
+ /*
* Destroy the shm segment when the configuration pool gets destroyed. This
* happens on server restarts. The parent will then (above) allocate a new
- * shm segment that the new children will bind to.
+ * shm segment that the new children will bind to.
*/
- apr_pool_cleanup_register(pconf, NULL, shm_cleanup_wrapper,
- apr_pool_cleanup_null);
+ apr_pool_cleanup_register(pconf, NULL, shm_cleanup_wrapper,
+ apr_pool_cleanup_null);
return OK;
}
-/*
+/*
* This routine gets called when a child inits. We use it to attach
* to the shared memory segment, and reinitialize the mutex.
*/
static void exipc_child_init(apr_pool_t *p, server_rec *s)
{
apr_status_t rs;
-
- /*
+
+ /*
* Re-open the mutex for the child. Note we're reusing
- * the mutex pointer global here.
+ * the mutex pointer global here.
*/
- rs = apr_global_mutex_child_init(&exipc_mutex,
+ rs = apr_global_mutex_child_init(&exipc_mutex,
apr_global_mutex_lockfile(exipc_mutex),
p);
if (APR_SUCCESS != rs) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, rs, s,
- "Failed to reopen mutex %s in child",
+ ap_log_error(APLOG_MARK, APLOG_CRIT, rs, s,
+ "Failed to reopen mutex %s in child",
exipc_mutex_type);
/* There's really nothing else we can do here, since This
* routine doesn't return a status. If this ever goes wrong,
* will.
*/
exit(1); /* Ugly, but what else? */
- }
+ }
}
/* The sample content handler */
int camped;
apr_time_t startcamp;
apr_int64_t timecamped;
- apr_status_t rs;
+ apr_status_t rs;
exipc_data *base;
-
+
if (strcmp(r->handler, "example_ipc")) {
return DECLINED;
}
-
- /*
- * The main function of the handler, aside from sending the
- * status page to the client, is to increment the counter in
- * the shared memory segment. This action needs to be mutexed
- * out using the global mutex.
+
+ /*
+ * The main function of the handler, aside from sending the
+ * status page to the client, is to increment the counter in
+ * the shared memory segment. This action needs to be mutexed
+ * out using the global mutex.
*/
-
- /*
+
+ /*
* First, acquire the lock. This code is a lot more involved than
* it usually needs to be, because the process based trylock
* routine is not implemented on unix platforms. I left it in to
* and platforms where trylock works.
*/
for (camped = 0, timecamped = 0; camped < MAXCAMP; camped++) {
- rs = apr_global_mutex_trylock(exipc_mutex);
+ rs = apr_global_mutex_trylock(exipc_mutex);
if (APR_STATUS_IS_EBUSY(rs)) {
apr_sleep(CAMPOUT);
} else if (APR_SUCCESS == rs) {
- gotlock = 1;
+ gotlock = 1;
break; /* Get out of the loop */
} else if (APR_STATUS_IS_ENOTIMPL(rs)) {
/* If it's not implemented, just hang in the mutex. */
break; /* Out of the loop */
} else {
/* Some error, log and bail */
- ap_log_error(APLOG_MARK, APLOG_ERR, rs, r->server,
- "Child %ld failed to acquire lock",
+ ap_log_error(APLOG_MARK, APLOG_ERR, rs, r->server,
+ "Child %ld failed to acquire lock",
(long int)getpid());
break; /* Out of the loop without having the lock */
- }
+ }
} else {
/* Some other error, log and bail */
- ap_log_error(APLOG_MARK, APLOG_ERR, rs, r->server,
- "Child %ld failed to try and acquire lock",
+ ap_log_error(APLOG_MARK, APLOG_ERR, rs, r->server,
+ "Child %ld failed to try and acquire lock",
(long int)getpid());
break; /* Out of the loop without having the lock */
-
+
}
- /*
+ /*
* The only way to get to this point is if the trylock worked
* and returned BUSY. So, bump the time and try again
*/
timecamped += CAMPOUT;
- ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_NOTICE,
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_NOTICE,
0, r->server, "Child %ld camping out on mutex for %" APR_INT64_T_FMT
" microseconds",
(long int) getpid(), timecamped);
} /* Lock acquisition loop */
-
+
/* Sleep for a millisecond to make it a little harder for
- * httpd children to acquire the lock.
+ * httpd children to acquire the lock.
*/
apr_sleep(SLEEPYTIME);
-
- r->content_type = "text/html";
+
+ r->content_type = "text/html";
if (!r->header_only) {
ap_rputs(HTML_HEADER, r);
base = (exipc_data *)apr_shm_baseaddr_get(exipc_shm);
base->counter++;
/* Send a page with our pid and the new value of the counter. */
- ap_rprintf(r, "<p>Lock acquired after %ld microseoncds.</p>\n",
- (long int) timecamped);
+ ap_rprintf(r, "<p>Lock acquired after %ld microseoncds.</p>\n",
+ (long int) timecamped);
ap_rputs("<table border=\"1\">\n", r);
- ap_rprintf(r, "<tr><td>Child pid:</td><td>%d</td></tr>\n",
+ ap_rprintf(r, "<tr><td>Child pid:</td><td>%d</td></tr>\n",
(int) getpid());
- ap_rprintf(r, "<tr><td>Counter:</td><td>%u</td></tr>\n",
+ ap_rprintf(r, "<tr><td>Counter:</td><td>%u</td></tr>\n",
(unsigned int)base->counter);
ap_rputs("</table>\n", r);
} else {
- /*
+ /*
* Send a page saying that we couldn't get the lock. Don't say
* what the counter is, because without the lock the value could
- * race.
+ * race.
*/
ap_rprintf(r, "<p>Child %d failed to acquire lock "
- "after camping out for %d microseconds.</p>\n",
+ "after camping out for %d microseconds.</p>\n",
(int) getpid(), (int) timecamped);
}
- ap_rputs(HTML_FOOTER, r);
+ ap_rputs(HTML_FOOTER, r);
} /* r->header_only */
-
+
/* Release the lock */
if (gotlock)
- rs = apr_global_mutex_unlock(exipc_mutex);
- /* Swallowing the result because what are we going to do with it at
- * this stage?
+ rs = apr_global_mutex_unlock(exipc_mutex);
+ /* Swallowing the result because what are we going to do with it at
+ * this stage?
*/
return OK;
static void exipc_register_hooks(apr_pool_t *p)
{
ap_hook_pre_config(exipc_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
- ap_hook_post_config(exipc_post_config, NULL, NULL, APR_HOOK_MIDDLE);
- ap_hook_child_init(exipc_child_init, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_post_config(exipc_post_config, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_child_init(exipc_child_init, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_handler(exipc_handler, NULL, NULL, APR_HOOK_MIDDLE);
}
/* Dispatch list for API hooks */
AP_DECLARE_MODULE(example_ipc) = {
- STANDARD20_MODULE_STUFF,
+ STANDARD20_MODULE_STUFF,
NULL, /* create per-dir config structures */
NULL, /* merge per-dir config structures */
NULL, /* create per-server config structures */
}
/* store this client IP for the monitor to pick up */
-
+
ap_update_child_status_from_conn(conn->sbh, SERVER_READY, conn);
return DECLINED;
/* pass what we have down the chain */
rv = ap_pass_brigade(f->next, ctx->bb);
if (rv) {
- /* should break out of the loop, since our write to the client
+ /* should break out of the loop, since our write to the client
* failed in some way. */
continue;
}
reqinfo->dc = dc;
output_ctx->dc = dc;
- output_ctx->tmpbb = apr_brigade_create(r->pool,
+ output_ctx->tmpbb = apr_brigade_create(r->pool,
r->connection->bucket_alloc);
ap_set_module_config(r->request_config, &charset_lite_module, reqinfo);
charset_dir_t *dc = ap_get_module_config(r->per_dir_config,
&charset_lite_module);
- if (dc && (dc->implicit_add == IA_NOIMPADD)) {
+ if (dc && (dc->implicit_add == IA_NOIMPADD)) {
ap_log_rerror(APLOG_MARK, APLOG_TRACE6, 0, r,
"xlate output filter not added implicitly because "
"CharsetOptions included 'NoImplicitAdd'");
*/
strcmp(mime_type, DIR_MAGIC_TYPE) == 0 ||
#endif
- strncasecmp(mime_type, "message/", 8) == 0 ||
+ strncasecmp(mime_type, "message/", 8) == 0 ||
dc->force_xlate == FX_FORCE)) {
rv = apr_xlate_open(&ctx->xlate,
/* pass what we have down the chain */
rv = ap_pass_brigade(f->next, ctx->bb);
if (rv) {
- /* should break out of the loop, since our write to the client
+ /* should break out of the loop, since our write to the client
* failed in some way. */
continue;
}
apr_table_setn(r->headers_out, "ETag", newtag);
}
- }
+ }
}
static apr_status_t deflate_out_filter(ap_filter_t *f,
break;
case '!': /* Empty the chain */
- /** IG: Add a NULL provider to the beginning so that
- * we can ensure that we'll empty everything before
+ /** IG: Add a NULL provider to the beginning so that
+ * we can ensure that we'll empty everything before
* this when doing config merges later */
p = apr_pcalloc(cmd->pool, sizeof(mod_filter_chain));
p->fname = NULL;
* through the chain, and prune out the NULL filters */
for (p = cfg->chain; p; p = p->next) {
- if (p->fname == NULL)
+ if (p->fname == NULL)
cfg->chain = p->next;
}
}
else {
current->value = 0;
- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rr->status, r,
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rr->status, r,
"mod_include: The tested "
"subrequest -A \"%s\" returned an error code.",
current->right->token.value);
*time_left_p = ccfg->timeout_at - apr_time_now();
if (*time_left_p <= 0)
return APR_TIMEUP;
-
+
if (*time_left_p < apr_time_from_sec(1)) {
*time_left_p = apr_time_from_sec(1);
}
ccfg->new_max_timeout = cfg->header_max_timeout;
ccfg->min_rate = cfg->header_min_rate;
ccfg->rate_factor = cfg->header_rate_factor;
-
+
ccfg->type = "header";
return OK;
else {
return "Unknown RequestReadTimeout parameter";
}
-
+
if ((rate_str = ap_strcasestr(val, ",minrate="))) {
initial_str = apr_pstrndup(p, val, rate_str - val);
rate_str += strlen(",minrate=");
if (ret)
return ret;
}
-
+
ret = parse_int(p, initial_str, &initial);
}
else {
return "Must set MinRate option if using timeout range";
ret = parse_int(p, val, &initial);
}
-
+
if (ret)
return ret;
reqtimeout_srv_cfg *conf =
ap_get_module_config(cmd->server->module_config,
&reqtimeout_module);
-
+
while (*arg) {
char *word, *val;
const char *err;
-
+
word = ap_getword_conf(cmd->temp_pool, &arg);
val = strchr(word, '=');
if (!val) {
*val++ = '\0';
err = set_reqtimeout_param(conf, cmd->pool, word, val);
-
+
if (err)
return apr_psprintf(cmd->temp_pool, "RequestReadTimeout: %s=%s: %s",
word, val, err);
}
-
+
return NULL;
-
+
}
static void reqtimeout_hooks(apr_pool_t *pool)
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0.
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied.
+ * http://www.apache.org/licenses/LICENSE-2.0.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied.
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
#include "httpd.h"
static const char *sed_add_expr(cmd_parms *cmd, void *cfg, const char *arg)
{
int offset = (int) (long) cmd->info;
- sed_expr_config *sed_cfg =
+ sed_expr_config *sed_cfg =
(sed_expr_config *) (((char *) cfg) + offset);
if (compile_sed_expr(sed_cfg, cmd, arg) != APR_SUCCESS) {
return apr_psprintf(cmd->temp_pool,
subst_pattern_t *script;
APR_BRIGADE_INSERT_TAIL(mybb, inb);
-
+
script = (subst_pattern_t *) cfg->patterns->elts;
apr_pool_create(&tpool, tmp_pool);
scratch = NULL;
apr_status_t rv;
substitute_module_ctx *ctx = f->ctx;
-
+
/*
* First time around? Create the saved bb that we used for each pass
* through. Note that we can also get here when we explicitly clear ctx,
if (is_pattern) {
nscript->patlen = strlen(from);
- nscript->pattern = apr_strmatch_precompile(cmd->pool, from,
+ nscript->pattern = apr_strmatch_precompile(cmd->pool, from,
!ignore_case);
}
else {
* Copyright (c) 2005, 2008 Sun Microsystems, Inc. All Rights Reserved.
* Use is subject to license terms.
*
- * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
- * All Rights Reserved
+ * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
+ * All Rights Reserved
*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0.
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied.
+ * http://www.apache.org/licenses/LICENSE-2.0.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied.
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
/* Code moved from regexp.h */
* Use is subject to license terms.
*
* Copyright (c) 1984 AT&T
- * All Rights Reserved
+ * All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0.
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied.
+ * http://www.apache.org/licenses/LICENSE-2.0.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied.
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
#include "apr.h"
return APR_SUCCESS;
}
-
+
/*
* sed_destroy_commands
*/
command_errf(commands, SEDERR_NRMES);
return -1;
}
- } else
+ } else
op = commands->rep->re1;
commands->rep->rhs = p;
* Use is subject to license terms.
*
* Copyright (c) 1984 AT&T
- * All Rights Reserved
+ * All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0.
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied.
+ * http://www.apache.org/licenses/LICENSE-2.0.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied.
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
#include "apr.h"
eval->lreadyflag = 1;
break;
}
-
+
appendmem_to_linebuf(eval, buf, llen + 1);
--eval->lspend;
/* replace new line character with NULL */
copy_to_holdbuf(eval, eval->genbuf);
break;
- case YCOM:
+ case YCOM:
p1 = eval->linebuf;
p2 = ipc->re1;
while((*p1 = p2[(unsigned char)*p1]) != 0) p1++;
"{Ascending,Descending} {Name,Size,Description,Date}"),
AP_INIT_ITERATE("IndexIgnore", add_ignore, NULL, DIR_CMD_PERMS,
"one or more file extensions"),
- AP_INIT_FLAG("IndexIgnoreReset", ap_set_flag_slot,
- (void *)APR_OFFSETOF(autoindex_config_rec, ign_noinherit),
+ AP_INIT_FLAG("IndexIgnoreReset", ap_set_flag_slot,
+ (void *)APR_OFFSETOF(autoindex_config_rec, ign_noinherit),
DIR_CMD_PERMS,
"Reset the inherited list of IndexIgnore filenames"),
AP_INIT_ITERATE2("AddDescription", add_desc, BY_PATH, DIR_CMD_PERMS,
if (emit_amble) {
emit_preamble(r, emit_xhtml, title);
}
-
+
d = (autoindex_config_rec *) ap_get_module_config(r->per_dir_config, &autoindex_module);
-
+
if (emit_H1) {
if (d->style_sheet != NULL) {
/* Insert style id if stylesheet used */
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"Cannot serve directory %s: No matching DirectoryIndex (%s) found, and "
"server-generated directory index forbidden by "
- "Options directive",
+ "Options directive",
r->filename,
index_names ? index_names : "none");
return HTTP_FORBIDDEN;
#include "mod_core.h"
#include "mod_cgi.h"
-#if APR_HAVE_STRUCT_RLIMIT
+#if APR_HAVE_STRUCT_RLIMIT
#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
#define AP_CGI_USE_RLIMIT
#endif
#include <sys/stat.h>
#include <sys/un.h> /* for sockaddr_un */
-#if APR_HAVE_STRUCT_RLIMIT
+#if APR_HAVE_STRUCT_RLIMIT
#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
#define AP_CGID_USE_RLIMIT
#endif
} cgid_server_conf;
#ifdef AP_CGID_USE_RLIMIT
-typedef struct {
+typedef struct {
#ifdef RLIMIT_CPU
int limit_cpu_set;
struct rlimit limit_cpu;
ap_escape_html(r->pool,
ws_record->vhost),
ap_escape_html(r->pool,
- ap_escape_logitem(r->pool,
+ ap_escape_logitem(r->pool,
ws_record->request)));
} /* no_table_report */
} /* for (j...) */
if (r->assbackwards) {
return 0;
}
-
+
/*
* Check for Range request-header (HTTP/1.1) or Request-Range for
* backwards-compatibility with second-draft Luotonen/Franks
* Request-Range based requests to work around a bug in Netscape
* Navigator 2-3 and MSIE 3.
*/
-
+
if (!(range = apr_table_get(r->headers_in, "Range"))) {
range = apr_table_get(r->headers_in, "Request-Range");
}
-
+
if (!range || strncasecmp(range, "bytes=", 6) || r->status != HTTP_OK) {
return 0;
}
-
+
/* is content already a single range? */
if (apr_table_get(r->headers_out, "Content-Range")) {
return 0;
}
-
+
/* is content already a multiple range? */
if ((ct = apr_table_get(r->headers_out, "Content-Type"))
&& (!strncasecmp(ct, "multipart/byteranges", 20)
|| !strncasecmp(ct, "multipart/x-byteranges", 22))) {
return 0;
}
-
+
/*
* Check the If-Range header for Etag or Date.
* Note that this check will return false (as required) if either
return 0;
}
}
-
+
range += 6;
it = range;
while (*it) {
char *dash;
char *errp;
apr_off_t number, start, end;
-
+
if (!*cur)
break;
-
+
/*
* Per RFC 2616 14.35.1: If there is at least one syntactically invalid
* byte-range-spec, we must ignore the whole header.
*/
-
+
if (!(dash = strchr(cur, '-'))) {
return 0;
}
-
+
if (dash == cur) {
/* In the form "-5" */
if (apr_strtoff(&number, dash+1, &errp, 10) || *errp) {
end = clength - 1;
}
}
-
+
if (start < 0) {
start = 0;
}
if (end >= clength) {
end = clength - 1;
}
-
+
if (!in_merge) {
/* new set */
ostart = start;
continue;
}
in_merge = 0;
-
+
if (start >= ostart && end <= oend) {
in_merge = 1;
}
-
+
if (start < ostart && end >= ostart-1) {
ostart = start;
++*reversals;
oend = end;
in_merge = 1;
}
-
+
if (in_merge) {
++*overlaps;
continue;
num_ranges++;
}
}
-
+
if (in_merge) {
idx = (indexes_t *)apr_array_push(*indexes);
idx->start = ostart;
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"Range: %s | %s (%d : %d : %"APR_OFF_T_FMT")",
it, r->range, *overlaps, *reversals, clength);
-
+
return num_ranges;
}
static const char *http_scheme(const request_rec *r)
{
- /*
- * The http module shouldn't return anything other than
+ /*
+ * The http module shouldn't return anything other than
* "http" (the default) or "https".
*/
if (r->server->server_scheme &&
(strcmp(r->server->server_scheme, "https") == 0))
return "https";
-
+
return "http";
}
if (r->server->server_scheme &&
(strcmp(r->server->server_scheme, "https") == 0))
return DEFAULT_HTTPS_PORT;
-
+
return DEFAULT_HTTP_PORT;
}
r = NULL;
}
- if (cs->state != CONN_STATE_WRITE_COMPLETION &&
+ if (cs->state != CONN_STATE_WRITE_COMPLETION &&
cs->state != CONN_STATE_SUSPENDED) {
/* Something went wrong; close the connection */
cs->state = CONN_STATE_LINGER;
/* Detect chunksize error (such as overflow) */
if (rv != APR_SUCCESS || ctx->remaining < 0) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r, "Error reading first chunk %s ",
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r, "Error reading first chunk %s ",
(ctx->remaining < 0) ? "(overflow)" : "");
ctx->remaining = 0; /* Reset it in case we have to
* come back here later */
- if (APR_STATUS_IS_TIMEUP(rv)) {
+ if (APR_STATUS_IS_TIMEUP(rv)) {
http_error = HTTP_REQUEST_TIME_OUT;
}
return bail_out_on_error(ctx, f, http_error);
/* Detect chunksize error (such as overflow) */
if (rv != APR_SUCCESS || ctx->remaining < 0) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r, "Error reading chunk %s ",
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r, "Error reading chunk %s ",
(ctx->remaining < 0) ? "(overflow)" : "");
ctx->remaining = 0; /* Reset it in case we have to
* come back here later */
- if (APR_STATUS_IS_TIMEUP(rv)) {
+ if (APR_STATUS_IS_TIMEUP(rv)) {
http_error = HTTP_REQUEST_TIME_OUT;
}
return bail_out_on_error(ctx, f, http_error);
if (ap_mpm_query(AP_MPMQ_MPM_STATE, &mpm_state)) {
return 0;
}
-
+
if (mpm_state == AP_MPMQ_STOPPING) {
return 0;
}
bb = apr_brigade_create(r->connection->pool, r->connection->bucket_alloc);
b = ap_bucket_eor_create(r->connection->bucket_alloc, r);
APR_BRIGADE_INSERT_HEAD(bb, b);
-
+
ap_pass_brigade(r->connection->output_filters, bb);
-
+
/* From here onward, it is no longer safe to reference r
* or r->pool, because r->pool may have been destroyed
* already by the EOR bucket's cleanup function.
*/
-
+
c->cs->state = CONN_STATE_WRITE_COMPLETION;
check_pipeline(c);
AP_PROCESS_REQUEST_RETURN((uintptr_t)r, r->uri, r->status);
/* Default define for ldap functions that need a SIZELIMIT but
* do not have the define
- * XXX This should be removed once a supporting #define is
+ * XXX This should be removed once a supporting #define is
* released through APR-Util.
*/
#ifndef APR_LDAP_SIZELIMIT
#endif
#endif
-#define AP_LDAP_HOPLIMIT_UNSET -1
+#define AP_LDAP_HOPLIMIT_UNSET -1
#define AP_LDAP_CHASEREFERRALS_OFF 0
#define AP_LDAP_CHASEREFERRALS_ON 1
* but always check/fix the binddn/bindpw when we take them out
* of the pool
*/
- if (!ldc->keep) {
+ if (!ldc->keep) {
uldap_connection_unbind(ldc);
}
- else {
+ else {
/* mark our connection as available for reuse */
ldc->freed = apr_time_now();
#if APR_HAS_THREADS
*
* The caller should hold the lock for this connection
*/
-static apr_status_t util_ldap_connection_remove (void *param) {
+static apr_status_t util_ldap_connection_remove (void *param) {
util_ldap_connection_t *ldc = param, *l = NULL, *prev = NULL;
util_ldap_state_t *st;
for (l=st->connections; l; l=l->next) {
if (l == ldc) {
if (prev) {
- prev->next = l->next;
+ prev->next = l->next;
}
- else {
+ else {
st->connections = l->next;
}
break;
/* Destory the pool associated with this connection */
- apr_pool_destroy(ldc->pool);
-
+ apr_pool_destroy(ldc->pool);
+
return APR_SUCCESS;
}
#endif
int version = LDAP_VERSION3;
apr_ldap_err_t *result = NULL;
#ifdef LDAP_OPT_NETWORK_TIMEOUT
- struct timeval connectionTimeout = {0};
+ struct timeval connectionTimeout = {0};
#endif
util_ldap_state_t *st =
(util_ldap_state_t *)ap_get_module_config(r->server->module_config,
ldap_option = ldc->deref;
ldap_set_option(ldc->ldap, LDAP_OPT_DEREF, &ldap_option);
- if (ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) {
+ if (ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) {
/* Set options for rebind and referrals. */
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"LDAP: Setting referrals to %s.",
return(rc);
}
-static int uldap_ld_errno(util_ldap_connection_t *ldc)
-{
+static int uldap_ld_errno(util_ldap_connection_t *ldc)
+{
int ldaprc;
#ifdef LDAP_OPT_ERROR_NUMBER
if (LDAP_SUCCESS == ldap_get_option(ldc->ldap, LDAP_OPT_ERROR_NUMBER, &ldaprc)) return ldaprc;
/*
* Replacement function for ldap_simple_bind_s() with a timeout.
- * To do this in a portable way, we have to use ldap_simple_bind() and
+ * To do this in a portable way, we have to use ldap_simple_bind() and
* ldap_result().
*
* Returns LDAP_SUCCESS on success; and an error code on failure
*/
while (failures <= st->retries) {
- if (failures > 0 && st->retry_delay > 0) {
+ if (failures > 0 && st->retry_delay > 0) {
apr_sleep(st->retry_delay);
}
rc = uldap_simple_bind(ldc, (char *)ldc->binddn, (char *)ldc->bindpw,
failures++;
- if (AP_LDAP_IS_SERVER_DOWN(rc)) {
+ if (AP_LDAP_IS_SERVER_DOWN(rc)) {
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
"ldap_simple_bind() failed with server down "
"(try %d)", failures);
else if (rc == LDAP_TIMEOUT) {
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
"ldap_simple_bind() timed out on %s "
- "connection, dropped by firewall?",
+ "connection, dropped by firewall?",
new_connection ? "new" : "reused");
}
- else {
+ else {
/* Other errors not retryable */
break;
}
if (!(failures % 2)) {
- ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
+ ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
"attempt to re-init the connection");
uldap_connection_unbind(ldc);
- if (LDAP_SUCCESS != uldap_connection_init(r, ldc)) {
+ if (LDAP_SUCCESS != uldap_connection_init(r, ldc)) {
/* leave rc as the initial bind return code */
break;
}
}
- }
+ }
/* free the handle if there was an error
*/
&& (l->deref == deref) && (l->secure == secureflag)
&& !compare_client_certs(dc->client_certs, l->client_certs))
{
- if (st->connection_pool_ttl > 0) {
- if (l->bound && (now - l->freed) > st->connection_pool_ttl) {
- ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
- "Removing LDAP connection last used %" APR_TIME_T_FMT " seconds ago",
+ if (st->connection_pool_ttl > 0) {
+ if (l->bound && (now - l->freed) > st->connection_pool_ttl) {
+ ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
+ "Removing LDAP connection last used %" APR_TIME_T_FMT " seconds ago",
(now - l->freed) / APR_USEC_PER_SEC);
uldap_connection_unbind(l);
/* Go ahead (by falling through) and use it, so we don't create more just to unbind some other old ones */
/* the bind credentials have changed */
/* no check for connection_pool_ttl, since we are unbinding any way */
uldap_connection_unbind(l);
-
+
util_ldap_strdup((char**)&(l->binddn), binddn);
util_ldap_strdup((char**)&(l->bindpw), bindpw);
break;
#endif
return NULL;
}
-
+
/*
* Add the new connection entry to the linked list. Note that we
* don't actually establish an LDAP connection yet; that happens
/* whether or not to keep this connection in the pool when it's returned */
l->keep = (st->connection_pool_ttl == 0) ? 0 : 1;
- if (l->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) {
+ if (l->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) {
if (apr_pool_create(&(l->rebind_pool), l->pool) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r,
"util_ldap: Failed to create memory pool");
(char *)dn,
(char *)attrib,
(char *)value);
- if (AP_LDAP_IS_SERVER_DOWN(result)) {
+ if (AP_LDAP_IS_SERVER_DOWN(result)) {
/* connection failed - try again */
ldc->reason = "ldap_compare_s() failed with server down";
uldap_connection_unbind(ldc);
static const char *util_ldap_set_debug_level(cmd_parms *cmd,
void *config,
- const char *arg) {
+ const char *arg) {
#ifdef AP_LDAP_OPT_DEBUG
util_ldap_state_t *st =
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
st->debug_level = atoi(arg);
return NULL;
#endif
-}
+}
static const char *util_ldap_set_referral_hop_limit(cmd_parms *cmd,
void *config,
dc->ReferralHopLimit = atol(hop_limit);
- if (dc->ReferralHopLimit <= 0) {
+ if (dc->ReferralHopLimit <= 0) {
return "LDAPReferralHopLimit must be greater than zero (Use 'LDAPReferrals Off' to disable referral chasing)";
}
(util_ldap_state_t *)ap_get_module_config(cmd->server->module_config,
&ldap_module);
- if (ap_timeout_parameter_parse(val, &timeout, "s") != APR_SUCCESS) {
+ if (ap_timeout_parameter_parse(val, &timeout, "s") != APR_SUCCESS) {
return "LDAPConnPoolTTL has wrong format";
}
- if (timeout < 0) {
+ if (timeout < 0) {
/* reserve -1 for default value */
timeout = AP_LDAP_CONNPOOL_INFINITE;
}
return err;
}
- if (ap_timeout_parameter_parse(val, &timeout, "s") != APR_SUCCESS) {
+ if (ap_timeout_parameter_parse(val, &timeout, "s") != APR_SUCCESS) {
return "LDAPRetryDelay has wrong format";
}
- if (timeout < 0) {
+ if (timeout < 0) {
return "LDAPRetryDelay must be >= 0";
}
}
st->retries = atoi(val);
- if (st->retries < 0) {
+ if (st->retries < 0) {
return "LDAPRetries must be >= 0";
}
- return NULL;
+ return NULL;
}
static void *util_ldap_create_config(apr_pool_t *p, server_rec *s)
util_ldap_state_t *st =
(util_ldap_state_t *)apr_pcalloc(p, sizeof(util_ldap_state_t));
- /* Create a per vhost pool for mod_ldap to use, serialized with
+ /* Create a per vhost pool for mod_ldap to use, serialized with
* st->mutex (also one per vhost). both are replicated by fork(),
* no shared memory managed by either.
*/
st->mutex = overrides->mutex;
#endif
- /* The cache settings can not be modified in a
+ /* The cache settings can not be modified in a
virtual host since all server use the same
shared memory cache. */
st->cache_bytes = base->cache_bytes;
st->search_cache_size = base->search_cache_size;
st->compare_cache_ttl = base->compare_cache_ttl;
st->compare_cache_size = base->compare_cache_size;
- st->util_ldap_cache_lock = base->util_ldap_cache_lock;
+ st->util_ldap_cache_lock = base->util_ldap_cache_lock;
st->connections = NULL;
st->ssl_supported = 0; /* not known until post-config and re-merged */
st->secure = (overrides->secure_set == 0) ? base->secure
: overrides->secure;
- /* These LDAP connection settings can not be overwritten in
- a virtual host. Once set in the base server, they must
+ /* These LDAP connection settings can not be overwritten in
+ a virtual host. Once set in the base server, they must
remain the same. None of the LDAP SDKs seem to be able
- to handle setting the verify_svr_cert flag on a
+ to handle setting the verify_svr_cert flag on a
per-connection basis. The OpenLDAP client appears to be
able to handle the connection timeout per-connection
but the Novell SDK cannot. Allowing the timeout to
be set by each vhost is of little value so rather than
- trying to make special expections for one LDAP SDK, GLOBAL_ONLY
+ trying to make special expections for one LDAP SDK, GLOBAL_ONLY
is being enforced on this setting as well. */
st->connectionTimeout = base->connectionTimeout;
st->opTimeout = base->opTimeout;
st->verify_svr_cert = base->verify_svr_cert;
st->debug_level = base->debug_level;
- st->connection_pool_ttl = (overrides->connection_pool_ttl == AP_LDAP_CONNPOOL_DEFAULT) ?
+ st->connection_pool_ttl = (overrides->connection_pool_ttl == AP_LDAP_CONNPOOL_DEFAULT) ?
base->connection_pool_ttl : overrides->connection_pool_ttl;
st->retries = base->retries;
apr_ldap_rebind_init (p);
#ifdef AP_LDAP_OPT_DEBUG
- if (st->debug_level > 0) {
+ if (st->debug_level > 0) {
result = ldap_set_option(NULL, AP_LDAP_OPT_DEBUG, &st->debug_level);
if (result != LDAP_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
- "LDAP: Could not set the LDAP library debug level to %d:(%d) %s",
+ "LDAP: Could not set the LDAP library debug level to %d:(%d) %s",
st->debug_level, result, ldap_err2string(result));
}
}
AP_INIT_TAKE1("LDAPCacheEntries", util_ldap_set_cache_entries,
NULL, RSRC_CONF,
"Set the maximum number of entries that are possible in the "
- "LDAP search cache. Use 0 or -1 to disable the search cache "
+ "LDAP search cache. Use 0 or -1 to disable the search cache "
"(default: 1024)"),
-
+
AP_INIT_TAKE1("LDAPCacheTTL", util_ldap_set_cache_ttl,
NULL, RSRC_CONF,
"Set the maximum time (in seconds) that an item can be "
AP_INIT_TAKE1("LDAPOpCacheEntries", util_ldap_set_opcache_entries,
NULL, RSRC_CONF,
"Set the maximum number of entries that are possible "
- "in the LDAP compare cache. Use 0 or -1 to disable the compare cache "
+ "in the LDAP compare cache. Use 0 or -1 to disable the compare cache "
"(default: 1024)"),
AP_INIT_TAKE1("LDAPOpCacheTTL", util_ldap_set_opcache_ttl,
else if (cls->condition_expr != NULL) {
const char *err;
int rc = ap_expr_exec(r, cls->condition_expr, &err);
- if (rc < 0)
+ if (rc < 0)
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
"Error evaluating log condition: %s", err);
if (rc <= 0)
if (!(id = apr_table_get(r->subprocess_env, "UNIQUE_ID"))) {
/* we make the assumption that we can't go through all the PIDs in
under 1 second */
- id = apr_psprintf(r->pool, "%" APR_PID_T_FMT ":%lx:%x", getpid(),
+ id = apr_psprintf(r->pool, "%" APR_PID_T_FMT ":%lx:%x", getpid(),
time(NULL), apr_atomic_inc32(&next_id));
}
ap_set_module_config(r->request_config, &log_forensic_module, (char *)id);
"request_rec->dispatching %s -> apr table",
name);
rs = (*func)(r);
- ap_lua_push_apr_table(L, rs);
+ ap_lua_push_apr_table(L, rs);
return 1;
}
makefun(&req_notes, APL_REQ_FUNTYPE_TABLE, p));
apr_hash_set(dispatch, "subprocess_env", APR_HASH_KEY_STRING,
makefun(&req_subprocess_env, APL_REQ_FUNTYPE_TABLE, p));
-
+
lua_pushlightuserdata(L, dispatch);
lua_setfield(L, LUA_REGISTRYINDEX, "Apache2.Request.dispatch");
const char *sub_pat,
const char *rep_pat,
apr_pool_t *pool,
- apr_array_header_t *paths,
+ apr_array_header_t *paths,
const char *file)
{
const char *current;
static apr_status_t vm_construct(void **vm, void *params, apr_pool_t *lifecycle_pool)
{
lua_State* L;
-
+
ap_lua_vm_spec *spec = params;
L = luaL_newstate();
if (rc != 0) {
char *err;
switch (rc) {
- case LUA_ERRSYNTAX:
- err = "syntax error";
+ case LUA_ERRSYNTAX:
+ err = "syntax error";
break;
- case LUA_ERRMEM:
- err = "memory allocation error";
+ case LUA_ERRMEM:
+ err = "memory allocation error";
break;
- case LUA_ERRFILE:
- err = "error opening or reading file";
+ case LUA_ERRFILE:
+ err = "error opening or reading file";
break;
default:
- err = "unknown error";
+ err = "unknown error";
break;
}
ap_log_perror(APLOG_MARK, APLOG_ERR, 0, lifecycle_pool,
static apr_status_t vm_destruct(void *vm, void *params, apr_pool_t *pool)
{
- lua_State *L = (lua_State *)vm;
+ lua_State *L = (lua_State *)vm;
(void)params;
(void)pool;
if (apr_pool_userdata_get((void **)&reslist,
"mod_lua", spec->pool) == APR_SUCCESS) {
if(reslist==NULL) {
- if(apr_reslist_create(&reslist,
- spec->vm_server_pool_min,
+ if(apr_reslist_create(&reslist,
+ spec->vm_server_pool_min,
spec->vm_server_pool_max,
spec->vm_server_pool_max,
0,
module AP_MODULE_DECLARE_DATA lua_module;
/**
- * error reporting if lua has an error.
+ * error reporting if lua has an error.
* Extracts the error from lua stack and prints
*/
static void report_lua_error(lua_State *L, request_rec *r)
apr_status_t rs;
for ( b = APR_BRIGADE_FIRST(bb);
b != APR_BRIGADE_SENTINEL(bb);
- b = APR_BUCKET_NEXT(b))
+ b = APR_BUCKET_NEXT(b))
{
if (APR_BUCKET_IS_EOS(b)) {kl
break;
char *mine = apr_pstrmemdup(f->r->pool, buffer, bytes);
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, f->r, "sending '%s'", mine);
}
-
+
ap_pass_brigade(f->next, bb);
-
+
return OK;
}
*/
/**
- * Like mod_alias except for lua handler fun :-)
+ * Like mod_alias except for lua handler fun :-)
*/
static int lua_alias_munger(request_rec *r)
{
/* Okay, this deserves a little explaination -- in order for the errors that lua
* generates to be 'accuarate', including line numbers, we basically inject
- * N line number new lines into the 'top' of the chunk reader.....
+ * N line number new lines into the 'top' of the chunk reader.....
*
* be happy. this is cool.
*
/**
* Called for config directive which looks like
- * LuaCodeCache
+ * LuaCodeCache
*/
static const char *register_code_cache(cmd_parms *cmd, void *_cfg,
const char *arg)
dir_config_rec *d = d_;
int status;
- if (!strcasecmp(arg1, "ON"))
+ if (!strcasecmp(arg1, "ON"))
status = HTTP_MOVED_TEMPORARILY;
- else if (!strcasecmp(arg1, "OFF"))
+ else if (!strcasecmp(arg1, "OFF"))
status = REDIRECT_OFF;
else if (!strcasecmp(arg1, "permanent"))
status = HTTP_MOVED_PERMANENTLY;
status = HTTP_MOVED_TEMPORARILY;
else if (!strcasecmp(arg1, "seeother"))
status = HTTP_SEE_OTHER;
- else if (apr_isdigit(*arg1)) {
+ else if (apr_isdigit(*arg1)) {
status = atoi(arg1);
- if (!ap_is_HTTP_REDIRECT(status)) {
+ if (!ap_is_HTTP_REDIRECT(status)) {
return "DirectoryIndexRedirect only accepts values between 300 and 399";
}
}
- else {
+ else {
return "DirectoryIndexRedirect ON|OFF|permanent|temp|seeother|3xx";
}
"a list of file names"),
AP_INIT_FLAG("DirectorySlash", configure_slash, NULL, DIR_CMD_PERMS,
"On or Off"),
- AP_INIT_TAKE1("DirectoryIndexRedirect", configure_redirect,
+ AP_INIT_TAKE1("DirectoryIndexRedirect", configure_redirect,
NULL, DIR_CMD_PERMS, "On, Off, or a 3xx status code."),
{NULL}
if (rr->status == HTTP_OK
&& ( (rr->handler && !strcmp(rr->handler, "proxy-server"))
|| rr->finfo.filetype == APR_REG)) {
-
- if (ap_is_HTTP_REDIRECT(d->redirect_index)) {
+
+ if (ap_is_HTTP_REDIRECT(d->redirect_index)) {
apr_table_setn(r->headers_out, "Location", ap_construct_url(r->pool, rr->uri, r));
return d->redirect_index;
}
}
/* record what we tried, mostly for the benefit of mod_autoindex */
- apr_table_set(r->notes, "dir-index-names",
- d->index_names ?
- apr_array_pstrcat(r->pool, d->index_names, ','):
+ apr_table_set(r->notes, "dir-index-names",
+ d->index_names ?
+ apr_array_pstrcat(r->pool, d->index_names, ','):
AP_DEFAULT_INDEX);
/* nothing for us to do, pass on through */
{
ap_set_content_type(r, "text/html; charset=ISO-8859-1");
- ap_rvputs(r, DOCTYPE_HTML_3_2, "<html><head>\n<title>Menu for ",
+ ap_rvputs(r, DOCTYPE_HTML_3_2, "<html><head>\n<title>Menu for ",
ap_escape_html(r->pool, r->uri),
"</title>\n</head><body>\n", NULL);
if (!strcasecmp(menu, "formatted")) {
- ap_rvputs(r, "<h1>Menu for ",
+ ap_rvputs(r, "<h1>Menu for ",
ap_escape_html(r->pool, r->uri),
"</h1>\n<hr />\n\n", NULL);
}
rewritelog((r, 5, NULL, "cache lookup OK: map=%s[SQL] key=%s, val=%s",
name, key, value));
return *value ? value : NULL;
-
+
/*
* Program file map
*/
current->len = span;
current->string = bri->source + bri->regmatch[n].rm_so;
}
-
+
outlen += span;
}
overrides->rewritemaps);
a->rewriteconds = apr_array_append(p, base->rewriteconds,
overrides->rewriteconds);
- a->rewriterules = apr_array_append(p, base->rewriterules,
+ a->rewriterules = apr_array_append(p, base->rewriterules,
overrides->rewriterules);
}
else {
case 'B':
if (!*key || !strcasecmp(key, "ackrefescaping")) {
cfg->flags |= RULEFLAG_ESCAPEBACKREF;
- }
+ }
else {
++error;
}
break;
case 'd':
case 'D':
- if (!*key || !strcasecmp(key, "PI") || !strcasecmp(key,"iscardpath")) {
+ if (!*key || !strcasecmp(key, "PI") || !strcasecmp(key,"iscardpath")) {
cfg->flags |= (RULEFLAG_DISCARDPATHINFO);
- }
+ }
break;
case 'e':
case 'E':
r->filename = newuri;
if (ctx->perdir && (p->flags & RULEFLAG_DISCARDPATHINFO)) {
- r->path_info = NULL;
+ r->path_info = NULL;
}
splitout_queryargs(r, p->flags & RULEFLAG_QSAPPEND, p->flags & RULEFLAG_QSDISCARD);
* instead. See PR 39746, 46428, and other headaches. */
if (ctx->perdir && (p->flags & RULEFLAG_NOESCAPE) == 0) {
char *old_filename = r->filename;
-
+
r->filename = ap_escape_uri(r->pool, r->filename);
rewritelog((r, 2, ctx->perdir, "escaped URI in per-dir context "
"for proxy, %s -> %s", old_filename, r->filename));
}
-
+
fully_qualify_uri(r);
rewritelog((r, 2, ctx->perdir, "forcing proxy-throughput with %s",
break;
}
- if (p->flags & RULEFLAG_END) {
+ if (p->flags & RULEFLAG_END) {
rewritelog((r, 8, perdir, "Rule has END flag, no further rewriting for this request"));
apr_pool_userdata_set("1", really_last_key, apr_pool_cleanup_null, r->pool);
break;
return DECLINED;
}
- /* END flag was used as a RewriteRule flag on this request */
+ /* END flag was used as a RewriteRule flag on this request */
apr_pool_userdata_get(&skipdata, really_last_key, r->pool);
- if (skipdata != NULL) {
+ if (skipdata != NULL) {
rewritelog((r, 8, NULL, "Declining, no further rewriting due to END flag"));
return DECLINED;
}
}
}
- /* END flag was used as a RewriteRule flag on this request */
+ /* END flag was used as a RewriteRule flag on this request */
apr_pool_userdata_get(&skipdata, really_last_key, r->pool);
- if (skipdata != NULL) {
+ if (skipdata != NULL) {
rewritelog((r, 8, dconf->directory, "Declining, no further rewriting due to END flag"));
return DECLINED;
}
/* append the QUERY_STRING part */
if (r->args) {
char *escaped_args = NULL;
- int noescape = (rulestatus == ACTION_NOESCAPE ||
+ int noescape = (rulestatus == ACTION_NOESCAPE ||
(oargs && !strcmp(r->args, oargs)));
-
+
r->filename = apr_pstrcat(r->pool, r->filename, "?",
- noescape
+ noescape
? r->args
: (escaped_args = ap_escape_uri(r->pool, r->args)),
NULL);
rewritelog((r, 1, dconf->directory, "%s %s to query string for redirect %s",
- noescape ? "copying" : "escaping",
- r->args ,
+ noescape ? "copying" : "escaping",
+ r->args ,
noescape ? "" : escaped_args));
}
(void*)APR_OFFSETOF(spconfig, enabled), OR_OPTIONS,
"whether or not to fix miscapitalized/misspelled requests"),
AP_INIT_FLAG("CheckCaseOnly", ap_set_flag_slot,
- (void*)APR_OFFSETOF(spconfig, case_only), OR_OPTIONS,
+ (void*)APR_OFFSETOF(spconfig, case_only), OR_OPTIONS,
"whether or not to fix only miscapitalized requests"),
{ NULL }
};
{
userdir_config *cfg = apr_pcalloc(p, sizeof(userdir_config));
userdir_config *base = basev, *overrides = overridesv;
-
+
cfg->globally_disabled = (overrides->globally_disabled != O_DEFAULT) ?
overrides->globally_disabled :
base->globally_disabled;
cfg->userdir = (overrides->userdir != DEFAULT_USER_DIR) ?
overrides->userdir : base->userdir;
-
+
/* not merged */
cfg->enabled_users = overrides->enabled_users;
cfg->disabled_users = overrides->disabled_users;
-
+
return cfg;
}
typedef struct {
/** The header to retrieve a proxy-via ip list */
const char *header_name;
- /** A header to record the proxied IP's
- * (removed as the physical connection and
- * from the proxy-via ip header value list)
+ /** A header to record the proxied IP's
+ * (removed as the physical connection and
+ * from the proxy-via ip header value list)
*/
const char *proxies_header_name;
/** A list of trusted proxies, ideally configured
apr_sockaddr_t *temp_sa;
if (s) {
- return apr_pstrcat(cmd->pool, "RemoteIP: Error parsing IP ", arg,
- " the subnet /", s, " is invalid for ",
+ return apr_pstrcat(cmd->pool, "RemoteIP: Error parsing IP ", arg,
+ " the subnet /", s, " is invalid for ",
cmd->cmd->name, NULL);
}
rv = apr_ipsubnet_create(&match->ip, ip, NULL, cmd->pool);
if (!(temp_sa = temp_sa->next))
break;
- match = (remoteip_proxymatch_t *)
+ match = (remoteip_proxymatch_t *)
apr_array_push(config->proxymatch_ip);
match->internal = internal;
}
if (rv != APR_SUCCESS) {
char msgbuf[128];
apr_strerror(rv, msgbuf, sizeof(msgbuf));
- return apr_pstrcat(cmd->pool, "RemoteIP: Error parsing IP ", arg,
+ return apr_pstrcat(cmd->pool, "RemoteIP: Error parsing IP ", arg,
" (", msgbuf, " error) for ", cmd->cmd->name, NULL);
}
rv = ap_pcfg_openfile(&cfp, cmd->temp_pool, filename);
if (rv != APR_SUCCESS) {
return apr_psprintf(cmd->pool, "%s: Could not open file %s: %s",
- cmd->cmd->name, filename,
+ cmd->cmd->name, filename,
apr_strerror(rv, lbuf, sizeof(lbuf)));
}
break;
errmsg = proxies_set(cmd, internal, arg);
if (errmsg) {
- errmsg = apr_psprintf(cmd->pool, "%s at line %d of %s",
+ errmsg = apr_psprintf(cmd->pool, "%s at line %d of %s",
errmsg, cfp->line_number, filename);
return errmsg;
}
*(parse_remote++) = '\0';
}
- while (*parse_remote == ' ')
+ while (*parse_remote == ' ')
++parse_remote;
eos = parse_remote + strlen(parse_remote) - 1;
#ifdef REMOTEIP_OPTIMIZED
/* Decode remote_addr - sucks; apr_sockaddr_vars_set isn't 'public' */
- if (inet_pton(AF_INET, parse_remote,
+ if (inet_pton(AF_INET, parse_remote,
&temp_sa->sa.sin.sin_addr) > 0) {
apr_sockaddr_vars_set(temp_sa, APR_INET, temp_sa.port);
}
#if APR_HAVE_IPV6
- else if (inet_pton(AF_INET6, parse_remote,
+ else if (inet_pton(AF_INET6, parse_remote,
&temp_sa->sa.sin6.sin6_addr) > 0) {
apr_sockaddr_vars_set(temp_sa, APR_INET6, temp_sa.port);
}
rv = apr_get_netos_error();
#else /* !REMOTEIP_OPTIMIZED */
/* We map as IPv4 rather than IPv6 for equivilant host names
- * or IPV4OVERIPV6
+ * or IPV4OVERIPV6
*/
- rv = apr_sockaddr_info_get(&temp_sa, parse_remote,
+ rv = apr_sockaddr_info_get(&temp_sa, parse_remote,
APR_UNSPEC, temp_sa->port,
APR_IPV4_ADDR_OK, r->pool);
if (rv != APR_SUCCESS) {
&& ((temp_sa->family == APR_INET
/* For internet (non-Internal proxies) deny all
* RFC3330 designated local/private subnets:
- * 10.0.0.0/8 169.254.0.0/16 192.168.0.0/16
+ * 10.0.0.0/8 169.254.0.0/16 192.168.0.0/16
* 127.0.0.0/8 172.16.0.0/12
*/
&& (addrbyte[0] == 10
|| (addrbyte[0] == 192 && addrbyte[1] == 168)))
#if APR_HAVE_IPV6
|| (temp_sa->family == APR_INET6
- /* For internet (non-Internal proxies) we translated
+ /* For internet (non-Internal proxies) we translated
* IPv4-over-IPv6-mapped addresses as IPv4, above.
* Accept only Global Unicast 2000::/3 defined by RFC4291
*/
/* Set remote_ip string */
if (!internal) {
if (proxy_ips)
- proxy_ips = apr_pstrcat(r->pool, proxy_ips, ", ",
+ proxy_ips = apr_pstrcat(r->pool, proxy_ips, ", ",
c->remote_ip, NULL);
else
proxy_ips = c->remote_ip;
if (!conn || (c->remote_addr == conn->orig_addr))
return OK;
- /* Fixups here, remote becomes the new Via header value, etc
+ /* Fixups here, remote becomes the new Via header value, etc
* In the heavy operations above we used request scope, to limit
* conn pool memory growth on keepalives, so here we must scope
* the final results to the connection pool lifetime.
if (remote)
remote = apr_pstrdup(c->pool, remote);
conn->proxied_remote = remote;
- conn->prior_remote = apr_pstrdup(c->pool, apr_table_get(r->headers_in,
+ conn->prior_remote = apr_pstrdup(c->pool, apr_table_get(r->headers_in,
config->header_name));
if (proxy_ips)
proxy_ips = apr_pstrdup(c->pool, proxy_ips);
}
ap_log_rerror(APLOG_MARK, APLOG_INFO|APLOG_NOERRNO, 0, r,
- conn->proxy_ips
+ conn->proxy_ips
? "Using %s as client's IP by proxies %s"
: "Using %s as client's IP by internal proxies",
conn->proxied_ip, conn->proxy_ips);
int checked_standby;
int total_factor = 0;
-
+
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: Entering bybusyness for BALANCER (%s)",
balancer->name);
(*worker)->s->lbstatus += (*worker)->s->lbfactor;
total_factor += (*worker)->s->lbfactor;
-
+
if (!mycandidate
|| (*worker)->s->busy < mycandidate->s->busy
|| ((*worker)->s->busy == mycandidate->s->busy && (*worker)->s->lbstatus > mycandidate->s->lbstatus))
int max_lbset = 0;
int checking_standby;
int checked_standby;
-
+
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: Entering byrequests for BALANCER (%s)",
balancer->name);
char *key;
char *value;
char *strtok_state;
-
+
key = apr_strtok(str, "&", &strtok_state);
while (key) {
value = strchr(key, '=');
if (!t) {
continue;
}
-
+
ip = apr_pstrndup(pool, buf, t - buf);
t++;
server = apr_hash_get(servers, ip, APR_HASH_KEY_STRING);
-
+
if (server == NULL) {
server = apr_pcalloc(pool, sizeof(hb_server_t));
server->ip = ip;
apr_hash_set(servers, server->ip, APR_HASH_KEY_STRING, server);
}
-
+
apr_table_clear(hbt);
argstr_to_table(pool, apr_pstrdup(pool, t), hbt);
}
if (server->busy == 0 && server->ready != 0) {
- /* Server has zero threads active, but lots of them ready,
- * it likely just started up, so lets /4 the number ready,
- * to prevent us from completely flooding it with all new
+ /* Server has zero threads active, but lots of them ready,
+ * it likely just started up, so lets /4 the number ready,
+ * to prevent us from completely flooding it with all new
* requests.
*/
server->ready = server->ready / 4;
apr_pool_t *tpool;
apr_hash_t *servers;
- lb_hb_ctx_t *ctx =
+ lb_hb_ctx_t *ctx =
ap_get_module_config(r->server->module_config,
&lbmethod_heartbeat_module);
unsigned int num;
lb_hb_ctx_t *ctx = ap_get_module_config(s->module_config,
&lbmethod_heartbeat_module);
-
+
/* do nothing on first call */
if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG)
return OK;
static void *lb_hb_create_config(apr_pool_t *p, server_rec *s)
{
lb_hb_ctx_t *ctx = (lb_hb_ctx_t *) apr_palloc(p, sizeof(lb_hb_ctx_t));
-
+
ctx->path = ap_server_root_relative(p, "logs/hb.dat");
-
+
return ctx;
}
&lbmethod_heartbeat_module);
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-
+
if (err != NULL) {
return err;
}
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: Entering roundrobin for BALANCER %s (%d)",
balancer->name, (int)getpid());
-
+
/* The index of the candidate last chosen is stored in ctx->index */
if (!balancer->context) {
/* UGLY */
return "stickysession length must be < 64 characters";
PROXY_STRNCPY(balancer->s->sticky_path, val);
PROXY_STRNCPY(balancer->s->sticky, val);
-
+
if ((path = strchr((char *)balancer->s->sticky, '|'))) {
*path++ = '\0';
PROXY_STRNCPY(balancer->s->sticky_path, path);
else if (!strcasecmp(key, "nonce")) {
if (!strcasecmp(val, "None")) {
*balancer->s->nonce = '\0';
- }
+ }
else {
if (strlen(val) > sizeof(balancer->s->nonce)-1) {
return "Provided nonce is too large";
}
else {
apr_status_t rv;
-
+
/* Handle the case where the error document is itself reverse
* proxied and was successful. We must maintain any previous
* error status so that an underlying error (eg HTTP_NOT_FOUND)
r->status = original_status;
r->status_line = original_status_line;
}
-
+
e = apr_bucket_transient_create(send_body_chunk_buff, size,
r->connection->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(output_brigade, e);
-
+
if ((conn->worker->s->flush_packets == flush_on) ||
((conn->worker->s->flush_packets == flush_auto) &&
((rv = apr_poll(conn_poll, 1, &conn_poll_fd,
char *args;
char *tok, *val;
char *key;
-
+
if (input == NULL) {
return;
}
apr_bucket_brigade *ib;
apr_size_t len = 1024;
char *buf = apr_pcalloc(r->pool, len+1);
-
+
ib = apr_brigade_create(r->connection->pool, r->connection->bucket_alloc);
rv = ap_get_brigade(r->input_filters, ib, AP_MODE_READBYTES,
APR_BLOCK_READ, len);
c->allowed_connect_ports = apr_array_append(p,
base->allowed_connect_ports,
overrides->allowed_connect_ports);
-
+
return c;
}
{
int i;
port_range *list = (port_range *) conf->allowed_connect_ports->elts;
-
+
if (apr_is_empty_array(conf->allowed_connect_ports)){
return port == APR_URI_HTTPS_DEFAULT_PORT
|| port == APR_URI_SNEWS_DEFAULT_PORT;
nbytes = apr_snprintf(buffer, sizeof(buffer),
"HTTP/1.0 200 Connection Established" CRLF);
ap_xlate_proto_to_ascii(buffer, nbytes);
- ap_fwrite(c->output_filters, bb, buffer, nbytes);
+ ap_fwrite(c->output_filters, bb, buffer, nbytes);
nbytes = apr_snprintf(buffer, sizeof(buffer),
"Proxy-agent: %s" CRLF CRLF,
ap_get_server_banner());
while (1) { /* Infinite loop until error (one side closes the connection) */
if ((rv = apr_pollset_poll(pollset, -1, &pollcnt, &signalled))
!= APR_SUCCESS) {
- if (APR_STATUS_IS_EINTR(rv)) {
+ if (APR_STATUS_IS_EINTR(rv)) {
continue;
}
apr_socket_close(sock);
static const char *set_dbmtype(cmd_parms *cmd,
void *dconf,
const char *arg)
-{
+{
express_server_conf *sconf;
sconf = ap_get_module_config(cmd->server->module_config, &proxy_express_module);
{
express_server_conf *sconf;
sconf = ap_get_module_config(cmd->server->module_config, &proxy_express_module);
-
+
sconf->enabled = flag;
return NULL;
static void *server_create(apr_pool_t *p, server_rec *s)
{
express_server_conf *a;
-
+
a = (express_server_conf *)apr_pcalloc(p, sizeof(express_server_conf));
-
+
a->dbmfile = NULL;
a->dbmtype = "default";
a->enabled = 0;
-
+
return (void *)a;
}
static void *server_merge(apr_pool_t *p, void *basev, void *overridesv)
{
express_server_conf *a, *base, *overrides;
-
+
a = (express_server_conf *)apr_pcalloc(p,
sizeof(express_server_conf));
base = (express_server_conf *)basev;
if (rv != APR_SUCCESS) {
return DECLINED;
}
-
+
name = ap_get_server_name(r);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy_express: looking for %s", name);
else {
return DECLINED;
}
-
+
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
"proxy: FCGI: canonicalising URL %s", url);
"error parsing URL %s: %s", url, err);
return HTTP_BAD_REQUEST;
}
-
+
apr_snprintf(sport, sizeof(sport), ":%d", port);
-
+
if (ap_strchr_c(host, ':')) {
/* if literal IPv6 address */
host = apr_pstrcat(r->pool, "[", host, "]", NULL);
fill_in_header(&header, FCGI_BEGIN_REQUEST, request_id, sizeof(abrb), 0);
brb.roleB1 = ((FCGI_RESPONDER >> 8) & 0xff);
- brb.roleB0 = ((FCGI_RESPONDER) & 0xff);
+ brb.roleB0 = ((FCGI_RESPONDER) & 0xff);
brb.flags = FCGI_KEEP_CONN;
brb.reserved[0] = 0;
brb.reserved[1] = 0;
return send_data(conn, vec, 2, &len, 1);
}
-static apr_status_t send_environment(proxy_conn_rec *conn, request_rec *r,
+static apr_status_t send_environment(proxy_conn_rec *conn, request_rec *r,
int request_id)
{
const apr_array_header_t *envarr;
for (i = 0; i < numenv; ++i) {
apr_size_t keylen, vallen;
-
+
if (! elts[i].key) {
continue;
}
memset(hex_line, 0, sizeof(hex_line));
while (posn < length) {
- unsigned char c = fheader[posn];
+ unsigned char c = fheader[posn];
if (i >= 20) {
i = 0;
}
dump_header_to_log(r, farray, readbuflen);
-
+
if (readbuflen != FCGI_HEADER_LEN) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
"proxy: FCGI: Failed to read entire header "
- "got %" APR_SIZE_T_FMT " wanted %d",
+ "got %" APR_SIZE_T_FMT " wanted %d",
readbuflen, FCGI_HEADER_LEN);
rv = APR_EINVAL;
break;
char *url, char *server_portstr)
{
/* Request IDs are arbitrary numbers that we assign to a
- * single request. This would allow multiplex/pipelinig of
- * multiple requests to the same FastCGI connection, but
+ * single request. This would allow multiplex/pipelinig of
+ * multiple requests to the same FastCGI connection, but
* we don't support that, and always use a value of '1' to
* keep things simple. */
- int request_id = 1;
+ int request_id = 1;
apr_status_t rv;
-
+
/* Step 1: Send FCGI_BEGIN_REQUEST */
rv = send_begin_request(conn, request_id);
if (rv != APR_SUCCESS) {
conn->close = 1;
return HTTP_SERVICE_UNAVAILABLE;
}
-
+
/* Step 2: Send Environment via FCGI_PARAMS */
rv = send_environment(conn, r, request_id);
if (rv != APR_SUCCESS) {
"proxy: FCGI: declining URL %s", url);
return DECLINED;
}
-
+
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: FCGI: serving URL %s", url);
else {
return DECLINED;
}
-
+
path = ap_server_root_relative(r->pool, url);
r->filename = apr_pstrcat(r->pool, "proxy:fd://", path, NULL);
return rv;
}
}
-
+
if (rv == -1 && errno != EISCONN) {
return errno;
}
struct cmsghdr *cmsg;
struct iovec iov;
char b = '\0';
-
+
rv = apr_os_sock_get(&rawsock, outbound);
if (rv != APR_SUCCESS) {
return rv;
if (rv != APR_SUCCESS) {
return rv;
}
-
+
memset(&msg, 0, sizeof(msg));
msg.msg_iov = &iov;
return errno;
}
-
+
return APR_SUCCESS;
}
{
apr_socket_t *dummy;
- /* Create a dummy unconnected socket, and set it as the one we were
- * connected to, so that when the core closes it, it doesn't close
+ /* Create a dummy unconnected socket, and set it as the one we were
+ * connected to, so that when the core closes it, it doesn't close
* the tcp connection to the client.
*/
rv = apr_socket_create(&dummy, APR_INET, SOCK_STREAM, APR_PROTO_TCP,
}
ap_set_core_module_config(r->connection->conn_config, dummy);
}
-
-
+
+
return OK;
}
bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
e = apr_bucket_flush_create(r->connection->bucket_alloc);
-
+
APR_BRIGADE_INSERT_TAIL(bb, e);
status = ap_pass_brigade(r->output_filters, bb);
{
char *ret;
char *d;
-
+
if (!dconf->ftp_escape_wildcards) {
return path;
}
&& (password = ap_pbase64decode(r->pool, password))[0] != ':') {
/* Check the decoded string for special characters. */
if (!ftp_check_string(password)) {
- return ap_proxyerror(r, HTTP_BAD_REQUEST,
+ return ap_proxyerror(r, HTTP_BAD_REQUEST,
"user credentials contained invalid character");
- }
+ }
/*
* Note that this allocation has to be made from r->connection->pool
* because it has the lifetime of the connection. The other
return APR_STATUS_IS_TIMEUP(status) ? HTTP_GATEWAY_TIME_OUT : HTTP_BAD_GATEWAY;
}
else {
- return HTTP_BAD_REQUEST;
+ return HTTP_BAD_REQUEST;
}
}
apr_brigade_cleanup(bb);
add_cl(p, bucket_alloc, header_brigade, old_cl_val);
status = apr_strtoff(&cl_val, old_cl_val, &endstr, 10);
-
+
if (status || *endstr || endstr == old_cl_val || cl_val < 0) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
"proxy: could not parse request Content-Length (%s)",
proxy_dir_conf *dconf;
conn_rec *origin = p_conn->connection;
int do_100_continue;
-
+
dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
header_brigade = apr_brigade_create(p, origin->bucket_alloc);
&& ap_request_has_body(r)
&& (PROXYREQ_REVERSE == r->proxyreq)
&& !(apr_table_get(r->subprocess_env, "force-proxy-request-1.0")));
-
+
if (apr_table_get(r->subprocess_env, "force-proxy-request-1.0")) {
/*
* According to RFC 2616 8.2.3 we are not allowed to forward an
if (dconf->preserve_host == 0) {
if (ap_strchr_c(uri->hostname, ':')) { /* if literal IPv6 address */
if (uri->port_str && uri->port != DEFAULT_HTTP_PORT) {
- buf = apr_pstrcat(p, "Host: [", uri->hostname, "]:",
+ buf = apr_pstrcat(p, "Host: [", uri->hostname, "]:",
uri->port_str, CRLF, NULL);
} else {
buf = apr_pstrcat(p, "Host: [", uri->hostname, "]", CRLF, NULL);
}
} else {
if (uri->port_str && uri->port != DEFAULT_HTTP_PORT) {
- buf = apr_pstrcat(p, "Host: ", uri->hostname, ":",
+ buf = apr_pstrcat(p, "Host: ", uri->hostname, ":",
uri->port_str, CRLF, NULL);
} else {
buf = apr_pstrcat(p, "Host: ", uri->hostname, CRLF, NULL);
* input_brigade and jump past all of the request body logic...
* Reading anything with ap_get_brigade is likely to consume the
* main request's body or read beyond EOS - which would be unplesant.
- *
+ *
* An exception: when a kept_body is present, then subrequest CAN use
* pass request bodies, and we DONT skip the body.
*/
&& ap_request_has_body(r)
&& (PROXYREQ_REVERSE == r->proxyreq)
&& !(apr_table_get(r->subprocess_env, "force-proxy-request-1.0")));
-
+
bb = apr_brigade_create(p, c->bucket_alloc);
pass_bb = apr_brigade_create(p, c->bucket_alloc);
-
+
/* Setup for 100-Continue timeout if appropriate */
if (do_100_continue) {
apr_socket_timeout_get(backend->sock, &old_timeout);
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"proxy: Closing connection to client because"
" reading from backend server %s:%d failed."
- " Number of keepalives %i", backend->hostname,
+ " Number of keepalives %i", backend->hostname,
backend->port, c->keepalives);
ap_proxy_backend_broke(r, bb);
/*
/* See define of AP_MAX_INTERIM_RESPONSES for why */
if (interim_response >= AP_MAX_INTERIM_RESPONSES) {
return ap_proxyerror(r, HTTP_BAD_GATEWAY,
- apr_psprintf(p,
+ apr_psprintf(p,
"Too many (%d) interim responses from origin server",
interim_response));
}
"SOCKET_EX", 5, APR_BUCKET_DATA,
apr_bucket_destroy_noop,
bucket_socket_ex_read,
- apr_bucket_setaside_notimpl,
+ apr_bucket_setaside_notimpl,
apr_bucket_split_notimpl,
apr_bucket_copy_notimpl
};
"error parsing URL %s: %s", url, err);
return HTTP_BAD_REQUEST;
}
-
+
apr_snprintf(sport, sizeof(sport), ":%u", port);
-
+
if (ap_strchr(host, ':')) { /* if literal IPv6 address */
host = apr_pstrcat(r->pool, "[", host, "]", NULL);
}
static void timed_cleanup_callback(void *baton)
{
s_baton_t *ctx = baton;
-
+
/* Causes all serf connections to unregister from the event mpm */
if (ctx->rstatus) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, ctx->rstatus, ctx->r,
/* TODO: return code? bleh */
ap_pass_brigade(ctx->r->output_filters, ctx->tmpbb);
-
+
apr_pool_destroy(ctx->serf_pool);
ap_finalize_request_protocol(ctx->r);
{
serf_bucket_t *hdrs_bkt = (serf_bucket_t *)vbaton;
- /* XXXXX: List of headers not to copy to serf. serf's serf_bucket_headers_setn,
+ /* XXXXX: List of headers not to copy to serf. serf's serf_bucket_headers_setn,
* doesn't actually overwrite a header if we set it once, so we need to ignore anything
* we might want to toggle or combine.
*/
return rv;
}
-
+
/**
- * XXXXX: If I understood serf buckets better, it might be possible to not
+ * XXXXX: If I understood serf buckets better, it might be possible to not
* copy all of the data here, and better stream it to the client.
**/
/* TODO: improve */
serf_bucket_response_status(response, &line);
ctx->r->status = line.code;
-
+
hdrs = serf_bucket_response_get_headers(response);
serf_bucket_headers_do(hdrs, copy_headers_out, ctx);
ctx->done_headers = 1;
ctx->bkt_alloc);
}
}
-
+
*acceptor = accept_response;
*acceptor_baton = ctx;
*handler = handle_response;
/* XXXXX: make persistent/per-process or something.*/
serf_context_t *serfme;
serf_connection_t *conn;
- serf_server_config_t *ctx =
+ serf_server_config_t *ctx =
(serf_server_config_t *)ap_get_module_config(r->server->module_config,
&serf_module);
apr_uint32_t pick = 0;
ap_serf_server_t *choice;
- /* TODO: could this be optimized in post-config to pre-setup the
+ /* TODO: could this be optimized in post-config to pre-setup the
* pointers to the right cluster inside the conf structure?
*/
cluster = apr_hash_get(ctx->clusters,
}
cp = ap_lookup_provider(AP_SERF_CLUSTER_PROVIDER, cluster->provider, "0");
-
+
if (cp == NULL) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"SerfCluster: unable to find provider %s", cluster->provider);
"SerfCluster: %s is missing list servers provider.", cluster->provider);
return HTTP_INTERNAL_SERVER_ERROR;
}
-
+
rc = cp->list_servers(cp->baton,
r,
cluster->params,
apr_file_seek(fp, APR_SET, &flen);
baton->body_bkt = serf_bucket_file_create(fp, baton->bkt_alloc);
}
-
+
conn = serf_connection_create(serfme, address,
conn_setup, baton,
closed_connection, baton,
else {
do {
rv = serf_context_run(serfme, SERF_DURATION_FOREVER, pool);
-
+
/* XXXX: Handle timeouts */
if (APR_STATUS_IS_TIMEUP(rv)) {
continue;
}
-
+
if (rv != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "serf_context_run() for %pI", address);
- return HTTP_INTERNAL_SERVER_ERROR;
+ return HTTP_INTERNAL_SERVER_ERROR;
}
-
+
serf_debug__closed_conn(baton->bkt_alloc);
} while (baton->keep_reading);
-
+
return baton->rstatus;
}
}
for (i = 1; i < argc; i++) {
const char *p = argv[i];
const char *x = ap_strchr_c(p, '=');
-
+
if (x) {
if (strncmp(p, "preservehost", x-p) == 0) {
conf->preservehost = is_true(x+1);
}
conf->on = 1;
-
+
return NULL;
}
ap_serf_cluster_provider_t *backend;
int i;
serf_cluster_t *cluster = NULL;
- serf_server_config_t *ctx =
+ serf_server_config_t *ctx =
(serf_server_config_t *)ap_get_module_config(cmd->server->module_config,
&serf_module);
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-
+
if (err != NULL) {
return err;
}
if (argc < 2) {
return "SerfCluster must have at least a name and provider.";
}
-
+
cluster = apr_palloc(cmd->pool, sizeof(serf_cluster_t));
cluster->name = apr_pstrdup(cmd->pool, argv[0]);
cluster->provider = apr_pstrdup(cmd->pool, argv[1]);
cluster->params = apr_table_make(cmd->pool, 6);
backend = ap_lookup_provider(AP_SERF_CLUSTER_PROVIDER, cluster->provider, "0");
-
+
if (backend == NULL) {
return apr_psprintf(cmd->pool, "SerfCluster: unable to find "
"provider '%s'", cluster->provider);
x+1);
}
else {
- apr_table_addn(cluster->params,
+ apr_table_addn(cluster->params,
apr_pstrdup(cmd->pool, p),
"");
}
}
rv = backend->check_config(backend->baton, cmd, cluster->params);
-
+
if (rv) {
return rv;
}
static void *create_server_config(apr_pool_t *p, server_rec *s)
{
- serf_server_config_t *ctx =
+ serf_server_config_t *ctx =
(serf_server_config_t *) apr_pcalloc(p, sizeof(serf_server_config_t));
ctx->clusters = apr_hash_make(p);
serf_server_config_t *ctx = apr_pcalloc(p, sizeof(serf_server_config_t));
serf_server_config_t *base = (serf_server_config_t *) basev;
serf_server_config_t *overrides = (serf_server_config_t *) overridesv;
-
+
ctx->clusters = apr_hash_overlay(p, base->clusters, overrides->clusters);
return ctx;
-}
+}
static const command_rec serf_cmds[] =
{
if (apr_is_empty_table(params)) {
return "SerfCluster Heartbeat requires a path to the heartbat information.";
}
-
+
b.p = cmd->pool;
b.msg = NULL;
apr_table_do(hb_table_check, &b, params, NULL);
-
+
if (b.msg) {
return b.msg;
}
char *key;
char *value;
char *strtok_state;
-
+
key = apr_strtok(str, "&", &strtok_state);
while (key) {
value = strchr(key, '=');
apr_finfo_t fi;
apr_status_t rv;
apr_file_t *fp;
-
+
if (!path) {
return APR_SUCCESS;
}
-
+
rv = apr_file_open(&fp, path, APR_READ|APR_BINARY|APR_BUFFERED,
APR_OS_DEFAULT, pool);
-
+
if (rv) {
return rv;
}
-
+
rv = apr_file_info_get(&fi, APR_FINFO_SIZE, fp);
-
+
if (rv) {
return rv;
}
-
+
{
char *t;
int lineno = 0;
if (buf[0] == '#') {
continue;
}
-
-
+
+
/* line format: <IP> <query_string>\n */
t = strchr(buf, ' ');
if (!t) {
continue;
}
-
+
ip = apr_pstrndup(pool, buf, t - buf);
t++;
server = apr_pcalloc(pool, sizeof(hb_server_t));
server->port = 80;
server->seen = -1;
apr_table_clear(hbt);
-
+
argstr_to_table(pool, apr_pstrdup(pool, t), hbt);
-
+
if (apr_table_get(hbt, "busy")) {
server->busy = atoi(apr_table_get(hbt, "busy"));
}
-
+
if (apr_table_get(hbt, "ready")) {
server->ready = atoi(apr_table_get(hbt, "ready"));
}
-
+
if (apr_table_get(hbt, "lastseen")) {
server->seen = atoi(apr_table_get(hbt, "lastseen"));
}
-
+
if (apr_table_get(hbt, "port")) {
server->port = atoi(apr_table_get(hbt, "port"));
}
-
+
if (server->busy == 0 && server->ready != 0) {
- /* Server has zero threads active, but lots of them ready,
- * it likely just started up, so lets /4 the number ready,
- * to prevent us from completely flooding it with all new
+ /* Server has zero threads active, but lots of them ready,
+ * it likely just started up, so lets /4 the number ready,
+ * to prevent us from completely flooding it with all new
* requests.
*/
server->ready = server->ready / 4;
APR_ARRAY_PUSH(servers, hb_server_t *) = server;
}
}
-
+
return APR_SUCCESS;
}
apr_pool_destroy(tpool);
return HTTP_INTERNAL_SERVER_ERROR;
}
-
+
qsort(tmpservers->elts, tmpservers->nelts, sizeof(hb_server_t *),
hb_server_sort);
key);
return 1;
}
-
+
return 0;
}
apr_table_t *params)
{
hb_table_baton_t b;
-
+
if (apr_is_empty_table(params)) {
return "SerfCluster Static requires at least a host list.";
}
-
+
b.p = cmd->pool;
b.msg = NULL;
-
+
apr_table_do(static_table_check, &b, params, NULL);
-
+
if (b.msg) {
return b.msg;
}
-
+
if (apr_table_get(params, "hosts") == NULL) {
return "SerfCluster Static requires at least a hosts parameter";
}
const char *order = apr_table_get(params, "order");
servers = apr_array_make(r->pool, 10, sizeof(ap_serf_server_t *));
-
+
ip = apr_strtok(apr_pstrdup(r->pool, hosts), ",", &strtok_state);
while (ip) {
char *host_str;
char *scope_id;
apr_port_t port = 0;
-
+
rv = apr_parse_addr_port(&host_str, &scope_id, &port, ip, r->pool);
if (!rv) {
ap_serf_server_t *s = apr_palloc(r->pool, sizeof(ap_serf_server_t));
if (rv != APR_SUCCESS) {
mpm_supprts_serf = 0;
}
-
- return OK;
+
+ return OK;
}
static void register_hooks(apr_pool_t *p)
char *ptr;
char *inuse;
apr_status_t retval = APR_SUCCESS;
-
+
if (!mem)
return APR_ENOSHMAVAIL;
if ((err = ssl_cmd_check_dir(cmd, &arg))) {
return err;
}
-
+
if (cmd->path) {
return NO_PER_DIR_SSL_CA;
}
if (mc->sesscache) {
/* Cache found; create it, passing anything beyond the colon. */
mc->sesscache_mode = enabled_flags;
- err = mc->sesscache->create(&mc->sesscache_context, sep,
+ err = mc->sesscache->create(&mc->sesscache_context, sep,
cmd->temp_pool, cmd->pool);
}
else {
/* Build a comma-separated list of all registered provider
* names: */
- name_list = ap_list_provider_names(cmd->pool,
+ name_list = ap_list_provider_names(cmd->pool,
AP_SOCACHE_PROVIDER_GROUP,
AP_SOCACHE_PROVIDER_VERSION);
all_names = apr_array_pstrcat(cmd->pool, name_list, ',');
if (err) {
return apr_psprintf(cmd->pool, "SSLSessionCache: %s", err);
}
-
+
return NULL;
}
const char *ssl_cmd_SSLProxyCARevocationCheck(cmd_parms *cmd,
void *dcfg,
const char *arg)
-{
+{
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
return ssl_cmd_crlcheck_parse(cmd, arg, &sc->proxy->crl_check_mode);
}
-
+
const char *ssl_cmd_SSLProxyMachineCertificateFile(cmd_parms *cmd,
void *dcfg,
const char *arg)
}
const char *ssl_cmd_SSLOCSPEnable(cmd_parms *cmd, void *dcfg, int flag)
-{
+{
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
sc->server->ocsp_enabled = flag ? TRUE : FALSE;
return "OCSP support disabled in SSL library; cannot enable "
"OCSP validation";
}
-#endif
+#endif
return NULL;
}
-
+
const char *ssl_cmd_SSLOCSPOverrideResponder(cmd_parms *cmd, void *dcfg, int flag)
{
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
}
const char *ssl_cmd_SSLOCSPDefaultResponder(cmd_parms *cmd, void *dcfg, const char *arg)
-{
+{
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
sc->server->ocsp_responder = arg;
if (mc->stapling_cache) {
/* Cache found; create it, passing anything beyond the colon. */
err = mc->stapling_cache->create(&mc->stapling_cache_context,
- sep, cmd->temp_pool,
+ sep, cmd->temp_pool,
cmd->pool);
}
else {
apr_array_header_t *name_list;
const char *all_names;
-
+
/* Build a comma-separated list of all registered provider
* names: */
- name_list = ap_list_provider_names(cmd->pool,
+ name_list = ap_list_provider_names(cmd->pool,
AP_SOCACHE_PROVIDER_GROUP,
AP_SOCACHE_PROVIDER_VERSION);
all_names = apr_array_pstrcat(cmd->pool, name_list, ',');
-
+
err = apr_psprintf(cmd->pool, "'%s' stapling cache not supported "
"(known names: %s)", name, all_names);
}
if (err) {
return apr_psprintf(cmd->pool, "SSLStaplingCache: %s", err);
}
-
+
return NULL;
}
const char *ssl_cmd_SSLUseStapling(cmd_parms *cmd, void *dcfg, int flag)
-{
+{
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
sc->server->stapling_enabled = flag ? TRUE : FALSE;
return NULL;
const char *ssl_cmd_SSLStaplingReturnResponderErrors(cmd_parms *cmd,
void *dcfg, int flag)
-{
+{
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
sc->server->stapling_return_errors = flag ? TRUE : FALSE;
return NULL;
const char *ssl_cmd_SSLStaplingFakeTryLater(cmd_parms *cmd,
void *dcfg, int flag)
-{
+{
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
sc->server->stapling_fake_trylater = flag ? TRUE : FALSE;
return NULL;
{
char *modver = ssl_var_lookup(p, s, NULL, NULL, "SSL_VERSION_INTERFACE");
char *libver = ssl_var_lookup(p, s, NULL, NULL, "SSL_VERSION_LIBRARY");
- char *incver = ssl_var_lookup(p, s, NULL, NULL,
+ char *incver = ssl_var_lookup(p, s, NULL, NULL,
"SSL_VERSION_LIBRARY_INTERFACE");
ap_add_version_component(p, modver);
ssl_log_ssl_error(SSLLOG_MARK, APLOG_EMERG, s);
ssl_die();
}
- ap_log_error(APLOG_MARK, APLOG_INFO, 0, s,
- "Init: loaded Crypto Device API `%s'",
+ ap_log_error(APLOG_MARK, APLOG_INFO, 0, s,
+ "Init: loaded Crypto Device API `%s'",
mc->szCryptoDevice);
ENGINE_free(e);
ssl_log_ssl_error(SSLLOG_MARK, APLOG_EMERG, s);
ssl_die();
}
-
+
#ifdef HAVE_OCSP_STAPLING
if ((mctx->pkp == FALSE) && (mctx->stapling_enabled == TRUE)) {
if (!ssl_stapling_init_cert(s, mctx, cert)) {
klen = strlen(key);
if ((ps = (server_rec *)apr_hash_get(table, key, klen))) {
- ap_log_error(APLOG_MARK,
+ ap_log_error(APLOG_MARK,
#ifdef OPENSSL_NO_TLSEXT
- APLOG_WARNING,
+ APLOG_WARNING,
#else
- APLOG_DEBUG,
+ APLOG_DEBUG,
#endif
0,
base_server,
}
}
-static int ssl_init_FindCAList_X509NameCmp(const X509_NAME * const *a,
+static int ssl_init_FindCAList_X509NameCmp(const X509_NAME * const *a,
const X509_NAME * const *b)
{
return(X509_NAME_cmp(*a, *b));
apr_bucket *e;
AP_DEBUG_ASSERT(APR_BRIGADE_EMPTY(outctx->bb));
-
+
e = apr_bucket_flush_create(outctx->bb->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(outctx->bb, e);
outctx->rc = APR_ECONNABORTED;
return -1;
}
-
+
/* when handshaking we'll have a small number of bytes.
* max size SSL will pass us here is about 16k.
* (16413 bytes to be exact)
* filter must setaside if necessary. */
e = apr_bucket_transient_create(in, inl, outctx->bb->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(outctx->bb, e);
-
+
if (bio_filter_out_pass(outctx) < 0) {
return -1;
}
/* fake the request line */
bucket = HTTP_ON_HTTPS_PORT_BUCKET(f->c->bucket_alloc);
break;
-
+
case MODSSL_ERROR_BAD_GATEWAY:
bucket = ap_bucket_error_create(HTTP_BAD_REQUEST, NULL,
- f->c->pool,
+ f->c->pool,
f->c->bucket_alloc);
ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, f->c,
"SSL handshake failed: sending 502");
/* Satisfy the read directly out of the buffer if possible;
* invoking ssl_io_input_getline will mean the entire buffer
* is copied once (unnecessarily) for each GETLINE call. */
- if (inctx->cbuf.length
- && (pos = memchr(inctx->cbuf.value, APR_ASCII_LF,
+ if (inctx->cbuf.length
+ && (pos = memchr(inctx->cbuf.value, APR_ASCII_LF,
inctx->cbuf.length)) != NULL) {
start = inctx->cbuf.value;
len = 1 + pos - start; /* +1 to include LF */
* overhead (network packets) for any output comprising many small
* buckets. SSI page applied through the HTTP chunk filter, for
* example, may produce many brigades containing small buckets -
- * [chunk-size CRLF] [chunk-data] [CRLF].
+ * [chunk-size CRLF] [chunk-data] [CRLF].
*
* The coalescing filter merges many small buckets into larger buckets
* where possible, allowing the SSL I/O output filter to handle them
/* The brigade consists of zero-or-more small data buckets which
* can be coalesced (the prefix), followed by the remainder of the
- * brigade.
+ * brigade.
*
* Find the last bucket - if any - of that prefix. count gives
* the number of buckets in the prefix. The "prefix" must contain
}
/* Coalesce the prefix, if:
- * a) more than one bucket is found to coalesce, or
+ * a) more than one bucket is found to coalesce, or
* b) the brigade contains only a single data bucket, or
- * c)
+ * c)
*/
if (bytes > 0
&& (count > 1
* in this loop it is safe to break out and fall back to the
* normal path of sending the buffer + remaining buckets in
* brigade. */
- e = APR_BRIGADE_FIRST(bb);
+ e = APR_BRIGADE_FIRST(bb);
while (e != last) {
apr_size_t len;
const char *data;
ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, f->c,
"unexpected bucket type during coalesce");
break; /* non-fatal error; break out */
- }
+ }
if (e->length) {
apr_status_t rv;
}
/* Be paranoid. */
- if (len > sizeof ctx->buffer
+ if (len > sizeof ctx->buffer
|| (len + ctx->bytes > sizeof ctx->buffer)) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, f->c,
"unexpected coalesced bucket data length");
ap_log_cerror(APLOG_MARK, APLOG_TRACE4, 0, f->c,
"coalesce: passing on %" APR_SIZE_T_FMT " bytes", ctx->bytes);
-
+
e = apr_bucket_transient_create(ctx->buffer, ctx->bytes, bb->bucket_alloc);
APR_BRIGADE_INSERT_HEAD(bb, e);
ctx->bytes = 0; /* buffer now emptied. */
}
-
- return ap_pass_brigade(f->next, bb);
+
+ return ap_pass_brigade(f->next, bb);
}
static apr_status_t ssl_io_filter_output(ap_filter_t *f,
/* Fail if this exceeds the maximum buffer size. */
if (total > maxlen) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
- "request body exceeds maximum size (%" APR_SIZE_T_FMT
+ "request body exceeds maximum size (%" APR_SIZE_T_FMT
") for SSL buffer", maxlen);
return HTTP_REQUEST_ENTITY_TOO_LARGE;
}
/* After consuming all protocol-level input, remove all protocol-level
* filters. It should strictly only be necessary to remove filters
- * at exactly ftype == AP_FTYPE_PROTOCOL, since this filter will
+ * at exactly ftype == AP_FTYPE_PROTOCOL, since this filter will
* precede all > AP_FTYPE_PROTOCOL anyway. */
while (r->proto_input_filters->frec->ftype < AP_FTYPE_CONNECTION) {
ap_remove_input_filter(r->proto_input_filters);
apr_status_t rv;
SSL *ssl;
- ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
"upgrading connection to TLS");
bb = apr_brigade_create(r->pool, conn->bucket_alloc);
}
ssl_init_ssl_connection(conn, r);
-
+
sslconn = myConnConfig(conn);
ssl = sslconn->ssl;
-
+
/* Perform initial SSL handshake. */
SSL_set_accept_state(ssl);
SSL_do_handshake(ssl);
if (SSL_get_state(ssl) != SSL_ST_OK) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"TLS upgrade handshake failed: not accepted by client!?");
-
+
return APR_ECONNABORTED;
}
/* Perform a speculative (and non-blocking) read from the connection
* filters for the given request, to determine whether there is any
* pending data to read. Return non-zero if there is, else zero. */
-static int has_buffered_data(request_rec *r)
+static int has_buffered_data(request_rec *r)
{
apr_bucket_brigade *bb;
apr_off_t len;
apr_status_t rv;
int result;
-
+
bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
-
+
rv = ap_get_brigade(r->connection->input_filters, bb, AP_MODE_SPECULATIVE,
- APR_NONBLOCK_READ, 1);
+ APR_NONBLOCK_READ, 1);
result = rv == APR_SUCCESS
&& apr_brigade_length(bb, 1, &len) == APR_SUCCESS
&& len > 0;
-
+
apr_brigade_destroy(bb);
-
+
return result;
}
const char *servername;
#endif
SSL *ssl;
-
+
/* Perform TLS upgrade here if "SSLEngine optional" is configured,
* SSL is not already set up for this connection, and the client
* has sent a suitable Upgrade header. */
"Performing full renegotiation: complete handshake "
"protocol (%s support secure renegotiation)",
#if defined(SSL_get_secure_renegotiation_support)
- SSL_get_secure_renegotiation_support(ssl) ?
+ SSL_get_secure_renegotiation_support(ssl) ?
"client does" : "client does not"
#else
"server does not"
/* Toggle the renegotiation state to allow the new
* handshake to proceed. */
sslconn->reneg_state = RENEG_ALLOW;
-
+
SSL_renegotiate(ssl);
SSL_do_handshake(ssl);
#ifdef SSL_get_secure_renegotiation_support
- apr_table_setn(r->notes, "ssl-secure-reneg",
+ apr_table_setn(r->notes, "ssl-secure-reneg",
SSL_get_secure_renegotiation_support(ssl) ? "1" : "0");
#endif
ecdh = EC_KEY_new();
if (ecdh != NULL) {
/* ecdh->group = EC_GROUP_new_by_nid(NID_secp160r2); */
- EC_KEY_set_group(ecdh,
+ EC_KEY_set_group(ecdh,
EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1));
}
init = 1;
}
-
+
return ecdh;
}
#endif
}
/* Dump debugginfo trace to the log file. */
-static void log_tracing_state(const SSL *ssl, conn_rec *c,
+static void log_tracing_state(const SSL *ssl, conn_rec *c,
server_rec *s, int where, int rc)
{
/*
* read. */
if ((where & SSL_CB_ACCEPT_LOOP) && scr->reneg_state == RENEG_REJECT) {
int state = SSL_get_state((SSL *)ssl);
-
- if (state == SSL3_ST_SR_CLNT_HELLO_A
+
+ if (state == SSL3_ST_SR_CLNT_HELLO_A
|| state == SSL23_ST_SR_CLNT_HELLO_A) {
scr->reneg_state = RENEG_ABORT;
ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c,
* or one of the ServerAliases matches the supplied name (to be used
* with ap_vhost_iterate_given_conn())
*/
-static int ssl_find_vhost(void *servername, conn_rec *c, server_rec *s)
+static int ssl_find_vhost(void *servername, conn_rec *c, server_rec *s)
{
SSLSrvConfigRec *sc;
SSL *ssl;
found = TRUE;
}
- /*
+ /*
* if not matched yet, check ServerAlias entries
* (adapted from vhost.c:matches_aliases())
*/
ap_log_error(file, line, APLOG_MODULE_INDEX, level, 0, s,
"SSL Library Error: %s%s%s%s%s%s",
/* %s */
- err,
+ err,
/* %s%s%s */
- data ? " (" : "", data ? data : "", data ? ")" : "",
+ data ? " (" : "", data ? data : "", data ? ")" : "",
/* %s%s */
annotation ? " -- " : "",
annotation ? annotation : "");
}
}
-static void ssl_log_cert_error(const char *file, int line, int level,
+static void ssl_log_cert_error(const char *file, int line, int level,
apr_status_t rv, const server_rec *s,
const conn_rec *c, const request_rec *r,
apr_pool_t *p, X509 *cert, const char *format,
char buf[HUGE_STRING_LEN];
int msglen, n;
char *name;
-
+
apr_vsnprintf(buf, sizeof buf, format, ap);
msglen = strlen(buf);
for (j = 0; j < sk_ACCESS_DESCRIPTION_num(values) && !result; j++) {
ACCESS_DESCRIPTION *value = sk_ACCESS_DESCRIPTION_value(values, j);
-
+
/* Name found in extension, and is a URI: */
if (OBJ_obj2nid(value->method) == NID_ad_OCSP
&& value->location->type == GEN_URI) {
(char *)value->location->d.uniformResourceIdentifier->data);
}
}
-
+
AUTHORITY_INFO_ACCESS_free(values);
return result;
/* Return the responder URI object which should be used in the given
* configuration for the given certificate, or NULL if none can be
* determined. */
-static apr_uri_t *determine_responder_uri(SSLSrvConfigRec *sc, X509 *cert,
+static apr_uri_t *determine_responder_uri(SSLSrvConfigRec *sc, X509 *cert,
conn_rec *c, apr_pool_t *p)
{
apr_uri_t *u = apr_palloc(p, sizeof *u);
s = sc->server->ocsp_responder;
}
else {
- s = extract_responder_uri(cert, p);
+ s = extract_responder_uri(cert, p);
if (s == NULL && sc->server->ocsp_responder) {
s = sc->server->ocsp_responder;
}
rv = apr_uri_parse(p, s, u);
- if (rv || !u->hostname) {
- ap_log_cerror(APLOG_MARK, APLOG_DEBUG, rv, c,
+ if (rv || !u->hostname) {
+ ap_log_cerror(APLOG_MARK, APLOG_DEBUG, rv, c,
"failed to parse OCSP responder URI '%s'", s);
return NULL;
}
if (strcasecmp(u->scheme, "http") != 0) {
- ap_log_cerror(APLOG_MARK, APLOG_DEBUG, rv, c,
+ ap_log_cerror(APLOG_MARK, APLOG_DEBUG, rv, c,
"cannot handle OCSP responder URI '%s'", s);
return NULL;
}
/* Create an OCSP request for the given certificate; returning the
* certificate ID in *certid and *issuer on success. Returns the
* request object on success, or NULL on error. */
-static OCSP_REQUEST *create_request(X509_STORE_CTX *ctx, X509 *cert,
- OCSP_CERTID **certid,
+static OCSP_REQUEST *create_request(X509_STORE_CTX *ctx, X509 *cert,
+ OCSP_CERTID **certid,
server_rec *s, apr_pool_t *p)
{
OCSP_REQUEST *req = OCSP_REQUEST_new();
"could not retrieve certificate id");
return NULL;
}
-
+
OCSP_request_add1_nonce(req, 0, -1);
-
+
return req;
}
-
+
/* Verify the OCSP status of given certificate. Returns
* V_OCSP_CERTSTATUS_* result code. */
-static int verify_ocsp_status(X509 *cert, X509_STORE_CTX *ctx, conn_rec *c,
+static int verify_ocsp_status(X509 *cert, X509_STORE_CTX *ctx, conn_rec *c,
SSLSrvConfigRec *sc, server_rec *s,
- apr_pool_t *pool)
+ apr_pool_t *pool)
{
int rc = V_OCSP_CERTSTATUS_GOOD;
OCSP_RESPONSE *response = NULL;
OCSP_REQUEST *request = NULL;
OCSP_CERTID *certID = NULL;
apr_uri_t *ruri;
-
+
ruri = determine_responder_uri(sc, cert, c, pool);
if (!ruri) {
return V_OCSP_CERTSTATUS_UNKNOWN;
if (!request || !response) {
rc = V_OCSP_CERTSTATUS_UNKNOWN;
}
-
+
if (rc == V_OCSP_CERTSTATUS_GOOD) {
int r = OCSP_response_status(response);
rc = V_OCSP_CERTSTATUS_UNKNOWN;
}
}
-
+
if (rc == V_OCSP_CERTSTATUS_GOOD) {
basicResponse = OCSP_response_get1_basic(response);
if (!basicResponse) {
rc = V_OCSP_CERTSTATUS_UNKNOWN;
}
}
-
+
if (rc == V_OCSP_CERTSTATUS_GOOD) {
if (OCSP_check_nonce(request, basicResponse) != 1) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
rc = V_OCSP_CERTSTATUS_UNKNOWN;
}
}
-
+
if (rc == V_OCSP_CERTSTATUS_GOOD) {
/* TODO: allow flags configuration. */
if (OCSP_basic_verify(basicResponse, NULL, ctx->ctx, 0) != 1) {
rc = V_OCSP_CERTSTATUS_UNKNOWN;
}
}
-
+
if (rc == V_OCSP_CERTSTATUS_GOOD) {
int reason = -1, status;
ASN1_GENERALIZEDTIME *thisup = NULL, *nextup = NULL;
}
{
- int level =
+ int level =
(status == V_OCSP_CERTSTATUS_GOOD) ? APLOG_INFO : APLOG_ERR;
- const char *result =
- status == V_OCSP_CERTSTATUS_GOOD ? "good" :
+ const char *result =
+ status == V_OCSP_CERTSTATUS_GOOD ? "good" :
(status == V_OCSP_CERTSTATUS_REVOKED ? "revoked" : "unknown");
ssl_log_cxerror(SSLLOG_MARK, level, 0, c, cert,
result, status, reason);
}
}
-
+
if (request) OCSP_REQUEST_free(request);
if (response) OCSP_RESPONSE_free(response);
if (basicResponse) OCSP_BASICRESP_free(basicResponse);
return rc;
}
-int modssl_verify_ocsp(X509_STORE_CTX *ctx, SSLSrvConfigRec *sc,
- server_rec *s, conn_rec *c, apr_pool_t *pool)
+int modssl_verify_ocsp(X509_STORE_CTX *ctx, SSLSrvConfigRec *sc,
+ server_rec *s, conn_rec *c, apr_pool_t *pool)
{
X509 *cert = X509_STORE_CTX_get_current_cert(ctx);
apr_pool_t *vpool;
apr_pool_create(&vpool, pool);
rv = verify_ocsp_status(cert, ctx, c, sc, s, vpool);
-
+
apr_pool_destroy(vpool);
/* Propagate the verification status back to the passed-in
case V_OCSP_CERTSTATUS_GOOD:
X509_STORE_CTX_set_error(ctx, X509_V_OK);
break;
-
+
case V_OCSP_CERTSTATUS_REVOKED:
X509_STORE_CTX_set_error(ctx, X509_V_ERR_CERT_REVOKED);
break;
-
+
case V_OCSP_CERTSTATUS_UNKNOWN:
/* correct error code for application errors? */
X509_STORE_CTX_set_error(ctx, X509_V_ERR_APPLICATION_VERIFICATION);
}
return rv == V_OCSP_CERTSTATUS_GOOD;
-}
+}
#endif /* HAVE_OCSP */
if (pkey_mtime) {
ssl_asn1_t *asn1 =
ssl_asn1_table_get(mc->tPrivateKey, key_id);
-
+
if (asn1 && (asn1->source_mtime == pkey_mtime)) {
ap_log_error(APLOG_MARK, APLOG_INFO,
0, pServ,
/* Perform once-per-process library version determination: */
var_library = apr_pstrdup(p, SSL_LIBRARY_DYNTEXT);
-
+
if ((cp = strchr(var_library, ' ')) != NULL) {
*cp = '/';
if ((cp2 = strchr(cp, ' ')) != NULL)
}
}
else if(ssl != NULL && strcEQ(var, "SESSION_RESUMED")) {
- if (SSL_session_reused(ssl) == 1)
+ if (SSL_session_reused(ssl) == 1)
result = "Resumed";
else
result = "Initial";
flag = SSL_get_secure_renegotiation_support(ssl);
#endif
result = apr_pstrdup(p, flag ? "true" : "false");
- }
+ }
return result;
}
}
return NULL;
}
-
+
/* Add each RDN in 'xn' to the table 't' where the NID is present in
* 'nids', using key prefix 'pfx'. */
-static void extract_dn(apr_table_t *t, apr_hash_t *nids, const char *pfx,
+static void extract_dn(apr_table_t *t, apr_hash_t *nids, const char *pfx,
X509_NAME *xn, apr_pool_t *p)
{
STACK_OF(X509_NAME_ENTRY) *ents = xn->entries;
ssl_var_lookup_ssl_cert_dn_rec[n].name);
}
}
-
+
/* Extract the server cert DNS -- note that the refcount does NOT
* increase: */
xs = SSL_get_certificate(ssl);
extract_dn(t, nids, "SSL_SERVER_S_DN_", X509_get_subject_name(xs), p);
extract_dn(t, nids, "SSL_SERVER_I_DN_", X509_get_issuer_name(xs), p);
}
-
+
/* Extract the client cert DNs -- note that the refcount DOES
* increase: */
xs = SSL_get_peer_certificate(ssl);
MODSSL_D2I_ASN1_type_bytes_CONST unsigned char *pp = str->data;
ASN1_STRING *ret = ASN1_STRING_new();
int rv = 0;
-
+
/* This allows UTF8String, IA5String, VisibleString, or BMPString;
* conversion to UTF-8 is forced. */
if (d2i_DISPLAYTEXT(&ret, &pp, str->length)) {
SSLModConfigRec *mc = myModConfig(s);
apr_status_t rv;
struct ap_socache_hints hints;
-
+
/* The very first invocation of this function will be the
* post_config invocation during server startup; do nothing for
* this first (and only the first) time through, since the pool
hints.avg_obj_size = 1500;
hints.avg_id_len = 20;
hints.expiry_interval = 300;
-
+
rv = mc->stapling_cache->init(mc->stapling_cache_context,
"mod_ssl-stapling", &hints, s, p);
if (rv) {
hints.avg_obj_size = 150;
hints.avg_id_len = 30;
hints.expiry_interval = 30;
-
+
rv = mc->sesscache->init(mc->sesscache_context, "mod_ssl-session", &hints, s, p);
if (rv) {
ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s,
void ssl_scache_kill(server_rec *s)
{
SSLModConfigRec *mc = myModConfig(s);
-
+
if (mc->sesscache) {
mc->sesscache->destroy(mc->sesscache_context, s);
}
if (mc->sesscache->flags & AP_SOCACHE_FLAG_NOTMPSAFE) {
ssl_mutex_on(s);
}
-
- rv = mc->sesscache->store(mc->sesscache_context, s, id, idlen,
+
+ rv = mc->sesscache->store(mc->sesscache_context, s, id, idlen,
expiry, encoded, len, p);
if (mc->sesscache->flags & AP_SOCACHE_FLAG_NOTMPSAFE) {
ssl_mutex_on(s);
}
- rv = mc->sesscache->retrieve(mc->sesscache_context, s, id, idlen,
+ rv = mc->sesscache->retrieve(mc->sesscache_context, s, id, idlen,
dest, &destlen, p);
if (mc->sesscache->flags & AP_SOCACHE_FLAG_NOTMPSAFE) {
case EVP_PKEY_EC:
t = SSL_ALGO_ECC;
break;
-#endif
+#endif
default:
break;
}
/* Dynamic lock structure */
struct CRYPTO_dynlock_value {
apr_pool_t *pool;
- const char* file;
+ const char* file;
int line;
apr_thread_mutex_t *mutex;
};
/*
* Dynamic lock creation callback
*/
-static struct CRYPTO_dynlock_value *ssl_dyn_create_function(const char *file,
+static struct CRYPTO_dynlock_value *ssl_dyn_create_function(const char *file,
int line)
{
struct CRYPTO_dynlock_value *value;
apr_pool_t *p;
apr_status_t rv;
- /*
+ /*
* We need a pool to allocate our mutex. Since we can't clear
* allocated memory from a pool, create a subpool that we can blow
- * away in the destruction callback.
+ * away in the destruction callback.
*/
rv = apr_pool_create(&p, dynlockpool);
if (rv != APR_SUCCESS) {
ap_log_perror(file, line, APLOG_MODULE_INDEX, APLOG_DEBUG, 0, p,
"Creating dynamic lock");
-
- value = (struct CRYPTO_dynlock_value *)apr_palloc(p,
+
+ value = (struct CRYPTO_dynlock_value *)apr_palloc(p,
sizeof(struct CRYPTO_dynlock_value));
if (!value) {
ap_log_perror(file, line, APLOG_MODULE_INDEX, APLOG_ERR, 0, p,
"Failed to allocate dynamic lock structure");
return NULL;
}
-
+
value->pool = p;
/* Keep our own copy of the place from which we were created,
using our own pool. */
value->file = apr_pstrdup(p, file);
value->line = line;
- rv = apr_thread_mutex_create(&(value->mutex), APR_THREAD_MUTEX_DEFAULT,
+ rv = apr_thread_mutex_create(&(value->mutex), APR_THREAD_MUTEX_DEFAULT,
p);
if (rv != APR_SUCCESS) {
ap_log_perror(file, line, APLOG_MODULE_INDEX, APLOG_ERR, rv, p,
/*
* Dynamic lock destruction callback
*/
-static void ssl_dyn_destroy_function(struct CRYPTO_dynlock_value *l,
+static void ssl_dyn_destroy_function(struct CRYPTO_dynlock_value *l,
const char *file, int line)
{
apr_status_t rv;
rv = apr_thread_mutex_destroy(l->mutex);
if (rv != APR_SUCCESS) {
ap_log_perror(file, line, APLOG_MODULE_INDEX, APLOG_ERR, rv, l->pool,
- "Failed to destroy mutex for dynamic lock %s:%d",
+ "Failed to destroy mutex for dynamic lock %s:%d",
l->file, l->line);
}
{
CRYPTO_set_locking_callback(NULL);
CRYPTO_set_id_callback(NULL);
-
+
CRYPTO_set_dynlock_create_callback(NULL);
CRYPTO_set_dynlock_lock_callback(NULL);
CRYPTO_set_dynlock_destroy_callback(NULL);
-
+
dynlockpool = NULL;
/* Let the registered mutex cleanups do their own thing
CRYPTO_set_id_callback(ssl_util_thr_id);
CRYPTO_set_locking_callback(ssl_util_thr_lock);
-
+
/* Set up dynamic locking scaffolding for OpenSSL to use at its
- * convenience.
+ * convenience.
*/
dynlockpool = p;
CRYPTO_set_dynlock_create_callback(ssl_dyn_create_function);
"Host: %s:%d\r\n"
"Content-Type: application/ocsp-request\r\n"
"Content-Length: %d\r\n"
- "\r\n",
+ "\r\n",
uri->path ? uri->path : "/",
uri->query ? "?" : "", uri->query ? uri->query : "",
uri->hostname, uri->port, len);
/* Send the OCSP request serialized into BIO 'request' to the
* responder at given server given by URI. Returns socket object or
* NULL on error. */
-static apr_socket_t *send_request(BIO *request, const apr_uri_t *uri,
+static apr_socket_t *send_request(BIO *request, const apr_uri_t *uri,
apr_interval_time_t timeout,
conn_rec *c, apr_pool_t *p)
{
rv = apr_sockaddr_info_get(&sa, uri->hostname, APR_UNSPEC, uri->port, 0, p);
if (rv) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c,
- "could not resolve address of OCSP responder %s",
+ "could not resolve address of OCSP responder %s",
uri->hostinfo);
return NULL;
}
-
- /* establish a connection to the OCSP responder */
- ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c,
+
+ /* establish a connection to the OCSP responder */
+ ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c,
"connecting to OCSP responder '%s'", uri->hostinfo);
/* Cycle through address until a connect() succeeds. */
return NULL;
}
- /* send the request and get a response */
- ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c,
+ /* send the request and get a response */
+ ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c,
"sending request to OCSP responder");
while ((len = BIO_read(request, buf, sizeof buf)) > 0) {
char *wbuf = buf;
apr_size_t remain = len;
-
+
do {
apr_size_t wlen = remain;
"failed reading line from OCSP server");
return NULL;
}
-
+
rv = apr_brigade_pflatten(bbout, &line, &len, p);
if (rv) {
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c,
return NULL;
}
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c,
- "OCSP response: got %" APR_SIZE_T_FMT
+ "OCSP response: got %" APR_SIZE_T_FMT
" bytes, %" APR_SIZE_T_FMT " total", len, count);
BIO_write(bio, data, (int)len);
OCSP_RESPONSE *modssl_dispatch_ocsp_request(const apr_uri_t *uri,
apr_interval_time_t timeout,
OCSP_REQUEST *request,
- conn_rec *c, apr_pool_t *p)
+ conn_rec *c, apr_pool_t *p)
{
OCSP_RESPONSE *response = NULL;
apr_socket_t *sd;
"could not serialize OCSP request");
return NULL;
}
-
+
sd = send_request(bio, uri, timeout, c, p);
if (sd == NULL) {
/* Errors already logged. */
return result;
}
-/*
+/*
* convert an X509_NAME to an RFC 2253 formatted string, optionally truncated
* to maxlen characters (specify a maxlen of 0 for no length limit)
*/
if (ok == TRUE) {
*p++ = 1;
expiry = apr_time_from_sec(mctx->stapling_cache_timeout);
- }
+ }
else {
*p++ = 0;
expiry = apr_time_from_sec(mctx->stapling_errcache_timeout);
/* If ID not present just pass back to client */
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
"stapling_check_response: certificate ID not present in response!");
- }
+ }
else {
if (OCSP_check_validity(thisupd, nextupd,
mctx->stapling_resptime_skew,
if (pok) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
"stapling_check_response: response times invalid");
- }
+ }
else {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
"stapling_check_response: cached response expired");
ocspuri);
rv = FALSE;
goto done;
- }
+ }
else if (strcmp(uri.scheme, "http")) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
"stapling_renew_response: Unsupported uri %s", ocspuri);
else {
goto done;
}
- }
+ }
else {
int response_status = OCSP_response_status(*prsp);
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
"stapling_renew_response: error in retreived response!");
}
- }
+ }
else {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
"stapling_renew_response: responder error %s",
int status;
apr_off_t len = 0;
apr_size_t bytes_sent = 0;
-
+
while (!APR_BRIGADE_EMPTY(db->bb) && bytes_sent < db->bytes_per_second) {
apr_bucket *e;
if (db->r->connection->aborted) {
return HTTP_INTERNAL_SERVER_ERROR;
}
-
+
status = apr_brigade_partition(db->bb, db->bytes_per_second, &e);
if (status != APR_SUCCESS && status != APR_INCOMPLETE) {
else {
APR_BRIGADE_CONCAT(db->tmpbb, db->bb);
}
-
+
e = apr_bucket_flush_create(db->r->connection->bucket_alloc);
-
+
APR_BRIGADE_INSERT_TAIL(db->tmpbb, e);
apr_brigade_length(db->tmpbb, 1, &len);
}
}
-static void
+static void
dialup_callback(void *baton)
{
int status;
/* See core.c, default handler for all of the cases we just decline. */
- if (r->method_number != M_GET ||
- r->finfo.filetype == APR_NOFILE ||
+ if (r->method_number != M_GET ||
+ r->finfo.filetype == APR_NOFILE ||
r->finfo.filetype == APR_DIR) {
return DECLINED;
}
}
db = apr_palloc(r->pool, sizeof(dialup_baton_t));
-
+
db->bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
db->tmpbb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
apr_bucket_file_enable_mmap(e, 0);
}
#endif
-
-
+
+
db->bytes_per_second = dcfg->bytes_per_second;
db->r = r;
db->fd = fd;
const modem_speed_t *standard;
int i = 0;
dialup_dcfg_t *dcfg = (dialup_dcfg_t*)dconf;
-
+
dcfg->bytes_per_second = 0;
while (modem_bitrates[i].name != NULL) {
dialup_dcfg_create(apr_pool_t *p, char *dummy)
{
dialup_dcfg_t *cfg = apr_palloc(p, sizeof(dialup_dcfg_t));
-
+
cfg->bytes_per_second = 0;
return cfg;
&& !APR_STATUS_IS_ENOTDIR(status)) {
ap_log_rerror(APLOG_MARK, APLOG_CRIT, status, r,
"%s pcfg_openfile: unable to check htaccess file, "
- "ensure it is readable and that '%s' "
+ "ensure it is readable and that '%s' "
"is executable",
filename, d);
apr_table_setn(r->notes, "error-notes",
static read_handle_t *read_handles;
/**
- * @brief The piped logging structure.
+ * @brief The piped logging structure.
*
- * Piped logs are used to move functionality out of the main server.
+ * Piped logs are used to move functionality out of the main server.
* For example, log rotation is done with piped logs.
*/
struct piped_log {
* take the parent process's child procs.
* If the win32 parent instead passed each and every
* logger write handle from itself down to the child,
- * and the parent manages all aspects of keeping the
+ * and the parent manages all aspects of keeping the
* reliable pipe log children alive, this would still
* make no sense :) Cripple it on Win32.
*/
*/
stderr_pool = p;
}
- if ((rc = apr_file_open_stderr(&stderr_log, stderr_pool))
+ if ((rc = apr_file_open_stderr(&stderr_log, stderr_pool))
== APR_SUCCESS) {
apr_file_flush(stderr_log);
- if ((rc = apr_file_dup2(stderr_log, stderr_file, stderr_pool))
+ if ((rc = apr_file_dup2(stderr_log, stderr_file, stderr_pool))
== APR_SUCCESS) {
apr_file_close(stderr_file);
/*
* You might ponder why stderr_pool should survive?
* The trouble is, stderr_pool may have s_main->error_log,
* so we aren't in a position to destory stderr_pool until
- * the next recycle. There's also an apparent bug which
- * is not; if some folk decided to call this function before
+ * the next recycle. There's also an apparent bug which
+ * is not; if some folk decided to call this function before
* the core open error logs hook, this pool won't survive.
* Neither does the stderr logger, so this isn't a problem.
*/
APR_NO_PIPE,
APR_NO_PIPE)) == APR_SUCCESS)
&& ((rc = apr_procattr_error_check_set(procattr, 1)) == APR_SUCCESS)
- && ((rc = apr_procattr_child_errfn_set(procattr, log_child_errfn))
+ && ((rc = apr_procattr_child_errfn_set(procattr, log_child_errfn))
== APR_SUCCESS)) {
char **args;
const char *pname;
/* In 2.4 favor PROGRAM_ENV, accept "||prog" syntax for compatibility
* and "|$cmd" to override the default.
- * Any 2.2 backport would continue to favor SHELLCMD_ENV so there
+ * Any 2.2 backport would continue to favor SHELLCMD_ENV so there
* accept "||prog" to override, and "|$cmd" to ease conversion.
*/
if (*fname == '|')
/* Register to throw away the read_handles list when we
* cleanup plog. Upon fork() for the apache children,
* this read_handles list is closed so only the parent
- * can relaunch a lost log child. These read handles
+ * can relaunch a lost log child. These read handles
* are always closed on exec.
- * We won't care what happens to our stderr log child
- * between log phases, so we don't mind losing stderr's
+ * We won't care what happens to our stderr log child
+ * between log phases, so we don't mind losing stderr's
* read_handle a little bit early.
*/
apr_pool_cleanup_register(p, &read_handles, ap_pool_cleanup_set_null,
apr_pool_cleanup_null);
/* HERE we need a stdout log that outlives plog.
- * We *presume* the parent of plog is a process
+ * We *presume* the parent of plog is a process
* or global pool which spans server restarts.
* Create our stderr_pool as a child of the plog's
* parent pool.
process_rec *process = s->process;
char *result;
int len_needed = 0;
-
+
/* Piece together the command line from the pieces
* in process->argv, with spaces in between.
*/
/* In 2.4 favor PROGRAM_ENV, accept "||prog" syntax for compatibility
* and "|$cmd" to override the default.
- * Any 2.2 backport would continue to favor SHELLCMD_ENV so there
+ * Any 2.2 backport would continue to favor SHELLCMD_ENV so there
* accept "||prog" to override, and "|$cmd" to ease conversion.
*/
if (*program == '|')
char ctimebuff[APR_CTIME_LEN];
apr_ctime(ctimebuff, apr_time_now());
fprintf(stderr, "[%s] [crit] (%d) %s: %s failed "
- "to initial context, exiting\n",
+ "to initial context, exiting\n",
ctimebuff, stat, (*argv)[0], failed);
apr_terminate();
exit(1);
"in this process");
}
else if (apr_atomic_read32(&connection_count) > threads_per_child
- + ap_queue_info_get_idlers(worker_queue_info) *
+ + ap_queue_info_get_idlers(worker_queue_info) *
worker_factor / WORKER_FACTOR_SCALE)
{
if (!listeners_disabled)
apr_status_t ap_queue_push_timer(fd_queue_t * queue, timer_event_t *te)
{
apr_status_t rv;
-
+
if ((rv = apr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) {
return rv;
}
-
+
AP_DEBUG_ASSERT(!queue->terminated);
APR_RING_INSERT_TAIL(&queue->timers, te, timer_event_t, link);
apr_thread_cond_signal(queue->not_empty);
-
+
if ((rv = apr_thread_mutex_unlock(queue->one_big_mutex)) != APR_SUCCESS) {
return rv;
}
-
+
return APR_SUCCESS;
}
elem->p = NULL;
#endif /* AP_DEBUG */
}
-
+
rv = apr_thread_mutex_unlock(queue->one_big_mutex);
return rv;
}
osthd = apr_os_thread_current();
apr_os_thread_put(&thd, &osthd, pchild);
#endif
-
+
apr_pool_create(&ptrans, pchild);
apr_pool_tag(ptrans, "transaction");
/* timeout == 10 seconds to avoid a hang at graceful restart/stop
* caused by the closing of sockets by the signal handler
*/
- status = apr_pollset_poll(pollset, apr_time_from_sec(10),
+ status = apr_pollset_poll(pollset, apr_time_from_sec(10),
&numdesc, &pdesc);
if (status != APR_SUCCESS) {
if (APR_STATUS_IS_TIMEUP(status) ||
apr_thread_mutex_lock(sc->mtx);
hi = apr_hash_first(sc->pool, sc->children);
if (hi != NULL) {
- apr_hash_this(hi, NULL, NULL, (void **)&child);
+ apr_hash_this(hi, NULL, NULL, (void **)&child);
apr_hash_set(sc->children, &child->pid, sizeof(child->pid), NULL);
}
apr_thread_mutex_unlock(sc->mtx);
-
+
if (child != NULL) {
kill(child->pid, 9);
/* TODO: recycle child object */
{
pid_t pid = 0;
int rv = 0;
- /* Although we could cut this off 'earlier', and not even invoke this
+ /* Although we could cut this off 'earlier', and not even invoke this
* function, I would like to keep the functions invoked when in debug mode
* to be as close as possible to those when not in debug... So, we just skip
* the actual spawn itself, but go through all of the motions...
*/
if (!sc->run_single_process) {
if (sc->spawn_via == SIMPLE_SPAWN_FORK) {
-
+
pid = fork();
if (pid == -1) {
rv = errno;
"simple_spawn_child: Unable to fork new process");
return rv;
}
-
+
if (pid == 0) {
/* this is the child process */
-
+
rv = simple_child_loop(sc);
if (rv) {
apr_thread_mutex_unlock(sc->mtx);
}
-
+
return 0;
}
if (sc->run_single_process && sc->restart_num == 2) {
static int run = 0;
- /* This is kinda of hack, but rather than spawning a child process,
+ /* This is kinda of hack, but rather than spawning a child process,
* we register the normal IO handlers in the main event loop....
*/
if (run == 0) {
if (g_simple_core) {
return APR_SUCCESS;
}
-
+
sc = g_simple_core = ap_retained_data_create(userdata_key, sizeof(*g_simple_core));
apr_pool_create(&sc->pool, ap_pglobal);
rv = apr_socket_accept(&socket, lr->sd, ptrans);
if (rv) {
/* pqXXXXXX: unixd.c has _tons_ of custom handling on return values
- * from accept, but it seems really crazy, it either worked, or didn't,
- * but taking this approach of swallowing the error it is possible we have a
- * fatal error on our listening socket, but we don't notice.
- *
+ * from accept, but it seems really crazy, it either worked, or didn't,
+ * but taking this approach of swallowing the error it is possible we have a
+ * fatal error on our listening socket, but we don't notice.
+ *
* Need to discuss this on dev@
*/
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
}
/* XXXXX: Hack. Reseting parts of the simple core needs to be more
- * thought out than this.
+ * thought out than this.
*/
APR_RING_INIT(&sc->timer_ring, simple_timer_t, link);
if (rv) {
return rv;
}
-
+
rv = simple_setup_workers(sc);
if (rv) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
#ifdef __MINGW32__
#include <mswsock.h>
-#endif
+#endif
/*
* The Windows MPM uses a queue of completion contexts that it passes
/* Create the transaction pool */
apr_allocator_create(&allocator);
apr_allocator_max_free_set(allocator, ap_max_mem_free);
- rv = apr_pool_create_ex(&context->ptrans, pchild, NULL,
+ rv = apr_pool_create_ex(&context->ptrans, pchild, NULL,
allocator);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf,
else {
accf = 0;
accf_name = "none";
- ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(),
+ ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(),
ap_server_conf,
"winnt_accept: unrecognized AcceptFilter '%s', "
"only 'data', 'connect' or 'none' are valid. "
#if APR_HAVE_IPV6
if (getsockname(nlsd, (struct sockaddr *)&ss_listen, &namelen) == SOCKET_ERROR) {
- ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_netos_error(),
+ ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_netos_error(),
ap_server_conf,
"winnt_accept: getsockname error on listening socket, "
"is IPv6 available?");
/* Create and initialize the accept socket */
#if APR_HAVE_IPV6
if (context->accept_socket == INVALID_SOCKET) {
- context->accept_socket = socket(ss_listen.ss_family, SOCK_STREAM,
+ context->accept_socket = socket(ss_listen.ss_family, SOCK_STREAM,
IPPROTO_TCP);
context->socket_family = ss_listen.ss_family;
}
else if (context->socket_family != ss_listen.ss_family) {
closesocket(context->accept_socket);
- context->accept_socket = socket(ss_listen.ss_family, SOCK_STREAM,
+ context->accept_socket = socket(ss_listen.ss_family, SOCK_STREAM,
IPPROTO_TCP);
context->socket_family = ss_listen.ss_family;
}
#endif
if (context->accept_socket == INVALID_SOCKET) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(),
+ ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(),
ap_server_conf,
"winnt_accept: Failed to allocate an accept socket. "
"Temporary resource constraint? Try again.");
/* We can get here when:
* 1) TransmitFile does not properly recycle the accept socket (typically
* because the client disconnected)
- * 2) there is VPN or Firewall software installed with
+ * 2) there is VPN or Firewall software installed with
* buggy WSAAccept or WSADuplicateSocket implementation
* 3) the dynamic address / adapter has changed
* Give five chances, then fall back on AcceptFilter 'none'
/* Not a failure condition. Keep running. */
}
- /* Get the local & remote address
+ /* Get the local & remote address
* TODO; error check
*/
GetAcceptExSockaddrs(buf, len, PADDED_ADDR_SIZE, PADDED_ADDR_SIZE,
&context->sa_server, &context->sa_server_len,
&context->sa_client, &context->sa_client_len);
- /* For 'data', craft a bucket for our data result
+ /* For 'data', craft a bucket for our data result
* and pass to worker_main as context->overlapped.Pointer
*/
if (accf == 2 && BytesRead)
if (rv != WAIT_OBJECT_0 + 2) {
- /* not FD_ACCEPT;
- * exit_event triggered or event handle was closed
+ /* not FD_ACCEPT;
+ * exit_event triggered or event handle was closed
*/
break;
}
}
break;
}
- /* Per MSDN, cancel the inherited association of this socket
+ /* Per MSDN, cancel the inherited association of this socket
* to the WSAEventSelect API, and restore the state corresponding
* to apr_os_sock_make's default assumptions (really, a flaw within
* os_sock_make and os_sock_put that it does not query).
sockinfo.family = context->sa_server->sa_family;
sockinfo.type = SOCK_STREAM;
/* Restore the state corresponding to apr_os_sock_make's default
- * assumption of timeout -1 (really, a flaw of os_sock_make and
+ * assumption of timeout -1 (really, a flaw of os_sock_make and
* os_sock_put that it does not query to determine ->timeout).
* XXX: Upon a fix to APR, these three statements should disappear.
*/
ioctlsocket(context->accept_socket, FIONBIO, &zero);
- setsockopt(context->accept_socket, SOL_SOCKET, SO_RCVTIMEO,
+ setsockopt(context->accept_socket, SOL_SOCKET, SO_RCVTIMEO,
(char *) &zero, sizeof(zero));
- setsockopt(context->accept_socket, SOL_SOCKET, SO_SNDTIMEO,
+ setsockopt(context->accept_socket, SOL_SOCKET, SO_SNDTIMEO,
(char *) &zero, sizeof(zero));
apr_os_sock_make(&context->sock, &sockinfo, context->ptrans);
}
-static void cleanup_thread(HANDLE *handles, int *thread_cnt,
+static void cleanup_thread(HANDLE *handles, int *thread_cnt,
int thread_to_clean)
{
int i;
for (lr = ap_listeners; lr; lr = lr->next) {
if (lr->sd != NULL) {
/* A smaller stack is sufficient.
- * To convert to CreateThread, the returned handle cannot be
+ * To convert to CreateThread, the returned handle cannot be
* ignored, it must be closed/joined.
*/
_beginthreadex(NULL, 65536, winnt_accept,
*/
/* Create the worker thread dispatch IOCP */
ThreadDispatchIOCP = CreateIoCompletionPort(INVALID_HANDLE_VALUE,
- NULL, 0, 0);
+ NULL, 0, 0);
apr_thread_mutex_create(&qlock, APR_THREAD_MUTEX_DEFAULT, pchild);
qwait_event = CreateEvent(NULL, TRUE, FALSE, NULL);
if (!qwait_event) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(),
+ ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(),
ap_server_conf,
"Child: Failed to create a qwait event.");
exit(APEXIT_CHILDINIT);
continue;
}
ap_update_child_status_from_indexes(0, i, SERVER_STARTING, NULL);
-
+
child_handles[i] = CreateThread(NULL, ap_thread_stacksize,
worker_main, (void *) i,
stack_res_flag, &tid);
goto shutdown;
}
threads_created++;
- /* Save the score board index in ht keyed to the thread handle.
+ /* Save the score board index in ht keyed to the thread handle.
* We need this when cleaning up threads down below...
*/
apr_thread_mutex_lock(child_lock);
"Child: %d threads blocked on the completion port",
g_blocked_threads);
for (i=g_blocked_threads; i > 0; i--) {
- PostQueuedCompletionStatus(ThreadDispatchIOCP, 0,
+ PostQueuedCompletionStatus(ThreadDispatchIOCP, 0,
IOCP_SHUTDOWN, NULL);
}
Sleep(1000);
apr_thread_mutex_unlock(qlock);
/* Give busy threads a chance to service their connections
- * (no more than the global server timeout period which
+ * (no more than the global server timeout period which
* we track in msec remaining).
*/
watch_thread = 0;
/* Every 30 seconds give an update */
if ((time_remains % 30000) == 0) {
- ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS,
+ ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS,
ap_server_conf,
"Child: Waiting %d more seconds "
- "for %d worker threads to finish.",
+ "for %d worker threads to finish.",
time_remains / 1000, threads_created);
}
/* We'll poll from the top, 10 times per second */
for (envc = 0; _environ[envc]; ++envc) {
;
}
- env = apr_palloc(ptemp, (envc + 2) * sizeof (char*));
+ env = apr_palloc(ptemp, (envc + 2) * sizeof (char*));
memcpy(env, _environ, envc * sizeof (char*));
apr_snprintf(pidbuf, sizeof(pidbuf), "AP_PARENT_PID=%lu", parent_pid);
env[envc] = pidbuf;
/* We wish this was *always* a reservation, but sadly it wasn't so and
* we couldn't break a hard limit prior to NT Kernel 5.1
*/
- if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT
+ if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT
&& ((osver.dwMajorVersion > 5)
|| ((osver.dwMajorVersion == 5) && (osver.dwMinorVersion > 0)))) {
stack_res_flag = STACK_SIZE_PARAM_IS_A_RESERVATION;
}
/* This child needs the existing stderr opened for logging,
- * already
+ * already
*/
/* Open a null handle to soak stdout in this process.
* Windows service processes are missing any file handle
- * usable for stdin/out/err. This was the cause of later
+ * usable for stdin/out/err. This was the cause of later
* trouble with invocations of apr_file_open_stdout()
*/
if ((rv = apr_file_open(&nullfile, "NUL",
}
}
/* Always reset our console handler to be the first, even on a restart
- * because some modules (e.g. mod_perl) might have set a console
+ * because some modules (e.g. mod_perl) might have set a console
* handler to terminate the process.
*/
if (strcasecmp(signal_arg, "runservice"))
WaitForSingleObject(stderr_ready, INFINITE);
- if ((apr_file_open_stderr(&stderr_file, p)
+ if ((apr_file_open_stderr(&stderr_file, p)
== APR_SUCCESS)
&& (apr_os_file_put(&eventlog_file, &hPipeWrite, APR_WRITE, p)
== APR_SUCCESS))
/* handle the SCM's ControlService() callbacks to our service */
-static DWORD WINAPI service_nt_ctrl(DWORD dwCtrlCode, DWORD dwEventType,
+static DWORD WINAPI service_nt_ctrl(DWORD dwCtrlCode, DWORD dwEventType,
LPVOID lpEventData, LPVOID lpContext)
{
nt_service_ctx_t *ctx = lpContext;
}
/* unblock the listener if it's waiting for a worker */
- ap_queue_info_term(worker_queue_info);
+ ap_queue_info_term(worker_queue_info);
/*
* we should just be able to "kill(ap_my_pid, LISTENER_SIGNAL)" on all
if (ap_scoreboard_image->parent[process_slot].generation !=
ap_scoreboard_image->global->running_generation) {
level = APLOG_DEBUG; /* common to get these at restart time */
- }
- else if (requests_this_child == INT_MAX
+ }
+ else if (requests_this_child == INT_MAX
|| ((requests_this_child == ap_max_requests_per_child)
- && ap_max_requests_per_child)) {
+ && ap_max_requests_per_child)) {
ap_log_error(APLOG_MARK, level, rv, ap_server_conf,
"apr_proc_mutex_%s failed "
"before this child process served any requests.",
func);
- clean_child_exit(APEXIT_CHILDSICK);
+ clean_child_exit(APEXIT_CHILDSICK);
}
ap_log_error(APLOG_MARK, level, rv, ap_server_conf,
"apr_proc_mutex_%s failed. Attempting to "
bucket_alloc = apr_bucket_alloc_create(ptrans);
process_socket(thd, ptrans, csd, process_slot, thread_slot, bucket_alloc);
worker_sockets[thread_slot] = NULL;
- requests_this_child--;
+ requests_this_child--;
apr_pool_clear(ptrans);
last_ptrans = ptrans;
}
*/
if (ps->pid != 0) { /* XXX just set all_dead_threads in outer for
loop if no pid? not much else matters */
- if (status <= SERVER_READY &&
+ if (status <= SERVER_READY &&
!ps->quiescing &&
ps->generation == retained->my_generation) {
++idle_thread_count;
/* terminate the free list */
if (free_length == 0) { /* scoreboard is full, can't fork */
- if (active_thread_count >= ap_daemons_limit * threads_per_child) {
+ if (active_thread_count >= ap_daemons_limit * threads_per_child) {
/* no threads are "inactive" - starting, stopping, etc. */
/* have we reached MaxRequestWorkers, or just getting close? */
if (0 == idle_thread_count) {
/* Ensure pid sanity. */
if (pid < 1) {
return 1;
- }
+ }
proc.pid = pid;
waitret = apr_proc_wait(&proc, &status, &why, APR_NOWAIT);
return APR_EINVAL;
}
- pg = getpgid(pid);
+ pg = getpgid(pid);
if (pg == -1) {
/* Process already dead... */
return errno;
"process group", sig, (long)pid);
return APR_EINVAL;
}
-#endif
+#endif
return kill(pid, sig) ? errno : APR_SUCCESS;
}
process->argc = mpm_new_argv->nelts;
process->argv = (const char * const *)mpm_new_argv->elts;
-
- if (NULL == dash_k_arg) {
+
+ if (NULL == dash_k_arg) {
dash_k_arg = dash_k_arg_noarg;
}
tmp_bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
ap_run_pre_read_request(r, conn);
-
+
/* Get the request... */
if (!read_request_line(r, tmp_bb)) {
if (r->status == HTTP_REQUEST_URI_TOO_LARGE
apr_status_t rv;
bb = apr_brigade_create(r->pool, c->bucket_alloc);
-
+
apr_brigade_insert_file(bb, fd, offset, len, r->pool);
rv = ap_pass_brigade(r->output_filters, bb);
* until some module interjects and changes the value.
*/
rnew->used_path_info = AP_REQ_DEFAULT_PATH_INFO;
-
+
/* Pass on the kept body (if any) into the new request. */
rnew->kept_body = r->kept_body;
ap_log_perror(APLOG_MARK, APLOG_ALERT|APLOG_STARTUP, 0, a,
"%s: Could not reliably determine the server's fully qualified "
"domain name, using %s. Set the 'ServerName' directive globally "
- "to suppress this message",
+ "to suppress this message",
ap_server_argv0, server_hostname);
return server_hostname;
return result;
}
-static const char *ap_expr_eval_var(ap_expr_eval_ctx_t *ctx,
+static const char *ap_expr_eval_var(ap_expr_eval_ctx_t *ctx,
const ap_expr_var_func_t *func,
const void *data)
{
return v;
}
t = ctx->r->err_headers_out;
- }
+ }
else if (name[0] == 'n') /* notes */
t = ctx->r->notes;
else if (name[3] == 'e') /* reqenv */
if (ret == OK)
return result;
ap_log_rerror(LOG_MARK(ctx->info), APLOG_DEBUG, 0, ctx->r,
- "%s %% escape in unescape('%s') at %s:%d",
+ "%s %% escape in unescape('%s') at %s:%d",
ret == HTTP_BAD_REQUEST ? "Bad" : "Forbidden", arg,
ctx->info->filename, ctx->info->line_number);
return "";
/* A Bison parser, made by GNU Bison 2.4.1. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
-
+
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
-
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
+ * if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
+typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
-
+
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
-
+
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
/* This must go here because YYSTYPE and YYLTYPE are included
* from bison output in section 1.*/
# define yylval yyg->yylval_r
-
+
int ap_expr_yylex_init (yyscan_t* scanner);
int ap_expr_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
#endif
static void yy_push_state (int new_state ,yyscan_t yyscanner);
-
+
static void yy_pop_state (yyscan_t yyscanner );
-
+
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
/* rule 1 can match eol */
YY_RULE_SETUP
#line 103 "util_expr_scan.l"
-{
+{
/* NOP */
}
YY_BREAK
YY_BUFFER_STATE ap_expr_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
-
+
b = (YY_BUFFER_STATE) ap_expr_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in ap_expr_yy_create_buffer()" );
}
b->yy_is_interactive = 0;
-
+
errno = oerrno;
}
, yyscanner);
if ( ! yyg->yy_buffer_stack )
YY_FATAL_ERROR( "out of dynamic memory in ap_expr_yyensure_buffer_stack()" );
-
+
memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
+
yyg->yy_buffer_stack_max = num_to_alloc;
yyg->yy_buffer_stack_top = 0;
return;
* @param base the character buffer
* @param size the size in bytes of the character buffer
* @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
+ * @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE ap_expr_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
-
+
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
*/
YY_BUFFER_STATE ap_expr_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
{
-
+
return ap_expr_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
}
char *buf;
yy_size_t n;
int i;
-
+
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
buf = (char *) ap_expr_yyalloc(n ,yyscanner );
int ap_expr_yyget_lineno (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
+
if (! YY_CURRENT_BUFFER)
return 0;
-
+
return yylineno;
}
/* lineno is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "ap_expr_yyset_lineno called with no buffer" , yyscanner);
-
+ yy_fatal_error( "ap_expr_yyset_lineno called with no buffer" , yyscanner);
+
yylineno = line_number;
}
errno = EINVAL;
return 1;
}
-
+
*ptr_yy_globals = (yyscan_t) ap_expr_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
-
+
if (*ptr_yy_globals == NULL){
errno = ENOMEM;
return 1;
}
-
+
/* By setting to 0xAA, we expose bugs in
yy_init_globals. Leave at 0x00 for releases. */
memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
+
ap_expr_yyset_extra (yy_user_defined, *ptr_yy_globals);
-
+
return yy_init_globals ( *ptr_yy_globals );
}
mechdir = ap_getword_conf(cmd->pool, &arg);
if (*mechdir == '\0') {
- return "Mutex requires at least a mechanism argument ("
+ return "Mutex requires at least a mechanism argument ("
AP_ALL_AVAILABLE_MUTEXES_STRING ")";
}
* preg points to a structure for recording the compiled expression
* pattern the pattern to compile
* cflags compilation flags
- *
+ *
* Returns: 0 on success
* various non-zero codes on failure
*/
/* PR#38070: This fails because it gets confused when a
* CGI Status header overrides ap_meets_conditions.
- *
+ *
* We can fix that by dropping ap_meets_conditions when
* Status has been set. Since this is the only place
* cgi_status gets used, let's test it explicitly.
if (str == NULL) {
return;
}
-
+
key = apr_strtok(str, "&", &strtok_state);
while (key) {
value = strchr(key, '=');
server_rec *server; /* the server to use if this matches */
name_chain *names; /* if non-NULL then a list of name-vhosts
* sharing this address */
- name_chain *initialnames; /* no runtime use, temporary storage of first
+ name_chain *initialnames; /* no runtime use, temporary storage of first
* NVH'es names */
};
const char *arg)
{
static int warnonce = 0;
- if (++warnonce == 1) {
- ap_log_error(APLOG_MARK, APLOG_NOTICE|APLOG_STARTUP, APR_SUCCESS, NULL,
- "NameVirtualHost has no effect and will be removed in the "
- "next release %s:%d",
- cmd->directive->filename,
+ if (++warnonce == 1) {
+ ap_log_error(APLOG_MARK, APLOG_NOTICE|APLOG_STARTUP, APR_SUCCESS, NULL,
+ "NameVirtualHost has no effect and will be removed in the "
+ "next release %s:%d",
+ cmd->directive->filename,
cmd->directive->line_num);
}
if (wild_match == NULL && (cur->port == 0 || sa->port == 0)) {
if (apr_sockaddr_equal(cur, sa)) {
/* don't break, continue looking for an exact match */
- wild_match = trav;
+ wild_match = trav;
}
}
}
if (wild_match == NULL && sar->host_port == 0) {
/* don't break, continue looking for an exact match */
wild_match = trav;
- }
+ }
}
return wild_match;
}
nc->next = ic->names;
/* iterating backwards, so each one we see becomes the current default server */
- ic->server = s;
+ ic->server = s;
- if (ic->names == NULL) {
- if (ic->initialnames == NULL) {
+ if (ic->names == NULL) {
+ if (ic->initialnames == NULL) {
/* first pass, set these names aside in case we see another VH.
* Until then, this looks like an IP-based VH to runtime.
*/
ic->initialnames = nc;
}
- else {
+ else {
/* second pass through this chain -- this really is an NVH, and we
* have two sets of names to link in.
*/
ic->initialnames = NULL;
}
}
- else {
+ else {
/* 3rd or more -- just keep stacking the names */
ic->names = nc;
}
if (!memcmp(sar->host_addr->ipaddr_ptr, inaddr_any, sar->host_addr->ipaddr_len)) {
ic = find_default_server(sar->host_port);
- if (!ic || sar->host_port != ic->sar->host_port) {
- /* No default server, or we found a default server but
+ if (!ic || sar->host_port != ic->sar->host_port) {
+ /* No default server, or we found a default server but
** exactly one of us is a wildcard port, which means we want
** two ip-based vhosts not an NVH with two names
*/
/* see if it matches something we've already got */
ic = find_ipaddr(sar->host_addr);
- if (!ic || sar->host_port != ic->sar->host_port) {
- /* No matching server, or we found a matching server but
+ if (!ic || sar->host_port != ic->sar->host_port) {
+ /* No matching server, or we found a matching server but
** exactly one of us is a wildcard port, which means we want
** two ip-based vhosts not an NVH with two names
*/
}
if (windowsize != 0) {
- rv = apr_socket_opt_set(c->aprsock, APR_SO_SNDBUF,
+ rv = apr_socket_opt_set(c->aprsock, APR_SO_SNDBUF,
windowsize);
if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
apr_err("socket send buffer", rv);
}
- rv = apr_socket_opt_set(c->aprsock, APR_SO_RCVBUF,
+ rv = apr_socket_opt_set(c->aprsock, APR_SO_RCVBUF,
windowsize);
if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
apr_err("socket receive buffer", rv);
"\nTest aborted after 10 failures\n\n");
apr_err("apr_socket_connect()", rv);
}
-
+
start_connect(c);
return;
}
/* The response may not have a Content-Length header */
if (!cl) {
c->keepalive = 1;
- c->length = 0;
+ c->length = 0;
}
}
c->bread += c->cbx - (s + l - c->cbuff) + r - tocopy;
}
if (verbosity >= 2)
- printf("INFO: %s header == \n---\n%s\n---\n",
+ printf("INFO: %s header == \n---\n%s\n---\n",
method_str[method], request);
reqlen = strlen(request);
start = lasttime = apr_time_now();
stoptime = tlimit ? (start + apr_time_from_sec(tlimit)) : AB_MAX;
-#ifdef SIGINT
+#ifdef SIGINT
/* Output the results if the user terminates the run early. */
apr_signal(SIGINT, output_results);
#endif
bad++;
err_except++;
/* avoid apr_poll/EINPROGRESS loop on HP-UX, let recv discover ECONNREFUSED */
- if (c->state == STATE_CONNECTING) {
+ if (c->state == STATE_CONNECTING) {
read_connection(c);
}
- else {
+ else {
start_connect(c);
}
continue;
}
}
} while (lasttime < stoptime && done < requests);
-
+
if (heartbeatres)
fprintf(stderr, "Finished %d requests\n", done);
else
#undef NL
static void usage_repeated_arg(apr_pool_t *pool, char option) {
- usage(apr_psprintf(pool,
+ usage(apr_psprintf(pool,
"The option '%c' cannot be specified more than once",
option));
}
if (errfile) {
apr_file_printf(errfile,
"Could not write the pid file '%s': %s" APR_EOL_STR,
- pidfilename,
+ pidfilename,
apr_strerror(status, errmsg, sizeof errmsg));
}
exit(1);
static void generate_salt(char *s, size_t size)
{
- static unsigned char tbl[] =
+ static unsigned char tbl[] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
size_t i;
for (i = 0; i < size; ++i) {
exit(2);
}
}
-
+
if (!config->postrotate_prog) {
/* Nothing more to do. */
return;
int tLogStart;
apr_status_t rv;
struct logfile newlog;
-
+
status->rotateReason = ROTATE_NONE;
if (config->tRotation) {
fprintf(stderr, "Could not open log file '%s' (%s)\n", newlog.name, error);
exit(2);
}
-
+
/* Throw away new state; it isn't going to be used. */
apr_pool_destroy(newlog.pool);
-
+
/* Try to keep this error message constant length
* in case it occurs several times. */
apr_snprintf(status->errbuf, sizeof status->errbuf,
"new log file, %10d messages lost: %-25.25s\n",
status->nMessCount, error);
nWrite = strlen(status->errbuf);
-
+
if (apr_file_trunc(status->current.fd, 0) != APR_SUCCESS) {
fprintf(stderr, "Error truncating the file %s\n", status->current.name);
exit(2);
- }
+ }
if (apr_file_write(status->current.fd, status->errbuf, &nWrite) != APR_SUCCESS) {
fprintf(stderr, "Error writing to the file %s\n", status->current.name);
exit(2);
}
}
-
+
status->nMessCount = 0;
}
}
-int am_RespawnAsUserAdmin(HWND hwnd, DWORD op, LPCTSTR szService,
+int am_RespawnAsUserAdmin(HWND hwnd, DWORD op, LPCTSTR szService,
LPCTSTR szComputerName)
{
TCHAR args[MAX_PATH + MAX_COMPUTERNAME_LENGTH + 12];
return 0;
}
- _sntprintf(args, sizeof(args) / sizeof(TCHAR),
+ _sntprintf(args, sizeof(args) / sizeof(TCHAR),
_T("%d \"%s\" \"%s\""), op, szService,
szComputerName ? szComputerName : _T(""));
if (!ShellExecute(hwnd, _T("runas"), __targv[0], args, NULL, SW_NORMAL)) {
}
if (RegConnectRegistry(szComputerName, HKEY_LOCAL_MACHINE, &hKeyRemote)
!= ERROR_SUCCESS) {
- _sntprintf(szTmp, sizeof(szTmp) / sizeof(TCHAR),
+ _sntprintf(szTmp, sizeof(szTmp) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_ECONNECT - IDS_MSG_FIRST],
szComputerName);
ErrorMessage(szTmp, FALSE);
if (osvi.dwMajorVersion >= 5)
*dwVersion = OS_VERSION_WIN2K;
else
- *dwVersion = OS_VERSION_WINNT;
+ *dwVersion = OS_VERSION_WINNT;
break;
case VER_PLATFORM_WIN32_WINDOWS:
_tcscpy(nid.szTip, g_lpMsg[IDS_MSG_RUNNINGALL - IDS_MSG_FIRST]);
}
else if (n) {
- _sntprintf(nid.szTip, sizeof(nid.szTip) / sizeof(TCHAR),
+ _sntprintf(nid.szTip, sizeof(nid.szTip) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_RUNNING - IDS_MSG_FIRST], n, i);
}
else if (i) {
- _sntprintf(nid.szTip, sizeof(nid.szTip) / sizeof(TCHAR),
+ _sntprintf(nid.szTip, sizeof(nid.szTip) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_RUNNINGNONE - IDS_MSG_FIRST], i);
}
else {
{
/* Avoid recursion of ImagePath NULL (from this Respawn) */
if (szImagePath) {
- am_RespawnAsUserAdmin(g_hwndMain, dwCommand,
+ am_RespawnAsUserAdmin(g_hwndMain, dwCommand,
szServiceName, szComputerName);
}
else {
switch (dwCommand)
{
case SERVICE_CONTROL_STOP:
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_SRVSTOP - IDS_MSG_FIRST],
szServiceName);
addListBoxString(g_hwndStdoutList, szMsg);
if (schSStatus.dwCurrentState == SERVICE_STOPPED)
{
retValue = TRUE;
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_SRVSTOPPED - IDS_MSG_FIRST],
szServiceName);
addListBoxString(g_hwndStdoutList, szMsg);
if (schSStatus.dwCurrentState == SERVICE_RUNNING)
{
retValue = TRUE;
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_SRVSTARTED - IDS_MSG_FIRST],
szServiceName);
addListBoxString(g_hwndStdoutList, szMsg);
break;
case SERVICE_APACHE_RESTART:
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_SRVRESTART - IDS_MSG_FIRST],
szServiceName);
addListBoxString(g_hwndStdoutList, szMsg);
if (schSStatus.dwCurrentState == SERVICE_RUNNING)
{
retValue = TRUE;
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_SRVRESTARTED - IDS_MSG_FIRST],
szServiceName);
addListBoxString(g_hwndStdoutList, szMsg);
int exitcode = 0;
PWTS_PROCESS_INFO tsProcs;
DWORD tsProcCount, i;
- DWORD thisProcId;
+ DWORD thisProcId;
/* This is graceful, close our own Window, clearing the icon */
if ((appwindow = FindWindow(g_szWindowClass, g_szTitle)) != NULL)
for (i = 0; i < tsProcCount; ++i) {
if (_tcscmp(tsProcs[i].pProcessName, _T(AM_STRINGIFY(BIN_NAME))) == 0
&& tsProcs[i].ProcessId != thisProcId)
- WTSTerminateProcess(WTS_CURRENT_SERVER_HANDLE,
+ WTSTerminateProcess(WTS_CURRENT_SERVER_HANDLE,
tsProcs[i].ProcessId, 1);
}
WTSFreeMemory(tsProcs);