本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
428B

  1. // +build !windows
  2. package pq
  3. import "os"
  4. // sslKeyPermissions checks the permissions on user-supplied ssl key files.
  5. // The key file should have very little access.
  6. //
  7. // libpq does not check key file permissions on Windows.
  8. func sslKeyPermissions(sslkey string) error {
  9. info, err := os.Stat(sslkey)
  10. if err != nil {
  11. return err
  12. }
  13. if info.Mode().Perm()&0077 != 0 {
  14. return ErrSSLKeyHasWorldPermissions
  15. }
  16. return nil
  17. }
上海开阖软件有限公司 沪ICP备12045867号-1