I'm WAAAAAAY behind in list reading, but I fixed a few bugs in
cvspasswd.c:

1) (main) glob_username was set to NULL twice, and glob_userid never.
   The second glob_username presumably should have been glob_userid

2) (find_and_open_passwd) If CVSROOT was set, but -d was also passed,
   the program ignores the -d option.  I just moved the checking around
   a bit.

3) (who_am_i) for some reason glob_username was being set to the users
   system password hash (or, for those of us who use shadow passwords,
   to "*"), I'm guessing curr_user->pw_passwd should really be
   curr_user->pw_name.

HTH,

jon

*** cvspasswd.c.orig    Sat Jul  8 18:17:41 2000
--- cvspasswd.c Wed Jul 19 12:23:12 2000
***************
*** 72,78 ****
        glob_passwd_size = 0;
        glob_passwd_contents = NULL;
        glob_username = NULL;
!       glob_username = NULL;
        glob_cur_password = NULL;
        strcpy (glob_passwd_file_name, "passwd");
        glob_cvsroot[0] = '\0';
--- 72,78 ----
        glob_passwd_size = 0;
        glob_passwd_contents = NULL;
        glob_username = NULL;
!       glob_userid = NULL;
        glob_cur_password = NULL;
        strcpy (glob_passwd_file_name, "passwd");
        glob_cvsroot[0] = '\0';
***************
*** 163,179 ****
  
        memset(passwd_file, 0, MAX_DIRPATH_LEN+MAX_FILENAME_LEN+1);
  
!       if(getenv("CVSROOT") == NULL){
!               if(glob_cvsroot[0] == '\0'){
                        printf("CVSROOT not specified.\n");
                        return FAILURE;
!               }
!       } else {
!               if(strlen(getenv("CVSROOT")) <= MAX_DIRPATH_LEN)
!                       strcpy(glob_cvsroot, getenv("CVSROOT"));
!               else {
!                       fprintf(stderr, "$CVSROOT path too big.");
!                       return FAILURE;
                }
        }
        
--- 163,179 ----
  
        memset(passwd_file, 0, MAX_DIRPATH_LEN+MAX_FILENAME_LEN+1);
  
!       if(glob_cvsroot[0] == '\0'){
!               if(getenv("CVSROOT") == NULL){
                        printf("CVSROOT not specified.\n");
                        return FAILURE;
!               } else {
!                       if(strlen(getenv("CVSROOT")) <= MAX_DIRPATH_LEN)
!                               strcpy(glob_cvsroot, getenv("CVSROOT"));
!                       else {
!                               fprintf(stderr, "$CVSROOT path too big.");
!                               return FAILURE;
!                       }
                }
        }
        
***************
*** 227,236 ****
                return FAILURE;
        }
  
!       len = strlen(curr_user->pw_passwd) + 1;
        glob_username = (char *)malloc(len);
        memset(glob_username, 0, len);
!       strncpy(glob_username, curr_user->pw_passwd, len - 1 );
  
        return SUCCESS;
  
--- 227,236 ----
                return FAILURE;
        }
  
!       len = strlen(curr_user->pw_name) + 1;
        glob_username = (char *)malloc(len);
        memset(glob_username, 0, len);
!       strncpy(glob_username, curr_user->pw_name, len - 1 );
  
        return SUCCESS;
  

-- 
.Jonathan J. Miner------------------Division of Information Technology.
|[EMAIL PROTECTED]                 University Of Wisconsin - Madison|
|608/262.9655                               Room 3149 Computer Science|
`---------------------------------------------------------------------'

 Wow, I'm being shot at from both sides.  That means I *must* be right.  :-)
              -- Larry Wall in <[EMAIL PROTECTED]>

Reply via email to