|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Subject: [Postfix/MySQL] Wierd column issue
From: scott (scott
chronis.pobox.com)Date: Mon Feb 21 2000 - 04:43:07 CST
- Next message: Michael J. Maravillo: "Re: CIDR notation in access table ?"
- Previous message: Gilles Grandou: "Re: postmaster address"
- Maybe reply: scott: "[Postfix/MySQL] Wierd column issue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This was also intended for the list :)
scott
----- Forwarded message from scott <scott
chronis.pobox.com> -----
Date: Mon, 21 Feb 2000 05:38:27 -0500
From: scott <scott
chronis.pobox.com>
To: Adam Sherman <adam
omniferum.com>
Subject: Re: [Postfix/MySQL] Wierd column issue
X-Mailer: Mutt 0.95.7i
In-Reply-To: <20000221024345.B12225
epals.com>
After some digging around, I found the source of this problem. If you
have multiple mysql maps, and don't define all the variables in each
one, and more than one map is used in a single process, then you will
experience this problem.
The underlying cause was this: when a mysql map parses it's config
file, it uses postfix's built in parse-a-file-into-a-dict function,
and gives that dict a static name. So if a single process has
multiple maps and one map does not define a setting and another does,
the map without the setting will use the value from the one that does
if it's config is parsed after the one that does.
The fix: make the name of config file parsing map vary per config
file. patch attached.
Thanks for your help on this one.
scott
On Mon, Feb 21, 2000 at 02:43:45AM -0500, Adam Sherman wrote:
> I solved the problem by putting an empty 'additional_conditions' in
> the only map that didn't have one. I think there's a bug in
> utils/dict_mysql.c, but I have no C experience. )-:
>
> Thanks,
>
> A.
> > This is a soon-to-be production server.
> >
> > Thanks,
> >
> > A.
> >
>
> --
> Adam Sherman
> <adam
omniferum.com>
> +1 (613) 223-5746
>
diff -cr postfix-19991231-pl04/util/dict_mysql.c variable-optdictname-postfix-19991231-pl04/util/dict_mysql.c
*** postfix-19991231-pl04/util/dict_mysql.c Thu Dec 9 17:02:25 1999
--- variable-optdictname-postfix-19991231-pl04/util/dict_mysql.c Mon Feb 21 05:35:07 2000
***************
*** 361,379 ****
int i;
char *nameval;
char *hosts;
MYSQL_NAME *name = (MYSQL_NAME *) mymalloc(sizeof(MYSQL_NAME));
ARGV *hosts_argv;
! dict_load_file("mysql_options", mysqlcf_path);
/* mysql username lookup */
! if ((nameval = (char *) dict_lookup("mysql_options", "user")) == NULL)
name->username = mystrdup("");
else
name->username = mystrdup(nameval);
if (msg_verbose)
msg_info("mysqlname_parse(): set username to '%s'", name->username);
/* password lookup */
! if ((nameval = (char *) dict_lookup("mysql_options", "password")) == NULL)
name->password = mystrdup("");
else
name->password = mystrdup(nameval);
--- 361,382 ----
int i;
char *nameval;
char *hosts;
+ /* the name of the dict for processing the mysql options file */
+ char *opt_dict_name = (char *) mymalloc(sizeof(char) * (strlen(mysqlcf_path) + 5));
MYSQL_NAME *name = (MYSQL_NAME *) mymalloc(sizeof(MYSQL_NAME));
ARGV *hosts_argv;
! sprintf(opt_dict_name, "opt %s", mysqlcf_path);
! dict_load_file(opt_dict_name, mysqlcf_path);
/* mysql username lookup */
! if ((nameval = (char *) dict_lookup(opt_dict_name, "user")) == NULL)
name->username = mystrdup("");
else
name->username = mystrdup(nameval);
if (msg_verbose)
msg_info("mysqlname_parse(): set username to '%s'", name->username);
/* password lookup */
! if ((nameval = (char *) dict_lookup(opt_dict_name, "password")) == NULL)
name->password = mystrdup("");
else
name->password = mystrdup(nameval);
***************
*** 381,387 ****
msg_info("mysqlname_parse(): set password to '%s'", name->password);
/* database name lookup */
! if ((nameval = (char *) dict_lookup("mysql_options", "dbname")) == NULL)
msg_fatal("%s: mysql options file does not include database name", mysqlcf_path);
else
name->dbname = mystrdup(nameval);
--- 384,390 ----
msg_info("mysqlname_parse(): set password to '%s'", name->password);
/* database name lookup */
! if ((nameval = (char *) dict_lookup(opt_dict_name, "dbname")) == NULL)
msg_fatal("%s: mysql options file does not include database name", mysqlcf_path);
else
name->dbname = mystrdup(nameval);
***************
*** 389,395 ****
msg_info("mysqlname_parse(): set database name to '%s'", name->dbname);
/* table lookup */
! if ((nameval = (char *) dict_lookup("mysql_options", "table")) == NULL)
msg_fatal("%s: mysql options file does not include table name", mysqlcf_path);
else
name->table = mystrdup(nameval);
--- 392,398 ----
msg_info("mysqlname_parse(): set database name to '%s'", name->dbname);
/* table lookup */
! if ((nameval = (char *) dict_lookup(opt_dict_name, "table")) == NULL)
msg_fatal("%s: mysql options file does not include table name", mysqlcf_path);
else
name->table = mystrdup(nameval);
***************
*** 397,403 ****
msg_info("mysqlname_parse(): set table name to '%s'", name->table);
/* select field lookup */
! if ((nameval = (char *) dict_lookup("mysql_options", "select_field")) == NULL)
msg_fatal("%s: mysql options file does not include select field", mysqlcf_path);
else
name->select_field = mystrdup(nameval);
--- 400,406 ----
msg_info("mysqlname_parse(): set table name to '%s'", name->table);
/* select field lookup */
! if ((nameval = (char *) dict_lookup(opt_dict_name, "select_field")) == NULL)
msg_fatal("%s: mysql options file does not include select field", mysqlcf_path);
else
name->select_field = mystrdup(nameval);
***************
*** 405,411 ****
msg_info("mysqlname_parse(): set select_field to '%s'", name->select_field);
/* where field lookup */
! if ((nameval = (char *) dict_lookup("mysql_options", "where_field")) == NULL)
msg_fatal("%s: mysql options file does not include where field", mysqlcf_path);
else
name->where_field = mystrdup(nameval);
--- 408,414 ----
msg_info("mysqlname_parse(): set select_field to '%s'", name->select_field);
/* where field lookup */
! if ((nameval = (char *) dict_lookup(opt_dict_name, "where_field")) == NULL)
msg_fatal("%s: mysql options file does not include where field", mysqlcf_path);
else
name->where_field = mystrdup(nameval);
***************
*** 413,419 ****
msg_info("mysqlname_parse(): set where_field to '%s'", name->where_field);
/* additional conditions */
! if ((nameval = (char *) dict_lookup("mysql_options", "additional_conditions")) == NULL)
name->additional_conditions = mystrdup("");
else
name->additional_conditions = mystrdup(nameval);
--- 416,422 ----
msg_info("mysqlname_parse(): set where_field to '%s'", name->where_field);
/* additional conditions */
! if ((nameval = (char *) dict_lookup(opt_dict_name, "additional_conditions")) == NULL)
name->additional_conditions = mystrdup("");
else
name->additional_conditions = mystrdup(nameval);
***************
*** 421,427 ****
msg_info("mysqlname_parse(): set additional_conditions to '%s'", name->additional_conditions);
/* mysql server hosts */
! if ((nameval = (char *) dict_lookup("mysql_options", "hosts")) == NULL)
hosts = mystrdup("");
else
hosts = mystrdup(nameval);
--- 424,430 ----
msg_info("mysqlname_parse(): set additional_conditions to '%s'", name->additional_conditions);
/* mysql server hosts */
! if ((nameval = (char *) dict_lookup(opt_dict_name, "hosts")) == NULL)
hosts = mystrdup("");
else
hosts = mystrdup(nameval);
***************
*** 447,452 ****
--- 450,456 ----
}
}
myfree(hosts);
+ myfree(opt_dict_name);
argv_free(hosts_argv);
return name;
}
----- End forwarded message -----
- Next message: Michael J. Maravillo: "Re: CIDR notation in access table ?"
- Previous message: Gilles Grandou: "Re: postmaster address"
- Maybe reply: scott: "[Postfix/MySQL] Wierd column issue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]