Exemple #1
0
int testTempPwCombined(rsComm_t *rsComm, char *s1) {
   int status;
   char pwValueToHash[500];
   char md5Buf[100];
   unsigned char digest[RESPONSE_LEN+2];
   char digestStr[100];
   MD5_CTX context;

   status = chlMakeTempPw(rsComm, pwValueToHash, "");
   if (status) return(status);

   printf("pwValueToHash: %s\n", pwValueToHash);

   /* 
      Calcuate the temp password: a hash of s1 (the user's main
      password) and the value returned by chlGenTempPw.
   */

   memset(md5Buf, 0, sizeof(md5Buf));
   strncpy(md5Buf, pwValueToHash, sizeof md5Buf);
   strncat(md5Buf, s1, sizeof md5Buf);

   MD5Init (&context);
   MD5Update (&context, (unsigned char*)md5Buf, sizeof md5Buf);
   MD5Final (digest, &context);

   md5ToStr(digest, digestStr);
   printf("digestStr (derived temp pw)=%s\n", digestStr);

   return(0);
}
Exemple #2
0
int testTempPwForOther(rsComm_t *rsComm, char *s1, char *otherUser) {
   int status;
   char pwValueToHash[500];
   char md5Buf[100];
   unsigned char digest[RESPONSE_LEN+2];
   char digestStr[100];
   MD5_CTX context;

   rsComm->clientUser.authInfo.authFlag = LOCAL_PRIV_USER_AUTH;
   rsComm->proxyUser.authInfo.authFlag = LOCAL_PRIV_USER_AUTH;

   status = chlMakeTempPw(rsComm, pwValueToHash, otherUser);
   if (status) return(status);

   printf("pwValueToHash: %s\n", pwValueToHash);

   /* 
      Calcuate the temp password: a hash of s1 (the user's main
      password) and the value returned by chlGenTempPw.
   */

   memset(md5Buf, 0, sizeof(md5Buf));
   strncpy(md5Buf, pwValueToHash, sizeof md5Buf);
   strncat(md5Buf, s1, sizeof md5Buf);

   MD5Init (&context);
   MD5Update (&context, (unsigned char*)md5Buf, sizeof md5Buf);
   MD5Final (digest, &context);

   md5ToStr(digest, digestStr);
   printf("digestStr (derived temp pw)=%s\n", digestStr);

   return(0);
}
Exemple #3
0
int testTempPw(rsComm_t *rsComm) {
   int status;
   char pwValueToHash[500];
   status = chlMakeTempPw(rsComm, pwValueToHash, "");
   printf("pwValueToHash: %s\n", pwValueToHash);

   return(status);
}
Exemple #4
0
int
_rsGetTempPassword( rsComm_t *rsComm,
                    getTempPasswordOut_t **getTempPasswordOut ) {
    int status;
    getTempPasswordOut_t *myGetTempPasswordOut;

    myGetTempPasswordOut = ( getTempPasswordOut_t* )malloc( sizeof( getTempPasswordOut_t ) );

    status = chlMakeTempPw( rsComm,
                            myGetTempPasswordOut->stringToHashWith, "" );
    if ( status < 0 ) {
        rodsLog( LOG_NOTICE,
                 "_rsGetTempPassword: getTempPassword, status = %d",
                 status );
    }

    *getTempPasswordOut = myGetTempPasswordOut;

    return status;
}