cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-1960645 ] OpenSSL RAND_file_name() on Windows when no "C" drive

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Thu, 08 May 2008 18:45:02 -0700

Bugs item #1960645, was opened at 2008-05-08 18:01
Message generated for change (Comment added) made by dfandrich
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1960645&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: https
Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Brian Wilson (brianwski)
Assigned to: Daniel Stenberg (bagder)
Summary: OpenSSL RAND_file_name() on Windows when no "C" drive

Initial Comment:
Using: libCURL 7.17.0

A customer of ours (we link with libCURL) had a Windows XP Professional machine with the situation of not having a "C" boot drive, the machine was configured with "F" as it's boot drive, and "C" is configured as the built-in flash card reader. Blech!

In this case, using libCURL to fetch an HTTPS URL caused an error dialog to appear on the customer's
Windows desktop saying "Windows No Disk".

I chased it down to the call in ssluse.c (line 252):
   RAND_file_name(buf, BUFSIZE);
which is an OpenSSL call. If you make that call on Windows and do not have a "C:" drive, then Windows pops up the dialog saying "Windows No Disk". Every time. 100 percent reproducible.

The work-around I put into our source tree VERY QUICKLY (and probably is not correct) is to replace that single line of "RAND_file_name(buf, BUFSIZE);" with the source code below (this fix lowers the randomness slightly for the case where customers do not have a "C" drive):

#ifdef _WIN32
  // The OpenSSL call to "RAND_file_name()" causes
  // problems if you do not have a "C:\" drive
  //
  {
      char pathToSystemDir[200];
      HRESULT res = SHGetFolderPath(NULL,
          CSIDL_SYSTEM, NULL,
          SHGFP_TYPE_CURRENT, pathToSystemDir);

      if (tolower(pathToSystemDir[0]) == 'c')
      {
          RAND_file_name(buf, BUFSIZE); // OK!
      }
  }
#else
  RAND_file_name(buf, BUFSIZE);
#endif

BTW, libcurl is awesome, thanks for all the great code.

-- Brian Wilson
   brianwonline453_at_codeblaze.com

----------------------------------------------------------------------

>Comment By: Dan Fandrich (dfandrich)
Date: 2008-05-08 18:45

Message:
Logged In: YES
user_id=236775
Originator: NO

This sounds like a configuration problem or OpenSSL bug, not a libcurl
bug. Were there any references to C: drive in the environment at the time,
especially TEMP, TMP, and USERPROFILE?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1960645&group_id=976
Received on 2008-05-09

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET