Package: wikipediafs
Version: 0.4-6
Severity: serious
Justification: makes the package completly unusable

Hi,

in August 2016 I tried to use wikipediafs with wiki.hamburg.ccc.de and
eventually succeeded, after applying the attached patches.

wiki.hamburg.ccc.de runs mediawiki 1.19.24

For this I had to take svn://svn.code.sf.net/p/wikipediafs/code@75 and
modify it like in the attached patch…

I have no idea how it performs against mediawiki 1.27.1-2 which is the
current version in stretch but I strongly assume it's still broken.

-- 
cheers,
        Holger
diff -Nru wikipediafs-0.4/debian/changelog wikipediafs-0.4/debian/changelog
--- wikipediafs-0.4/debian/changelog	2014-07-14 11:35:51.000000000 +0200
+++ wikipediafs-0.4/debian/changelog	2016-08-05 16:06:40.000000000 +0200
@@ -1,3 +1,12 @@
+wikipediafs (0.4-6.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Take svn upstream commit #75 from mercury: "Make logins less touchy to
+    cookie changes."
+  * Modify that patch… 
+
+ -- Holger Levsen <hol...@debian.org>  Fri, 05 Aug 2016 15:32:21 +0200
+
 wikipediafs (0.4-6) unstable; urgency=medium
 
   * Add Vcs-* information
diff -Nru wikipediafs-0.4/debian/patches/0001-Make-logins-less-touchy-to-cookie-changes.patch wikipediafs-0.4/debian/patches/0001-Make-logins-less-touchy-to-cookie-changes.patch
--- wikipediafs-0.4/debian/patches/0001-Make-logins-less-touchy-to-cookie-changes.patch	1970-01-01 01:00:00.000000000 +0100
+++ wikipediafs-0.4/debian/patches/0001-Make-logins-less-touchy-to-cookie-changes.patch	2016-08-05 16:06:23.000000000 +0200
@@ -0,0 +1,92 @@
+From a30a97bd49a440907c9c28bb8be66a08d013c02f Mon Sep 17 00:00:00 2001
+From: mercury <mercury@59acd704-e115-0410-a914-e735a229ed7c>
+Date: Fri, 10 Jul 2015 02:45:15 +0000
+Subject: [PATCH] Make logins less touchy to cookie changes.
+
+First off, the cookie list internal to getCookieString is now a dict instead of a list, this has slightly worse code for formatting, but rather better code for checking to see if we have logged in successfully.
+
+Second, the login declined case no longer tries to format more variables that are provided, allowing us to go down the path correctly.
+
+This gets wikipediafs working again for me against mediawiki 1.19.14+dfsg-1.
+
+
+
+git-svn-id: svn://svn.code.sf.net/p/wikipediafs/code@75 59acd704-e115-0410-a914-e735a229ed7c
+---
+ trunk/src/wikipediafs/user.py | 34 +++++++++++++++++++---------------
+ 1 file changed, 19 insertions(+), 15 deletions(-)
+
+diff --git a/src/wikipediafs/user.py b/src/wikipediafs/user.py
+index 9e3f48e..c28eb2d 100644
+--- a/src/wikipediafs/user.py
++++ b/src/wikipediafs/user.py
+@@ -66,7 +66,7 @@ class User:
+ 
+         printlog(self.logger, "debug", "Logging in with username %s." % self.username)
+         self.logintoken = None
+-        cookie_list = []
++        cookies = {}
+         conn = ExtendedHTTPConnection(self.host, self.port, self.https)
+ 
+         if self.httpauth_username and self.httpauth_password:
+@@ -101,10 +101,11 @@ class User:
+         # If we have a login token, then we also need to send the cookie from the initial connection.
+         # If we don't, then doing so breaks the login.
+ 
+-        token_session = re.search('(.*?);', response.getheader("Set-Cookie")).group(1)
++        token_matches = re.search('((.*?)=(.*?));', response.getheader("Set-Cookie"));
++        token_session = token_matches.group(1)
+         if self.logintoken:
+             headers["Cookie"] = token_session
+-            cookie_list.append(token_session)
++            cookies[token_matches.group(2)] = token_matches.group(3)
+ 
+         printlog(self.logger, "debug", "Headers:")
+         printlog(self.logger, "debug", headers)
+@@ -125,28 +126,31 @@ class User:
+         response = conn.getresponse()
+         printlog(self.logger, "debug", "URL: %s, response status: %d, text: %s" % (self.login_page, response.status, response.read()))
+ 
+-        in_cookie = re.compile(': (.*?);')
++        in_cookie = re.compile(': ((.*?)=(.*?));')
+ 
+         for cookie_value in response.msg.getallmatchingheaders("set-cookie"):
++            printlog(self.logger, "debug", "cookie: %s" % cookie_value)
+             it_matches = in_cookie.search(cookie_value)
+ 
+             if it_matches:
+-                cookie_list.append(it_matches.group(1))
++                cookies[it_matches.group(2)] = it_matches.group(3)
+ 
+         conn.close()
+ 
+         printlog(self.logger, "debug", "cookie_list:")
+-        printlog(self.logger, "debug", cookie_list)
+-
+-        if len(cookie_list) == 4:
+-            cookie_list.pop()
+-            printlog(self.logger, "info",
+-                     "Logged in successfully with username %s" % self.username)
+-                #self.logger.info("; ".join(cookie_list))
+-            return "; ".join(cookie_list)
++        printlog(self.logger, "debug", cookies)
++
++        if cookies.has_key('wikiUserName'):
++            cookie_str = ""
++            for k, v in cookies.iteritems():
++                if cookie_str == "":
++                    cookie_str = "%s=%s;" % (k, v)
++                else:
++                    cookie_str += " %s=%s;" % (k, v)
++            printlog(self.logger, "info", "Logged in successfully with username %s" % self.username)
++            return cookie_str
+         else:
+-            printlog(self.logger, "warning",
+-                     "Could not log in with username %s: %s" % self.username)
++            printlog(self.logger, "warning", "Could not log in with username %s" % self.username)
+             return None
+ 
+ 
+-- 
+2.1.4
+
diff -Nru wikipediafs-0.4/debian/patches/series wikipediafs-0.4/debian/patches/series
--- wikipediafs-0.4/debian/patches/series	2014-07-14 11:35:51.000000000 +0200
+++ wikipediafs-0.4/debian/patches/series	2016-08-05 15:37:58.000000000 +0200
@@ -1,3 +1,4 @@
 #10_no_shebang_lines.patch
 20_585369.patch
 30-spelling-in-manpage.patch
+0001-Make-logins-less-touchy-to-cookie-changes.patch

Attachment: signature.asc
Description: Digital signature

Reply via email to