[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[myserver-commit] [2869] Don't hardly code `xml' as security validator a
From: |
Giuseppe Scrivano |
Subject: |
[myserver-commit] [2869] Don't hardly code `xml' as security validator and auth method. |
Date: |
Sun, 05 Oct 2008 10:33:12 +0000 |
Revision: 2869
http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2869
Author: gscrivano
Date: 2008-10-05 10:33:11 +0000 (Sun, 05 Oct 2008)
Log Message:
-----------
Don't hardly code `xml' as security validator and auth method.
Modified Paths:
--------------
trunk/myserver/include/conf/security/security_token.h
trunk/myserver/src/conf/security/security_token.cpp
trunk/myserver/src/conf/vhost/vhost.cpp
trunk/myserver/src/protocol/ftp/ftp.cpp
trunk/myserver/src/protocol/http/http.cpp
Modified: trunk/myserver/include/conf/security/security_token.h
===================================================================
--- trunk/myserver/include/conf/security/security_token.h 2008-10-05
09:47:50 UTC (rev 2868)
+++ trunk/myserver/include/conf/security/security_token.h 2008-10-05
10:33:11 UTC (rev 2869)
@@ -47,7 +47,7 @@
SecurityToken();
void reset();
- const char* getHashedData (const char* name, int domains);
+ const char* getHashedData (const char* name, int domains, const char *def =
NULL);
string& getUser ()
{
Modified: trunk/myserver/src/conf/security/security_token.cpp
===================================================================
--- trunk/myserver/src/conf/security/security_token.cpp 2008-10-05 09:47:50 UTC
(rev 2868)
+++ trunk/myserver/src/conf/security/security_token.cpp 2008-10-05 10:33:11 UTC
(rev 2869)
@@ -53,12 +53,14 @@
/*!
*Get the value for the variable using the specified domains.
*\param name Variable name.
+ *\param def Default value.
*\param domains Domains where to look. They are looked in this order:
*\li Security configuration file.
*\li Virtual host configuration file.
*\li Global security file.
+ *\li Default value.
*/
-const char* SecurityToken::getHashedData (const char* name, int domains)
+const char* SecurityToken::getHashedData (const char* name, int domains, const
char *def)
{
if (domains & MYSERVER_SECURITY_CONF)
{
@@ -87,5 +89,5 @@
}
- return NULL;
+ return def;
}
Modified: trunk/myserver/src/conf/vhost/vhost.cpp
===================================================================
--- trunk/myserver/src/conf/vhost/vhost.cpp 2008-10-05 09:47:50 UTC (rev
2868)
+++ trunk/myserver/src/conf/vhost/vhost.cpp 2008-10-05 10:33:11 UTC (rev
2869)
@@ -583,22 +583,23 @@
}
/*!
- *Get the value for name in the hash dictionary. If the data is not present
- *it tries to get it from the Server class.
- *\param name The key of the hashed entry.
+ *Get the value for name in the hash dictionary.
+ *\param name The hashed entry key.
*/
const char* Vhost::getHashedData(const char* name)
{
string *s;
- if(name == 0)
- return 0;
+
+ if(!name)
+ return NULL;
+
s = hashedData.get(name);
+
if(s)
return s->c_str();
- return Server::getInstance() ? Server::getInstance()->getHashedData(name)
- : 0 ;
+ return NULL;
}
/*!
Modified: trunk/myserver/src/protocol/ftp/ftp.cpp
===================================================================
--- trunk/myserver/src/protocol/ftp/ftp.cpp 2008-10-05 09:47:50 UTC (rev
2868)
+++ trunk/myserver/src/protocol/ftp/ftp.cpp 2008-10-05 10:33:11 UTC (rev
2869)
@@ -2404,10 +2404,15 @@
st.setResource (&sFileName);
AuthDomain auth (&st);
- string xml ("xml");//FIXME: don't hardly-code "xml".
+ string validator (st.getHashedData ("sec.validator", MYSERVER_VHOST_CONF |
+ MYSERVER_SERVER_CONF, "xml"));
+ string authMethod (st.getHashedData ("sec.auth_method", MYSERVER_VHOST_CONF |
+ MYSERVER_SERVER_CONF, "xml"));
+
SecurityDomain* domains[] = {&auth, NULL};
- Server::getInstance()->getSecurityManager ()->getPermissionMask (&st,
domains, xml, xml);
+ Server::getInstance()->getSecurityManager ()->getPermissionMask (&st,
domains,
+ validator,
authMethod);
return (st.getMask () & mask);
}
Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp 2008-10-05 09:47:50 UTC (rev
2868)
+++ trunk/myserver/src/protocol/http/http.cpp 2008-10-05 10:33:11 UTC (rev
2869)
@@ -442,10 +442,16 @@
AuthDomain auth (&securityToken);
HttpReqSecurityDomain httpReqSecDom (&(td->request));
- string xml ("xml");//FIXME: don't hardly-code "xml".
+ string validator (securityToken.getHashedData ("sec.validator",
MYSERVER_VHOST_CONF |
+ MYSERVER_SERVER_CONF,
"xml"));
+ string authMethod (securityToken.getHashedData ("sec.auth_method",
MYSERVER_VHOST_CONF |
+ MYSERVER_SERVER_CONF,
"xml"));
+
+
SecurityDomain* domains[] = {&auth, &httpReqSecDom, NULL};
- Server::getInstance()->getSecurityManager ()->getPermissionMask
(&securityToken, domains, xml, xml);
+ Server::getInstance()->getSecurityManager ()->getPermissionMask
(&securityToken, domains,
+
validator, authMethod);
const char *authType = securityToken.getHashedData ("http.auth",
MYSERVER_SECURITY_CONF |
MYSERVER_VHOST_CONF |
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [2869] Don't hardly code `xml' as security validator and auth method.,
Giuseppe Scrivano <=