Commit Graph

28 Commits

Author SHA1 Message Date
darthgandalf
dffabfed2e Modules can now embed web stuff directly to other web pages which support this feature.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2128 726aef4b-f618-498e-8847-2d620e286838
2010-09-11 18:51:54 +00:00
psychon
6d16047113 WebMods: Use PrintErrorPage() instead of GetErrorPage()
GetErrorPage() only generates the HTML for the error page while PrintErrorPage()
actually makes sure the error page is sent with the correct HTTP status code.
(We sent all error pages with status "200 OK"!)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2039 726aef4b-f618-498e-8847-2d620e286838
2010-06-22 15:18:56 +00:00
cflakes
114bb25aa8 Fixed an issue identified by Un1matr1x: If you were running two 0.090 ZNCs on the same IP,
(but different ports), any web login session from ZNC #1 would overwrite the session from
ZNC #2. While doing this, also removed an unnecessary check in CHTTPSock::SendCookie and
CHTTPSock::GetRequestCookies (which doesn't transparently translate cookie names and has
never been used so far).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2030 726aef4b-f618-498e-8847-2d620e286838
2010-06-19 19:07:24 +00:00
psychon
f31621b305 Remove some unneeded functions from CWebSock
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2014 726aef4b-f618-498e-8847-2d620e286838
2010-06-07 12:38:24 +00:00
cflakes
f4b4eafc74 Removed the mis-use of the fake module concept in WebMods.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2011 726aef4b-f618-498e-8847-2d620e286838
2010-06-06 11:41:31 +00:00
psychon
c6b5a4d4db Move module's templates to their data dir
Instead of having the template files and images in /usr/share/znc/www/<mod>/,
modules now get to use /usr/share/znc/<mod>/tmpl/ and files/ for this purpose.
This puts those directories for static data to good use again and might even fix
some bugs (after all, the code for that dir is older and more tested than the
new code for www/).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1997 726aef4b-f618-498e-8847-2d620e286838
2010-05-17 13:25:17 +00:00
psychon
0c0c51172e WebModules: Make PAGE_DONE imply Close()
When one now finishes a web request with PAGE_DONE, the code actively calls
Close(CLT_AFTERWRITE) which one previously had to call explicitly. This means
there is finally a difference between PAGE_DONE and PAGE_DEFERRED. ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1981 726aef4b-f618-498e-8847-2d620e286838
2010-05-13 15:54:06 +00:00
psychon
3b6205979e WebMods: Calculate the module's web path correctly
Until now, the code checked for <moddir>/www/<mod name> and just used
./modules/www/<mod name> if the other dir didn't exist.

Now we calculate the correct path from the module's shared object's path, which
is the correct thing to do.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1967 726aef4b-f618-498e-8847-2d620e286838
2010-05-03 13:49:45 +00:00
psychon
3faf0adf90 Some more tabs gone
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1964 726aef4b-f618-498e-8847-2d620e286838
2010-05-01 20:26:30 +00:00
psychon
f2d7ae1a08 Change a bunch of tabs into spaces
At the beginning of lines, one uses tabs for indenting. In the middle of the
line, you use spaces. If you want two different lines to line up with each
other, you start them with the same number of tabs and use spaces for the rest
of the indenting in the "other" line.

Really, that's how one does it!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1963 726aef4b-f618-498e-8847-2d620e286838
2010-05-01 20:15:01 +00:00
psychon
b0d140e2ed Webmods: Only accept POST requests with a secret parameter
This is a first step against CSRF. Thanks to flakes for the idea.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1932 726aef4b-f618-498e-8847-2d620e286838
2010-04-25 13:04:51 +00:00
psychon
ba05f11ea4 Remove CWebSock::m_bLoggedIn
We can just check if m_pUser is NULL for the very same thing.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1859 726aef4b-f618-498e-8847-2d620e286838
2010-03-30 12:20:31 +00:00
cflakes
5b723fe7a4 WebSock: Add PAGE_DONE to EPageReqResult. It's used to better differentiate between
async processing (PAGE_DEFERRED) and redirects and other synchronous stuff (-> PAGE_DONE).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1842 726aef4b-f618-498e-8847-2d620e286838
2010-03-23 18:03:12 +00:00
cflakes
4daa637130 WebMods/HTTPSock: Do not send Set-Cookie headers if the cookie has not changed.
To achieve that, split internal cookie jar into a jar for received cookies
and one for cookies that are to be sent with the response.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1840 726aef4b-f618-498e-8847-2d620e286838
2010-03-23 16:48:25 +00:00
psychon
b764aa7b42 Fix WebModules with auth modules
When e.g. imapauth started handling a login from WebMods it opened a new TCP
connection etc. This took time, but WebMods didn't actually wait for the login
to finish which caused the login to fail later on since the HTTP socket was
already destroyed.

This fixes it by letting the HTTP sock just hang. Once the login finishes,
CHTTPSock::Redirect() is called to let it come back to life again.

Thanks to DarthGandalf for finding this issue.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1834 726aef4b-f618-498e-8847-2d620e286838
2010-03-15 16:06:56 +00:00
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
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
prozacx
5e940438f9 Removed unused member
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1800 726aef4b-f618-498e-8847-2d620e286838
2010-03-01 01:25:20 +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
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
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