diff options
author | serg@serg.mysql.com <> | 2003-03-10 12:31:49 +0100 |
---|---|---|
committer | serg@serg.mysql.com <> | 2003-03-10 12:31:49 +0100 |
commit | 357766eca8c0724d4552f503683cf8adb923210b (patch) | |
tree | 7b67a2cd40a2fa799ca6aff68a3fe2725752b6e8 /mysys | |
parent | d086e735d1ef228550fd64661413056219b01b19 (diff) | |
download | mariadb-git-357766eca8c0724d4552f503683cf8adb923210b.tar.gz |
ignore world-writeable my.cnf's
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/default.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/mysys/default.c b/mysys/default.c index 062711b185d..c9b0704216a 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -39,6 +39,7 @@ #include "mysys_priv.h" #include "m_string.h" #include "m_ctype.h" +#include <my_dir.h> char *defaults_extra_file=0; @@ -60,13 +61,13 @@ DATADIR, NullS, }; -#define default_ext ".cnf" /* extension for config file */ +#define default_ext ".cnf" /* extension for config file */ #ifdef __WIN__ #include <winbase.h> #define windows_ext ".ini" #endif -static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, +static my_bool search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc, const char *dir, const char *config_file, const char *ext, TYPELIB *group); @@ -241,6 +242,16 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, { strmov(name,config_file); } + fn_format(name,name,"","",4); +#if !defined(__WIN__) && !defined(OS2) + { + MY_STAT stat_info; + if (!my_stat(name,&stat_info,MYF(MY_WME))) + return 0; + if (stat_info.st_mode & S_IWOTH) /* ignore world-writeable files */ + return 0; + } +#endif if (!(fp = my_fopen(fn_format(name,name,"","",4),O_RDONLY,MYF(0)))) return 0; /* Ignore wrong files */ |