Yeah, I know, running out of svn HEAD is not a supported configuration. I'm not complaining, per se. I know that doing that is prone to break stuff.So, having said that ...I've spent the last 2 hours trying to log into my own website. I svn up'ed from possibly 100 revs ago, and would appreciate suggestions as to what is likely to have changed in that time, regarding logins in particular, that might cause me to not be able to log in.It was suggested that I empty my rewrite_rules table, which I have done, with the result that per-tag atom feeds no longer work, but I can still not log in. I dropped the records in my users table and re-ran the install, which recreated the user records (with {SSHA512} rather than {SSHA} in the password, I note) but still can't log in.
I think you would have to drop your tables and rebuild, at least as far as I know. Owen sent out an email to that effect a few days ago, IIRC. That might explain your wacky sessions.
For whatever it's worth, when I put in an incorrect username and/or password, it very clearly tells me that I've entered invalid login information. When I enter valid information, it sends me back to the login form, with no "bad password" notification. Debug prints placed various places tell me that the password verified successfully.
Unless you've added permissions to the permissions table, Habari doesn't
check for permissions other than a valid login.
Owen
Might there be something with your configuration of PHP that doesn't
like the session handling code recently added?
Are there any entries in the session table? Once you've logged in, you
should register a record in the session table, I think.
--
GPG 9CFA4B35 | ski...@skippy.net | http://skippy.net/
Rich Bowen wrote:Well, I did a completely fresh installation, on a completely newdatabase, and *still* can't log in, although the logs table assures methat I've successfully logged in.Sufficient frustration for one day. Perhaps inspiration will come to metomorrow.Might there be something with your configuration of PHP that doesn'tlike the session handling code recently added?
Are there any entries in the session table? Once you've logged in, youshould register a record in the session table, I think.
Nothing in particular: I don't know much about PHP session handling, but
if you've rolled your own PHP then perhaps you selected some
non-standard compilation options. Unlikely, I guess.
>> Are there any entries in the session table? Once you've logged in, you
>> should register a record in the session table, I think.
>
>
> Yes, there are entries logged in the session table. However, I note that
> they all have user_id set NULL.
I haven't dabbled with the session code yet, but a quick look suggests
that a die() around line 75 of user.php might be able to let you know
whether the user id is being returned from the session.
Line 137 is where the session data actually gets stored, so you could
check what happens there, too.
Rich Bowen wrote:Might there be something with your configuration of PHP that doesn'tlike the session handling code recently added?Do you have something particular in mind?Nothing in particular: I don't know much about PHP session handling, butif you've rolled your own PHP then perhaps you selected somenon-standard compilation options. Unlikely, I guess.
Are there any entries in the session table? Once you've logged in, youshould register a record in the session table, I think.Yes, there are entries logged in the session table. However, I note thatthey all have user_id set NULL.I haven't dabbled with the session code yet, but a quick look suggeststhat a die() around line 75 of user.php might be able to let you knowwhether the user id is being returned from the session.Line 137 is where the session data actually gets stored, so you couldcheck what happens there, too.
That bit of code makes sure that the first three octets of your IP
address are the same between visits. The intent is to ensure that your
session is being used from the same network each time, while still
allowing for (some) configurations that use more than one proxy server.
I'm not sure how the ">>" operation works, either, but it's bitwise math
explained here:
http://us2.php.net/manual/en/language.operators.bitwise.php
>> Rich Bowen wrote:
>>> $subnet = ip2long($_SERVER['REMOTE_ADDR']) >> 8;
>>>
>>> if($session->subnet != $subnet) {
>>>
>>> $dodelete = true;
>>>
>>> }
>>
>> That bit of code makes sure that the first three octets of your IP
>> address are the same between visits. The intent is to ensure that your
>> session is being used from the same network each time, while still
>> allowing for (some) configurations that use more than one proxy server.
>
> Evidently, then, it's not actually working. I'm accessing the server
> across the LAN, and have a static DHCP reservation. Ok, I'll poke around
> some more and see if it's working, why it's not working in some
> situations, and why it seems to be working in others. Thanks for the
> pointer.
This is a wild guess, but are you running on a 64bit architecture? Also,
could you tell us the output of ip2long($_SERVER['REMOTE_ADDR']) and
ip2long($_SERVER['REMOTE_ADDR']) >> 8?
-Matt
This is a wild guess, but are you running on a 64bit architecture? Also,could you tell us the output of ip2long($_SERVER['REMOTE_ADDR']) andip2long($_SERVER['REMOTE_ADDR']) >> 8?
$_SERVER['REMOTE_ADDR'] = 192.168.200.1ip2long($_SERVER['REMOTE_ADDR']) = -1062680575ip2long($_SERVER['REMOTE_ADDR']) >> 8 = -4151096
> However, whatever odd value it returns, I'd expect it to return the
> *same* odd values, given the same IP address. Right?
The schema stores the value in an UNSIGNED field. Likely, it's doing
some bad bit math during the conversion in or out of the database. Any
PC with a remote_addr with a first octet higher than 127 should exhibit
this issue, since that's the "sign" bit. This also explains why it
works for some users (everyone but Rich) and not others, since it would
depend on the IP address you accessed the server from.
Anyone have a fix for this? I think got a D on that signed/unsigned
test in computer class in high school. We could always change the
schema to allow signed integers, I suppose.
Owen
We could use IP addresses as strings, rather than convert them to true
integers.
This should work:
$ip= $_SERVER['REMOTE_ADDR'];
$end= strrpos( $ip, '.');
$subnet= substr( $ip, 0, $end);
Then just store the string value of $subnet in the DB. Maybe less
elegant, but it does make troubleshooting a little easier.
True, this would work. The reason I didn't do this is because it runs
this check on every page view, and I was eeking out a bit of performance
using bitwise math.
I think it's worthwhile to try changing the field in Rich's database (if
he's willing) to be not unsigned, to see if that fixes things, and then
if it doesn't, I have no problem using the string method you've
supplied. We can always figure out what went wrong with the bit math
later and change the code back if we wanted.
Is this not working anywhere else? Does anyone else have this problem?
Owen
Scott Merrill wrote:We could use IP addresses as strings, rather than convert them to trueintegers.This should work:$ip= $_SERVER['REMOTE_ADDR'];$end= strrpos( $ip, '.');$subnet= substr( $ip, 0, $end);Then just store the string value of $subnet in the DB. Maybe lesselegant, but it does make troubleshooting a little easier.True, this would work. The reason I didn't do this is because it runsthis check on every page view, and I was eeking out a bit of performanceusing bitwise math.I think it's worthwhile to try changing the field in Rich's database (ifhe's willing) to be not unsigned, to see if that fixes things,