Operating System - HP-UX
1826443 Members
3966 Online
109692 Solutions
New Discussion

Trying to interface to trusted database

 
Jim Poplawski
Advisor

Trying to interface to trusted database

Folks,
Windows application clients connect to our Trusted HP server passing account and password via a TCP socket. We are required to treat such connections as a login (as if the user is connecting via telnet). We're having trouble with the putprpwnam() system call in that it will not update a trusted database field if it does not exist in the account's record. The simplest example involves updating the trusted database following a login attempt with a valid account and a non matching password. Here's a code snippet (with error checking removed)

pw_ptr = getprpwnam ( psUsername );
pw_ptr->ufld.fd_nlogins++; // Inc consecutive failed login count
strcpy(pw_ptr->ufld.fd_unsuctty, "TCPClient"); // set tty of last unsuccessful login
time(&now) // now is a time_t type
pw_ptr->ufld.fd_ulogin = now; // set time of last unsuccessful login
putprpwnam (psUsername, pw_ptr);

The fd_unsuctty and fd_ulogin trusted database fields are updated correctly, however the fd_nlogins tag (u_numunsuclog#?) is not always updated since it may not exist in the trusted database. Note, the Unix login daemon inserts the u_numunsuclog tag when a login failure occurs and removes it when a successful login occurs.

How do we convince putprpwnam() to insert trusted database tags that do not exist (just as the Unix login daemon does). We do not feel that we should manually parse trusted database entries. Are there flags in the pw_ptr structure that must be set before calling putprpwnam()?
thanks
Jim