From 28fb596b47a9d8cb5292e760ebe3037dd009df93 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Thu, 3 Jul 2025 20:39:29 -0400 Subject: [PATCH] Small improvement on the cram-md5 and digest-md5 --- lib/lvleml.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/lvleml.c b/lib/lvleml.c index ffd14b9..243959b 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -358,6 +358,7 @@ char *seq; char *code; USRTYP *usr; char *line; +char *name; //extracted name int got; int phase; _Bool proceed; @@ -372,6 +373,7 @@ seq=strdup("<01234567890ABCDEFGHIJKLMNOPQRST@mailpostg.example.com>"); (void) rou_alert(0,"%s JMPDBG SEQ=<%s>",OPEP,seq); code=(char *)0; usr=(USRTYP *)0; +name=(char *)0; line=(char *)0; got=0; phase=0; @@ -392,7 +394,6 @@ while (proceed==true) { } break; case 1 : { //extracting code - char *name; //extracted name char *ptr; code=cnv_getb64(line); @@ -407,10 +408,11 @@ while (proceed==true) { if (name!=(char *)0) { (void) sql_mngusr(contact->sqlptr,sql_select,name,&usr); (void) rou_alert(0,"%s JMPDBG md5 name=<%s>",OPEP,name); - name=rou_freestr(name); } if (usr==(USRTYP *)0) { code=rou_freestr(code); + (void) rou_asprintf(&decoded,"%s%s%s%s", + IOBNULL,name,IOBNULL,(char *)0); phase=999; } line=rou_freestr(line); @@ -421,10 +423,16 @@ while (proceed==true) { char *hexa; //local=cnv_hashmd5(usr->passwd,(unsigned char *)seq); + (void) rou_asprintf(&decoded,"%s%s%s%s",IOBNULL,name,IOBNULL,(char *)0); local=cnv_hashmd5("mailleur",(unsigned char *)seq); hexa=cnv_tohexa(local); - (void) rou_alert(0,"JMPDBG local =<%s>",hexa); - (void) rou_alert(0,"JMPDBG remote=<%s>",code); + (void) rou_alert(0,"%s code=<%s>",OPEP,code); + (void) rou_alert(0,"%s hexa=<%s>",OPEP,hexa); + if (strcmp(hexa,code)==0) { + (void) rou_asprintf(&decoded,"%s%s%s%s", + IOBNULL,usr->email,IOBNULL,"mailleur"); + (void) rou_alert(0,"JMPDBG decoded=<%s>",decoded); + } hexa=rou_freestr(hexa); local=rou_freestr(local); usr=sql_freeusr(usr); @@ -435,7 +443,9 @@ while (proceed==true) { } phase++; } +name=rou_freestr(name); seq=rou_freestr(seq); +(void) rou_alert(0,"%s JMPDBG decoded=<%s>",OPEP,decoded); return decoded; #undef OPEP @@ -568,7 +578,7 @@ static _Bool getauth(CONTYP *contact,int delay,char *buffer) { #define OPEP "lvleml.c:getauth," -static char *vocloc[]={"PLAIN","LOGIN","CRAM-MD5",(char *)0}; +static char *vocloc[]={"PLAIN","LOGIN","CRAM-MD5","DIGEST-MD5",(char *)0}; _Bool isok; int code; @@ -623,7 +633,8 @@ while (proceed==true) { if ((decoded=get_auth_login(contact,delay))==(char *)0) phase=999; break; - case 2 : //AUTH DIGEST-MD5 + case 2 : //AUTH CRAM-MD5 + case 3 : //AUTH DIGEST-MD5 if ((decoded=get_auth_md5(contact,delay))==(char *)0) phase=999; break; -- 2.47.3