System.Data.SQLite

Check-in [d149920e68]
Login

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

Overview
Comment:Enhance robustness of the new 'allowBaseDirectoryOnly' feature of the native library pre-loader.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | netStandard20
Files: files | file ages | folders
SHA1: d149920e68a28e3e46632eedca722caf75f246da
User & Date: mistachkin 2018-04-07 17:47:22.101
Context
2018-04-07
19:10
Use 'SQLITE_NET_CONFIGURATION_SUFFIX' in the .NET Core build scripts for POSIX. check-in: 6abb302e8b user: mistachkin tags: netStandard20
17:47
Enhance robustness of the new 'allowBaseDirectoryOnly' feature of the native library pre-loader. check-in: d149920e68 user: mistachkin tags: netStandard20
17:25
Fix shell script naming typo. check-in: ea81f2d9f7 user: mistachkin tags: netStandard20
Changes
Unified Diff Ignore Whitespace Patch
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Private Data
      /// <summary>
      /// This lock is used to protect the static <see cref="isMono" /> and
      /// <see cref="isDotNetCore" /> field.
      /// </summary>
      private static readonly object staticSyncRoot = new object();

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This type is only present when running on Mono.
      /// </summary>







|







353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Private Data
      /// <summary>
      /// This lock is used to protect the static <see cref="isMono" /> and
      /// <see cref="isDotNetCore" /> fields.
      /// </summary>
      private static readonly object staticSyncRoot = new object();

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This type is only present when running on Mono.
      /// </summary>
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034








3035






3036


3037
3038
3039
3040
3041
3042
3043
          string fileNameOnly = GetNativeLibraryFileNameOnly();

          if (fileNameOnly == null)
              return false;

          //
          // NOTE: If the native SQLite library exists in the base directory
          //       itself, stop now.
          //
          string fileName = FixUpDllFileName(MaybeCombinePath(baseDirectory,
              fileNameOnly));









          if (!allowBaseDirectoryOnly && File.Exists(fileName))






              return false;



          //
          // NOTE: If the specified processor architecture is null, use the
          //       default.
          //
          if (processorArchitecture == null)
              processorArchitecture = GetProcessorArchitecture();







|




>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
|
>
>







3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
          string fileNameOnly = GetNativeLibraryFileNameOnly();

          if (fileNameOnly == null)
              return false;

          //
          // NOTE: If the native SQLite library exists in the base directory
          //       itself, possibly stop now.
          //
          string fileName = FixUpDllFileName(MaybeCombinePath(baseDirectory,
              fileNameOnly));

          if (File.Exists(fileName))
          {
              //
              // NOTE: If the caller is allowing the base directory itself
              //       to be used, also make sure a processor architecture
              //       was not specified; if either condition is false just
              //       stop now and return failure.
              //
              if (allowBaseDirectoryOnly &&
                  String.IsNullOrEmpty(processorArchitecture))
              {
                  goto baseDirOnly;
              }
              else
              {
                  return false;
              }
          }

          //
          // NOTE: If the specified processor architecture is null, use the
          //       default.
          //
          if (processorArchitecture == null)
              processorArchitecture = GetProcessorArchitecture();
3082
3083
3084
3085
3086
3087
3088


3089
3090
3091
3092
3093
3094
3095

              //
              // NOTE: If the file does not exist, skip trying to load it.
              //
              if (!File.Exists(fileName))
                  return false;
          }



          try
          {
#if !NET_COMPACT_20 && TRACE_PRELOAD
              try
              {
                  //







>
>







3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113

              //
              // NOTE: If the file does not exist, skip trying to load it.
              //
              if (!File.Exists(fileName))
                  return false;
          }

      baseDirOnly:

          try
          {
#if !NET_COMPACT_20 && TRACE_PRELOAD
              try
              {
                  //