[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [leafnode-list] Question regarding authentification
>I had a look. The problem (for me :-) is that checkpassword insists on
>reading the username and password from fd3, and I have (due to a lack
>of Unix programming knowledge) no idea how to send data from a parent
>process to fd3 of a child process. I assume that it has to do something
>with pipes, but sifting through Stevens so far was not very helpful.
>I assume that it must go somewhat like this (this is pseudo code):
Hey! Something I know!
The call you want is dup2(from, to). This duplicates the `from' fd into the
It's usually used like this:
// Create a pipe
if (fork() == 0)
// Inside child. We want to connect one end of the pipe to
// the child's stdout.
close(1); // Don't want old stdout
// Call remote process
// Paranoia rules
// Now we can read from pipefd, and we'll get the child's stdout.
Connecting a pipe to fd 3 is identical (just change the close() and dup()
lines). And, of course, you can use multiple pipes.
>I assume that it wouldn't be a major fuss to include checkpassword into
>the leafnode distribution because it is free. I could still check with
>Dan Bernstein first, just to be sure. Of course configure.in would have
>to be tweaked so that an already existing checkpassword would not be
Aren't there already yp services for doing this?
+- David Given ---------------McQ-+
| Work: dg@xxxxxxxxxxxxx | Resist the resistance!
| Play: dgiven@xxxxxxxxx |
+- http://wired.st-and.ac.uk/~dg -+
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list