Solved

Unix password verification

Posted on 1997-11-18
3
318 Views
Last Modified: 2013-12-26
I found a little program on on web that checked the password giving the username and a password, it would return 0 or one.

I lost the source! I need it to authentificate from an other file.
0
Comment
Question by:ohp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Expert Comment

by:rbr
ID: 1295626
I know that this program is in some archive. Use archie and search for
passwd.c. This will lead to the right program.
0
 

Author Comment

by:ohp
ID: 1295627
the passwd.c program changes a password. I could live with that,
but it doesn't deal with shadow file.

If my memery serves me well. I found this program on livingston WEB. But cant find it anymore!

0
 
LVL 4

Accepted Solution

by:
jos010697 earned 200 total points
ID: 1295628
Shadow files are a different cup of tea; you need _access_
rights to get to that file (normally the root does).
The rest of the checking (if you have access to that file)
is a piece of cake:

char passwd[32];    /* contains a possible password */
char salt[3];       /* crypt() likes it spicy */
struct passwd* pw;  

pw= getpwuid(getuid()); /* or use getpwnam() if username known */

strncpy(salt, pw->pw_passwd, 2); /* get the 'salt' part */
salt[2]= '\0';

if (strcmp(crypt(passwd, salt), pw->pw_passwd))
   return 0; /* not a valid password */
else
   return 1;



0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand macro to ask for filename column 8 40
move a line in eclipse 3 111
Authenticate using sesu from script 7 160
Notepad++ Question 11 28
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

752 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