- output.sink = sink_stdio("stdout", stdout);
- if(!(user = getenv("REMOTE_USER"))) fatal(0, "REMOTE_USER is not set");
- if(disorder_connect(g.client)) {
- disorder_cgi_error(&output, &s, "connect");
- return 0;
- }
- if(disorder_become(g.client, user)) {
- disorder_cgi_error(&output, &s, "become");
- return 0;
+ output.sink = sink_stdio("stdout", stdout);
+ /* See if there's a cookie */
+ cookie_env = getenv("HTTP_COOKIE");
+ if(cookie_env) {
+ /* This will be an HTTP header */
+ if(!parse_cookie(cookie_env, &cd)) {
+ for(n = 0; n < cd.ncookies
+ && strcmp(cd.cookies[n].name, "disorder"); ++n)
+ ;
+ if(n < cd.ncookies)
+ login_cookie = cd.cookies[n].value;
+ }