/*

Author	: Premson P. R.
Desc	: Fetch account information using audit ID

*/

#include <sys/types.h>
#include <stdio.h>
#include <sys/security.h>
#include <prot.h>

void main (argc, argv)
int        argc;
char      *argv[];
{

   if (argc < 2) {
   printf("Author : Premson P R\n");
   printf("Usage  : usrinfo [username]\n");
   } else {

   struct es_passwd  *acct;
   time_t expire_time;
   time_t expire_date;
   uid_t myuid;

   /*--- Standard initialization ---*/

   set_auth_parameters(argc, argv);
   initprivs();

   /*--- fetch account information using audit ID ---*/
   myuid = getluid();
   if (acct = getespwnam(argv[1])) {
   printf("Username	\t   : %s \n", acct->ufld->fd_name);
   printf("Last Successful Attempt    : %s \n", acct->ufld->fd_suctty);
   printf("Last Unsuccessful Attempt  : %s \n", acct->ufld->fd_unsuctty);
   printf("Auditmask Text             : %s \n", acct->ufld->fd_auditdisp);
   printf("Auditmask Control          : %d \n", acct->ufld->fd_auditcntl); }
   else {
   printf("No Such User ! \n");
   exit(1); }
   }
}
