Last modified: 2013-10-05 04:40:41 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57190, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55190 - *-login.data can have case discrepency on Linux host
*-login.data can have case discrepency on Linux host
Status: NEW
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-05 04:40 UTC by Kunal Mehta (Legoktm)
Modified: 2013-10-05 04:40 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2013-10-05 04:40:22 UTC
Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1475/
Reported by: jaclayiii
Created on: 2012-06-26 04:52:22
Subject: *-login.data can have case discrepency on Linux host
Original description:
Pywikipedia \[http\] trunk/pywikipedia \(r10401, 2012/06/21, 06:18:43\)
Python 2.7.2+ \(default, Oct  4 2011, 20:06:09\)
\[GCC 4.6.1\]
config-settings:
use\_api = True
use\_api\_login = True
unicode test: ok

Summary: the \*-login.data file maybe saved with an uppercase username but when load cookies tries to find it on a Linux host, the case of the username maybe lower. This has the unintended consequence of not allowing bots to login on private wikis that have anonymous read api rights disabled.


If a user connects to a wiki that has LDAP or some other form of "add-on" authentication, the user name returned may vary in case from what is in the user-config.py file. The reason this matters is that the <wikifamily>-<language>-<username>-login.data file may be saved with an upper case letter in the username. Thus if the user-config.py file contained:

users\["mywiki"\]\["en"\]="james"

but the LDAP authenticator returned back "James" as the username, then the \*-login.data file would be mywiki-en-James-login.data, but when \_loadcookies goes to look for such a file on line 5572: 

if os.path.exists\(localPA\)

localPA is /~some/path/to/mywiki-en-james-login.data

Notice that the James is now lower case in the file above.

As Linux is case sensitive, it cannot find the login data and thus prevents access to wikis the do not allow anonymous access to api's. A temporary work around requires setting user name to the appropriate case \(even if the username is case insensitive in the LDAP authentication scheme\), for example:

users\["mywiki"\]\["en"\]="James"


keywords: SSL, Login failure, https login failure, https linux login, https pywikipedia, https pywikipedia linux
Comment 1 Kunal Mehta (Legoktm) 2013-10-05 04:40:24 UTC
Quick comment: \_loadCookies\(\) is in wikipedia.py on line 5534
Comment 2 Kunal Mehta (Legoktm) 2013-10-05 04:40:26 UTC
This has very little to do with Linux or LDAP, but rather has to do with the fact your username is 'James' and not 'james'. This is related to the 'first character is capitalized' convention on some wikis, but not all \(\!\).

However, we could probably check whether the name has changed when the user is logged in and emit a warning when this happens \(and/or store the cookie with the username as saved in the config file, but that could have some unintended consequences\).
Comment 3 Kunal Mehta (Legoktm) 2013-10-05 04:40:28 UTC
It has very much to do with LDAP: http://www.mediawiki.org/wiki/Extension:LDAP\_Authentication/User\_Provided\_Information\#Capitalize\_user\_name\_as\_in\_LDAP

And it has very much to do with Linux: Linux path names are case sensitive. 

I reported the bug as it took me time to track down and perhaps someone else who has the misfortune of dealing with it will find this helpful.

The fact is that if I can login with a lower case name, and I can, then whatever pywiki stores should be in the same case, NOT what may be returned when the wiki user name is returned. The file name for \*-login.data should be the same case as what is stored in user-config.py

This is just good practice, especially on a case sensitive host like Linux.

Also, as mediawiki is authenticating against LDAP, whatever it stores as the username is irrelevant if it correctly authenticates. A further reason to enforce correct casing based on the user-config.py file.
Comment 4 Kunal Mehta (Legoktm) 2013-10-05 04:40:30 UTC
After rereading the LDAP link, you're probably right in that the it's the actual mediawiki login that is forcing uppercase, nonetheless the file name that pywiki attempts to find should be case correct irrelevant of the username supplied or returned. My thought for that fix has to do with correctly saving the \*-login.data cookie with the username found in user-config.py.
Comment 5 Kunal Mehta (Legoktm) 2013-10-05 04:40:31 UTC
After thinking even more on this issue, even for those not using LDAP authentication \(which I would assume the majority are not using\), correct casing based on the user-config file shouldn't have undesirable effects: if you can log in with what's in the user config file then correctly saving the cookie file with that username shouldn't negatively impact anything. On the other hand if you do not save the cookie file with the same user name that is in the user-config file, but you continue to use the user-config file to generate the localPA variable, then you may have problems on case sensitive platforms.

If this fix seems to difficult \(I don't believe it to be\) or you're suspicious of the logic, you may want to place a warning in the setup instructions. I've added a comment on the wiki for userconfig.py that people using \*nix systems should be aware that by default mediawiki has uppercase user names.
Comment 6 Kunal Mehta (Legoktm) 2013-10-05 04:40:33 UTC
I have been taking  Japan Lingzhi 2 Day Diet http://udaydiets.cocolog-nifty.com/ for a week and lost 5 pounds.the initial issue within the morning is take this pill with an empty stomach and it appears to create my appetite disappear. this is considerably stronger than any other merchandise. and i choose to take 2 tablets within the future.
Comment 7 Kunal Mehta (Legoktm) 2013-10-05 04:40:35 UTC
Hey\! Do you use Twitter? I'llike to follow you if that would be ok. I'm certainly enjoying your blog and look forward to new updates. louis vuitton replicated bags http://www.louisvuittonreplicago.com/
Comment 8 Kunal Mehta (Legoktm) 2013-10-05 04:40:37 UTC
ET0EqF I truly appreciate this blog article.Really thank you\! Will read on... http://point.md/
Comment 9 Kunal Mehta (Legoktm) 2013-10-05 04:40:39 UTC
mwyHgt  <a href="http://sivhbtbyssot.com/">sivhbtbyssot</a>, \[url=http://rhecwdzrqubz.com/\]rhecwdzrqubz\[/url\], \[link=http://izhdiwwkxgsa.com/\]izhdiwwkxgsa\[/link\], http://coiapkvdjaci.com/

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links