Hi Pavel,

I know that perl mostly doesn't like the sticky-bits on files such as :

-r-sr-xr-x   1 root       bin          24576 Aug  6  1998 /usr/bin/su

He just doesn't executes them.
Personaly I haven't found a solution for this. I know a collegue of mine has written
a C-programm around it.
Maybe someone else in the group could tell you the details.

I probably don't have to tell you the gates you are opening for everyone, so I
won't :) Don't know about the rest of the people out here.


Regs David
------------------
> 
> I need to make CGI script for changing user password throught web
> browser. I have one, but doesn't work:
> 
> I'm using FreeBSD 4.6 & Apache 1.3.24
> 
> 
> #!/usr/bin/perl -w
> 
> use Expect;
> 
> $suexec = "/usr/bin/su";
> 
> print "Content-Type: text/html\n\n";
> 
> sub ChangeUnixPassword {
>       my ($account,$passwd) = @_;
>       
>       $command = "root -c 'passwd $account'";
>       $srp = "rootpassword";
>       
>       my $pobj = Expect->spawn($suexec, $command);
>       die "$suexec:$!\n" unless (defined $pobj);
> 
>       $pobj->log_stdout(0);
> 
>       $pobj->expect(10,"Password:");
>       sleep 1;
>       print $pobj "$srp\r";
> 
>       $pobj->expect(10,"New password:");
>       print $pobj "$passwd\r";
> 
>       $pobj->expect(10,"Retype new password:");
>       print $pobj "$passwd\r";
> 
>       $result = ...
> 
>       $pobj->soft_close(  );
> 
>       return $result;
> }
> 
> unless ($result = &ChangeUnixPassword("user","newpassword)) {
>       print "OK\n";
> } else {
>       print "failed\n";
> }
> 
> 
> 
> Pavel
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to