Bluehost.com Web Hosting $6.95

[courier-users] courier-auth multi domain table patch

This is a discussion on [courier-users] courier-auth multi domain table patch within the Courier-Imap forums, part of the Mail Servers and Related category; This is a multi-part message in MIME format. --------------010501050700030708050709 Content-Type: text/plain; charset=ISO-8859-15; format=flowed ...


Go Back   Usenet Forums > Mail Servers and Related > Courier-Imap

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-09-2005
Alessandro Briosi
 
Posts: n/a
Default [courier-users] courier-auth multi domain table patch

This is a multi-part message in MIME format.
--------------010501050700030708050709
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

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






--------------010501050700030708050709
Content-Type: text/plain;
name="courier-authlib-domaintable.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="courier-authlib-domaintable.patch"

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;
}

+/* abriosi@users.sourceforge.net */
+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;
+}
+
/* siefca@pld.org.pl */

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;
}

+/* abriosi@users.sourceforge.net */
+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;
+}
+
/* tom@minnesota.com */

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;


--------------010501050700030708050709--


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/.../courier-users
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 02:34 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0