From: Jean-Marc Pigeon (Delson) Date: Wed, 9 Jul 2025 10:17:26 +0000 (-0400) Subject: Removing realm from database X-Git-Tag: tag-0.13~11 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=8c839f23a0d0d57e97385e9ddbbb51d7b59e7300;p=jmp%2Fmailleur Removing realm from database --- diff --git a/conf/mailleur.conf b/conf/mailleur.conf index b75e89a..54406b8 100644 --- a/conf/mailleur.conf +++ b/conf/mailleur.conf @@ -6,7 +6,11 @@ APPNAME=mailleur ROOTBASE="/" #defining local default domain DFLTDOMAIN="localdomain" -#defineing the local REALM +#defining the local REALM +#Caution! the realm is hardcoded within data-base +#and USED too to hash the user passwd +#Changing this value coule be a trouble make +#(entering again ALL user password) REALM="mailleur-email" #------------------------------------------------ #list of listening port to do SMTP protocole diff --git a/conf/mailleur.conf.dvl b/conf/mailleur.conf.dvl index 30ce830..80a6902 100644 --- a/conf/mailleur.conf.dvl +++ b/conf/mailleur.conf.dvl @@ -8,6 +8,10 @@ ROOTBASE="/home/jmp/safe-mailleur/mailleur/test_area/" #defining local default domain DFLTDOMAIN="example.com" #defineing the local REALM +#Caution! the realm is hardcoded within data-base +#and USED too to hash the user passwd +#Changing this value coule be a trouble make +#(entering again ALL user password) REALM="mailleur-email" #------------------------------------------------ #list of listening port to do SMTP protocole diff --git a/lib/devsql.c b/lib/devsql.c index 3af2067..80e0bf9 100644 --- a/lib/devsql.c +++ b/lib/devsql.c @@ -49,7 +49,6 @@ const FLDTYP usrfield[]={ {4,"mxspace"}, {5,"locked"}, {6,"hash"}, - {7,"realm"}, {0,(char *)0} }; @@ -383,9 +382,6 @@ while (proceed==true) { case 6 : //'email:realm:password' MD5 usr->hash=strdup(locval); break; - case 7 : //'realm - usr->realm=strdup(locval); - break; default : (void) rou_alert(0,"%s field <%d:%s> not implemented (Bug?)", OPEP,usrfield[i].num,usrfield[i].name); diff --git a/lib/lvleml.c b/lib/lvleml.c index 06d4965..810f830 100644 --- a/lib/lvleml.c +++ b/lib/lvleml.c @@ -730,8 +730,6 @@ while (proceed==true) { if (sql_mngusr(contact->sqlptr,sql_select,resp->username,&usr)==true) { if (usr->hash!=(char *)0) (void) strncpy(hash,usr->hash,sizeof(hash)-1); - if (usr->realm!=(char *)0) - (void) strncpy(usrrealm,usr->realm,sizeof(usrrealm)-1); usr=sql_freeusr(usr); } if (strlen(hash)==0) { @@ -766,10 +764,6 @@ while (proceed==true) { (void) rou_alert(0,"%s delay expired to get remote empty line (network?)", OPEP); line=rou_freestr(line); //EMPTY Line! - if (strcmp(realm,usrrealm)!=0) { - (void) strncpy(realm,usrrealm,sizeof(realm)-1); - phase=0; - } } break; case 9 : { //comparing result. diff --git a/lib/unisql.c b/lib/unisql.c index c1b9e30..909a356 100644 --- a/lib/unisql.c +++ b/lib/unisql.c @@ -106,7 +106,6 @@ PUBLIC USRTYP *sql_freeusr(USRTYP *usr) { if (usr!=(USRTYP *)0) { - usr->realm=rou_freestr(usr->realm); usr->hash=rou_freestr(usr->hash); usr->passwd=rou_freestr(usr->passwd); usr->email=rou_freestr(usr->email); diff --git a/lib/unisql.h b/lib/unisql.h index ba59dea..e0dcab8 100644 --- a/lib/unisql.h +++ b/lib/unisql.h @@ -21,7 +21,6 @@ typedef enum { typedef struct { char *email; //user emails char *passwd; //user password - char *realm; //user realm u_int lock; //account is lock u_long space; //user space used u_long mxspace; //user maximun space diff --git a/sql/mailleur.sql b/sql/mailleur.sql index 95201dd..0541f63 100644 --- a/sql/mailleur.sql +++ b/sql/mailleur.sql @@ -55,8 +55,6 @@ CREATE TABLE emails ( email TEXTUNIQUE, //User email password TEXT //User password DFLT '!', - realm TEXT //user realm - DFLT 'mailleur-email', hash TEXT, //'email:realm:password' MD5 space INTEGER //space used by user email DFLT 0, @@ -69,11 +67,13 @@ GRANT SELECT,INSERT,UPDATE,DELETE ON emails TO mailapache; GRANT SELECT ON emails TO maildove; //defining the password trigger according database type +#define REALM 'mailleur-email' + #ifdef POSTGRESQL CREATE FUNCTION updpass() RETURNS trigger AS $$ BEGIN - NEW.hash = md5(concat (NEW.email,':',NEW.realm,':',new.password)); + NEW.hash = md5(concat (NEW.email,':',REALM,':',new.password)); NEW.password = crypt(new.password, gen_salt('md5')); RETURN NEW; END