From: "Duffy, Thomas J." <thomas.duffy@ngc.com>
Subject: SUMMARY: Utility to validate username, password combination
Date: Mon, 28 Jul 2003 14:29:10 -0700 [thread overview]
Message-ID: <3F16FF786F31154EB6171035DFB0FC85058DD4@xcgmd062.md.essd.northgrum.com> (raw)
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
>
>
reply other threads:[~2003-07-28 21:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox