You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Bruno Tobias Stella <br...@trt15.gov.br> on 2002/08/15 22:20:31 UTC

My first doubt

Hello ! I'm new in this list. First, I'd like say that my English
isn't good, then, I'm so sorry !

My problem is: I'm using Samba as File Server, Apache as Web
Server, OpenWebmail as mail and OpenLdap (as a Directory Service).
And I'd like that when I change the Webmail Password, the Samba
Password to be changed too.
Then I put in change_password script of Webmail the follow line:

   system "/usr/local/.../smbpasswd", '-a', $uidUser, $newpassword
;

When this command is executed, the samba password is changed, but
the APACHE return a Internal Server Error. And in the apache
log_errors there is this line: "... malformed header from script.
Bad header=..." .

And this error happen only when the system return some message,
that in this case is:  "Password changed for user xxxxxxxxx".
I need to know how the Apache can understand (or not) this system
message and go already, continue executing the scripts.

I hope some help and ideas,

Thanks very muck !


--
Bruno T. Stella
brunostella@trt15.gov.br
Tribunal Regional do Trabalho da 15a. Regiao
(http://www.trt15.gov.br)


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: My first doubt

Posted by Zac Stevens <zt...@cryptocracy.com>.
Hi Bruno,

On Fri, Aug 16, 2002 at 09:41:42AM -0300, Bruno Tobias Stella wrote:
> Ok, I tried this and it isn't what i'd like !
> With this 2 lines, at all webmail's pages, show the script header
> on top of them. And I want only that the webmail continue
> executing the script, and not show me the system answer on its top
> !

This is something you'd really want to bring up in a forum related to your
webmail system, not Apache.

I would hazard a guess that your webmail system is expecting you to provide
it with something more than a system command, but this isn't really
anything to do with the web server in particular.

Hope that helps,


Zac

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: My first doubt

Posted by Dirk-Willem van Gulik <di...@webweaving.org>.

On Fri, 16 Aug 2002, Dirk-Willem van Gulik wrote:

>
> Right - but the problem is, if it -fails- you do want to have the output.
> So you'll need to distinguis at least four cases:
>
> -	Not enough user ID information to check access
> -	UserID provided + password provided is checkable
> 	and the check says OK
> -	UserID provided + password provided is checkable
> 	and the check says DENIED
> -	UserID provided + password provided is checkable
> 	and the check somehow failed or could not be made.

Snipped from elsewhere:

# Error happened which is not the users fault. So punt
# and do not ask for, say, the password again. As that
# is not going to fix it.
#
sub report_error_and_die {
	print "Status: 500 Error\nContent-type: text/plain\n\n";
	print join('',@_);
	exit 1;
};

@output=();
open(FH,"/some/cmnd 2>&1 |")
	or &report_error_and_die("No cmd: $!");
$output = join('\n',<FH>);
close(FH);
if ($? == 256 && $output =~m/NACK/s ) {
	# passwd check returned unauthorized.
	#
	print "Status: 401\n";
	print "Content-type: text/plain\n\nPlease enter your Foo
		password to enter";
elsif ($?) {
	# password check returned a new sort of
	# error we've not seen before..
	#
	&report_error_and_die("Cmd failed:",$output);
}

print "Status: 200 OK\nContent-type: text/html\n\n";
...




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: My first doubt

Posted by Dirk-Willem van Gulik <di...@webweaving.org>.

On Fri, 16 Aug 2002, Bruno Tobias Stella wrote:

> Ok, I tried this and it isn't what i'd like ! With this 2 lines, at all
> webmail's pages, show the script header on top of them.

> And I want only that the webmail continue executing the script, and not
> show me the system answer on its top !

Right - but the problem is, if it -fails- you do want to have the output.
So you'll need to distinguis at least four cases:

-	Not enough user ID information to check access
-	UserID provided + password provided is checkable
	and the check says OK
-	UserID provided + password provided is checkable
	and the check says DENIED
-	UserID provided + password provided is checkable
	and the check somehow failed or could not be made.

With what you do now:

> > >    system "/usr/local/.../smbpasswd", '-a', $uidUser,

there is no real error case distinction. You propably want to either send
the output to /dev/null or trap it; buffer stderr - and you want to do
proper error trapping. Check out a book like

	http://safari.oreilly.com/main.asp?bookname=cgi2

for some proper techniques. See for example:

	http://safari.oreilly.com/main.asp?bookname=cgi2&snode=106

books like that (and the perl Cookbook) are worth their value !

Dw

> $newpassword
> > > When this command is executed, the samba password is changed,
> but
> > > the APACHE return a Internal Server Error. And in the apache
> > > log_errors there is this line: "... malformed header from
> script.
> > > Bad header=..." .
> >
> > Look at the FAQ; in short - you need to sent out a
> > content-type. Put at the top of your perl script:
> >
> > 	print "Content-type: text/plain\n\n";
> > 	$|=1;
> >
> > and retry.
> >
> > Dw.
> >
> >
> ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache
> > HTTP Server Project. See
> > <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-
> > unsubscribe@httpd.apache.org   "   from the digest:
> > users-digest-unsubscribe@httpd.apache.org For additional
> > commands, e-mail: users-help@httpd.apache.org
>
>
> --
> Bruno T. Stella
> brunostella@trt15.gov.br
> Tribunal Regional do Trabalho da 15a. Regiao
> (http://www.trt15.gov.br)
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: My first doubt

Posted by Bruno Tobias Stella <br...@trt15.gov.br>.
Ok, I tried this and it isn't what i'd like !
With this 2 lines, at all webmail's pages, show the script header
on top of them. And I want only that the webmail continue
executing the script, and not show me the system answer on its top
!

If you could help me ...

Thanks


> >    system "/usr/local/.../smbpasswd", '-a', $uidUser,
$newpassword
> > When this command is executed, the samba password is changed,
but
> > the APACHE return a Internal Server Error. And in the apache
> > log_errors there is this line: "... malformed header from
script.
> > Bad header=..." .
> 
> Look at the FAQ; in short - you need to sent out a 
> content-type. Put at the top of your perl script:
> 
> 	print "Content-type: text/plain\n\n";
> 	$|=1;
> 
> and retry.
> 
> Dw.
> 
>
---------------------------------------------------------------------
> The official User-To-User support forum of the Apache 
> HTTP Server Project. See 
> <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-
> unsubscribe@httpd.apache.org   "   from the digest: 
> users-digest-unsubscribe@httpd.apache.org For additional 
> commands, e-mail: users-help@httpd.apache.org


--
Bruno T. Stella
brunostella@trt15.gov.br
Tribunal Regional do Trabalho da 15a. Regiao
(http://www.trt15.gov.br)


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: My first doubt

Posted by Dirk-Willem van Gulik <di...@webweaving.org>.
>    system "/usr/local/.../smbpasswd", '-a', $uidUser, $newpassword
> When this command is executed, the samba password is changed, but
> the APACHE return a Internal Server Error. And in the apache
> log_errors there is this line: "... malformed header from script.
> Bad header=..." .

Look at the FAQ; in short - you need to sent out a content-type. Put
at the top of your perl script:

	print "Content-type: text/plain\n\n";
	$|=1;

and retry.

Dw.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org