RSPTYP *resp;
resp=(RSPTYP *)0;
-(void) rou_alert(0,"JMPDBG in dig_parseresp <%s>",response);
if ((response!=(char *)0)&&(strlen(response)>0)) {
char *cpy;
char *next;
case 2 : //doing hashing
(void) EVP_DigestInit_ex(mdctx,EVP_md5(),(ENGINE *)0);
(void) EVP_DigestUpdate(mdctx,seq,length);
- (void) rou_alert(0,"%s digestup de of <%s> '%d' long",OPEP,seq,length);
break;
case 3 : { //assign memory
unsigned int s;
md5=calloc(1,sizeof(MD5TYP));
(void) EVP_DigestFinal_ex(mdctx,(unsigned char *)md5,&s);
- (void) rou_alert(0,"%s got digest of '%d' char",OPEP,s);
EVP_MD_CTX_free(mdctx);
}
break;
/* challenge as an B64 string. */
/* */
/********************************************************/
-PUBLIC char *dig_getchallenge()
+PUBLIC char *dig_getchallenge(char *realm)
{
#define OPEP "unidig.c:dig_getchallenge,"
(void) memset(loc,'\000',sizeof(loc));
switch (num) {
case 0 : //realm
- (void) snprintf(loc,sizeof(loc),comp[num],REALM);
+ (void) snprintf(loc,sizeof(loc),comp[num],realm);
break;
case 1 : { //nonce
char *nonce;
switch (phase) {
case 0 : { //computing hash HA1
MD5TYP *A1;
- char second[300];
+ char *ptr;
+ int max;
(void) snprintf(seq,sizeof(seq),"%s:%s:%s",resp->username,resp->realm,secret);
- (void) rou_alert(0,"JMDPBG seq1=<%s>",seq);
A1=dig_hashmd5((unsigned char *)seq,strlen(seq));
- //algorithm value is "MD5-sess"
+ //starting algorithm value is "MD5-sess"
(void) memset(seq,'\000',sizeof(seq));
(void) memmove(seq,(char *)A1,sizeof(MD5TYP));
- (void) snprintf(second,sizeof(seq),":%s:%s",resp->nonce,resp->cnonce);
- (void) strcat(seq+sizeof(MD5TYP),second);
- (void) rou_alert(0,"JMDPBG seq2=<%s>",seq);
(void) free(A1);
- A1=dig_hashmd5((unsigned char *)seq,sizeof(MD5TYP)+strlen(second));
+ ptr=seq+sizeof(MD5TYP);
+ max=sizeof(seq)-sizeof(MD5TYP);
+ (void) snprintf(ptr,max,":%s:%s",resp->nonce,resp->cnonce);
+ A1=dig_hashmd5((unsigned char *)seq,sizeof(MD5TYP)+strlen(ptr));
+ //ending algorithm value is "MD5-sess"
HA1=cnv_tohexa((char *)A1,sizeof(MD5TYP));
(void) free(A1);
}