Fix warnings on Solaris and/or 64bit builds.

This commit is contained in:
brectanus
2007-11-02 22:31:47 +00:00
parent 7f1c802b49
commit 5a54d3300d
10 changed files with 46 additions and 31 deletions

View File

@@ -1,3 +1,9 @@
02 Nov 2007 - 2.1.4-rc3
-----------------------
* Fix warnings on Solaris and/or 64bit builds.
25 Oct 2007 - 2.1.4-rc2
-----------------------

View File

@@ -17,7 +17,17 @@ builddir = .
# Debian - /usr/share/apache2 (apache2-prefork-dev or apache2-threaded-dev
# needed, depending on your installation type)
#
top_dir = /apps/apache22
# NOTE: On Solaris the top_builddir is /var/apache2. This version of Apache
# httpd uses the buildin PCRE, but you must still install the PCRE headers
# to compile ModSecurity as they are not installed with Apache httpd. Because
# of this, it is recommended to install your own version of Apache httpd.
#
# Additionally, if you do not have PCRE installed, you can use the
# headers included with Apache httpd. To do this, add the PCRE
# include directory to the INCLUDES variable below
# Something like: -I /path/to/httpd-x.y/srclib/pcre
#
top_dir = /usr/local/apache2
top_srcdir = ${top_dir}
top_builddir = ${top_dir}
@@ -28,6 +38,7 @@ APXS = apxs
APACHECTL = apachectl
INCLUDES = -I /usr/include/libxml2
#INCLUDES = -I /usr/include/libxml2 -I /path/to/httpd-x.y/srclib/pcre
DEFS = -DWITH_LIBXML2
#DEFS = -DWITH_LIBXML2 -DNO_MODSEC_API
#LIBS = -Lmy/lib/dir -lmylib

View File

@@ -438,7 +438,7 @@ static int hook_post_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_t
if (first_time == 0) {
ap_log_error(APLOG_MARK, APLOG_NOTICE | APLOG_NOERRNO, 0, s,
"ModSecurity: chroot checkpoint #2 (pid=%d ppid=%d)", getpid(), getppid());
"ModSecurity: chroot checkpoint #2 (pid=%d ppid=%d)", (int)getpid(), (int)getppid());
if (chdir(chroot_dir) < 0) {
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, s,
@@ -467,7 +467,7 @@ static int hook_post_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_t
"ModSecurity: chroot successful, path=%s", chroot_dir);
} else {
ap_log_error(APLOG_MARK, APLOG_NOTICE | APLOG_NOERRNO, 0, s,
"ModSecurity: chroot checkpoint #1 (pid=%d ppid=%d)", getpid(), getppid());
"ModSecurity: chroot checkpoint #1 (pid=%d ppid=%d)", (int)getpid(), (int)getppid());
}
}
#endif

View File

@@ -460,9 +460,8 @@ apr_status_t modsecurity_process_phase(modsec_rec *msr, int phase) {
break;
default :
msr_log(msr, 1, "Invalid processing phase: %i", msr->phase);
return -1;
break;
}
return 0;
return -1;
}

View File

@@ -57,8 +57,8 @@ typedef struct msc_string msc_string;
#define PHASE_RESPONSE_BODY 4
#define PHASE_LOGGING 5
#define NOT_SET -1
#define NOT_SET_P (void *)-1
#define NOT_SET -1l
#define NOT_SET_P (void *)-1l
#define CREATEMODE ( APR_UREAD | APR_UWRITE | APR_GREAD )
#define CREATEMODE_DIR ( APR_UREAD | APR_UWRITE | APR_UEXECUTE | APR_GREAD | APR_GEXECUTE )

View File

@@ -138,17 +138,16 @@ apr_status_t msre_rule_process(msre_rule *rule, modsec_rec *msr);
#define PHASE_RESPONSE_BODY 4
#define PHASE_LOGGING 5
#define FN_OP_PARAM_INIT(X) int (*X)(msre_rule *rule, char **error_msg)
#define FN_OP_EXECUTE(X) int (*X)(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg)
typedef int (*fn_op_param_init_t)(msre_rule *rule, char **error_msg);
typedef int (*fn_op_execute_t)(modsec_rec *msr, msre_rule *rule, msre_var *var, char **error_msg);
struct msre_op_metadata {
const char *name;
FN_OP_PARAM_INIT (param_init);
FN_OP_EXECUTE (execute);
fn_op_param_init_t param_init;
fn_op_execute_t execute;
};
#define FN_TFN_EXECUTE(X) int (*X)(apr_pool_t *pool, unsigned char *input, long int input_length, char **rval, long int *rval_length)
typedef int (*fn_tfn_execute_t)(apr_pool_t *pool, unsigned char *input, long int input_length, char **rval, long int *rval_length);
struct msre_tfn_metadata {
const char *name;
@@ -186,16 +185,16 @@ msre_tfn_metadata DSOLOCAL *msre_engine_tfn_resolve(msre_engine *engine, const c
#define VAR_DONT_CACHE 0
#define VAR_CACHE 1
#define FN_VAR_VALIDATE(X) char *(*X)(msre_ruleset *ruleset, msre_var *var)
#define FN_VAR_GENERATE(X) int (*X)(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *table, apr_pool_t *mptmp)
typedef char *(*fn_var_validate_t)(msre_ruleset *ruleset, msre_var *var);
typedef int (*fn_var_generate_t)(modsec_rec *msr, msre_var *var, msre_rule *rule, apr_table_t *table, apr_pool_t *mptmp);
struct msre_var_metadata {
const char *name;
unsigned int type; /* VAR_TYPE_ constants */
unsigned int argc_min;
unsigned int argc_max;
FN_VAR_VALIDATE (validate);
FN_VAR_GENERATE (generate);
fn_var_validate_t validate;
fn_var_generate_t generate;
unsigned int is_cacheable; /* 0 - no, 1 - yes */
unsigned int availability; /* when does this variable become available? */
};
@@ -248,9 +247,9 @@ msre_actionset *msre_actionset_create_default(msre_engine *engine);
void msre_actionset_init(msre_actionset *actionset, msre_rule *rule);
#define FN_ACTION_VALIDATE(X) char *(*X)(msre_engine *engine, msre_action *action)
#define FN_ACTION_INIT(X) apr_status_t (*X)(msre_engine *engine, msre_actionset *actionset, msre_action *action)
#define FN_ACTION_EXECUTE(X) apr_status_t (*X)(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action)
typedef char *(*fn_action_validate_t)(msre_engine *engine, msre_action *action);
typedef apr_status_t (*fn_action_init_t)(msre_engine *engine, msre_actionset *actionset, msre_action *action);
typedef apr_status_t (*fn_action_execute_t)(modsec_rec *msr, apr_pool_t *mptmp, msre_rule *rule, msre_action *action);
#define ACTION_DISRUPTIVE 1
#define ACTION_NON_DISRUPTIVE 2
@@ -270,9 +269,9 @@ struct msre_action_metadata {
unsigned int argc_max;
unsigned int allow_param_plusminus;
unsigned int cardinality;
FN_ACTION_VALIDATE (validate);
FN_ACTION_INIT (init);
FN_ACTION_EXECUTE (execute);
fn_action_validate_t validate;
fn_action_init_t init;
fn_action_execute_t execute;
};
struct msre_action {

View File

@@ -16,8 +16,8 @@
*/
static void msre_engine_action_register(msre_engine *engine, const char *name, unsigned int type,
unsigned int argc_min, unsigned int argc_max, unsigned int allow_param_plusminus,
unsigned int cardinality, FN_ACTION_VALIDATE(validate), FN_ACTION_INIT(init),
FN_ACTION_EXECUTE(execute))
unsigned int cardinality, fn_action_validate_t validate, fn_action_init_t init,
fn_action_execute_t execute)
{
msre_action_metadata *metadata = (msre_action_metadata *)apr_pcalloc(engine->mp,
sizeof(msre_action_metadata));

View File

@@ -16,7 +16,7 @@
*
*/
void msre_engine_op_register(msre_engine *engine, const char *name,
FN_OP_PARAM_INIT(fn1), FN_OP_EXECUTE(fn2))
fn_op_param_init_t fn1, fn_op_execute_t fn2)
{
msre_op_metadata *metadata = (msre_op_metadata *)apr_pcalloc(engine->mp,
sizeof(msre_op_metadata));
@@ -573,17 +573,17 @@ static int msre_op_validateUrlEncoding_execute(modsec_rec *msr, msre_rule *rule,
int rc = validate_url_encoding(var->value, var->value_len);
switch(rc) {
case 1 :
return 0; /* Encoding is valid, no match. */
/* Encoding is valid */
break;
case -2 :
*error_msg = apr_psprintf(msr->mp, "Invalid URL Encoding: Non-hexadecimal "
"digits used.");
return 1; /* Invalid, match. */
return 1; /* Invalid match. */
break;
case -3 :
*error_msg = apr_psprintf(msr->mp, "Invalid URL Encoding: Not enough characters "
"at the end of input.");
return 1; /* Invalid, match. */
return 1; /* Invalid match. */
break;
case -1 :
default :

View File

@@ -364,7 +364,7 @@ static int msre_fn_normalisePathWin_execute(apr_pool_t *mptmp, unsigned char *in
* Registers one transformation function with the engine.
*/
void msre_engine_tfn_register(msre_engine *engine, const char *name,
FN_TFN_EXECUTE(execute))
fn_tfn_execute_t execute)
{
msre_tfn_metadata *metadata = (msre_tfn_metadata *)apr_pcalloc(engine->mp,
sizeof(msre_tfn_metadata));

View File

@@ -1801,7 +1801,7 @@ static int var_multipart_unmatched_boundary_generate(modsec_rec *msr, msre_var *
*/
static void msre_engine_variable_register(msre_engine *engine, const char *name,
unsigned int type, unsigned int argc_min, unsigned int argc_max,
FN_VAR_VALIDATE(validate), FN_VAR_GENERATE(generate),
fn_var_validate_t validate, fn_var_generate_t generate,
unsigned int is_cacheable, unsigned int availability)
{
msre_var_metadata *metadata = (msre_var_metadata *)apr_pcalloc(engine->mp,