2 * validate a password for a user
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation. No representations are made about the suitability of this
9 * software for any purpose. It is provided "as is" without express or
21 int hash_vms_password(char *output_buf,char *input_buf,int input_length,
22 char *username,int encryption_type,unsigned short salt);
26 * Validate a VMS UserName/Password pair.
30 int validate_user(name,password)
34 char password_buf[64];
35 char username_buf[31];
38 register char *cp,*cp1;
39 struct passwd *user_entry;
42 * Get the users UAF entry
44 user_entry = getpwnam(name);
47 * If user_entry == NULL then we got a bad error
48 * return -1 to indicate a bad error
50 if (user_entry == NULL) return (-1);
53 * Uppercase the password
59 *cp1++ = toupper(*cp++);
63 * Get the length of the password
67 * Encrypt the password
69 hash_vms_password(encrypt_buf,password_buf,i,user_entry->pw_name,
70 user_entry->pw_encrypt, user_entry->pw_salt);
71 if (memcmp(encrypt_buf,user_entry->pw_passwd,8) == 0)