[imp] IMAP Quota Redhat 7.3 extra code

Eric Rostetter eric.rostetter@physics.utexas.edu
Tue, 4 Jun 2002 13:05:52 -0500


Quoting Tilo Lutz <TiloLutz@gmx.de>:

> Hi
> 
> > Maybe it's better to use "su" instead of sudo
> > because you don't need to run "quota" as root.
> 
> How exactly are you going to reliably and cross-platform pass the password
> to the su command?
>
> I hoped the su command is always the same.

No.

> I have to enter
> "su $user" and in the next line the password.

Okay, after "su $user" you may get an error rather than a password prompt.
So now you'd have to parse the output.  Is the output written to standard
error, standard out, or to the tty?  Do we have a tty to read/write to?
Now you have the prompt, and you want to send the password.  Again, do 
you send it to standard input or to the tty?  And how -- via a pipe might
work for standard input, not not from a tty.  php calls like exec() and
system() aren't exactly interactive...  I don't see anyway to do this kind
of thing.  Normally you get around such problems by using a program like
"expect" but that makes things way to complicated now as they would have
possibly install and configure expect...

See my problem?
 
> Tilo

-- 
Eric Rostetter
The Department of Physics
The University of Texas at Austin

"TAD (Technology Attachment Disorder) is an unshakable, impractical devotion
to a brand, platform, product line, or programming language. It's relatively
harmless among the rank and file, but when management is afflicted the damage
can be measured in dollars. It's also contagious -- someone with sufficient
political clout can infect an entire organization."

--"Enterprise Strategies" columnist Tom Yager.