diff options
author | Nisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com> | 2017-05-12 09:47:48 +0530 |
---|---|---|
committer | Nisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com> | 2017-05-12 09:47:48 +0530 |
commit | b615c3dff885b1ce44fa2275aec8f04c8963ea75 (patch) | |
tree | b739e4235a8417a0812d09ab8f3ca3d628bec8ca /include | |
parent | 67bec60c726ee25e5c4a82709397c65c4e768e3e (diff) | |
download | mariadb-git-b615c3dff885b1ce44fa2275aec8f04c8963ea75.tar.gz |
BUG#25451091:CREATE TABLE DATA DIRECTORY / INDEX DIRECTORY
SYMLINK CHECK RACE CONDITIONS
ANALYSIS:
=========
A potential defect exists in the handling of CREATE
TABLE .. DATA DIRECTORY/ INDEX DIRECTORY which gives way to
the user to gain access to another user table or a system
table.
FIX:
====
The lstat and fstat output of the target files are now
stored which help in determining the identity of the target
files thus preventing the unauthorized access to other
files.
Diffstat (limited to 'include')
-rw-r--r-- | include/my_sys.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/my_sys.h b/include/my_sys.h index 472c2ba5ca0..9983ee3319f 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,6 +49,7 @@ typedef struct my_aio_result { #ifdef _WIN32 #include <malloc.h> /*for alloca*/ #endif +#include <sys/stat.h> #define MY_INIT(name) { my_progname= name; my_init(); } @@ -491,6 +492,16 @@ typedef struct st_io_cache /* Used when cacheing files */ typedef int (*qsort2_cmp)(const void *, const void *, const void *); +/* + Subset of struct stat fields filled by stat/lstat/fstat that uniquely + identify a file +*/ +typedef struct st_file_id +{ + dev_t st_dev; + ino_t st_ino; +} ST_FILE_ID; + /* defines for mf_iocache */ /* Test if buffer is inited */ @@ -569,8 +580,9 @@ extern File my_create(const char *FileName,int CreateFlags, extern int my_close(File Filedes,myf MyFlags); extern int my_mkdir(const char *dir, int Flags, myf MyFlags); extern int my_readlink(char *to, const char *filename, myf MyFlags); -extern int my_is_symlink(const char *filename); +extern int my_is_symlink(const char *filename, ST_FILE_ID *file_id); extern int my_realpath(char *to, const char *filename, myf MyFlags); +extern int my_is_same_file(File file, const ST_FILE_ID *file_id); extern File my_create_with_symlink(const char *linkname, const char *filename, int createflags, int access_flags, myf MyFlags); |