Operating System - HP-UX
1830939 Members
2777 Online
110017 Solutions
New Discussion

Re: access to password on trusted system

 
Boissé_1
Advisor

access to password on trusted system

Hi,

I work on HPUX 11.00 System and the trusted system mode is enabled.

I would like to check a login/password entered with the password in the database.

here is my code:



struct passwd *pwd;
struct pr_passwd *pr_pwd;
char *c_passwd;

if ((pwd=getpwnam(user))==NULL)
return(FALSE);
else{
c_passwd=crypt((const char*)u_passwd.c_str(),pwd->pw_passwd);
if(!strcmp(c_passwd,pwd->pw_passwd))
return(TRUE);
else{
if ((pr_pwd=getprpwnam((char*)user))==NULL)
return(FALSE);
else{
c_passwd=crypt((const char*)u_passwd.c_str(),pr_pwd->ufld.fd_encrypt);
if(!strcmp(c_passwd,pr_pwd->ufld.fd_encrypt))
return(TRUE);
else
return(FALSE);
}
}
}

it returns false at first test :(pr_pwd=getprpwnam((char*)user))==NULL

even if the account exists.

Can you help me please.

Thanks a lot !
3 REPLIES 3
Kent Ostby
Honored Contributor

Re: access to password on trusted system

You dont appear to have initialized the variable "user" to any value.
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Boissé_1
Advisor

Re: access to password on trusted system

sorry,

user is initialized as parameter.

I forgot to write it.

the code works fine if trusted system is disabled...

Thanks
Boissé_1
Advisor

Re: access to password on trusted system

the problem is that it was not root which has launched the program but another user.

The other user has no access to the secured database.