summaryrefslogtreecommitdiffstats
path: root/auth_mellon_config.c
diff options
context:
space:
mode:
authorolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2008-11-10 18:33:55 +0000
committerolavmrk <olavmrk@a716ebb1-153a-0410-b759-cfb97c6a1b53>2008-11-10 18:33:55 +0000
commite8069a282501ffda569d1f84c669d285400b12b1 (patch)
tree053f9cf64f31e890e2f0be1f14b88f92c4253def /auth_mellon_config.c
parent18a8e091a690e942cdc9dc12fb22502052b00998 (diff)
downloadmod_auth_mellon-e8069a282501ffda569d1f84c669d285400b12b1.tar.gz
mod_auth_mellon-e8069a282501ffda569d1f84c669d285400b12b1.tar.xz
mod_auth_mellon-e8069a282501ffda569d1f84c669d285400b12b1.zip
Use lasso_server_new_from_buffer if available.
Recent versions of Lasso supports loading the SP metadata, certificate and private key from memory. This patch changes mod_mellon to use this function if it is available. This makes it possible to store the SP private key readable only from root. Thanks to Emmanuel Dreyfus for this patch. git-svn-id: https://modmellon.googlecode.com/svn/trunk@35 a716ebb1-153a-0410-b759-cfb97c6a1b53
Diffstat (limited to 'auth_mellon_config.c')
-rw-r--r--auth_mellon_config.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/auth_mellon_config.c b/auth_mellon_config.c
index 6c27e26..878c140 100644
--- a/auth_mellon_config.c
+++ b/auth_mellon_config.c
@@ -40,6 +40,40 @@ static const char *default_user_attribute = "NAME_ID";
static const char *default_cookie_name = "cookie";
+/* This function handles configuration directives which set a file
+ * slot in the module configuration. If lasso is recent enough, it
+ * attempts to read the file immediatly.
+ *
+ * Parameters:
+ * cmd_parms *cmd The command structure for this configuration
+ * directive.
+ * void *struct_ptr Pointer to the current directory configuration.
+ * NULL if we are not in a directory configuration.
+ * This value isn't used by this function.
+ * const char *arg The string argument following this configuration
+ * directive in the configuraion file.
+ *
+ * Returns:
+ * NULL on success or an error string on failure.
+ */
+static const char *am_set_filestring_slot(cmd_parms *cmd,
+ void *struct_ptr,
+ const char *arg)
+{
+ const char *data;
+
+#ifdef HAVE_lasso_server_new_from_buffers
+ if ((data = am_getfile(cmd->pool, cmd->server, arg)) == NULL)
+ return apr_psprintf(cmd->pool, "%s - Cannot read file %s",
+ cmd->cmd->name, arg);
+#else
+ data = arg;
+#endif
+
+ return ap_set_string_slot(cmd, struct_ptr, data);
+}
+
+
/* This function handles configuration directives which set a string
* slot in the module configuration.
*
@@ -359,21 +393,21 @@ const command_rec auth_mellon_commands[] = {
),
AP_INIT_TAKE1(
"MellonSPMetadataFile",
- ap_set_string_slot,
+ am_set_filestring_slot,
(void *)APR_OFFSETOF(am_dir_cfg_rec, sp_metadata_file),
OR_AUTHCFG,
"Full path to xml file with metadata for the SP."
),
AP_INIT_TAKE1(
"MellonSPPrivateKeyFile",
- ap_set_string_slot,
+ am_set_filestring_slot,
(void *)APR_OFFSETOF(am_dir_cfg_rec, sp_private_key_file),
OR_AUTHCFG,
"Full path to pem file with the private key for the SP."
),
AP_INIT_TAKE1(
"MellonSPCertFile",
- ap_set_string_slot,
+ am_set_filestring_slot,
(void *)APR_OFFSETOF(am_dir_cfg_rec, sp_cert_file),
OR_AUTHCFG,
"Full path to pem file with certificate for the SP."