[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[myserver-commit] [2850] Added `XmlValidator' class skeleton.
From: |
Giuseppe Scrivano |
Subject: |
[myserver-commit] [2850] Added `XmlValidator' class skeleton. |
Date: |
Sun, 28 Sep 2008 12:49:54 +0000 |
Revision: 2850
http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2850
Author: gscrivano
Date: 2008-09-28 12:49:53 +0000 (Sun, 28 Sep 2008)
Log Message:
-----------
Added `XmlValidator' class skeleton.
Modified Paths:
--------------
branches/myserver_sec_new/include/base/xml/xml_parser.h
branches/myserver_sec_new/include/conf/security/Makefile.am
branches/myserver_sec_new/include/conf/security/security_cache.h
branches/myserver_sec_new/include/conf/security/security_manager.h
branches/myserver_sec_new/include/conf/security/validator.h
branches/myserver_sec_new/src/conf/security/Makefile.am
branches/myserver_sec_new/src/conf/security/auth_domain.cpp
branches/myserver_sec_new/src/conf/security/security_cache.cpp
branches/myserver_sec_new/src/conf/security/security_manager.cpp
branches/myserver_sec_new/src/conf/security/validator.cpp
branches/myserver_sec_new/src/conf/security/validator_factory.cpp
branches/myserver_sec_new/src/protocol/ftp/ftp.cpp
branches/myserver_sec_new/src/protocol/http/http.cpp
branches/myserver_sec_new/tests/Makefile.am
branches/myserver_sec_new/tests/test_security_cache.cpp
Added Paths:
-----------
branches/myserver_sec_new/include/conf/security/xml_validator.h
branches/myserver_sec_new/src/conf/security/xml_validator.cpp
Modified: branches/myserver_sec_new/include/base/xml/xml_parser.h
===================================================================
--- branches/myserver_sec_new/include/base/xml/xml_parser.h 2008-09-27
21:40:15 UTC (rev 2849)
+++ branches/myserver_sec_new/include/base/xml/xml_parser.h 2008-09-28
12:49:53 UTC (rev 2850)
@@ -54,58 +54,57 @@
class XmlParser
{
public:
- static bool startXML();
+ static bool startXML();
static bool cleanXML();
- XmlParser();
- ~XmlParser();
- xmlDocPtr getDoc();
- int open(const char* filename, bool useXpath = 0);
- int open(string const &filename, bool useXpath = 0){return
open(filename.c_str(), useXpath);};
- int openMemBuf(MemBuf &, bool useXpath = 0);
+ XmlParser();
+ ~XmlParser();
+ xmlDocPtr getDoc();
+ int open(const char* filename, bool useXpath = 0);
+ int open(string const &filename, bool useXpath = 0){return
open(filename.c_str(), useXpath);};
+ int openMemBuf(MemBuf &, bool useXpath = 0);
- char *getValue(const char* field);
- char *getValue(string const &field){return getValue(field.c_str());};
- char *getAttr(const char* field, const char *attr);
- int setValue(const char* field, const char *value);
- int close();
+ char *getValue(const char* field);
+ char *getValue(string const &field){return getValue(field.c_str());};
+ char *getAttr(const char* field, const char *attr);
+ int setValue(const char* field, const char *value);
+ int close();
- int save(const char *filename,int *nbytes = 0);
- int save(string const &filename,int *nbytes = 0){return
save(filename.c_str(), nbytes);};
- int saveMemBuf(MemBuf &,int *nbytes = 0);
+ int save(const char *filename, int *nbytes = 0);
+ int save(string const &filename, int *nbytes = 0){return
save(filename.c_str(), nbytes);};
+ int saveMemBuf(MemBuf &, int *nbytes = 0);
- void newfile(const char * root);
- void newfile(string const &root){newfile(root.c_str());};
- void addChild(const char * name, const char * value);
- void addChild(string const &name, string& value)
+ void newfile(const char * root);
+ void newfile(string const &root){newfile(root.c_str());};
+ void addChild(const char * name, const char * value);
+ void addChild(string const &name, string& value)
{addChild(name.c_str(), value.c_str());};
- void addGroup(const char * name);
- void addGroup(string const &name)
+ void addGroup(const char * name);
+ void addGroup(string const &name)
{addGroup(name.c_str());};
- void endGroup();
+ void endGroup();
- void setAttr(const char * name, const char * value);
+ void setAttr(const char * name, const char * value);
- void setAttr(string& name, string& value)
- {
- setAttr(name.c_str(), value.c_str());
- };
+ void setAttr(string& name, string& value)
+ {
+ setAttr(name.c_str(), value.c_str());
+ };
- void addLineFeed();
- time_t getLastModTime();
-
+ void addLineFeed();
+ time_t getLastModTime();
+
XmlXPathResult* evaluateXpath(string & path){return
evaluateXpath(path.c_str());}
XmlXPathResult* evaluateXpath(const char*);
bool isXpathEnabled(){return useXpath;}
private:
xmlXPathContextPtr xpathCtx;
bool useXpath;
- xmlDocPtr doc;
- string buffer;
- xmlNodePtr cur;
- xmlNodePtr prevCur;
- xmlNodePtr lastNode;
- time_t mtime;
-
+ xmlDocPtr doc;
+ string buffer;
+ xmlNodePtr cur;
+ xmlNodePtr prevCur;
+ xmlNodePtr lastNode;
+ time_t mtime;
};
#endif
Modified: branches/myserver_sec_new/include/conf/security/Makefile.am
===================================================================
--- branches/myserver_sec_new/include/conf/security/Makefile.am 2008-09-27
21:40:15 UTC (rev 2849)
+++ branches/myserver_sec_new/include/conf/security/Makefile.am 2008-09-28
12:49:53 UTC (rev 2850)
@@ -1,4 +1,4 @@
securityincludedir=$(includedir)/myserver/include/conf/security
-securityinclude_HEADERS = auth_domain.h security_cache.h security_domain.h
security_manager.h validator.h validator_factory.h
+securityinclude_HEADERS = auth_domain.h security_cache.h security_domain.h
security_manager.h validator.h validator_factory.h xml_validator.h
SUBDIRS =
Modified: branches/myserver_sec_new/include/conf/security/security_cache.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/security_cache.h
2008-09-27 21:40:15 UTC (rev 2849)
+++ branches/myserver_sec_new/include/conf/security/security_cache.h
2008-09-28 12:49:53 UTC (rev 2850)
@@ -19,6 +19,7 @@
#define SECURITY_CACHE_H
#include <include/base/hash_map/hash_map.h>
#include <include/conf/security/security_manager.h>
+#include <include/conf/security/validator_factory.h>
#include <string>
@@ -28,23 +29,25 @@
{
public:
- SecurityCache();
- ~SecurityCache();
- void free();
- void setMaxNodes(int);
- int getMaxNodes();
+ SecurityCache ();
+ ~SecurityCache ();
+ void free ();
+ void setMaxNodes (int);
+ int getMaxNodes ();
- XmlParser* getParser(const string &dir, const string &sys, bool useXpath =
true);
- int getSecurityFile(const string &file, const string &sys, string &out);
+ XmlParser* getParser (const string &dir, const string &sys, bool useXpath =
true, const char* secName = ".security.xml");
+ int getSecurityFile (const string &file, const string &sys, string
&out, const char* secName = ".security.xml");
- /////////OLD////////////////////////////////////
- int getPermissionMask(SecurityToken* st){return 0;}
- int getErrorFileName(const char *root, int error,
+ /////////OLD NASTY AND DISGUSTING. TEMPORARY SOLUTION TO DON'T BREAK
APIs////////////////////////////////////
+ static class SecurityManager sm;
+ static class ValidatorFactory validatorFactory;
+
+ int getPermissionMask (SecurityToken* st){string xml("xml"); return
sm.getPermissionMask (st, NULL, xml);}
+ int getErrorFileName (const char *root, int error,
const char* sysdirectory, string& out){return 0;}
-
private:
- /*! Store a list of opened files using a hash dictionary. */
+ /*! Store a list of opened files using a hash dictionary. */
HashMap<string, XmlParser*> dictionary;
int limit;
};
Modified: branches/myserver_sec_new/include/conf/security/security_manager.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/security_manager.h
2008-09-27 21:40:15 UTC (rev 2849)
+++ branches/myserver_sec_new/include/conf/security/security_manager.h
2008-09-28 12:49:53 UTC (rev 2850)
@@ -45,8 +45,9 @@
class SecurityDomain;
class ValidatorFactory;
+class Vhost;
+class Server;
-
/*!
*Define permissions flags.
*/
@@ -80,13 +81,13 @@
string password;
/*! Directory that the user is in. */
- string directory;
+ string *directory;
/*! System directory for the host. */
- string sysdirectory;
+ string *sysdirectory;
/*! Resource that the user tried to access. */
- string resource;
+ string *resource;
/*!
*Password that the user should provide to have access.
@@ -106,7 +107,13 @@
/*! If it is true the security manager will use the cached values. */
bool done;
+ /*! Server instance. */
+ Server* server;
+ /*! VHost. */
+ Vhost* vhost;
+
+
///////OLD NOT USED////////////
char* requiredPassword;
const char* filename;
Modified: branches/myserver_sec_new/include/conf/security/validator.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/validator.h 2008-09-27
21:40:15 UTC (rev 2849)
+++ branches/myserver_sec_new/include/conf/security/validator.h 2008-09-28
12:49:53 UTC (rev 2850)
@@ -41,7 +41,7 @@
virtual int getPermissionMaskImpl (SecurityToken* st);
- virtual string *getValue (string &name);
+ string *getValue (string &name);
protected:
int initializeDomains (SecurityToken* st,
list<SecurityDomain*> *domains);
Added: branches/myserver_sec_new/include/conf/security/xml_validator.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/xml_validator.h
(rev 0)
+++ branches/myserver_sec_new/include/conf/security/xml_validator.h
2008-09-28 12:49:53 UTC (rev 2850)
@@ -0,0 +1,47 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2008 Free Software Foundation, Inc.
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef XML_VALIDATOR_H
+#define XML_VALIDATOR_H
+
+#include "stdafx.h"
+#include <include/base/hash_map/hash_map.h>
+
+#include <include/conf/security/security_domain.h>
+#include <include/conf/security/security_manager.h>
+#include <include/server/server.h>
+#include <include/base/sync/mutex.h>
+#include <include/conf/security/security_cache.h>
+#include <include/conf/security/validator.h>
+#include <include/base/xml/xml_parser.h>
+
+class XmlValidator : public Validator
+{
+public:
+ XmlValidator ();
+ virtual ~XmlValidator ();
+
+ virtual int getPermissionMaskImpl (SecurityToken *st);
+private:
+ int computeXmlNode (xmlNodePtr node, SecurityToken *st);
+ SecurityCache* getCache(Server*);
+ SecurityCache *secCache;
+ Mutex cacheMutex;
+};
+
+#endif
Modified: branches/myserver_sec_new/src/conf/security/Makefile.am
===================================================================
--- branches/myserver_sec_new/src/conf/security/Makefile.am 2008-09-27
21:40:15 UTC (rev 2849)
+++ branches/myserver_sec_new/src/conf/security/Makefile.am 2008-09-28
12:49:53 UTC (rev 2850)
@@ -1,4 +1,4 @@
lib_LIBRARIES = libsecurity.a
-libsecurity_a_SOURCES = auth_domain.cpp security_cache.cpp
security_domain.cpp security_manager.cpp validator.cpp validator_factory.cpp
+libsecurity_a_SOURCES = auth_domain.cpp security_cache.cpp
security_domain.cpp security_manager.cpp validator.cpp validator_factory.cpp
xml_validator.cpp
SUBDIRS =
INCLUDES = $(all_includes)
Modified: branches/myserver_sec_new/src/conf/security/auth_domain.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/auth_domain.cpp 2008-09-27
21:40:15 UTC (rev 2849)
+++ branches/myserver_sec_new/src/conf/security/auth_domain.cpp 2008-09-28
12:49:53 UTC (rev 2850)
@@ -43,10 +43,10 @@
return &(securityToken->password);
if (!name.compare ("directory"))
- return &(securityToken->directory);
+ return securityToken->directory;
if (!name.compare("sysdirectory"))
- return &(securityToken->sysdirectory);
+ return securityToken->sysdirectory;
return NULL;
}
Modified: branches/myserver_sec_new/src/conf/security/security_cache.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/security_cache.cpp
2008-09-27 21:40:15 UTC (rev 2849)
+++ branches/myserver_sec_new/src/conf/security/security_cache.cpp
2008-09-28 12:49:53 UTC (rev 2850)
@@ -24,22 +24,26 @@
using namespace std;
+
+ValidatorFactory SecurityCache::validatorFactory;
+SecurityManager SecurityCache::sm(&SecurityCache::validatorFactory);
+
+
/*!
*Constructor for the SecurityCache object.
*/
-SecurityCache::SecurityCache()
+SecurityCache::SecurityCache ()
{
/*!
*By default do not store more than 25 nodes.
*/
limit = 25;
-
}
/*!
*Destroy the security cache object.
*/
-SecurityCache::~SecurityCache()
+SecurityCache::~SecurityCache ()
{
free();
}
@@ -47,11 +51,11 @@
/*!
*free the memory used by the SecurityCache object.
*/
-void SecurityCache::free()
+void SecurityCache::free ()
{
HashMap<string, XmlParser*>::Iterator it = dictionary.begin();
- for (;it != dictionary.end(); it++)
+ for (;it != dictionary.end (); it++)
{
delete (*it);
}
@@ -61,11 +65,15 @@
/*!
*Set a new limit on the nodes to keep in memory.
+ *\param newLimit Number of files to cache. it is adjusted
+ *to be >= 1.
*/
-void SecurityCache::setMaxNodes(int newLimit)
+void SecurityCache::setMaxNodes (int newLimit)
{
+ if (newLimit <= 0)
+ newLimit = 1;
+
/*! Remove all the additional nodes from the dictionary. */
-
while(newLimit < dictionary.size())
{
XmlParser* toremove = dictionary.remove(dictionary.begin());
@@ -81,10 +89,12 @@
*\param dir The directory we need a security parser for.
*\param sys The system directory.
*\param out Output string where put the security file path.
+ *\param secFileName The security file name.
*/
-int SecurityCache::getSecurityFile(const string& dir,
- const string& sys,
- string& out)
+int SecurityCache::getSecurityFile (const string& dir,
+ const string& sys,
+ string& out,
+ const char* secFileName)
{
int found = 0;
string secFile;
@@ -96,7 +106,8 @@
file.erase(i--, 1);
secFile.assign(dir);
- secFile.append("/security");
+ secFile.append("/");
+ secFile.append(secFileName);
/* The security file exists in the directory. */
if(FilesUtility::fileExists(secFile))
@@ -126,12 +137,14 @@
if(i == 0)
{
out.assign(sys);
- out.append("/security");
+ out.append("/");
+ out.append(secFileName);
return !FilesUtility::fileExists(out);
}
secFile.assign(file);
- secFile.append("/security");
+ secFile.append("/");
+ secFile.append(secFileName);
found = FilesUtility::fileExists(secFile);
}
@@ -154,35 +167,37 @@
*\param dir The path where start looking.
*\param sys The system directory.
*\param useXpath Specify if XPath will be used on the file.
+ *\param secFileName The security file name.
*/
-XmlParser* SecurityCache::getParser(const string &dir,
- const string &sys,
- bool useXpath)
+XmlParser* SecurityCache::getParser (const string &dir,
+ const string &sys,
+ bool useXpath,
+ const char* secFileName)
{
XmlParser* parser;
string file;
- if(getSecurityFile(dir, sys, file))
+ if (getSecurityFile (dir, sys, file, secFileName))
return NULL;
- parser = dictionary.get(file);
+ parser = dictionary.get (file);
/*!
*If the parser is already present and satisfy XPath then use it.
*/
- if(parser && (!useXpath || parser->isXpathEnabled()))
+ if (parser && (!useXpath || parser->isXpathEnabled ()))
{
time_t fileModTime;
/*! If the file was modified reload it. */
- fileModTime = FilesUtility::getLastModTime(file.c_str());
- if((fileModTime != static_cast<time_t>(-1)) &&
- (parser->getLastModTime() != fileModTime))
+ fileModTime = FilesUtility::getLastModTime (file.c_str ());
+ if ((fileModTime != static_cast<time_t>(-1)) &&
+ (parser->getLastModTime () != fileModTime))
{
- parser->close();
- if(parser->open(file.c_str(), useXpath) == -1)
+ parser->close ();
+ if(parser->open (file.c_str (), useXpath) == -1)
{
- dictionary.remove(file.c_str());
+ dictionary.remove (file.c_str ());
return NULL;
}
@@ -194,28 +209,26 @@
*Create the parser and add it to the dictionary.
*/
XmlParser* old;
- parser = new XmlParser();
+ parser = new XmlParser ();
- if(parser == NULL)
+ if (parser == NULL)
{
return NULL;
}
- if(dictionary.size() >= limit)
+ if (dictionary.size () >= limit)
{
- XmlParser* toremove = dictionary.remove(dictionary.begin());
- if(toremove)
+ XmlParser* toremove = dictionary.remove (dictionary.begin ());
+ if (toremove)
delete toremove;
}
- if(parser->open(file.c_str(), useXpath) == -1)
+ if (parser->open (file.c_str (), useXpath) == -1)
return NULL;
- old = dictionary.put(file, parser);
- if(old)
- {
+ old = dictionary.put (file, parser);
+ if (old)
delete old;
- }
}
return parser;
Modified: branches/myserver_sec_new/src/conf/security/security_manager.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/security_manager.cpp
2008-09-27 21:40:15 UTC (rev 2849)
+++ branches/myserver_sec_new/src/conf/security/security_manager.cpp
2008-09-28 12:49:53 UTC (rev 2850)
@@ -41,9 +41,15 @@
{
mask = 0;
done = false;
+ server = NULL;
+ vhost = NULL;
+
+ directory = NULL;
+ sysdirectory = NULL;
+ resource = NULL;
+
}
-
SecurityManager::SecurityManager (ValidatorFactory* vf)
{
validatorFactory = vf;
@@ -63,7 +69,13 @@
{
Validator* v = validatorFactory->getValidator(validator);
- if (!v)
+ if (v == NULL)
+ {
+ string xml ("xml");
+ v = validatorFactory->getValidator (xml);
+ }
+
+ if (v == NULL)
return 0;
return v->getPermissionMask (st, domains);
Modified: branches/myserver_sec_new/src/conf/security/validator.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/validator.cpp 2008-09-27
21:40:15 UTC (rev 2849)
+++ branches/myserver_sec_new/src/conf/security/validator.cpp 2008-09-28
12:49:53 UTC (rev 2850)
@@ -65,7 +65,7 @@
int Validator::initializeDomains (SecurityToken* st,
list<SecurityDomain*> *domains)
{
- string authName("");
+ string authName ("");
hashedDomains.put (authName, new AuthDomain(st));
if (domains)
@@ -121,7 +121,7 @@
securityDomain = hashedDomains.get (domain);
if (securityDomain)
- return securityDomain->getValue(var);
+ return securityDomain->getValue (var);
return NULL;
}
Modified: branches/myserver_sec_new/src/conf/security/validator_factory.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/validator_factory.cpp
2008-09-27 21:40:15 UTC (rev 2849)
+++ branches/myserver_sec_new/src/conf/security/validator_factory.cpp
2008-09-28 12:49:53 UTC (rev 2850)
@@ -18,10 +18,19 @@
#include <include/conf/security/validator.h>
#include <include/conf/security/validator_factory.h>
+#include <include/conf/security/xml_validator.h>
+#include <string>
+
+using namespace std;
+
ValidatorFactory::ValidatorFactory ()
{
- // validators
+ XmlValidator* xmlValidator = new XmlValidator;
+ string xml ("xml");
+
+ validators.put (xml, xmlValidator);
+
}
ValidatorFactory::~ValidatorFactory ()
Added: branches/myserver_sec_new/src/conf/security/xml_validator.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/xml_validator.cpp
(rev 0)
+++ branches/myserver_sec_new/src/conf/security/xml_validator.cpp
2008-09-28 12:49:53 UTC (rev 2850)
@@ -0,0 +1,91 @@
+/*
+MyServer
+Copyright (C) 2008 Free Software Foundation, Inc.
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/conf/security/xml_validator.h>
+#include <include/conf/security/auth_domain.h>
+
+XmlValidator::XmlValidator ()
+{
+ secCache = NULL;
+}
+
+XmlValidator::~XmlValidator ()
+{
+ if (secCache != NULL)
+ {
+ secCache->free ();
+ delete secCache;
+ }
+}
+
+/*!
+ *Get the security files cache.
+ */
+SecurityCache* XmlValidator::getCache(Server *server)
+{
+ if (secCache == NULL && server != NULL)
+ {
+ const char *data = server->getHashedData ("SECURITY_CACHE_NODES");
+ secCache = new SecurityCache ();
+ if (data)
+ {
+ int nodes = atoi (data);
+ secCache->setMaxNodes (nodes);
+ }
+ }
+
+ return secCache;
+}
+
+
+/*!
+ *\see XmlValidator#getPermissionMaskImpl.
+ */
+int XmlValidator::getPermissionMaskImpl (SecurityToken* st)
+{
+ const char *secName;
+ XmlParser* xmlFile;
+ SecurityCache *cache = getCache (st->server);
+
+ if (cache == NULL)
+ return 0;
+
+ secName = st->vhost ? st->vhost->getHashedData ("SECURITY_FILE_NAME") : NULL;
+
+ if (secName == NULL)
+ secName = st->server ? st->server->getHashedData ("SECURITY_FILE_NAME") :
NULL;
+
+ if (secName == NULL)
+ secName = ".security.xml";
+
+ xmlFile = cache->getParser (*st->resource, *st->sysdirectory, false,
secName);
+
+ if (xmlFile == NULL)
+ return 0;
+
+
+ return computeXmlNode (xmlFile->getDoc ()->children, st);
+}
+
+/*!
+ *Compute the current XML node.
+ */
+int XmlValidator::computeXmlNode (xmlNodePtr node, SecurityToken *st)
+{
+ return 0;
+}
Modified: branches/myserver_sec_new/src/protocol/ftp/ftp.cpp
===================================================================
--- branches/myserver_sec_new/src/protocol/ftp/ftp.cpp 2008-09-27 21:40:15 UTC
(rev 2849)
+++ branches/myserver_sec_new/src/protocol/ftp/ftp.cpp 2008-09-28 12:49:53 UTC
(rev 2850)
@@ -2399,8 +2399,8 @@
st.user = sUser.c_str();
st.password = sPass.c_str();
}
- st.directory = sDir.c_str();
- st.sysdirectory =
td.pConnection->host->getSystemRoot().c_str();//pFtpUserData->m_pDataConnection->host->getSystemRoot().c_str();
+ st.directory = &sDir;
+ st.sysdirectory =
(string*)&(td.pConnection->host->getSystemRoot());//pFtpUserData->m_pDataConnection->host->getSystemRoot().c_str();
st.authType = 0;
st.filename = sFileName.c_str();
//st.providedMask = &mask;
Modified: branches/myserver_sec_new/src/protocol/http/http.cpp
===================================================================
--- branches/myserver_sec_new/src/protocol/http/http.cpp 2008-09-27
21:40:15 UTC (rev 2849)
+++ branches/myserver_sec_new/src/protocol/http/http.cpp 2008-09-28
12:49:53 UTC (rev 2850)
@@ -352,6 +352,13 @@
char authType[16];
int providedMask;
+ st.server = Server::getInstance();
+ st.resource = &filenamePath;
+ st.directory = &directory;
+ st.sysdirectory = &(td->vhostSys);
+
+ st.vhost = td->connection->host;
+
try
{
st.authType = authType;
@@ -418,8 +425,6 @@
{
st.user = td->connection->getLogin();
st.password = td->connection->getPassword();
- st.directory = directory.c_str();
- st.sysdirectory = td->getVhostSys();
st.filename = file.c_str();
st.requiredPassword =
((HttpUserData*)td->connection->protocolBuffer)->requiredPassword;
@@ -440,8 +445,6 @@
{
st.user = "Guest";
st.password = "";
- st.directory = directory.c_str();
- st.sysdirectory = td->getVhostSys();
st.filename = file.c_str();
st.requiredPassword = 0;
st.providedMask = 0;
@@ -493,8 +496,6 @@
{
st.user = "Guest";
st.password = "";
- st.directory = directory.c_str();
- st.sysdirectory = td->getVhostSys();
st.filename = file.c_str();
st.requiredPassword = 0;
st.providedMask = 0;
Modified: branches/myserver_sec_new/tests/Makefile.am
===================================================================
--- branches/myserver_sec_new/tests/Makefile.am 2008-09-27 21:40:15 UTC (rev
2849)
+++ branches/myserver_sec_new/tests/Makefile.am 2008-09-28 12:49:53 UTC (rev
2850)
@@ -2,5 +2,5 @@
#
bin_PROGRAMS = tests_suite
-tests_suite_SOURCES = main.cpp test_connection.cpp test_ftp.cpp
test_log_manager.cpp test_mutex.cpp test_security_domain.cpp test_validator.cpp
test_auth_domain.cpp test_connections_scheduler.cpp test_gzip.cpp
test_log_stream_factory.cpp test_pipe.cpp test_security_manager.cpp
test_validator_factory.cpp test_base64.cpp test_file_stream.cpp
test_hashmap.cpp test_md5.cpp test_recursive_mutex.cpp test_semaphore.cpp
test_xml.cpp test_cached_file_buffer.cpp test_file_stream_creator.cpp
test_homedir.cpp test_mem_buff.cpp test_regex.cpp
test_socket_stream_creator.cpp test_cached_file.cpp test_files_utility.cpp
test_http_request.cpp test_mem_stream.cpp test_safetime.cpp test_thread.cpp
test_cached_file_factory.cpp test_filter_chain.cpp test_http_response.cpp
test_multicast.cpp test_security_cache.cpp test_utility.cpp
+tests_suite_SOURCES = main.cpp test_connection.cpp test_ftp.cpp
test_log_manager.cpp test_mutex.cpp test_security_domain.cpp test_validator.cpp
test_auth_domain.cpp test_connections_scheduler.cpp test_gzip.cpp
test_log_stream_factory.cpp test_pipe.cpp test_security_manager.cpp
test_validator_factory.cpp test_base64.cpp test_file_stream.cpp
test_hashmap.cpp test_md5.cpp test_recursive_mutex.cpp test_semaphore.cpp
test_xml.cpp test_cached_file_buffer.cpp test_file_stream_creator.cpp
test_homedir.cpp test_mem_buff.cpp test_regex.cpp
test_socket_stream_creator.cpp test_cached_file.cpp test_files_utility.cpp
test_http_request.cpp test_mem_stream.cpp test_safetime.cpp test_thread.cpp
test_cached_file_factory.cpp test_filter_chain.cpp test_http_response.cpp
test_multicast.cpp test_security_cache.cpp test_utility.cpp
test_xml_validator.cpp
tests_suite_LDADD = ../src/libmyserver.a $(CPPUNIT_LDFLAGS) $(PTHREAD_LIB)
$(IDN_LIB) $(XNET_LIB) $(EVENT_LIB) $(DL_LIB) $(OPENSSL_LIB) $(ZLIB_LIB)
$(XML_LIBS) $(LDFLAGS)
Modified: branches/myserver_sec_new/tests/test_security_cache.cpp
===================================================================
--- branches/myserver_sec_new/tests/test_security_cache.cpp 2008-09-27
21:40:15 UTC (rev 2849)
+++ branches/myserver_sec_new/tests/test_security_cache.cpp 2008-09-28
12:49:53 UTC (rev 2850)
@@ -51,9 +51,15 @@
void testMaxNodes ()
{
+ secCache->setMaxNodes (-10);
+ CPPUNIT_ASSERT_EQUAL (secCache->getMaxNodes (), 1);
+
secCache->setMaxNodes (0);
- CPPUNIT_ASSERT_EQUAL (secCache->getMaxNodes (), 0);
+ CPPUNIT_ASSERT_EQUAL (secCache->getMaxNodes (), 1);
+ secCache->setMaxNodes (1);
+ CPPUNIT_ASSERT_EQUAL (secCache->getMaxNodes (), 1);
+
secCache->setMaxNodes (10);
CPPUNIT_ASSERT_EQUAL (secCache->getMaxNodes (), 10);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [2850] Added `XmlValidator' class skeleton.,
Giuseppe Scrivano <=