Solved

Unix password verification

Posted on 1997-11-18
3
319 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

626 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