]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Removing realm from database
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 9 Jul 2025 10:17:26 +0000 (06:17 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 9 Jul 2025 10:17:26 +0000 (06:17 -0400)
conf/mailleur.conf
conf/mailleur.conf.dvl
lib/devsql.c
lib/lvleml.c
lib/unisql.c
lib/unisql.h
sql/mailleur.sql

index b75e89aa26546fc0de4c2225f281d609cfbae87a..54406b8cf45403f5f95d253be33ef77d499683f6 100644 (file)
@@ -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
index 30ce8303996d789822739d9e3e834ae08aa8cb4e..80a6902b44f6f6239c7da02b31df3c493c7b81b1 100644 (file)
@@ -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
index 3af20679ed8082a759da932e0d9d7919fc44c231..80e0bf9372c92fded76c4975a325f2c223d60148 100644 (file)
@@ -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);
index 06d4965d9894db7ff8b7a9077def92d649e4fafe..810f8309fbfdea897900a294178ab9863a35dad2 100644 (file)
@@ -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.
index c1b9e30ed181eedfffb7061983e7d0eadd13faa9..909a356fc345ca2b5b09719630f01d85a4fcee35 100644 (file)
@@ -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);
index ba59dea4b8293fc6ed5c189e9b96e69a4edd3555..e0dcab8e2ca6edec8772e40e23c8ca4ebe2a61e6 100644 (file)
@@ -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
index 95201ddfdcda33883842bce0a46e6aba71c14f34..0541f63d2dd93e2ab2c5ec10d6d3d496632c9d5e 100644 (file)
@@ -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