SUMMARY: Utility to validate username, password combination

From: Duffy, Thomas J. (thomas.duffy@ngc.com)
Date: Mon Jul 28 2003 - 17:29:10 EDT


Many thanks! Especially to Ann Majeske, Jim Lola, and Jerome Berkman

My original question was:

I wrote a simple utility for SGI and Solari machines to query a user for a
username and password and it validates the entry against the shadow password
file. To accomplish this, I used the getspnam and crypt routines. Is there
an analogous set of routines for Tru64 5.1A UNIX or a similar utility that I
can employ?

-------------------------------------------------

Ann's response was to try sia_validate_user...

The sia_validate_user() routine can be used to validate
username password combinations. See the sia_validate_user
man page and the Security manual for more information.
Further input on SIA collection routines is available from
the interface specifications in /usr/include/sia.h

THIS WORKED WELL FOR ME. I put in code like below to validate username
(argv[1]) and password (argv[2]):

if (!sia_validate_user(NULL, 1, sia_argv, NULL, argv[1], NULL, 0, NULL,
argv[2]))
{
  printf ("Invalid login!\n");
  exit (-1);
}
else
{
  printf ("Valid login!\n");
  exit(0);
}

Note, sia_argv was just a pointer to an array of character pointers
containing my program name and 1 was the number entries within it. See the
documentation for sia_validate_user.

----------------------------------------------------------------------------
-----

Jim & Jerome pointed out the Compaq-equivalent of getspnam (getespwnam).
Unfortunately, when I tried this I got an error: "Authentication database
not initialized" I stopped chasing this down when the above worked.

Thanks for such timely responses.

Tom

Thomas Duffy
Northrop Grumman

> *Phone: 410-993-6128
> *FAX: 410-765-6286
> *Email: thomas.duffy@ngc.com
> *Mail Stop: 3J18
>
>



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:49:28 EDT