I am attempting to write a program that interfaces to the *nix passwd command. My intent is to keep it as portable as possible across different environments and eventually will need a Windows port. However, for now *nix is more than sufficient.
My understanding in reading the boards it that system() does not allow communication between child and parent processes. I would need the following steps:
1. Parent runs passwd as child.
2. child writes "Changing passwd for user.\n Old password:" and waits for input.
3. Parent sends the old password as supplied by the user.
4. child writes "New password:" and waits for input.
5. Parent sends the new password as supplied by the user.
6. child writes "Re-enter new password:" and waits for input.
7. Parent re-sends the new password as supplied by the user.
8 child exits successfully.
We have an ERP system which does not allow access to the underlying OS. Per recent regulations we need to implement password expiry and interfacing through a scripting language like Expect is not an option.