Hello All:

I have a question: How can you perform Password Administration using "C-Programming" functions.

Basically, we had UNIX Shell script that performed the following:
1. Got the current users password.
2. Did a time computation on it - had it expired yet, and when it will
3. Queried if the user wanted to change their password.

Well, after the time calculations and other UNIX issues, managment decided that it would be better just to use "C" to do these same functions. Start a C-process, pass the appropriate parameters, and perform the appropriate password processing, if necessary.

Can anyone direct me to where I can get more information on this? I am currently utilizing the AIX 4.3 version of UNIX.

Thanks again, for your help in advance....

can't you just translate that shell program into c? That is, write a c program that makes the same system calls ?

As much as i know, there are no system calls for doing all that in POSIX http://opengroup.org/onlinepubs/007908799 nothing about password expiry. All that can be done though with commands, again i'm not entirely sure whether all of these are POSIX. The shell script likely used commands, and it is not always possible to replace all commands with UNIX functions, there are no equivalent ones for every command. Some of the necessary data is likely in the file etc/shadow

As much as i know, there are no system calls for doing all that in POSIX http://opengroup.org/onlinepubs/007908799 nothing about password expiry. All that can be done though with commands, again i'm not entirely sure whether all of these are POSIX. The shell script likely used commands, and it is not always possible to replace all commands with UNIX functions, there are no equivalent ones for every command. Some of the necessary data is likely in the file etc/shadow

Thanks for the Response!

I did happen to find the getuserattr and putuserattr calls in "C". Now I just got to figure out how these gizmo's really work.....

Thanks!

getuserattr and putuserattr are some solaris functions or such, i found them nowhere in debian. The command usermod can be used to change these attributes. But to read these attributes, the only way seems to be to read the file /etc/shadow, which is not difficult, the format of this file is there: http://www.cyberciti.biz/faq/understanding-etcshadow-file

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.