diff options
author | olavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53> | 2013-05-30 07:35:54 +0000 |
---|---|---|
committer | olavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53> | 2013-05-30 07:35:54 +0000 |
commit | 8f403cc3d52612ee6cdabe04418dbddc0749d178 (patch) | |
tree | 6279f1fd24b5f75331ceadcab32837b6f286d801 /auth_mellon_config.c | |
parent | ab738b5a33c7ce86eb8ddf88a4d1661e3bd90612 (diff) | |
download | mod_auth_mellon-8f403cc3d52612ee6cdabe04418dbddc0749d178.tar.gz mod_auth_mellon-8f403cc3d52612ee6cdabe04418dbddc0749d178.tar.xz mod_auth_mellon-8f403cc3d52612ee6cdabe04418dbddc0749d178.zip |
Add MellonSetEvnNoPrefix option.
This option allows you to set environment variables without the
"MELLON_" prefix.
Thanks to Laas Toom for implementing this!
git-svn-id: https://modmellon.googlecode.com/svn/trunk@211 a716ebb1-153a-0410-b759-cfb97c6a1b53
Diffstat (limited to 'auth_mellon_config.c')
-rw-r--r-- | auth_mellon_config.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/auth_mellon_config.c b/auth_mellon_config.c index 36a82ac..8d6345e 100644 --- a/auth_mellon_config.c +++ b/auth_mellon_config.c @@ -508,7 +508,38 @@ static const char *am_set_setenv_slot(cmd_parms *cmd, const char *oldName) { am_dir_cfg_rec *d = (am_dir_cfg_rec *)struct_ptr; - apr_hash_set(d->envattr, oldName, APR_HASH_KEY_STRING, newName); + /* Configure as prefixed attribute name */ + am_envattr_conf_t *envattr_conf = (am_envattr_conf_t *)apr_palloc(cmd->pool, sizeof(am_envattr_conf_t)); + envattr_conf->name = newName; + envattr_conf->prefixed = 1; + apr_hash_set(d->envattr, oldName, APR_HASH_KEY_STRING, envattr_conf); + return NULL; +} + +/* This function handles the MellonSetEnvNoPrefix configuration directive. + * This directive allows the user to change the name of attributes without prefixing them with MELLON_. + * + * Parameters: + * cmd_parms *cmd The command structure for the MellonSetEnv + * configuration directive. + * void *struct_ptr Pointer to the current directory configuration. + * const char *newName The new name of the attribute. + * const char *oldName The old name of the attribute. + * + * Returns: + * This function will always return NULL. + */ +static const char *am_set_setenv_no_prefix_slot(cmd_parms *cmd, + void *struct_ptr, + const char *newName, + const char *oldName) +{ + am_dir_cfg_rec *d = (am_dir_cfg_rec *)struct_ptr; + /* Configure as not prefixed attribute name */ + am_envattr_conf_t *envattr_conf = (am_envattr_conf_t *)apr_palloc(cmd->pool, sizeof(am_envattr_conf_t)); + envattr_conf->name = newName; + envattr_conf->prefixed = 0; + apr_hash_set(d->envattr, oldName, APR_HASH_KEY_STRING, envattr_conf); return NULL; } @@ -951,9 +982,17 @@ const command_rec auth_mellon_commands[] = { am_set_setenv_slot, NULL, OR_AUTHCFG, - "Renames attributes received from the server. The format is" + "Renames attributes received from the server while retaining prefix MELLON_. The format is" " MellonSetEnv <old name> <new name>." ), + AP_INIT_TAKE2( + "MellonSetEnvNoPrefix", + am_set_setenv_no_prefix_slot, + NULL, + OR_AUTHCFG, + "Renames attributes received from the server without adding prefix. The format is" + " MellonSetEnvNoPrefix <old name> <new name>." + ), AP_INIT_FLAG( "MellonSessionDump", ap_set_flag_slot, |