From f2d98ed70ea4298a6fa2b661f41f1824ac47a4c8 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Mon, 7 Jul 2025 05:45:55 -0400 Subject: [PATCH] Adjusting code to allow use of cram-md5 and disgest-md5 on plain link --- lib/lvleml.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/lvleml.c b/lib/lvleml.c index d2921be..da40fb6 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -438,7 +438,7 @@ while (proceed==true) { phase=999; //no need to go further } break; - case 5 : { //comparing challange answer + case 5 : { //comparing challenge answer char *local; char *hexa; @@ -447,7 +447,7 @@ while (proceed==true) { //(void) rou_alert(0,"%s anwr=<%s>",OPEP,answer); //(void) rou_alert(0,"%s hexa=<%s>",OPEP,hexa); if (strcmp(hexa,answer)!=0) - (void) strncpy(passwd,"$1(ukn as cram_d5)",sizeof(passwd)-1); + (void) strncpy(passwd,"$1(ukn as cram_md5)",sizeof(passwd)-1); (void) rou_asprintf(&decoded,"%s%s%s%s",IOBNULL,name,IOBNULL,passwd); hexa=rou_freestr(hexa); local=rou_freestr(local); @@ -586,7 +586,9 @@ while (proceed==true) { break; } if (strcmp(HA0,resp->response)!=0) { - phase=999; //user NOT autheticated + //user authentication failed + curpass=rou_freestr(curpass); + (void) rou_asprintf(&curpass,"$1(ukn as digest_md5)"); } HA0=rou_freestr(HA0); } @@ -821,10 +823,16 @@ while (proceed==true) { case 3 : //getting "username password" accorind login type switch (code) { case 0 : //AUTH PLAIN - decoded=get_auth_plain(contact,delay,local); + if (soc_iscrypted(contact->socptr)==true) + decoded=get_auth_plain(contact,delay,local); + else + (void) transmit(contact,true,"%d 5.7.3 Unsafe PLAIN auth mode",FAILED); break; case 1 : //AUTH LOGIN - decoded=get_auth_login(contact,delay); + if (soc_iscrypted(contact->socptr)==true) + decoded=get_auth_login(contact,delay); + else + (void) transmit(contact,true,"%d 5.7.3 Unsafe LOGIN auth mode",FAILED); break; case 2 : //AUTH CRAM-MD5 decoded=get_auth_cram_md5(contact,delay); @@ -1294,6 +1302,7 @@ static struct { char *str; //the message to display }ehlo[]={ {1,"STARTTLS"}, + {1,"AUTH CRAMD-MD5 DIGEST-MD5"}, {2,"AUTH PLAIN LOGIN CRAM-MD5 DIGEST-MD5"}, {0,"SIZE "MXMSIZE}, {0,"8BITMIME"}, -- 2.47.3