P
prasi
I want to verify the password of a user by accepting the password and
comparing with the entry in the /etc/shadow file .But I a, getting an
error
The following code is giving one error
/home/training/prasanna/unix system programming/testpas.c:19: undefined
reference to `crypt'
collect2: ld returned 1 exit status
the code as foolows
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <crypt.h>
#include <stdlib.h>
#include <sys/types.h>
#include<pwd.h>
int main()
{
struct passwd *pw;
char *password="prasanna";
char *epass;
epass=(char*)malloc(20);
pw=getpwnam("prasanna");
epass=crypt(password,pw->pw_passwd);
if(strcmp(epass,pw->pw_passwd)==0)
printf("login success\n");
else
printf("login failure\n");
return 0;
}//end of main
please let me know why it ios giving the error
if the method i am following is not correct please tell me the other
alternative
thanks
prasi
comparing with the entry in the /etc/shadow file .But I a, getting an
error
The following code is giving one error
/home/training/prasanna/unix system programming/testpas.c:19: undefined
reference to `crypt'
collect2: ld returned 1 exit status
the code as foolows
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <crypt.h>
#include <stdlib.h>
#include <sys/types.h>
#include<pwd.h>
int main()
{
struct passwd *pw;
char *password="prasanna";
char *epass;
epass=(char*)malloc(20);
pw=getpwnam("prasanna");
epass=crypt(password,pw->pw_passwd);
if(strcmp(epass,pw->pw_passwd)==0)
printf("login success\n");
else
printf("login failure\n");
return 0;
}//end of main
please let me know why it ios giving the error
if the method i am following is not correct please tell me the other
alternative
thanks
prasi