summaryrefslogtreecommitdiff
path: root/mysys/default.c
diff options
context:
space:
mode:
authormonty@narttu.mysql.fi <>2003-03-16 19:17:54 +0200
committermonty@narttu.mysql.fi <>2003-03-16 19:17:54 +0200
commita434bca70425e4497c8397d073b11be3620be999 (patch)
tree956d20750d7fec498888d037be8d588dab6412f0 /mysys/default.c
parentce7db2827ee3ae8866882b777f2643914f56ead8 (diff)
parentba46c7289c3ce1517e595a37cef48ffb3c993bb0 (diff)
downloadmariadb-git-a434bca70425e4497c8397d073b11be3620be999.tar.gz
Merge with 4.0
Diffstat (limited to 'mysys/default.c')
-rw-r--r--mysys/default.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/mysys/default.c b/mysys/default.c
index 0ae409f1015..83dd177f6b4 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -38,6 +38,7 @@
#include "mysys_priv.h"
#include "m_string.h"
#include "m_ctype.h"
+#include <my_dir.h>
char *defaults_extra_file=0;
@@ -61,13 +62,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);
@@ -242,6 +243,20 @@ 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(0)))
+ return 0;
+ if (stat_info.st_mode & S_IWOTH) /* ignore world-writeable files */
+ {
+ fprintf(stderr, "warning: World-writeable config file %s is ignored\n",
+ name);
+ return 0;
+ }
+ }
+#endif
if (!(fp = my_fopen(fn_format(name,name,"","",4),O_RDONLY,MYF(0))))
return 0; /* Ignore wrong files */