* C2 security -- help needed
@ 1999-11-23 5:00 Jeff A. Fitzgerald
1999-11-24 5:00 ` Paul Szabo
0 siblings, 1 reply; 2+ messages in thread
From: Jeff A. Fitzgerald @ 1999-11-23 5:00 UTC (permalink / raw)
Hi all,
I'm attempting to install some software on a customers DEC Alpha, which
is running C2 security. The passwd file is obviously shadowed, as the
password field carries only "*"s. One of my subroutines does validation of
an entered user id and password. It uses the getpwnam function to retrieve
the encrypted password from the passwd file and then encrypts the supplied
password and compares. But getpwnam returns the "*" and not the encrypted
password from the shadow file or whatever DEC uses...
The man pages for getpwnam implies that when properly linked, etc. it
should retrieve the encrypted password.
Can anyone tell me what libraries to link with my program to properly
function with C2 security? Alternatively, can anyone tell me where the
encrypted password lives? I've looked for shadow files, etc. without any
luck.
Any and all thoughts appreciated!
Thanks in advance,
Jeff Fitzgerald
mailto:jeff@fitzlong.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: C2 security -- help needed
1999-11-23 5:00 C2 security -- help needed Jeff A. Fitzgerald
@ 1999-11-24 5:00 ` Paul Szabo
0 siblings, 0 replies; 2+ messages in thread
From: Paul Szabo @ 1999-11-24 5:00 UTC (permalink / raw)
To: Jeff A. Fitzgerald
Jeff A. Fitzgerald wrote:
> ... C2 security ... validation of an entered user id and password.
> ... But getpwnam returns the "*" and not the encrypted password ...
In some software, I use more-or-less the following. Hope this helps.
/*
* Changed by: Paul Szabo <psz@maths.usyd.edu.au>
* Reason: With C2 security, getpwnam() does NOT return the encrypted
* password (even though the man page suggests it does, and not
* even for root). Use sia_validate_user() instead, as this
* SHOULD work for both BSD (base) and C2 security setups. This
* is also the 'right' routine: no crypt() needed. - Note that
* with C2 security sia_validate_user() can only ever succeed
* for root, normal users cannot see even their own passwords.
* Be paranoid.
*
* Password check
* Accepts: user name string
* password string
* argument count
* argument vector
* Returns: 1 if password validated, 0 otherwise
*/
#include <sia.h>
#include <siad.h>
long pwchk (char *user, char *pass, int argc, char *argv[])
{
long ret = 0;
struct passwd *pw = getpwnam (user);
if (pw && pw->pw_uid && /* validate user and password */
pw->pw_uid > 100 && /* sanity checks (paranoia?) */
pw->pw_gid > 100 &&
!strcmp (pw->pw_name, user) &&
/*
* Any good way of checking pw_dir and pw->pw_shell ??
* strlen(pw->pw_dir) > 2 && strcmp (pw->pw_dir, "/") &&
* !strcmp (pw->pw_shell, "/bin/csh") &&
*/
sia_validate_user (
NULL, /* collect */
argc,
argv,
NULL, /* hostname */
user,
NULL, /* tty */
0, /* colinput */
NULL, /* gssapi */
pass ) ) {
ret = 1;
}
return ret;
}
--
Paul Szabo - System Manager // School of Mathematics and Statistics
psz@maths.usyd.edu.au // University of Sydney, NSW 2006, Australia
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-11-24 5:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-11-23 5:00 C2 security -- help needed Jeff A. Fitzgerald
1999-11-24 5:00 ` Paul Szabo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox