Solved

Verifying a user's password

Posted on 1998-05-31
4
361 Views
Last Modified: 2010-04-21
I am writing a UNIX program to verify a user's UNIX user name and password. UNIX includes a structure called passwd that allows programmers to verify fields in the passwd file. Comparing and verifying the user inputted/supplied name can be accomplished using this structure; however, the users inputted/supplied password can not, since it must be encrypted before it can be used. Is there a function that encrypts the user's inputted password? Th objective is to compare it against the field in the passwd file.


ronandersen@hotmail.com
0
Comment
Question by:ronandersen
  • 2
4 Comments
 

Author Comment

by:ronandersen
ID: 2007309
Edited text of question
0
 

Author Comment

by:ronandersen
ID: 2007310
This question should probably go under the topic UNIX programming, although administrators could benefit from the response.
0
 
LVL 84

Expert Comment

by:ozo
ID: 2007311
man 3 crypt

0
 
LVL 1

Accepted Solution

by:
hajek earned 100 total points
ID: 2007312
integer pw_compare(current, check)
char    *current,               /* Current pw (encrypted) */
        *check;                 /* check pw (plain) */
{
        if (!*current)
                return(0);
        return(!strcmp(current, crypt(check, current)));
}
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now