-
-
Notifications
You must be signed in to change notification settings - Fork 944
Closed
Description
What is the bug you are experiencing?
When user's $HOME directory is not a directory (e.g. is set to something like /dev/null), lib/pq panics when trying to ping a postgresql database over ssl with the error:
stat /dev/null/.postgresql/postgres.crt is not a directory
How can it be reproduced?
HOME=/dev/null && <try to ping a db using ssl>
Or take a look at this
More Details
This line and other similar checks of if _, err := os.Stat(sslcert); os.IsNotExist(err) result in unexpected behaviour when the 'directory' being looked in is not a directory. os.Stat will return ENOTDIR type error instead of NOTEXIST, and in the case of sslClientCertificates this causes a panic instead of returning early (which is what would happen normally if an sslcert wasn't found).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels