From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078712011581.tru64-unix-managers.marc@archive.invalid> From: Jerome M Berkman Date: Wed, 10 Jun 1998 19:56:52 +0000 To: tru64-unix-managers Subject: Cyrus and DU C2 Security X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078712011581 The Cyrus distribution of pwcheck_getpwnam.c does not work with Digitail UNIX C2 security/shadow password files. Here is a version that does. - Jerry /* pwcheck_getpwnam.c -- check passwords using getpwname() * * Copyright 1996, Carnegie Mellon University. All Rights Reserved. * * This software is made available for academic and research * purposes only. No commercial license is hereby granted. * Copying and other reproduction is authorized only for research, * education, and other non-commercial purposes. No warranties, * either expressed or implied, are made regarding the operation, * use, or results of the software. Such a release does not permit * use of the code for commercial purposes or benefits by anyone * without specific, additional permission by the owner of the code. * */ #include #include #include /* need Digital UNIX version of prot.h, not CMU version which isn't relevant here. */ #include "/usr/include/prot.h" struct pr_passwd *getprpwnam(); encrypt_pw_osf(); /* * CMU version out of date - rewritten by Jerry Berkman, UCB, * June 1, 1998 */ char *pwcheck(char *userid, char *password) { struct pr_passwd *pr_pwd; char enc_pw_osf[30]; pr_pwd = getprpwnam(userid); if ( pr_pwd == NULL ) { return "Userid not found"; } encrypt_pw_osf( password, enc_pw_osf, pr_pwd->ufld.fd_encrypt ); if (strcmp(pr_pwd->ufld.fd_encrypt, enc_pw_osf ) != 0) { return "Incorrect password"; } else { return "OK"; } } encrypt_pw_osf( raw_pw, enc_pw_osf, salt ) char *raw_pw; char *enc_pw_osf; char *salt; { char *crypt(); char *ptr; char temp_raw[9]; char temp_encr[14]; /* * crypt password using OSF encryption scheme for C-2 security */ /* encrypt first 8 characters */ strcpy( enc_pw_osf, crypt( raw_pw, salt ) ); if( strlen( raw_pw ) > 8 ) { /* next 8 characters */ ptr = crypt( raw_pw+8, enc_pw_osf+2 ); strcat( enc_pw_osf, ptr + 2 ); } }