[BACK]Return to unix_auth.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tcfs

Diff for /src/usr.bin/tcfs/Attic/unix_auth.c between version 1.2 and 1.3

version 1.2, 2000/06/19 20:06:19 version 1.3, 2000/06/19 22:42:29
Line 23 
Line 23 
 #include "tcfserrors.h"  #include "tcfserrors.h"
   
 int  int
 unix_auth (char **user, char **password, int flag)  unix_auth(char **user, char **password, int flag)
 {  {
         char *luser, *passwd;          char *luser, *passwd;
         struct passwd *passentry;          struct passwd *passentry;
   
         luser = (char*)calloc (LOGIN_NAME_MAX, sizeof(char));          luser = (char *)calloc(LOGIN_NAME_MAX, sizeof(char));
         passwd = (char*)calloc (_PASSWORD_LEN, sizeof(char));          passwd = (char *)calloc(_PASSWORD_LEN, sizeof(char));
   
         if (!luser || !passwd)          if (!luser || !passwd)
                 tcfs_error (ER_MEM, NULL);                  tcfs_error(ER_MEM, NULL);
   
         if (flag) {          if (flag) {
                 passentry = getpwuid(getuid());                  passentry = getpwuid(getuid());
                 strlcpy(luser, passentry->pw_name, LOGIN_NAME_MAX);                  strlcpy(luser, passentry->pw_name, LOGIN_NAME_MAX);
         } else {          } else {
                 printf ("Enter user: ");                  printf("Enter user: ");
                 fgets(luser, LOGIN_NAME_MAX, stdin);                  fgets(luser, LOGIN_NAME_MAX, stdin);
                 luser[strlen(luser)-1] = '\0';                  luser[strlen(luser)-1] = '\0';
                 passentry = getpwnam(luser);                  passentry = getpwnam(luser);
Line 47 
Line 47 
         passwd = getpass("Password:");          passwd = getpass("Password:");
   
         if (passentry == NULL) {          if (passentry == NULL) {
                 bzero (passwd, strlen(passwd));                  bzero(passwd, strlen(passwd));
                 return 0;                  return (0);
         }          }
   
         if (strcmp(crypt(passwd, passentry->pw_passwd), passentry->pw_passwd))          if (strcmp(crypt(passwd, passentry->pw_passwd), passentry->pw_passwd))

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3