Solved

Verifying a user's password

Posted on 1998-05-31
4
371 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
g++ pthread_init failure on AIX 10 71
Vmware Vswitch  VS  Redhat  Bridge 1 100
UNIX SCP 5 70
Sed question 2 69
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

867 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

22 Experts available now in Live!

Get 1:1 Help Now