Sorry ignore this thread i've removed it because it was so horribly embarrassing. It was just some ramble that didn't make much sense as a relevant topic for a question here, i feel. Plus it looked like i'd made rlogind.c even worse than it already was because, for some reason that eludes me, i did the i/o without select(2) and didn't make use of non-blocking i/o.
So it was horribly bad and i'd rather forget about it, even though i've possibly made this thread even more meaningless by editing it.

Last edited by unixjingleman; 26th September 2016 at 10:38 AM.
Reason: Have changed the code

And yes the firewall is off on the server, when i test the program. Also i don't use rcmd, on the client, to initiate the normal rlogin login. I just send the username to the server. The server then passes this username to /bin/login which is exec()'d as written above.

How extremely embarrassing. The problem was i was returning from the parent after the child had been forked to do the execle of /usr/bin/login so that i wasn't wait()ing for the child or calling a function to handle the reads/writes to/from the socket/pty(ptmx).
Sorry(again) for posting such a trivial problem!