Bug Tracker item #3018940, was opened at 2010-06-21 11:02
Message generated for change (Comment added) made by vit_s
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=3018940&group_id=250683

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: contrib/thunderbird
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Vitauts Stočka (vit_s)
Assigned to: Stevan Bajic (sbajic)
Summary: dspam_maintenance MySQL cleanup fails if root/.my.cnf exists

Initial Comment:
If root user has .my.cnf MySQL options file with password= option set (even 
empty), dspam_maintenance script data storage cleanup fails with

ERROR 1045 (28000): Access denied for user 'dspam'@'localhost' (using password: 
NO)

Reason is the way dspam_maintenance assigns password from tmp file with 
--defaults-extra-file mysql option. This way .my.cnf from root home directory 
takes precedence and password from tmp file is never used. Solution is to 
change --defaults-extra-file to --defaults-file. We don't expect mysql options 
to be defined anywhere else so it seems safe to use --defaults-file here, which 
according the documentation "Use only the given option file". See 
http://dev.mysql.com/doc/refman/5.0/en/option-files.html#option_general_defaults-extra-file

This small change solves my problem. Patch attached.

With best regards,
Vitauts

----------------------------------------------------------------------

>Comment By: Vitauts Stočka (vit_s)
Date: 2010-08-04 10:38

Message:
We are talking about different things. Debian doesn't change options order,
my example was simply to illustrate, WHAT mysql command line options are
used, not the order. You are right, --defaults-extra-file comes first and
then --user=dspam. That doesn't change the fact that /root/.my.cnf is
loaded, --user option changes username for mysql connection but not the
fact, that mysql command is called by root user.

Debian calls dspam_maintenance from /etc/cron.dayly/dspam script. These
scripts are called as root. If this script is deleted and dspam_maintenance
is run by dspam cronbat or from /etc/crontab setting dspam as user, there
would be no problem. But putting maintenance scripts in /etc/cron.daily
seems fine, just fix dspam_maintenance to ignore possible interference from
/root/.my.cnf.

Do you have any reason to call defaults-extra-file? It is simply stated
that defaults-file loads just given options and nothing else. That seems
fairly enough for me. defaults-extra-file loads given file and possibly (as
in my case) something else.


----------------------------------------------------------------------

Comment By: Stevan Bajic (sbajic)
Date: 2010-08-04 10:15

Message:
> Using dspam crontab configuration (at least on debian) dspam_maintenance
> is called as root which results in calling mysql --user=dspam
> --defaults-extra-file=..tmp.. as root. 
> 
Then Debian has change the original file to include first the --user
option. Look at the original file:
http://dspam.git.sourceforge.net/git/gitweb.cgi?p=dspam/dspam;a=blob;f=contrib/dspam_maintenance/dspam_maintenance.sh;hb=HEAD#l347

The --user option there is not called first.

Can you show me an URL where I can read the maintenance script Debian is
using?

----------------------------------------------------------------------

Comment By: Vitauts Stočka (vit_s)
Date: 2010-08-04 09:02

Message:
This has nothing to do with mysql bugs. Precedence was not meant as loading
order but as final effect. Mysql manual states regarding
defaults-extra-file, that it is loaded "before the user option file". Which
means, that user option file IS loaded. 
Using dspam crontab configuration (at least on debian) dspam_maintenance
is called as root which results in calling mysql --user=dspam
--defaults-extra-file=..tmp.. as root. As a result dspam file with password
is loaded "before the user option file", i.e., root/.my.cnf is loaded
afterwards and contains root password replacing dspam value from temporary
file. It results in mysql connection attempt with user=dspam and root's
password.

Think it another way. defaults-file is meant to "Use only the given option
file". It is exactly the case we need, as every other option is defined by
command line and tmp options file contains password. What else options do
you care about? However, with defaults-extra-file additional options may
interfere as in my case.

----------------------------------------------------------------------

Comment By: Imposit.com Webmaster (bofh999)
Date: 2010-08-04 03:09

Message:
hey i didnt posted anything. my first post was my answer to your question
about mysql
i remebered something similar... 
its no my bug report... 

(and i think noone should have /root/.my.cnf ... :-)

----------------------------------------------------------------------

Comment By: Imposit.com Webmaster (bofh999)
Date: 2010-08-04 03:07

Message:
ah ok i found it. was 1.5 yearts ago :-) hey i really found it im impressed
because ife no idea which cover id i used hehe


ok i think its another thing. it was related to mysqld and mysql_safe
start script but sounded similar in the back of my brain... anyway

http://bugs.mysql.com/bug.php?id=44624
but maybe related... 

----------------------------------------------------------------------

Comment By: Stevan Bajic (sbajic)
Date: 2010-08-04 02:55

Message:
Would be good if you could point me to the correct bug entry in their
bug-tracker. I will however test if using the other switch is an option.
The order is not so much important. The only thing that I can see from the
link you posted is that the --user and --password option has some special
handling. I need to find the time to look more closer into that issue.

----------------------------------------------------------------------

Comment By: Imposit.com Webmaster (bofh999)
Date: 2010-08-04 02:49

Message:
Ahh Stevaaaan 
I think , i think its a bug in the mysql script.

Its a long time ago but i think i submitted something like that to the
mysql bugtracker.
the mysqlscript has some issues 
you have to be in the correct order and some other things - pretty touchy
that beast

dont know it exactly anymore, sorry, but this is a very nice place to look
for errors

----------------------------------------------------------------------

Comment By: Stevan Bajic (sbajic)
Date: 2010-08-04 02:38

Message:
Where do you see in
http://dev.mysql.com/doc/refman/5.0/en/option-files.html#option_general_defaults-extra-file
that $HOME/.my.cnf or ~/.my.cnf has precedence over --defaults-extra-file?
Can you point me to the paragraph showing this?



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=3018940&group_id=250683

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Dspam-devel mailing list
Dspam-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspam-devel

Reply via email to