Menu

#1 Can't login if there are multiple cookies for the server

1.0
open-accepted
6
2004-02-13
2004-02-13
Anonymous
No

I have WebGUI as well as Projectory installed on our Apache
Server. The WebGUI system places a cookie at / of our
server with "wgSession" as the cookie name. Projectory
also places a cookie at /projectory/ with the name "token".
Projectory doesn't remember logins if there is more than one
cookie returned when the cookies are retrieved. e.g. you
login and then it takes you right back to http://
SERVER_NAME/projectory/projectory.cgi?
command=showTaskPad&authtoken=XXXX and ignores your
login.

The fix is probably to improve the Regex in decryptCookie so
that it doesn't suck up the other cookies that might be
included. Cookies are separated by semi-colons, so this
Regex should fix the problem:

OLD:
$_encrypted =~ s/^token\=(.+)//i;

FIXED:
$_encrypted =~ /token=(\w+)/i;
$_encrypted = ;

I made this change and it works fine now.
Thank you. We look forward exploring this product.
Mark Alway, always@u.washington.edu

Discussion

  • Corey Ehmke

    Corey Ehmke - 2004-02-13

    Logged In: YES
    user_id=575649

    Nice catch, Mark! I'll make an incremental release next week with your
    fix.

     
  • Corey Ehmke

    Corey Ehmke - 2004-02-13
    • milestone: --> 1.0
    • priority: 5 --> 6
    • assigned_to: nobody --> bantik
    • status: open --> open-accepted
     
  • Steve Spellman

    Steve Spellman - 2004-02-28

    Logged In: YES
    user_id=986151

    Projectory works great on my laptop, even with Mac OS X 10.28 and
    mySQL 3.23.51-entropy.ch, however, I experience the same login
    problem -- but the current line of code looks different from what was
    previously posted.

    CURRENT CODE:
    $_encrypted =~ s/^token\=(.+)//i;

    I delete old cookies to get around it for now.

    I don't know any Perl, so there may be an obvious fix, but changing
    the code to the previous recommendation didn't work. Any
    suggestions?

    Thank you.

     
  • Corey Ehmke

    Corey Ehmke - 2004-02-28

    Logged In: YES
    user_id=575649

    Here's the fix that will be in 1.1. Find sub decryptCookie (line 3633) and
    replace this:

    my $_encrypted = $ENV{'HTTP_COOKIE'};
    $_encrypted =~ s/^token\=(.+)//i;

    with this:

    my @_cookies = split(";",$ENV{'HTTP_COOKIE'});
    my $_encrypted;

    foreach my $_cookie (@_cookies) {

    if ($_cookie =~ /^token\=.+/) {

    $_encrypted = $_cookie;
    $_encrypted =~ s/^token\=(.+)//i;

    }

    }

    if (!($_encrypted)) { return ("error","error","error","error"); }

     
  • Steve Spellman

    Steve Spellman - 2004-03-01

    Logged In: YES
    user_id=986151

    Thank you for the fix. I modified it slightly, as follows, and everything
    seems to work great. I will be testing it out this week.

    My projectory.cgi's sub decryptCookie code had an extra '' in it and
    looked like this:

    my $_encrypted = $ENV{'HTTP_COOKIE'};
    $_encrypted =~ s/^token\=(.+)//i;

    so I modified the replacement code with an extra '', like this:

    my @_cookies = split(";",$ENV{'HTTP_COOKIE'});
    my $_encrypted;

    foreach my $_cookie (@_cookies) {

    if ($_cookie =~ /^token\=.+/) {

    $_encrypted = $_cookie;
    $_encrypted =~ s/^token\=(.+)//i;

    }

    }

    if (!($_encrypted)) { return ("error","error","error","error");
    }

     
  • Steve Spellman

    Steve Spellman - 2004-03-01

    Logged In: YES
    user_id=986151

    My last post doesn't display correctly. The extra characters that were
    needed for it to work, were a dollar symbol and a numeral one
    between the two forward slashes near the end of the following line in
    both the old code and the new code

    $_encrypted =~ s/^token\=(.+)//i;

    Thank you.

     
  • Pedro Ferreira

    Pedro Ferreira - 2006-02-27

    Logged In: YES
    user_id=162168

    look at correction for bug 934458, it may also solve this one...

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.