[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[myserver-commit] [2975] Use `SecurityToken::getHashedData'.
From: |
Giuseppe Scrivano |
Subject: |
[myserver-commit] [2975] Use `SecurityToken::getHashedData'. |
Date: |
Thu, 04 Dec 2008 18:49:52 +0000 |
Revision: 2975
http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2975
Author: gscrivano
Date: 2008-12-04 18:49:52 +0000 (Thu, 04 Dec 2008)
Log Message:
-----------
Use `SecurityToken::getHashedData'.
Modified Paths:
--------------
trunk/myserver/include/conf/security/xml_validator.h
trunk/myserver/src/conf/security/xml_validator.cpp
trunk/myserver/src/protocol/http/http.cpp
Modified: trunk/myserver/include/conf/security/xml_validator.h
===================================================================
--- trunk/myserver/include/conf/security/xml_validator.h 2008-11-30
19:20:22 UTC (rev 2974)
+++ trunk/myserver/include/conf/security/xml_validator.h 2008-12-04
18:49:52 UTC (rev 2975)
@@ -69,7 +69,7 @@
int getPermissions (xmlAttr* attrs, xmlChar** user = NULL, xmlChar**
password = NULL);
- SecurityCache *getCache(Server*);
+ SecurityCache *getCache(SecurityToken*);
SecurityCache *secCache;
Mutex cacheMutex;
};
Modified: trunk/myserver/src/conf/security/xml_validator.cpp
===================================================================
--- trunk/myserver/src/conf/security/xml_validator.cpp 2008-11-30 19:20:22 UTC
(rev 2974)
+++ trunk/myserver/src/conf/security/xml_validator.cpp 2008-12-04 18:49:52 UTC
(rev 2975)
@@ -38,12 +38,14 @@
/*!
*Get the security files cache.
*/
-SecurityCache* XmlValidator::getCache (Server *server)
+SecurityCache* XmlValidator::getCache (SecurityToken *st)
{
- if (!secCache && server)
+ if (!secCache)
{
- const char *data = server->getHashedData ("SECURITY_CACHE_NODES");
+ const char *data = st->getHashedData ("SECURITY_CACHE_NODES",
MYSERVER_SERVER_CONF, NULL);
+
secCache = new SecurityCache ();
+
if (data)
{
int nodes = atoi (data);
@@ -61,19 +63,13 @@
{
const char *secName;
- SecurityCache *cache = getCache (st->getServer ());
+ SecurityCache *cache = getCache (st);
if (!cache)
return NULL;
- secName = st->getVhost () ? st->getVhost ()->getHashedData
("SECURITY_FILE_NAME") : NULL;
+ secName = st->getHashedData ("SECURITY_FILE_NAME", MYSERVER_VHOST_CONF |
MYSERVER_SERVER_CONF, ".security.xml");
- if (!secName)
- secName = st->getServer () ? st->getServer ()->getHashedData
("SECURITY_FILE_NAME") : NULL;
-
- if (!secName)
- secName = ".security.xml";
-
return cache->getParser (*(st->getResource ()), *(st->getSysDirectory ()),
false, secName);
}
Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp 2008-11-30 19:20:22 UTC (rev
2974)
+++ trunk/myserver/src/protocol/http/http.cpp 2008-12-04 18:49:52 UTC (rev
2975)
@@ -420,7 +420,10 @@
if (FilesUtility::isLink (td->filenamePath.c_str()))
{
- const char *perm = td->connection->host->getHashedData("FOLLOW_LINKS");
+ const char *perm = td->securityToken.getHashedData ("FOLLOW_LINKS",
MYSERVER_VHOST_CONF |
+ MYSERVER_SERVER_CONF,
"NO");
+
+
if(!perm || strcmpi(perm, "YES"))
return raiseHTTPError(401);
}
@@ -1220,24 +1223,20 @@
if(documentRoot.length())
{
+ const char *useHomeDir = td->securityToken.getHashedData
("USE_HOME_DIRECTORY", MYSERVER_VHOST_CONF |
+
MYSERVER_SERVER_CONF, "YES");
- const char *useHomeDir = td->connection-> host ?
- td->connection->host->getHashedData("USE_HOME_DIRECTORY") : 0;
- const char *homeDir = td->connection-> host ?
- td->connection->host->getHashedData("HOME_DIRECTORY") : 0;
+ const char *homeDir = td->securityToken.getHashedData
("HOME_DIRECTORY", MYSERVER_VHOST_CONF |
+
MYSERVER_SERVER_CONF, "public_html");
- if(homeDir == 0)
- homeDir = "public_html";
+ if (strcmpi (useHomeDir, "YES"))
+ return raiseHTTPError (404);
- if(useHomeDir == 0 || strcmpi(useHomeDir, "YES"))
- return raiseHTTPError(404);
+ td->vhostDir.assign (documentRoot);
+ td->vhostDir.append ("/");
+ td->vhostDir.append (homeDir);
-
- td->vhostDir.assign(documentRoot);
- td->vhostDir.append("/");
- td->vhostDir.append(homeDir);
-
if(!td->request.uriEndsWithSlash && !(td->request.uri.length() -
pos))
{
td->request.uri.append("/");
@@ -1258,7 +1257,9 @@
*virtual host A value of zero means no limit.
*/
{
- const char* val = a->host->getHashedData("MAX_CONNECTIONS");
+ const char* val = td->securityToken.getHashedData ("MAX_CONNECTIONS",
MYSERVER_VHOST_CONF |
+
MYSERVER_SERVER_CONF, NULL);
+
if(val)
{
u_long limit = (u_long)atoi(val);
@@ -1558,8 +1559,8 @@
int useMessagesFiles = 1;
HttpRequestHeader::Entry *host = td->request.other.get("Host");
HttpRequestHeader::Entry *connection = td->request.other.get("Connection");
- const char *useMessagesVal = td->connection->host ?
- td->connection->host->getHashedData("USE_ERROR_FILE") : 0;
+ const char *useMessagesVal = td->securityToken.getHashedData
("USE_ERROR_FILE", MYSERVER_VHOST_CONF |
+
MYSERVER_SERVER_CONF, NULL);
if(useMessagesVal)
{
@@ -1653,8 +1654,9 @@
/*! Send only the header (and the body if specified). */
{
- const char* value = td->connection->host ?
- td->connection->host->getHashedData("ERRORS_INCLUDE_BODY") : 0;
+ const char* value = td->securityToken.getHashedData ("USE_ERROR_FILE",
MYSERVER_VHOST_CONF |
+
MYSERVER_SERVER_CONF, NULL);
+
if(value && !strcmpi(value, "NO"))
{
errorBodyLength = 0;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [2975] Use `SecurityToken::getHashedData'.,
Giuseppe Scrivano <=