summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertrand Jacquin <bjacquin@exosec.fr>2012-12-11 15:56:01 +0100
committerBertrand Jacquin <bjacquin@exosec.fr>2012-12-11 15:56:01 +0100
commit7f3e3403238821f720ecb1c4bdb0be84cc7b1e64 (patch)
tree58b6e65b99c4162d51213c3178d78b77a3957d08
parent[CLEANUP] Eliminate the usage of malloc() in vv_var_new, so TODO-- as in (diff)
downloadmod_virtualvalue-7f3e3403238821f720ecb1c4bdb0be84cc7b1e64.tar.gz
[MISC] Indent all parenthesis to match
http://haproxy.1wt.eu/coding-style.html
-rw-r--r--al_alias.c10
-rw-r--r--al_alias.h2
-rw-r--r--al_authn_file.c8
-rw-r--r--al_authn_file.h2
-rw-r--r--al_core.c26
-rw-r--r--al_core.h8
-rw-r--r--al_dumb.c4
-rw-r--r--al_dumb.h2
-rw-r--r--al_php5.c4
-rw-r--r--al_php5.h2
-rw-r--r--mod_virtualvalue.c64
-rw-r--r--mod_virtualvalue.h18
12 files changed, 75 insertions, 75 deletions
diff --git a/al_alias.c b/al_alias.c
index c933083..c2e6385 100644
--- a/al_alias.c
+++ b/al_alias.c
@@ -6,25 +6,25 @@
#include "al_alias.h"
-int vv_alter_scriptalias (int argc __U__, char **argv, request_rec *r) {
+int vv_alter_scriptalias(int argc __U__, char **argv, request_rec *r) {
char *scriptalias;
if (!strstr(r->uri, argv[0]))
return (DECLINED);
- scriptalias = vv_flat_arg (argv[1], r);
+ scriptalias = vv_flat_arg(argv[1], r);
if (!scriptalias) {
VV_error("%s", "Can't build ScriptAlias");
return (DECLINED);
}
- vv_core_docroot (r, scriptalias);
+ vv_core_docroot(r, scriptalias);
r->handler = "cgi-script";
- apr_table_setn (r->notes, "alias-forced-type", r->handler);
+ apr_table_setn(r->notes, "alias-forced-type", r->handler);
- VV_debug ("ScriptAlias: %s", scriptalias);
+ VV_debug("ScriptAlias: %s", scriptalias);
return (OK);
}
diff --git a/al_alias.h b/al_alias.h
index f7021f3..7d5d0d4 100644
--- a/al_alias.h
+++ b/al_alias.h
@@ -1,6 +1,6 @@
#ifndef AL_ALIAS_H
#define AL_ALIAS_H
-int vv_alter_scriptalias (int, char **, request_rec *);
+int vv_alter_scriptalias(int, char **, request_rec *);
#endif /* AL_ALIAS_H */
diff --git a/al_authn_file.c b/al_authn_file.c
index f5ced25..5876928 100644
--- a/al_authn_file.c
+++ b/al_authn_file.c
@@ -11,20 +11,20 @@ struct authn_file_config_rec {
char *pwfile;
};
-int vv_alter_authuserfile (int argc __U__, char **argv, request_rec *r) {
+int vv_alter_authuserfile(int argc __U__, char **argv, request_rec *r) {
struct authn_file_config_rec *conf;
char *authuserfile;
conf = ap_get_module_config(r->per_dir_config, &authn_file_module);
- authuserfile = vv_flat_arg (argv[0], r);
+ authuserfile = vv_flat_arg(argv[0], r);
if (!authuserfile) {
- VV_error ("%s", "Can't build AuthUserFile");
+ VV_error("%s", "Can't build AuthUserFile");
return (DECLINED);
}
conf->pwfile = authuserfile;
- ap_set_module_config (r->per_dir_config, &authn_file_module, conf);
+ ap_set_module_config(r->per_dir_config, &authn_file_module, conf);
return (OK);
}
diff --git a/al_authn_file.h b/al_authn_file.h
index eece7cc..4702e64 100644
--- a/al_authn_file.h
+++ b/al_authn_file.h
@@ -1,6 +1,6 @@
#ifndef AL_AUTHN_FILE_H
#define AL_AUTHN_FILE_H
-int vv_alter_authuserfile (int, char **, request_rec *);
+int vv_alter_authuserfile(int, char **, request_rec *);
#endif /* AL_AUTHN_FILE_H */
diff --git a/al_core.c b/al_core.c
index c50704e..ca5c812 100644
--- a/al_core.c
+++ b/al_core.c
@@ -9,7 +9,7 @@
#include "mod_virtualvalue.h"
#include "al_core.h"
-int vv_core_docroot (request_rec *r, char *n_root) {
+int vv_core_docroot(request_rec *r, char *n_root) {
request_rec *top;
core_server_config *core;
@@ -22,59 +22,59 @@ int vv_core_docroot (request_rec *r, char *n_root) {
/* Then, also define core DOCUMENT_ROOT,
* so PHP and CGI have a correct DOCUMENT_ROOT env variable */
top = (r->main)? r->main : r;
- core = (core_server_config *) ap_get_module_config (r->server->module_config, &core_module);
+ core = (core_server_config *)ap_get_module_config(r->server->module_config, &core_module);
core->ap_document_root = apr_pstrdup(top->pool, n_root);
return (OK);
}
-int vv_alter_docroot (int argc __U__, char **argv, request_rec *r) {
+int vv_alter_docroot(int argc __U__, char **argv, request_rec *r) {
char *docroot;
- docroot = vv_flat_arg (argv[0], r);
+ docroot = vv_flat_arg(argv[0], r);
if (!docroot) {
VV_error("%s", "Can't build DocumentRoot");
return (DECLINED);
}
- vv_core_docroot (r, docroot);
+ vv_core_docroot(r, docroot);
VV_debug("DocumentRoot: %s", docroot);
return (OK);
}
-int vv_alter_serveradmin (int argc __U__, char **argv, request_rec *r) {
+int vv_alter_serveradmin(int argc __U__, char **argv, request_rec *r) {
char *serveradmin;
- serveradmin = vv_flat_arg (argv[0], r);
+ serveradmin = vv_flat_arg(argv[0], r);
if (!serveradmin) {
- VV_error ("%s", "Can't build ServerAdmin");
+ VV_error("%s", "Can't build ServerAdmin");
return (DECLINED);
}
r->server->server_admin = serveradmin;
- VV_debug ("ServerAdmin: %s", serveradmin);
+ VV_debug("ServerAdmin: %s", serveradmin);
return (OK);
}
-int vv_alter_servername (int argc __U__, char **argv, request_rec *r) {
+int vv_alter_servername(int argc __U__, char **argv, request_rec *r) {
char *servername;
- servername = vv_flat_arg (argv[0], r);
+ servername = vv_flat_arg(argv[0], r);
if (!servername) {
- VV_error ("%s", "Can't build ServerName");
+ VV_error("%s", "Can't build ServerName");
return (DECLINED);
}
r->server->server_hostname = servername;
- VV_debug ("ServerName: %s", servername);
+ VV_debug("ServerName: %s", servername);
return (OK);
}
diff --git a/al_core.h b/al_core.h
index c25abf5..a143ae7 100644
--- a/al_core.h
+++ b/al_core.h
@@ -1,10 +1,10 @@
#ifndef AL_CORE_H
#define AL_CORE_H
-int vv_core_docroot (request_rec *, char *);
+int vv_core_docroot (request_rec *, char *);
-int vv_alter_docroot (int, char **, request_rec *);
-int vv_alter_serveradmin (int, char **, request_rec *);
-int vv_alter_servername (int, char **, request_rec *);
+int vv_alter_docroot (int, char **, request_rec *);
+int vv_alter_serveradmin(int, char **, request_rec *);
+int vv_alter_servername (int, char **, request_rec *);
#endif /* AL_CORE_H */
diff --git a/al_dumb.c b/al_dumb.c
index 443abc8..7b7ea23 100644
--- a/al_dumb.c
+++ b/al_dumb.c
@@ -4,13 +4,13 @@
#include "mod_virtualvalue.h"
#include "al_dumb.h"
-int vv_echo (int argc __U__, char **argv, request_rec *r) {
+int vv_echo(int argc __U__, char **argv, request_rec *r) {
char *s2;
VV_error("%s", "");
VV_error("Original: %s", argv[0]);
- s2 = vv_flat_arg (argv[0], r);
+ s2 = vv_flat_arg(argv[0], r);
VV_error("Translat: %s", s2);
VV_error("%s", "");
diff --git a/al_dumb.h b/al_dumb.h
index b37225b..020ddb4 100644
--- a/al_dumb.h
+++ b/al_dumb.h
@@ -1,6 +1,6 @@
#ifndef AL_DUMB_H
#define AL_DUMB_H
-int vv_echo (int, char **, request_rec *);
+int vv_echo(int, char **, request_rec *);
#endif /* AL_DUMB_H */
diff --git a/al_php5.c b/al_php5.c
index 6e75028..ca7e420 100644
--- a/al_php5.c
+++ b/al_php5.c
@@ -16,11 +16,11 @@
#include "mod_virtualvalue.h"
#include "al_php5.h"
-int vv_php_alter_ini (int argc __U__, char **argv, request_rec *r) {
+int vv_php_alter_ini(int argc __U__, char **argv, request_rec *r) {
char *arg;
VV_debug("Translating %s %s", argv[0], argv[1]);
- arg = vv_flat_arg (argv[1], r);
+ arg = vv_flat_arg(argv[1], r);
if (zend_alter_ini_entry(argv[0], strlen(argv[0]) + 1, arg, strlen(arg), PHP_INI_SYSTEM, PHP_INI_STAGE_STARTUP) == -1)
VV_error("zend_alter_ini_entry() failed (%s %s)", argv[0], arg);
diff --git a/al_php5.h b/al_php5.h
index 61f7150..d782362 100644
--- a/al_php5.h
+++ b/al_php5.h
@@ -1,6 +1,6 @@
#ifndef AL_PHP5_H
#define AL_PHP5_H
-int vv_php_alter_ini (int, char **, request_rec *);
+int vv_php_alter_ini(int, char **, request_rec *);
#endif /* AL_PHP5_H */
diff --git a/mod_virtualvalue.c b/mod_virtualvalue.c
index 881f67b..0bb154d 100644
--- a/mod_virtualvalue.c
+++ b/mod_virtualvalue.c
@@ -74,7 +74,7 @@ static virtualvalue_var_t *vv_var_new(apr_pool_t *pool) {
return (elm);
}
-static virtualvalue_var_t *vv_var_append (virtualvalue_var_t *list, virtualvalue_var_t *elm) {
+static virtualvalue_var_t *vv_var_append(virtualvalue_var_t *list, virtualvalue_var_t *elm) {
virtualvalue_var_t *c;
if (!list || !elm)
@@ -90,9 +90,9 @@ static virtualvalue_var_t *vv_var_append (virtualvalue_var_t *list, virtualvalue
return list;
}
-static const char *vv_replace_HTTP (char *full __U__, char *search, request_rec *r);
-static const char *vv_replace_ENV (char *full __U__, char *search, request_rec *r);
-static const char *vv_replace_SYM (char *full __U__, char *search, request_rec *r);
+static const char *vv_replace_HTTP(char *full __U__, char *search, request_rec *r);
+static const char *vv_replace_ENV (char *full __U__, char *search, request_rec *r);
+static const char *vv_replace_SYM (char *full __U__, char *search, request_rec *r);
token_t token_tab[] = {
/*{ Config Token , Token lenght
@@ -119,9 +119,9 @@ tag_t tag_tab[] = {
{ NULL , 0, NULL }
};
-static char *vv_strrrstr (char *start, char *cur, const char *needle) {
+static char *vv_strrrstr(char *start, char *cur, const char *needle) {
char *s;
- int len = strlen (needle);
+ int len = strlen(needle);
s = NULL;
@@ -137,62 +137,62 @@ static char *vv_strrrstr (char *start, char *cur, const char *needle) {
return s;
}
-static const char *vv_replace_HTTP (char *full __U__, char *search, request_rec *r) {
+static const char *vv_replace_HTTP(char *full __U__, char *search, request_rec *r) {
const char *header;
header = apr_table_get(r->headers_in, search);
if (!header) {
VV_error("Header %s not found", search);
- header = apr_pstrdup (r->pool, "NULL");
+ header = apr_pstrdup(r->pool, "NULL");
}
return (header);
}
-static const char *vv_replace_ENV (char *full __U__, char *search, request_rec *r) {
+static const char *vv_replace_ENV(char *full __U__, char *search, request_rec *r) {
const char *env;
env = apr_table_get(r->subprocess_env, search);
if (!env) {
VV_error("ENV %s not found", search);
- env = apr_pstrdup (r->pool, "NULL");
+ env = apr_pstrdup(r->pool, "NULL");
}
return (env);
}
-static const char *vv_replace_SYM (char *full __U__, char *search, request_rec *r) {
+static const char *vv_replace_SYM(char *full __U__, char *search, request_rec *r) {
struct stat st;
char *real;
- real = (char *)apr_palloc (r->pool, PATH_MAX * sizeof(char));
+ real = (char *)apr_palloc(r->pool, PATH_MAX * sizeof(char));
if (search[0] != '/') {
VV_error("Bad search: %s", search);
- apr_cpystrn (real, "NULL", 5);
+ apr_cpystrn(real, "NULL", 5);
return (real);
}
real[0] = 0;
if (lstat(search, &st) == -1) {
- apr_cpystrn (real, "NULL", 5);
+ apr_cpystrn(real, "NULL", 5);
return (real);
}
- realpath (search, real);
+ realpath(search, real);
if (lstat(real, &st) == -1) {
- apr_cpystrn (real, "NULL", 5);
+ apr_cpystrn(real, "NULL", 5);
return (real);
}
return (real);
}
-char *vv_flat_arg (char *s1, request_rec *r) {
+char *vv_flat_arg(char *s1, request_rec *r) {
char *c, *end;
const char *s2;
@@ -201,7 +201,7 @@ char *vv_flat_arg (char *s1, request_rec *r) {
char final[DEFAULT_MAX_SIZE];
char search[DEFAULT_MAX_SEARCH];
- apr_cpystrn (final, s1, strlen(s1)+1);
+ apr_cpystrn(final, s1, strlen(s1) + 1);
c = final + strlen(s1);
@@ -214,19 +214,19 @@ char *vv_flat_arg (char *s1, request_rec *r) {
}
for (i = tag_tab, s2 = NULL ; i->tag != NULL ; i++) {
- if (strncmp (c+2, i->tag, i->len) == 0) {
- memcpy (&search, c+2 + i->len +1, end - (c+2 + i->len) -1);
+ if (strncmp(c+2, i->tag, i->len) == 0) {
+ memcpy(&search, c+2 + i->len+1, end - (c+2 + i->len) -1);
search[end - (c+2 + i->len) -1] = '\0';
- s2 = i->func (c, search, r);
+ s2 = i->func(c, search, r);
break;
}
}
if (s2) {
- memmove (c + strlen(s2), end+1, strlen(c));
- memcpy (c, s2, strlen(s2));
+ memmove(c + strlen(s2), end + 1, strlen(c));
+ memcpy(c, s2, strlen(s2));
}
c--;
@@ -235,14 +235,14 @@ char *vv_flat_arg (char *s1, request_rec *r) {
return apr_pstrndup(r->pool, final, strlen(final));
}
-static void *vv_create_server_config (apr_pool_t *p, server_rec *s __U__) {
+static void *vv_create_server_config(apr_pool_t *p, server_rec *s __U__) {
virtualvalue_cfg_t *cfg = (virtualvalue_cfg_t *)apr_pcalloc(p, sizeof(virtualvalue_cfg_t));
return (void *)cfg;
}
-static void *vv_merge_server_config (apr_pool_t *p __U__, void *parent __U__, void *child) {
- virtualvalue_cfg_t *c_cfg = (virtualvalue_cfg_t *) child;
+static void *vv_merge_server_config(apr_pool_t *p __U__, void *parent __U__, void *child) {
+ virtualvalue_cfg_t *c_cfg = (virtualvalue_cfg_t *)child;
return (void *)c_cfg;
}
@@ -257,7 +257,7 @@ static int vv_translate(request_rec *r) {
n = c->vars;
while (n) {
- n->handler (n->argc, n->argv, r);
+ n->handler(n->argc, n->argv, r);
n = (virtualvalue_var_t *)n->next;
}
@@ -266,7 +266,7 @@ static int vv_translate(request_rec *r) {
return (DECLINED);
}
-static const char *vv_set (cmd_parms *cmd, void *struct_ptr __U__, int argc, char *const argv[]) {
+static const char *vv_set(cmd_parms *cmd, void *struct_ptr __U__, int argc, char *const argv[]) {
virtualvalue_cfg_t *c = (virtualvalue_cfg_t *)ap_get_module_config(cmd->server->module_config, &virtualvalue_module);
virtualvalue_var_t *n;
token_t *i;
@@ -315,11 +315,11 @@ static const char *vv_set (cmd_parms *cmd, void *struct_ptr __U__, int argc, cha
return NULL;
}
-static const char *vv_on (cmd_parms *cmd, void *struct_ptr __U__, int flag) {
+static const char *vv_on(cmd_parms *cmd, void *struct_ptr __U__, int flag) {
virtualvalue_cfg_t *cfg = (virtualvalue_cfg_t *)ap_get_module_config(cmd->server->module_config, &virtualvalue_module);
cfg->enable = (flag ? 1 : 0);
- VV_debug ("VirtualValue enable: %i", (unsigned int)cfg->enable);
+ VV_debug("VirtualValue enable: %i", (unsigned int)cfg->enable);
return NULL;
}
@@ -345,14 +345,14 @@ static void register_hooks(apr_pool_t *p __U__) {
}
static const command_rec vv_cmds[] = {
- AP_INIT_FLAG (
+ AP_INIT_FLAG(
"VirtualValueEnabled",
vv_on,
NULL,
RSRC_CONF,
"Turn on Apache VirtualValue"
),
- AP_INIT_TAKE_ARGV (
+ AP_INIT_TAKE_ARGV(
"VirtualValue",
vv_set,
NULL,
diff --git a/mod_virtualvalue.h b/mod_virtualvalue.h
index 7c1270a..fc37b71 100644
--- a/mod_virtualvalue.h
+++ b/mod_virtualvalue.h
@@ -17,10 +17,10 @@
#ifdef DEBUG
# define VV_debug(fmt, args...) \
do { \
- fprintf (stderr, "%s+%i %*s(): DEBUG ", __FILE__, __LINE__, 20, __func__); \
- fprintf (stderr, fmt, ##args); \
- fprintf (stderr, "\n"); \
- fflush (stderr); \
+ fprintf(stderr, "%s+%i %*s(): DEBUG ", __FILE__, __LINE__, 20, __func__); \
+ fprintf(stderr, fmt, ##args); \
+ fprintf(stderr, "\n"); \
+ fflush(stderr); \
} while(0)
#else
# define VV_debug(fmt, args...) { }
@@ -28,12 +28,12 @@
#define VV_error(fmt, args...) \
do { \
- fprintf (stderr, "%s+%i %*s(): ERROR ", __FILE__, __LINE__, 20, __func__); \
- fprintf (stderr, fmt, ##args); \
- fprintf (stderr, "\n"); \
- fflush (stderr); \
+ fprintf(stderr, "%s+%i %*s(): ERROR ", __FILE__, __LINE__, 20, __func__); \
+ fprintf(stderr, fmt, ##args); \
+ fprintf(stderr, "\n"); \
+ fflush(stderr); \
} while(0)
-char *vv_flat_arg (char *, request_rec *);
+char *vv_flat_arg(char *, request_rec *);
#endif /* MOD_VIRTUALVALUE_H */