ID:86498
 
Not a bug
Not a bug, changes to how Apache2 handles script execution require a certain directory to be created and proper permissions set to allow DMCGI to properly store authentication data server-side.
BYOND Version:459
Operating System:Linux
Web Browser:Firefox 3.5.5
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND Developer forums.
Descriptive Problem Summary:
hosting BYOND DMCGI using Apache2 on a Linux server
usr << Login()
redirects properly to BYOND login if user is not logged in.
Once you log in, Login() fails to return the user's key, instead redirecting to the current page with an increasingly long href.
Using a var to hold Login() has the same effect.

Code Snippet (if applicable) to Reproduce Problem:
CGI/Topic(href,href_list[])
usr << Login()
return


Expected Results:
usr gets [key] as output after logging in

Actual Results:
URL after several rounds of redirects:
http://test.terulia.com/ index.cgi?byondcert=XXXXXXXXXXXXXXXXXXXXXXXX&byondcertexp=%2 b4d&byondcert=XXXXXXXXXXXXXXXXXXXXXXXX&byondcertexp=&byondce rt=XXXXXXXXXXXXXXXXXXXXXXXX&byondcertexp=&byondcert=XXXXXXXX XXXXXXXXXXXXXXXX&byondcertexp=
When does the problem NOT occur?
no known workarounds

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

It did work several months ago when I tested it briefly, but given my current server setup, I am unable to test the older versions.

You can visit test.terulia.com to see the effect for yourself. The snippet above is the only bit of code I'm using in this bug test (aside from Dantom.CGI).</<>
This is actually not a bug, this happens when the server is running using suexec for script execution. What happens is that it tries to write to the /[user_home]/.byond directory to store required authentication information.

Since the file is actually executing as the owner of the webserver it'll try writing those files to the root web directory of your server (usually /var/www), which it won't have permission to since the directory either won't exist or it'll be owned by root.

What you want to do is
mkdir /var/www/.byond
mkdir /var/www/.byond/cache
mkdir /var/www/.byond/cfg
chown -R www-data:www-data /var/www/.byond
chmod -R 755 /var/www/.byond


Logins should work fine after doing those steps.

It should also be noted that the example code you posted is an infinite loop, which is where your long URL is coming from. It just keeps calling Login() over and over as the page is reloaded after a successful login. You need some conditionals to prevent that from happening.