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
OSSL_STORE and absolute devices #3907
Conversation
Note: the tests should fail on Appveyor |
And now, with code to handle paths that start with a device name. Hopefully, Appveyor will be happier this time. (I'll have to try this with a device called "file" somewhere...) |
7c93f99
to
6022a58
Compare
This seems to do it, at least on Windows, so out of WIP it goes |
I've verified it on VMS as well. |
602850f
to
a8e7165
Compare
#endif | ||
} else { | ||
path = uri; | ||
if (stat(path_data[i].path, &st) < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It helps Windows if stat is redefined as _stat. See crypto/rand/randfile.c for an example. This kind of thing allows to remove dependency of the object code from compiler /M flag. I mean with stat redefined as _stat it's up to application which /M flag to use. And without it would occasionally cause link errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good point, will do. Thanks for the reminder
On side note lack of empty lines between functions (and between functions and data) sting the eye. [I was under impression that it, empty lines between functions, was in coding style...] |
to_rel_file_uri really treated all files appropriately, absolute and relative alike, and really just constructs a URI, so gets renamed to to_file_uri to_file_uri, on the other hand, forces the path into an absolute one, so gets renamed to to_abs_file_uri
We haven't tested plain absolute paths without making them URIs...
… URIs To handle paths that contain devices (for example, C:/foo/bar.pem on Windows), try to "open" the URI using the file scheme loader first, and failing that, check if the device is really a scheme we know. The "file" scheme does the same kind of thing to pick out the path part of the URI. An exception to this special treatment is if the URI has an authority part (something that starts with "//" directly after what looks like a scheme). Such URIs will never be treated as plain file paths.
…h 'file:' These cases are performed on Linux only. They check that files with names starting with 'file:' can be processed as well.
If we have a local file with a name starting with 'file:', we don't want to check if the part after 'file:' is absolute. Instead, mark each possibility for absolute check if needed, and perform the absolute check later on, when checking each actual path.
a8e7165
to
127914d
Compare
ping @dot-asm |
path_data[path_data_n].check_absolute = 1; | ||
#ifdef _WIN32 | ||
/* Windows file: URIs with a drive letter start with a / */ | ||
if (p[0] == '/' && p[2] == ':' && p[3] == '/') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to double-check that p[1] is 'a' to 'z'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Done, pushing in a moment
to_rel_file_uri really treated all files appropriately, absolute and relative alike, and really just constructs a URI, so gets renamed to to_file_uri to_file_uri, on the other hand, forces the path into an absolute one, so gets renamed to to_abs_file_uri Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from #3907)
We haven't tested plain absolute paths without making them URIs... Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from #3907)
Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from #3907)
… URIs To handle paths that contain devices (for example, C:/foo/bar.pem on Windows), try to "open" the URI using the file scheme loader first, and failing that, check if the device is really a scheme we know. The "file" scheme does the same kind of thing to pick out the path part of the URI. An exception to this special treatment is if the URI has an authority part (something that starts with "//" directly after what looks like a scheme). Such URIs will never be treated as plain file paths. Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from #3907)
…h 'file:' These cases are performed on Linux only. They check that files with names starting with 'file:' can be processed as well. Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from #3907)
If we have a local file with a name starting with 'file:', we don't want to check if the part after 'file:' is absolute. Instead, mark each possibility for absolute check if needed, and perform the absolute check later on, when checking each actual path. Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from #3907)
… named Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from #3907)
This is related to #3897
This is an attempt to solve the problem when OSSL_STORE is presented with a path that begins with a device name.