Package: wikipediafs Version: 0.4-6.1 Severity: important Hi,
appearantly it's possible to use custom cookie names with mediawiki, at
least wiki.hamburg.ccc.de uses "ccchhwikiUserName" as the cookie name
containing the username… thus I had to patch wikipediafs as following:
$ diff src/wikipediafs/user.py
/usr/lib/python2.7/dist-packages/wikipediafs/user.py
69c69
< cookie_list = []
---
> cookies = {}
104c104,105
< token_session = re.search('(.*?);',
response.getheader("Set-Cookie")).group(1)
---
> token_matches = re.search('((.*?)=(.*?));',
> response.getheader("Set-Cookie"));
> token_session = token_matches.group(1)
107c108
< cookie_list.append(token_session)
---
> cookies[token_matches.group(2)] = token_matches.group(3)
128c129
< in_cookie = re.compile(': (.*?);')
---
> in_cookie = re.compile(': ((.*?)=(.*?));')
130a132
> printlog(self.logger, "debug", "cookie: %s" % cookie_value)
134c136
< cookie_list.append(it_matches.group(1))
---
> cookies[it_matches.group(2)] = it_matches.group(3)
139c141
< printlog(self.logger, "debug", cookie_list)
---
> printlog(self.logger, "debug", cookies)
141,146c143,151
< 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)
---
> if cookies.has_key('ccchhwikiUserName'):
> 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
148,149c153
< 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)
--
cheers,
Holger
signature.asc
Description: Digital signature

