summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/http/mod-openauth.cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-12-23 08:18:38 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-12-23 08:18:38 +0000
commit681567b28116421496c4b7560a5b70f9730b8a79 (patch)
tree527231756f6a291ba35a217e3cd880c2cf15e5e0 /sca-cpp/trunk/modules/http/mod-openauth.cpp
parentf55fe8a88efb11b57fcb393ce5958e5dcace24d7 (diff)
Use HTTPD ap_log_error instead of stderr to log when running inside HTTPD, to get log piping and rotation to work.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1222604 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/http/mod-openauth.cpp')
-rw-r--r--sca-cpp/trunk/modules/http/mod-openauth.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/sca-cpp/trunk/modules/http/mod-openauth.cpp b/sca-cpp/trunk/modules/http/mod-openauth.cpp
index c2791b5402..09d62bf5f7 100644
--- a/sca-cpp/trunk/modules/http/mod-openauth.cpp
+++ b/sca-cpp/trunk/modules/http/mod-openauth.cpp
@@ -33,6 +33,7 @@
#include <sys/stat.h>
+#define WANT_HTTPD_LOG 1
#include "string.hpp"
#include "stream.hpp"
#include "list.hpp"
@@ -79,13 +80,20 @@ public:
#ifdef WANT_MAINTAINER_MODE
/**
- * Log a session entry.
+ * Log session entries.
*/
-int debugSession(unused void* r, const char* key, const char* value) {
+int debugSessionEntry(unused void* r, const char* key, const char* value) {
cdebug << " session key: " << key << ", value: " << value << endl;
return 1;
}
+const bool debugSession(request_rec* r, session_rec* z) {
+ if (!isDebugLog())
+ return true;
+ apr_table_do(debugSessionEntry, r, z->entries, NULL);
+ return true;
+}
+
#endif
/**
@@ -103,7 +111,7 @@ const failable<value> userInfoFromSession(const string& realm, request_rec* r) {
if (z == NULL)
return mkfailure<value>("Couldn't retrieve user session");
#ifdef WANT_MAINTAINER_MODE
- apr_table_do(debugSession, r, z->entries, NULL);
+ debugSession(r, z);
#endif
if (ap_session_get_fn == NULL)
@@ -225,8 +233,8 @@ static int checkAuthn(request_rec *r) {
if (hasContent(info)) {
// Try to authenticate the request
- const value cinfo = content(info);
- const failable<int> authz = checkAuthnz(cadr(assoc<value>("id", cinfo)), cadr(assoc<value>("password", cinfo)), r);
+ const value uinfo = content(info);
+ const failable<int> authz = checkAuthnz(cadr(assoc<value>("id", uinfo)), cadr(assoc<value>("password", uinfo)), r);
if (!hasContent(authz)) {
// Authentication failed, redirect to login page
@@ -236,7 +244,7 @@ static int checkAuthn(request_rec *r) {
// Successfully authenticated, store the user info in the request
r->ap_auth_type = const_cast<char*>(atype);
- return httpd::reportStatus(authenticated(cinfo, r));
+ return httpd::reportStatus(authenticated(uinfo, r));
}
}
@@ -254,8 +262,8 @@ static int checkAuthn(request_rec *r) {
if (hasContent(info)) {
// Try to authenticate the request
- const value cinfo = content(info);
- const failable<int> authz = checkAuthnz(cadr(assoc<value>("id", cinfo)), cadr(assoc<value>("password", cinfo)), r);
+ const value uinfo = content(info);
+ const failable<int> authz = checkAuthnz(cadr(assoc<value>("id", uinfo)), cadr(assoc<value>("password", uinfo)), r);
if (!hasContent(authz)) {
// Authentication failed, redirect to login page
@@ -265,7 +273,7 @@ static int checkAuthn(request_rec *r) {
// Successfully authenticated, store the user info in the request
r->ap_auth_type = const_cast<char*>(atype);
- return httpd::reportStatus(authenticated(cinfo, r));
+ return httpd::reportStatus(authenticated(uinfo, r));
}
}