I have no idea if this is the right place to post this.
I just create a patch to add to the authlib a "domain_table" variable.
so that users can be splitted in multiple tables like
example1_com
example2_com
This is very handy when you have multiple domains.
To anybody who needs it I have the same patch for postfix.
Hope it will be included in the next release.
Alessandro
diff -Naur courier-authlib-0.57/authmysqllib.c
courier-authlib-0.57-new/authmysqllib.c
--- courier-authlib-0.57/authmysqllib.c 2005-07-13 02:54:57.000000000 +0200
+++ courier-authlib-0.57-new/authmysqllib.c 2005-09-08 21:23:15.000000000
+0200
@@ -535,6 +535,19 @@
return domain_buf;
}
+/* [EMAIL PROTECTED] */
+static const char *get_domaintable (const char *domain)
+{
+char *p;
+static char domaintable_buf[130];
+
+ sprintf(domaintable_buf,"%s",domain);
+ while ( (p = strstr(domaintable_buf,"."))){
+ *p = '_';
+ }
+ return domaintable_buf;
+}
+
/* [EMAIL PROTECTED] */
static const char *validateMyPassword (const char *password)
@@ -576,6 +589,7 @@
{"local_part", NULL, sizeof("local_part"), 0},
{"domain", NULL, sizeof("domain"), 0},
{"service", NULL, sizeof("service"), 0},
+ {"domain_table", NULL, sizeof("domain_table"), 0},
{NULL, NULL, 0, 0}};
if (clause == NULL || *clause == '\0' ||
@@ -587,6 +601,7 @@
if (!vd[0].value || !vd[1].value)
return NULL;
vd[2].value = service;
+ vd[3].value = get_domaintable (vd[1].value);
return (parse_string (clause, vd));
}
@@ -601,6 +616,7 @@
{"domain", NULL, sizeof("domain"), 0},
{"newpass", NULL, sizeof("newpass"), 0},
{"newpass_crypt", NULL, sizeof("newpass_crypt"), 0},
+ {"domain_table", NULL, sizeof("domain_table"), 0},
{NULL, NULL, 0, 0}};
if (clause == NULL || *clause == '\0' ||
@@ -612,6 +628,7 @@
vd[1].value = get_domain (username, defdomain);
vd[2].value = validateMyPassword (newpass);
vd[3].value = validateMyPassword (newpass_crypt);
+ vd[4].value = get_domaintable (vd[1].value);
if (!vd[0].value || !vd[1].value ||
!vd[2].value || !vd[3].value) return NULL;
diff -Naur courier-authlib-0.57/authpgsqllib.c
courier-authlib-0.57-new/authpgsqllib.c
--- courier-authlib-0.57/authpgsqllib.c 2005-07-13 02:54:57.000000000 +0200
+++ courier-authlib-0.57-new/authpgsqllib.c 2005-09-08 21:23:05.000000000
+0200
@@ -506,6 +506,19 @@
return domain_buf;
}
+/* [EMAIL PROTECTED] */
+static const char *get_domaintable (const char *domain)
+{
+char *p;
+static char domaintable_buf[130];
+
+ sprintf(domaintable_buf,"%s",domain);
+ while ( (p = strstr(domaintable_buf,"."))){
+ *p = '_';
+ }
+ return domaintable_buf;
+}
+
/* [EMAIL PROTECTED] */
static const char *validate_password (const char *password)
@@ -547,6 +560,7 @@
{"local_part", NULL, sizeof("local_part"), 0},
{"domain", NULL, sizeof("domain"), 0},
{"service", NULL, sizeof("service"), 0},
+ {"domain_table", NULL, sizeof("domain_table"), 0},
{NULL, NULL, 0, 0}};
if (clause == NULL || *clause == '\0' ||
@@ -558,6 +572,7 @@
if (!vd[0].value || !vd[1].value)
return NULL;
vd[2].value = service;
+ vd[3].value = get_domaintable (vd[1].value);
return (parse_string (clause, vd));
}
@@ -572,6 +587,7 @@
{"domain", NULL, sizeof("domain"), 0},
{"newpass", NULL, sizeof("newpass"), 0},
{"newpass_crypt", NULL, sizeof("newpass_crypt"), 0},
+ {"domain_table", NULL, sizeof("domain_table"), 0},
{NULL, NULL, 0, 0}};
if (clause == NULL || *clause == '\0' ||
@@ -583,6 +599,7 @@
vd[1].value = get_domain (username, defdomain);
vd[2].value = validate_password (newpass);
vd[3].value = validate_password (newpass_crypt);
+ vd[4].value = get_domaintable (vd[1].value);
if (!vd[0].value || !vd[1].value ||
!vd[2].value || !vd[3].value) return NULL;