summaryrefslogtreecommitdiffstats
path: root/auth_mellon_util.c
diff options
context:
space:
mode:
authormanu@netbsd.org <manu@netbsd.org@a716ebb1-153a-0410-b759-cfb97c6a1b53>2011-03-23 15:05:19 +0000
committermanu@netbsd.org <manu@netbsd.org@a716ebb1-153a-0410-b759-cfb97c6a1b53>2011-03-23 15:05:19 +0000
commitf0467bab7c76db8b5989515da004931cfbca9837 (patch)
tree5081a9dab1e72c644ee7deaf2b7333b819d1305f /auth_mellon_util.c
parent30133d867b8513dbee8253c369d6d58d750eda54 (diff)
downloadmod_auth_mellon-f0467bab7c76db8b5989515da004931cfbca9837.tar.gz
mod_auth_mellon-f0467bab7c76db8b5989515da004931cfbca9837.tar.xz
mod_auth_mellon-f0467bab7c76db8b5989515da004931cfbca9837.zip
New MellonIdPMetadataGlob directive to load mulitple IdP metadata
using a glob(3) pattern. git-svn-id: https://modmellon.googlecode.com/svn/trunk@117 a716ebb1-153a-0410-b759-cfb97c6a1b53
Diffstat (limited to 'auth_mellon_util.c')
-rw-r--r--auth_mellon_util.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/auth_mellon_util.c b/auth_mellon_util.c
index 68f048f..7001d98 100644
--- a/auth_mellon_util.c
+++ b/auth_mellon_util.c
@@ -838,6 +838,31 @@ char *am_generate_session_id(request_rec *r)
return ret;
}
+/* This returns the directroy part of a path, a la dirname(3)
+ *
+ * Parameters:
+ * apr_pool_t p Pool to allocate memory from
+ * const char *path Path to extract directory from
+ *
+ * Returns:
+ * The directory part of path
+ */
+const char *am_filepath_dirname(apr_pool_t *p, const char *path)
+{
+ char *cp;
+
+ /*
+ * Try Unix and then Windows style. Borrowed from
+ * apr_match_glob(), it seems it cannot be made more
+ * portable.
+ */
+ if (((cp = strrchr(path, (int)'/')) == NULL) &&
+ ((cp = strrchr(path, (int)'\\')) == NULL))
+ return ".";
+
+ return apr_pstrndup(p, path, cp - path);
+}
+
/*
* malloc a buffer and fill it with a given file
*