Commit Graph

20 Commits

Author SHA1 Message Date
silverleo
07d7477dec It's 2010, where's my hoverboard?
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1693 726aef4b-f618-498e-8847-2d620e286838
2010-01-06 09:37:05 +00:00
psychon
c7583c4946 Fix a low impact directory traversal bug
A common pattern for checking directories in ZNC is the following:

	sAbsolutePath = CDir::ChangeDir(sAllowedPath, sFile);
	if (sAbsolutePath.Left(sAllowedPath.length()) != sAllowedPath)
		Error;

But there is a problem: If sAllowedPath doesn't end with a slash, we are
vulnerable to an attack. If e.g. sAllowedPath = "/foo/bar", then
sFile = "../bartender" would result in sAbsolutePath = "/foo/bartender". Since
this path does begin with sAllowedPath, the code allowed it.

There shouldn't be any places where this can be exploited currently, but it is
still a security bug (path traversal).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1569 726aef4b-f618-498e-8847-2d620e286838
2009-07-21 18:36:33 +00:00
psychon
31b5df8b73 CTempalte: Fix a minor error in a debug message
Patch by KiNgMaR, thanks


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1545 726aef4b-f618-498e-8847-2d620e286838
2009-06-19 15:34:59 +00:00
prozacx
c4a6f39b53 Pulled in CString changes from my common repository to help facilitate the upcoming webmods changes
Changes include...

- CString -
Addition of LCString typedef to list<CString>

Added four more args to CString::Token()...
	bool bAllowEmpty = false        <-- This default of false is NOT backward compatible but seems way more intuitive
	const CString& sLeft = ""
	const CString& sRight = ""
	bool bTrimQuotes = true

Added CString::OptionSplit()
Added CString::QuoteSplit()

Added two new args to CString::Split()...
	bool bTrimQuotes = true,
	bool bTrimWhiteSpace = false

- CTemplate -
Added new class CTemplateTagHandler to provide capability to add custom tags and vars
Added var name pointer dereferencing in the form of <? VAR Name=*other_var ?> (use ** to start with a literal star)
Added a list of paths that can be used to look for a given filename in multiple locations
Added CTemplate::PrependPath()
Added CTemplate::AppendPath()
Added CTemplate::RemovePath()
Added CTemplate::ClearPath()
Added CTemplate::PrintString() for filling a CString& instead of a stream
Added <? LT ?> which outputs a literal "<?"
Added <? GT ?> which outputs a literal "?>"
Added <? SETBLOCK ?> and <? ENDSETBLOCK ?> for setting a variable's value to the contents between the tags
Added <? EXPAND ?> for expanding a filename to a path using the settable list of paths
Added <? BREAK ?> and <? CONTINUE ?> inner loop tags
Added <? EXIT ?> tag to stop processing
Added <? DEBUG ?> tag for printing to DEBUG()
Added REVERSE keyword to the <? LOOP ?> tag



git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1537 726aef4b-f618-498e-8847-2d620e286838
2009-06-10 05:48:12 +00:00
psychon
235b10c200 Use that new define everywhere
Now there are no uses of DEBUG_ONLY() left :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1349 726aef4b-f618-498e-8847-2d620e286838
2009-01-25 16:51:54 +00:00
psychon
6345ce12fa Make O_RDONLY the default mode when opening files through CFile
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1336 726aef4b-f618-498e-8847-2d620e286838
2009-01-19 15:55:41 +00:00
psychon
08ad0291ea Happy New Year 2009 everyone!
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1317 726aef4b-f618-498e-8847-2d620e286838
2009-01-01 12:22:21 +00:00
kroimon
5237a24747 Use CString::Equals() everywhere.
* (CString::CaseCmp() == 0) became CString::Equals()
* (CString::CaseCmp() != 0) became !CString::Equals()
* replaced some occurrences of strn?casecmp

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1234 726aef4b-f618-498e-8847-2d620e286838
2008-09-30 15:15:59 +00:00
psychon
1f9e4f9601 Save some space for --disable-modules by not compiling template and http socks
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@927 726aef4b-f618-498e-8847-2d620e286838
2008-01-18 22:46:40 +00:00
psychon
e72c445694 Clean up includes
All the headers are now self-contained (g++ Header.h -o /dev/null).

Some system headers where moved to the .cpp they are actually needed in,
some of our own headers are includes less. (Especially MD5.h)

Headers are sorted alphabetically while in e.g. FileUtils.cpp FileUtils.h
is the first file included.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@915 726aef4b-f618-498e-8847-2d620e286838
2008-01-07 21:31:16 +00:00
psychon
eeec633e30 Update copyright header for 2008
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@910 726aef4b-f618-498e-8847-2d620e286838
2008-01-07 21:13:07 +00:00
psychon
b490b12058 Fix some gcc 4.3 warnings
These are mostly string casts, handling function's return value and some
weird warning about missing spaces on empty while loops.

These were reported by and fixed with Marcus Rueckert <darix@opensu.se>.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@904 726aef4b-f618-498e-8847-2d620e286838
2007-12-20 18:31:48 +00:00
psychon
a09a7e79f6 Switch to the copyright headers the GPLv2 wants us to have
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@843 726aef4b-f618-498e-8847-2d620e286838
2007-09-21 18:55:33 +00:00
prozacx
6dcacaa79e Added contact info
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@752 726aef4b-f618-498e-8847-2d620e286838
2006-09-13 07:39:48 +00:00
prozacx
0720669c81 Added template options
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@717 726aef4b-f618-498e-8847-2d620e286838
2006-03-26 20:45:54 +00:00
prozacx
ebaceebd8b Added an extra debug print
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@712 726aef4b-f618-498e-8847-2d620e286838
2006-03-25 10:10:39 +00:00
prozacx
a9e60b43c5 Migrated away from CString::ToString() in favor of explicit constructors
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@669 726aef4b-f618-498e-8847-2d620e286838
2006-02-25 09:43:35 +00:00
prozacx
1fe82b66fb Fail if unable to open an included template
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@646 726aef4b-f618-498e-8847-2d620e286838
2006-02-12 00:18:52 +00:00
prozacx
4cb6e9151b Added debug prints
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@621 726aef4b-f618-498e-8847-2d620e286838
2006-02-08 08:42:48 +00:00
prozacx
ecf431f246 Added CTemplate support which included upgrading String.cpp/h and FileUtils.cpp/h and fixing some issues
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@603 726aef4b-f618-498e-8847-2d620e286838
2006-02-05 05:01:53 +00:00