/ Check-in [67985761]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change the temporary directory search algorithm on unix so that directories with only -wx permission are allowed. And do not allow "." to be returned if it lacks -wx permission.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 67985761aa93fb613b87d340e75371fa55b0f778
User & Date: drh 2016-04-21 23:37:24
Context
2016-04-23
20:59
Fix the fix to the temporary directory search algorithm so that it continues to return "." as a fallback if that directory has the correct permissions. check-in: b38fe522 user: drh tags: trunk
19:55
Merge the latest trunk changes. check-in: 84da122d user: drh tags: tempfiles-25
2016-04-21
23:37
Change the temporary directory search algorithm on unix so that directories with only -wx permission are allowed. And do not allow "." to be returned if it lacks -wx permission. check-in: 67985761 user: drh tags: trunk
18:13
Add the sqlite3rbu_vacuum() API, to create an RBU handle that can be used to rebuild a database in the same way as the VACUUM command. check-in: bd4a6f83 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

  5416   5416   
  5417   5417     if( !azDirs[0] ) azDirs[0] = getenv("SQLITE_TMPDIR");
  5418   5418     if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR");
  5419   5419     for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){
  5420   5420       if( zDir==0 ) continue;
  5421   5421       if( osStat(zDir, &buf) ) continue;
  5422   5422       if( !S_ISDIR(buf.st_mode) ) continue;
  5423         -    if( osAccess(zDir, 07) ) continue;
  5424         -    break;
         5423  +    if( osAccess(zDir, 03) ) continue;
         5424  +    return zDir;
  5425   5425     }
  5426         -  return zDir;
         5426  +  return 0;
  5427   5427   }
  5428   5428   
  5429   5429   /*
  5430   5430   ** Create a temporary file name in zBuf.  zBuf must be allocated
  5431   5431   ** by the calling process and must be big enough to hold at least
  5432   5432   ** pVfs->mxPathname bytes.
  5433   5433   */
................................................................................
  5435   5435     const char *zDir;
  5436   5436     int iLimit = 0;
  5437   5437   
  5438   5438     /* It's odd to simulate an io-error here, but really this is just
  5439   5439     ** using the io-error infrastructure to test that SQLite handles this
  5440   5440     ** function failing. 
  5441   5441     */
         5442  +  zBuf[0] = 0;
  5442   5443     SimulateIOError( return SQLITE_IOERR );
  5443   5444   
  5444   5445     zDir = unixTempFileDir();
         5446  +  if( zDir==0 ) return SQLITE_IOERR_GETTEMPPATH;
  5445   5447     do{
  5446   5448       u64 r;
  5447   5449       sqlite3_randomness(sizeof(r), &r);
  5448   5450       assert( nBuf>2 );
  5449   5451       zBuf[nBuf-2] = 0;
  5450   5452       sqlite3_snprintf(nBuf, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX"%llx%c",
  5451   5453                        zDir, r, 0);