-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug in ocrc.c#combinecredentials #472
Conversation
where a null user+pwd generates garbage. This in turn interferes with using .netrc because the garbage user+pwd can (sometimes) override the .netrc. Not entirely sure what is going on because it works as is under e.g. cygwin. In any case it needs fixing.
It occurs to me that the reason it fails only sometimes is that memory allocated |
BTW, this should fix e-support HAW-868287 |
@DennisHeimbigner Neither the version 4.4.1.1, compile from the source release, it's working My gues it's because the libcurl version. I'm using the one bundle with the ubuntu repository and its version is 7.35.0. |
I would be surprised if 7.35 was the problem. I made it work with 7.29.
|
The output from the compilation made from branch
PS: The output from the
|
|
in the working directory The credentials been provided by a For the With respect to providing credentials by |
So, at this point, and with .daprc deleted, what is the state of things? What works and what |
|
|
Credentials have to be provided with the With version 4.4.1.1 encoded creadentials at URI works. In the the compiled branch Note: I haven't tested with credentials that doesn't have special characters which need to be encoded |
Ok, let me see if I can add a fix for using escaped characters in the user+pwd in url. |
@DennisHeimbigner Then the problem is not related with encoding characters. |
generates garbage. This in turn interferes with using .netrc because the garbage user+pwd can will override the .netrc. Note that this may work ok sometimes if the garbage happens to start with a nul character. 2. It turns out that the user:pwd combination needs to support character escaping. One reason is the user may contain an '@' character. The other is that modern password rules make it not unlikely that the password will contain characters that interfere with url parsing. So, the rule I have implemented is that all occurrences of the user:pwd format must escape any dodgy characters. The escape format is URL escaping of the form %XX. This applies both to user:pwd embedded in a URL as well as the use of HTTP.CREDENTIALS.USERPASSWORD in a .dodsrc/.daprc file. The user and password in .netrc must not be escaped. This is now documented in docs/auth.md The fix for #2 actually obviated #1. Now, internally, the user and pwd are stored separately and not in the user:pwd format. They are combined (and escaped) only when needed.
The current commit on
with respect to the RC keys and doc it may be would be useful introduce this improvements:
|
|
Primary change is to cleanup code and remove duplicated code. 1. Unify the rc file reading into libdispatch/drc.c. Eventually extend if we need rc file for netcdf itself as opposed to the dap code. 2. Unify the extraction from the rc file of DAP authorization info. 3. Misc. other small unifications: make temp file, read file. 4. Avoid use of libcurl when reading file:// because there is some kind of problem with the Visual Studio version. Might be related to the winpath problem. In any case, do direct read instead. 5. Add new error code NC_ERCFILE for errors in reading RC file. 6. Complete documentation cleanup as indicated in this comment #472 (comment) 7. Convert some occurrences of #ifdef _WIN32 to #ifdef _MSC_VER
Implemented the remainder of the suggested changes in |
Fix bug in ocrc.c#combinecredentials where a null user+pwd
generates garbage. This in turn interferes with using .netrc
because the garbage user+pwd can will override the
.netrc. Note that this may work ok sometimes
if the garbage happens to start with a nul character.
It turns out that the user:pwd combination needs to support
character escaping. One reason is the user may contain an '@' character.
The other is that modern password rules make it not unlikely that
the password will contain characters that interfere with url parsing.
So, the rule I have implemented is that all occurrences of the user:pwd
format must escape any dodgy characters. The escape format is URL escaping
of the form %XX. This applies both to user:pwd
embedded in a URL as well as the use of HTTP.CREDENTIALS.USERPASSWORD
in a .dodsrc/.daprc file. The user and password in .netrc must not
be escaped. This is now documented in docs/auth.md
The fix for #2 actually obviated #1. Now, internally, the user and pwd
are stored separately and not in the user:pwd format. They are combined
(and escaped) only when needed.