Hi everyone,
I am creating a login program that uses the PAM functions. When you login, it checks with another machine to see if the password is correct. If the password is correct it compares the password with the machine logging in. I need to update these passwords if they are different. Right now I am using fgetpwent(password file) & fgetspent (shadow password file) to find the record & keep a pointer to the position in the file (which means I know the file name for the passwords). Then I use putpwent (password file) & putspent (shadow password file) to update the password in this record. Is this the correct way to manipulate the password files or is there a better way? I eventually need this to work on systems running NIS? Will these functions differ (I won't know which file the password is in to update it)?
I am creating a login program that uses the PAM functions. When you login, it checks with another machine to see if the password is correct. If the password is correct it compares the password with the machine logging in. I need to update these passwords if they are different. Right now I am using fgetpwent(password file) & fgetspent (shadow password file) to find the record & keep a pointer to the position in the file (which means I know the file name for the passwords). Then I use putpwent (password file) & putspent (shadow password file) to update the password in this record. Is this the correct way to manipulate the password files or is there a better way? I eventually need this to work on systems running NIS? Will these functions differ (I won't know which file the password is in to update it)?