Commit 896e6e56 authored by unknown's avatar unknown
Browse files

Fixes for bugs reported by Stefano Di Paola (stefano.dipaola@wisec.it)

Originally contained in 2005/03/03 19:51:29+01:00 serg@serg.mylan;
contained in MySQL 4.1.10a;
re-committed for archival purposes.


include/my_global.h:
  O_NOFOLLOW
isam/create.c:
  create table files with O_EXCL|O_NOFOLLOW
merge/mrg_create.c:
  create table files with O_EXCL|O_NOFOLLOW
myisam/mi_create.c:
  create files of temporary tables with O_EXCL|O_NOFOLLOW
myisammrg/myrg_create.c:
  create table files with O_EXCL|O_NOFOLLOW
mysys/mf_tempfile.c:
  create temporary files with O_EXCL|O_NOFOLLOW
sql/ha_myisam.cc:
  let mi_create know if the table is TEMPORARY
sql/mysql_priv.h:
  --allow_suspicious_udfs
sql/mysqld.cc:
  --allow_suspicious_udfs
sql/share/english/errmsg.txt:
  typo
sql/sql_udf.cc:
  --allow_suspicious_udfs
  don't allow xxx() udf without any of xxx_init/deinit/add/reset
  check paths when loading from mysql.func
sql/table.cc:
  create frm of temporary table with O_EXCL|O_NOFOLLOW
parent a8b9f30e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -523,6 +523,9 @@ typedef SOCKET_SIZE_TYPE size_socket;
#ifndef O_SHORT_LIVED
#define O_SHORT_LIVED	0
#endif
#ifndef O_NOFOLLOW
#define O_NOFOLLOW      0
#endif

/* #define USE_RECORD_LOCK	*/

+3 −2
Original line number Diff line number Diff line
@@ -58,13 +58,14 @@ int nisam_create(const char *name,uint keys,N_KEYDEF *keyinfo,
  base_pos=512;					/* Enough for N_STATE_INFO */
  bzero((byte*) &share,sizeof(share));
  if ((file = my_create(fn_format(buff,name,"",N_NAME_IEXT,4),0,
       O_RDWR | O_TRUNC,MYF(MY_WME))) < 0)
       O_RDWR | O_EXCL | O_NOFOLLOW,MYF(MY_WME))) < 0)
    goto err;
  errpos=1;
  VOID(fn_format(buff,name,"",N_NAME_DEXT,2+4));
  if (!(flags & HA_DONT_TOUCH_DATA))
  {
    if ((dfile = my_create(buff,0,O_RDWR | O_TRUNC,MYF(MY_WME))) < 0)
    if ((dfile = my_create(buff,0,O_RDWR | O_EXCL | O_NOFOLLOW,
                           MYF(MY_WME))) < 0)
      goto err;
    errpos=2;
  }
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ int mrg_create(const char *name, const char**table_names)

  errpos=0;
  if ((file = my_create(fn_format(buff,name,"",MRG_NAME_EXT,4),0,
       O_RDWR | O_TRUNC,MYF(MY_WME))) < 0)
       O_RDWR | O_EXCL | O_NOFOLLOW,MYF(MY_WME))) < 0)
    goto err;
  errpos=1;
  if (table_names)
+7 −7
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
{
  register uint i,j;
  File dfile,file;
  int errpos,save_errno;
  int errpos,save_errno, create_mode= O_RDWR | O_TRUNC;
  myf create_flag;
  uint fields,length,max_key_length,packed,pointer,real_length_diff,
       key_length,info_length,key_segs,options,min_key_length_skip,
@@ -176,7 +176,10 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
    min_pack_length+=varchar_length+2*varchar_count;
  }
  if (flags & HA_CREATE_TMP_TABLE)
  {
    options|= HA_OPTION_TMP_TABLE;
    create_mode|= O_EXCL | O_NOFOLLOW;
  }
  if (flags & HA_CREATE_CHECKSUM || (options & HA_OPTION_CHECKSUM))
  {
    options|= HA_OPTION_CHECKSUM;
@@ -533,9 +536,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
    create_flag=MY_DELETE_OLD;
  }

  if ((file= my_create_with_symlink(linkname_ptr,
				    filename,
				    0, O_RDWR | O_TRUNC,
  if ((file= my_create_with_symlink(linkname_ptr, filename, 0, create_mode,
				    MYF(MY_WME | create_flag))) < 0)
    goto err;
  errpos=1;
@@ -546,7 +547,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
    if (share.base.raid_type)
    {
      (void) fn_format(filename,name,"",MI_NAME_DEXT,2+4);
      if ((dfile=my_raid_create(filename,0,O_RDWR | O_TRUNC,
      if ((dfile=my_raid_create(filename, 0, create_mode
				share.base.raid_type,
				share.base.raid_chunks,
				share.base.raid_chunksize,
@@ -570,8 +571,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
	create_flag=MY_DELETE_OLD;
      }
      if ((dfile=
	   my_create_with_symlink(linkname_ptr, filename,
				  0,O_RDWR | O_TRUNC,
	   my_create_with_symlink(linkname_ptr, filename, 0, create_mode,
				  MYF(MY_WME | create_flag))) < 0)
	goto err;
    }
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ int myrg_create(const char *name, const char **table_names,

  errpos=0;
  if ((file = my_create(fn_format(buff,name,"",MYRG_NAME_EXT,4),0,
       O_RDWR | O_TRUNC,MYF(MY_WME))) < 0)
       O_RDWR | O_EXCL | O_NOFOLLOW,MYF(MY_WME))) < 0)
    goto err;
  errpos=1;
  if (table_names)
Loading