Re: Service logs only when exiting

Jurjen Oskam <[email protected]> Thu, 28 Aug 2003 21:58:36 +0200
Newsgroups gmane.comp.lib.ptyget
Message-ID <[email protected]>
On Thu, Aug 28, 2003 at 02:41:56PM -0400, Paul Jarc wrote:

> > ./compile ptyspawn.c
> > In file included from ptyspawn.c:12:
> > readwrite.h:4: conflicting types for `read'
> > /usr/include/unistd.h:179: previous declaration of `read'
> > readwrite.h:5: conflicting types for `write'
> > /usr/include/unistd.h:191: previous declaration of `write'
> 
> Try this:
> $ echo '#include <unistd.h>' > readwrite.h

This fixes the above error.

> Changing _POSIX_VDISABLE to 0 might work.

And this also seemed to work.

"make" succeeded after all these changes. "make setup"
however didn't, because AIX 5.2 doesn't have a group
named "tty". After I manually added one (without doing
anything else - it is just an unprivileged group without
any members) "make setup" succeeded.

(The only thing is that it seems to put the
manpages in /usr/local/man/cat[18]/)

If I do "nobuf ./umc -v 2>&1 | cat" I do not get the
batchy behaviour, but the messages are displayed as
they are generated. However, the warning "ptyget: warning: unable to
allocate secure pty" is displayed. This is undoubtedly because of
the editing of conf-secure.h, but what are the consequences of this?
Does it mean that every local user can interfere?




As for the other use I had in mind for ptybandage: a program on our
system requires a username and password. It can either be entered
interactively or specified on the commandline. With that last option,
the username and password are visible to all users on the system.

The problem is that that program is called from scripts quite often.
The only option is to call it with username and password on the
commandline. Feeding the program data from stdin and redirecting the
output to stdout works fine, *except* when it asks for username/password.
The program does its own magic to not display the password as it is
entered. My current solution is to use Perl and the Expect module to
interface with the program, which works, but ptybandage looks much
cleaner and simpler.

So I tried ptybandage (this is all on AIX 5.2):

bash-2.05a# ptybandage dsmadmc <<EOF >uit.txt
> joskam
> password
> query session
> query process
> quit
> EOF
ptyget: warning: unable to allocate secure pty
readline: warning: turning on OPOST for terminal
bash-2.05a#

... after which uit.txt contained the expected (pun intended) output!

There are minor problems though:
 - the warning about OPOST (don't know what that means)
 - when a program run with nobuf or ptybandage exits, my
   typed characters aren't echoed back to me until I give
   the "reset" command.


I'm hoping that it is possible to make ptyget work, securely, in
this environment.

Thanks Paul, for assisting me this far.

-- 
Jurjen Oskam

PGP Key available at http://www.stupendous.org/