I am trying to compare the 2 passwords for authentication but it is returning true even if I have wrongly input the password. I have tried other ways but it is not working. Can you help?
void registerUser()
{
char userName[32];
printf("Maximum length for username is 32 characters long\n");
printf("Enter username: ");
scanf("%s",userName);
char *passwordFirst = getpass("Enter new UNIX password: ");
char *passwordSecond = getpass("Retype new UNIX Password: ");
if (strcmp(passwordFirst,passwordSecond)==0)
{
printf("GOOD");
}
else
{
printf("Sorry, passwords do not match\n");
printf("passwd: Authentication token manipulation error\n");
printf("passwd: password unchanged\n");
}