Re: Re: Premature end of script headers: sqwebmail
Sagara Wijetunga <[email protected]> Tue, 1 Jun 2004 03:59:06 -0700 (PDT)
| Newsgroups | gmane.mail.sqwebmail |
|---|---|
| Message-ID | <[email protected]> |
--- Sam Varshavchik <[email protected]> wrote: > As I said, it's mostly irrelevant. > > In version 4, sqwebmail is a persistent daemon > process, and the cgi-bin > directory contains only a small stub binary. > Although you can run the > sqwebmail stub binary using suexec, it won't make > any difference, and you > still must run the main sqwebmail daemon process. > > Yes, my intention is to run the sqwebmail CGI stub binary under suEXEC, not the sqwebmail daemon process under suEXEC. I understand and appreciate the SqWebMail's new architecture. I managed to get the sqwebmail CGI stub binary run under suEXEC. The problem was I patched the sqwebmail/sqwebmail.c. Once I reversed sqwebmail.c to it's original code, it runs under suEXEC without a problem. The objective of my patch is to get the login domain from an environment variable named LOGINDOMAIN, not from CGI. So that users are not required to type or select the domain name. I disabled getting the login domain from CGI in sqwebmail/sqwebmail.c and replaced with a line as indicated in the <<== New line in the following code: if (*(u=cgi("username"))) /* Request to log in */ { const char *p=cgi("password"); const char *mailboxid; // const char *u2=cgi("logindomain"); <<== Original line const char *u2=getenv("LOGINDOMAIN"); <<== New line char *ubuf=malloc(strlen(u)+strlen(u2)+2); int can_changepwd; strcpy(ubuf, u); if (*u2) strcat(strcat(ubuf, "@"), u2); This code compiles without any error, but it develops Apache Error 500 at run time with the following error message: Premature end of script headers: sqwebmail I introduced LOGINDOMAIN to the safe_env_lst[] of suexec.c of Apache and httpd.conf and ssl.conf. My other CGI programs run under suEXEC can read the LOGINDOMAIN environment variable and I can see its value. Does the sqwebmail CGI stub binary drops any environment variable that it was not designed to use? If that is the case, how do I introduce LOGINDOMAIN environment variable to sqwebmail CGI stub binary? If what I'm doing is wrong, please let me know, where and how do I have to change, to read the login domain name from LOGINDOMAIN environment variable so that users do not have to type the domain name? Sagara __________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/