954,224 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to use admin passwords with "C"

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....

kxh29
Junior Poster in Training
56 posts since Apr 2007
Reputation Points: 10
Solved Threads: 1
 

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

Ancient Dragon
Retired & Loving It
Team Colleague
30,046 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,342
 

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

TkTkorrovi
Junior Poster
170 posts since Mar 2005
Reputation Points: 85
Solved Threads: 13
 
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!

kxh29
Junior Poster in Training
56 posts since Apr 2007
Reputation Points: 10
Solved Threads: 1
 

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

TkTkorrovi
Junior Poster
170 posts since Mar 2005
Reputation Points: 85
Solved Threads: 13
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You