~vanhoof/+junk/znc

« back to all changes in this revision

Viewing changes to debian/patches/02-inc-port-in-cookie.diff

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Matthäi
  • Date: 2011-02-06 17:41:38 UTC
  • mfrom: (21.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110206174138-ush4l5mkr4wg738n
Tags: 0.096-2
* Merge 0.092-3~bpo50+1 changelog.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Add upstream patch 02-inc-port-in-cookie.diff, which adds the port number
2
 
# of the znc instance to the cookie name, to avoid cookie clashes with more
3
 
# than a single znc instance per IP and user.
4
 
 
5
 
diff -Naur znc-0.092.orig//HTTPSock.cpp znc-0.092/HTTPSock.cpp
6
 
--- znc-0.092.orig//HTTPSock.cpp        2010-05-01 20:36:05.000000000 +0200
7
 
+++ znc-0.092/HTTPSock.cpp      2010-08-16 20:08:06.000000000 +0200
8
 
@@ -43,21 +43,13 @@
9
 
 
10
 
 bool CHTTPSock::SendCookie(const CString& sKey, const CString& sValue) {
11
 
        if (!sKey.empty() && !sValue.empty()) {
12
 
-               if (m_msRequestCookies.find(sKey) == m_msRequestCookies.end() ||
13
 
-                       m_msRequestCookies[sKey].StrCmp(sValue) != 0)
14
 
-               {
15
 
-                       m_msResponseCookies[sKey] = sValue;
16
 
-               }
17
 
+               m_msResponseCookies[sKey] = sValue;
18
 
                return true;
19
 
        }
20
 
 
21
 
        return false;
22
 
 }
23
 
 
24
 
-const MCString& CHTTPSock::GetRequestCookies() const {
25
 
-       return m_msRequestCookies;
26
 
-}
27
 
-
28
 
 CString CHTTPSock::GetRequestCookie(const CString& sKey) const {
29
 
        MCString::const_iterator it = m_msRequestCookies.find(sKey);
30
 
 
31
 
diff -Naur znc-0.092.orig//HTTPSock.h znc-0.092/HTTPSock.h
32
 
--- znc-0.092.orig//HTTPSock.h  2010-05-01 22:15:01.000000000 +0200
33
 
+++ znc-0.092/HTTPSock.h        2010-08-16 20:08:06.000000000 +0200
34
 
@@ -52,7 +52,6 @@
35
 
        void GetPage();
36
 
 
37
 
        // Cookies
38
 
-       const MCString& GetRequestCookies() const;
39
 
        CString GetRequestCookie(const CString& sKey) const;
40
 
        bool SendCookie(const CString& sKey, const CString& sValue);
41
 
        // Cookies
42
 
diff -Naur znc-0.092.orig//WebModules.cpp znc-0.092/WebModules.cpp
43
 
--- znc-0.092.orig//WebModules.cpp      2010-05-22 12:32:59.000000000 +0200
44
 
+++ znc-0.092/WebModules.cpp    2010-08-16 20:08:06.000000000 +0200
45
 
@@ -475,25 +475,29 @@
46
 
        return false;
47
 
 }
48
 
 
49
 
-CString CWebSock::GetRequestCookie(const CString& sKey) const {
50
 
+CString CWebSock::GetRequestCookie(const CString& sKey) {
51
 
+       const CString sPrefixedKey = CString(GetLocalPort()) + "-" + sKey;
52
 
        CString sRet;
53
 
 
54
 
        if (!m_sModName.empty()) {
55
 
-               sRet = CHTTPSock::GetRequestCookie("Mod::" + m_sModName + "::" + sKey);
56
 
+               sRet = CHTTPSock::GetRequestCookie("Mod-" + m_sModName + "-" + sPrefixedKey);
57
 
        }
58
 
 
59
 
        if (sRet.empty()) {
60
 
-               return CHTTPSock::GetRequestCookie(sKey);
61
 
+               return CHTTPSock::GetRequestCookie(sPrefixedKey);
62
 
        }
63
 
+
64
 
        return sRet;
65
 
 }
66
 
 
67
 
 bool CWebSock::SendCookie(const CString& sKey, const CString& sValue) {
68
 
+       const CString sPrefixedKey = CString(GetLocalPort()) + "-" + sKey;
69
 
+
70
 
        if (!m_sModName.empty()) {
71
 
-               return CHTTPSock::SendCookie("Mod::" + m_sModName + "::" + sKey, sValue);
72
 
+               return CHTTPSock::SendCookie("Mod-" + m_sModName + "-" + sPrefixedKey, sValue);
73
 
        }
74
 
 
75
 
-       return CHTTPSock::SendCookie(sKey, sValue);
76
 
+       return CHTTPSock::SendCookie(sPrefixedKey, sValue);
77
 
 }
78
 
 
79
 
 void CWebSock::OnPageRequest(const CString& sURI) {
80
 
diff -Naur znc-0.092.orig//WebModules.h znc-0.092/WebModules.h
81
 
--- znc-0.092.orig//WebModules.h        2010-05-17 15:25:17.000000000 +0200
82
 
+++ znc-0.092/WebModules.h      2010-08-16 20:08:06.000000000 +0200
83
 
@@ -155,7 +155,7 @@
84
 
        size_t GetAvailSkins(vector<CFile>& vRet);
85
 
        CString GetSkinName();
86
 
 
87
 
-       CString GetRequestCookie(const CString& sKey) const;
88
 
+       CString GetRequestCookie(const CString& sKey);
89
 
        bool SendCookie(const CString& sKey, const CString& sValue);
90
 
 
91
 
        static void FinishUserSessions(const CUser& User) {