linux programming help needed ......

linux programming help needed ......

Post by yaoz.. » Sat, 01 Jul 2000 04:00:00



hello all,

I am developing a webmail system on linux. I need to add a user into the
system by cgi(written in GNU C), of course, I executed useradd program
and passwd, the problem occurred when I tried to send the password to
passwd using a pipe.  my program goes like this

  pipe_out = popen ("passwd username", "w");
  fprintf (pipe_out, "password\npassword\n");
  pclose(pipe_out);

but passwd said "conversation error". anoy way it doesn't work.  So
anyone know how to handle this kind of problem? or in an alternative
way to work the task out.

thanks
nick

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

linux programming help needed ......

Post by Josef Moeller » Sat, 01 Jul 2000 04:00:00



> hello all,

> I am developing a webmail system on linux. I need to add a user into the
> system by cgi(written in GNU C), of course, I executed useradd program
> and passwd, the problem occurred when I tried to send the password to
> passwd using a pipe.  my program goes like this

>   pipe_out = popen ("passwd username", "w");
>   fprintf (pipe_out, "password\npassword\n");
>   pclose(pipe_out);

> but passwd said "conversation error". anoy way it doesn't work.  So
> anyone know how to handle this kind of problem? or in an alternative
> way to work the task out.

Just an educated guess:
Since the passwd program will want to disable printing your password (in
case anyone is looking over your shoulders or happens to drop past while
the input is still visible on your screen), it needs to issue an ioctl
to the standard input. However, the pipe you open between your program
and the passwd program does not allow this.

Barring any other means to set the password, you can use pseudo ttys and
have passwd use the slave side.

--
Josef M?llers
Fujitsu Siemens Computers
SHV Server DS 1

 
 
 

linux programming help needed ......

Post by bill davids » Thu, 06 Jul 2000 04:00:00


| I am developing a webmail system on linux. I need to add a user into the
| system by cgi(written in GNU C), of course, I executed useradd program
| and passwd, the problem occurred when I tried to send the password to
| passwd using a pipe.  my program goes like this
|
|   pipe_out = popen ("passwd username", "w");
|   fprintf (pipe_out, "password\npassword\n");
|   pclose(pipe_out);
|
| but passwd said "conversation error". anoy way it doesn't work.  So
| anyone know how to handle this kind of problem? or in an alternative
| way to work the task out.

  See the 'expect' program for this. You need to be using a pty, and
that's a simple way to get there from here. Part of tk, tcl, some
package I don't remember off the top of my head.

--

  "Doing interesting things with little computers since 1979"(tm)
It doesn't bother me that people make flavored yogurt with fruits. It doesn't
bother me that someone makes caramel broccoli yogurt. It doesn't even bother
me that people buy it to rub on each other's * bodies.
What DOES bother me is that people buy it to EAT!

 
 
 

1. Linux Programming help needed

hello all,

I am developing a webmail system on linux. I need to add a user into the
system by cgi(written in GNU C), of course, I executed useradd program
and passwd, the problem occurred when I tried to send the password to
passwd using a pipe.  my program goes like this

  pipe_out = popen ("passwd username", "w");
  fprintf (pipe_out, "password\npassword\n");
  pclose(pipe_out);

but passwd said "conversation error". anoy way it doesn't work.  So
anyone know how to handle this kind of problem? or in an alternative
way to work the task out.

thanks
nick

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Secure Unix commands

3. Driver for external hard disk?

4. Help for script with programs controlling other programs needed

5. 4.6 dvd drive won't eject

6. NEED HELP WITH PROGRAMMING POP3 MAIL PROGRAM TO RETRIEVE MAIL ON UNIX-TO-UNIX

7. Linux for the masses? I think not.

8. Help C program in linux help help help !!!!!!!

9. Help-i need a cd-labeler program for linux.

10. Programming a file server for linux using TCP/IP - Need help urgently

11. C++ and Assembly Programming need help in Linux pleaseeeeeeeeeeeeeeeeeeee

12. Need Help to run school's xwindow programs on linux's xwindow