Commit Graph

17 Commits

Author SHA1 Message Date
psychon
1d7fdc2954 Change the return type of OnPageRequestInternal()
Instead of return a bool, this now returns an enum. This explains the meaning of
the returned value better and will be used in the next commit to fix a bug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1833 726aef4b-f618-498e-8847-2d620e286838
2010-03-15 15:58:15 +00:00
psychon
e54b0bda0a Revert r1831
No, I'm not going to explain why. :P


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1832 726aef4b-f618-498e-8847-2d620e286838
2010-03-15 15:43:22 +00:00
psychon
d76f193b6b Remove a self-assignment due to copy&paste
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1831 726aef4b-f618-498e-8847-2d620e286838
2010-03-15 15:36:04 +00:00
psychon
cb193d8f72 Make it possible to process HTTP requests async
This changes CHTTPSock so that one can handle HTTP requests asynchronously.
This is done by not forcing a page to be sent out in the caller of
OnPageRequest() but instead requiring a call to the new function
CHTTPSock::PrintPage().


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1830 726aef4b-f618-498e-8847-2d620e286838
2010-03-15 15:27:02 +00:00
psychon
c3728f4cb3 Fix a crash with WebMods and deleting User
If a user who is currently logged in to WebMods is deleted, his CWebSession
still kept a stale CUser pointer around. The next time he loaded a web page,
Bad Things(tm) happened.

This is fixed by deleting all of a user's sessions when that user is deleted.

Thanks to DarthGandalf for spotting the bug and writing the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1827 726aef4b-f618-498e-8847-2d620e286838
2010-03-11 17:29:36 +00:00
psychon
547b603488 Fix a crash bug with WebMods and auth modules
When a CWebSock was destroyed before its CWebAuth, the CWebAuth dereferenced a
stale pointer once it was used again. Fix this by calling
CAuthBase::Invalidate() appropriately.

Thanks to DarthGandalf for finding this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1826 726aef4b-f618-498e-8847-2d620e286838
2010-03-10 20:47:48 +00:00
psychon
5ff69d8e05 Fix traffic accounting of WebModules
The traffic generated by it was just discarded. Now it's accounted towards a
user if one is logged in, else towards the global traffic usage.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1825 726aef4b-f618-498e-8847-2d620e286838
2010-03-10 19:34:21 +00:00
psychon
a7d26bb598 Fix a crash bug in WebModules
WebModules use CHTTPSock for the HTTP server. That class requires a CModule
instance for working since it's based on CSocket. This was solved by creating a
fake module instance which is destroyed when the socket is destroyed.

The problem here was that CSocket's destructor tried to access that module
instance which was already destroyed resulting in a use-after-free.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1824 726aef4b-f618-498e-8847-2d620e286838
2010-03-10 19:16:38 +00:00
psychon
f6f7dce129 Use TCacheMap for saving the WebModules session
With this change, sessions are automatically "garbage collected" 24h after the
last request using this session.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1823 726aef4b-f618-498e-8847-2d620e286838
2010-03-10 17:53:57 +00:00
psychon
cbb6e14c3a Generate session IDs more securely
We now use a lot more data for generating the session id which is fed to a hash
to make it impossible to attack specific parts of the input.

Also we now retry generating a new session id in the (improbable) case of
collision with an existing session id.

Thanks a lot to cnu for pointing out the weakness in the old code by stealing my
session cookie, you evil hacker!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1819 726aef4b-f618-498e-8847-2d620e286838
2010-03-09 19:44:24 +00:00
psychon
c9f26ba05f Move the list of sessions to a more "public" place
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1806 726aef4b-f618-498e-8847-2d620e286838
2010-03-04 14:10:45 +00:00
psychon
9f742b352d Use a random string instead of an md5 hash for session IDs
This string has the same length as the md5 hash, but it does actually contain
more entropy. Also, why md5? :/


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1804 726aef4b-f618-498e-8847-2d620e286838
2010-03-04 14:03:27 +00:00
prozacx
c27713cc1d Added support for cookies and sessions. Logging in is now done via cookies.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1799 726aef4b-f618-498e-8847-2d620e286838
2010-03-01 01:22:02 +00:00
psychon
8e5960983b Add our copyright header to WebModules.cpp
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1795 726aef4b-f618-498e-8847-2d620e286838
2010-02-25 12:30:14 +00:00
prozacx
aff85c2244 Added F_ADMIN flag to CWebSubPage to require admin privs on a page-by-page basis
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1792 726aef4b-f618-498e-8847-2d620e286838
2010-02-24 06:28:39 +00:00
prozacx
45caa26d86 Renamed GetWebNavTitle() to GetWebMenuTitle() to keep in line with the name of the Menu.tmpl file
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1787 726aef4b-f618-498e-8847-2d620e286838
2010-02-23 06:09:21 +00:00
prozacx
ad92c58c42 Initial commit of webmods - still lots of work to be done
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1784 726aef4b-f618-498e-8847-2d620e286838
2010-02-22 07:40:22 +00:00