Below is the list of changes that have just been committed into a local
4.1 repository of rburnett. When rburnett does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2227 05/05/05 16:11:34 rburnett@stripped +2 -0
Bug #9148 Denial of Service
The problem is that names such as COM1, LPT1, etc are reserved device names in DOS and
old Winodws and they are still supported in current versions of the C runtime. The
access() method is used to determine if a file has a certain mode but access() reports
success on these reserved names while we want it to report failure on non-file names.
sql_db.cc:
Added file_access method to mask problems with access() method in MSVCRT
BitKeeper/etc/logging_ok
1.381 05/05/05 16:11:34 rburnett@stripped +1 -0
Logging to logging@stripped accepted
sql/sql_db.cc
1.126 05/05/05 16:08:09 rburnett@stripped +35 -1
Added file_access method to mask problems with access() method in MSVCRT
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: rburnett
# Host: bk-internal.mysql.com
# Root: /users/rburnett/mysql-4.1
--- 1.125/sql/sql_db.cc 2005-02-02 12:52:15 +01:00
+++ 1.126/sql/sql_db.cc 2005-05-05 16:08:09 +02:00
@@ -874,6 +874,40 @@
DBUG_RETURN(-1);
}
+/*
+ Check a file or path for accessability.
+
+ SYNOPSIS
+ file_access()
+ path path to check
+ amode mode to check
+
+ DESCRIPTION
+ This function wraps the normal access method because the access available in MSVCRT
+ reports that filenames such as LPT1 and COM1 are valid (they are but should not be so
+ for us).
+
+ RETURN VALUES
+ 0 ok
+ -1 error
+*/
+int file_access(const char *path, int amode)
+{
+#ifdef __WIN__
+ WIN32_FILE_ATTRIBUTE_DATA fileinfo;
+ BOOL result = ::GetFileAttributesEx(path, GetFileExInfoStandard, &fileinfo);
+ if (! result) return -1;
+
+ if ((fileinfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) &&
+ (amode & 2))
+ return -1;
+
+ return 0;
+#else
+ return access(path, amode);
+#endif
+}
+
/*
Change default database.
@@ -946,7 +980,7 @@
length=unpack_dirname(path,path); // Convert if not unix
if (length && path[length-1] == FN_LIBCHAR)
path[length-1]=0; // remove ending '\'
- if (access(path,F_OK))
+ if (file_access(path,F_OK))
{
net_printf(thd,ER_BAD_DB_ERROR,dbname);
my_free(dbname,MYF(0));
--- 1.380/BitKeeper/etc/logging_ok 2005-05-04 10:16:02 +02:00
+++ 1.381/BitKeeper/etc/logging_ok 2005-05-05 16:11:34 +02:00
@@ -195,6 +195,7 @@
ram@ram.(none)
ramil@stripped
ranger@stripped
+rburnett@stripped
rburnett@stripped
reggie@bob.(none)
reggie@mdk10.(none)
| Thread |
|---|
| • bk commit into 4.1 tree (rburnett:1.2227) BUG#9148 | reggie | 5 May |