(self, fp, default_netrc, login)
| 155 | self._security_check(fp, default_netrc, self.hosts[entryname][0]) |
| 156 | |
| 157 | def _security_check(self, fp, default_netrc, login): |
| 158 | if _can_security_check() and default_netrc and login != "anonymous": |
| 159 | prop = os.fstat(fp.fileno()) |
| 160 | current_user_id = os.getuid() |
| 161 | if prop.st_uid != current_user_id: |
| 162 | fowner = _getpwuid(prop.st_uid) |
| 163 | user = _getpwuid(current_user_id) |
| 164 | raise NetrcParseError( |
| 165 | (f"~/.netrc file owner ({fowner}, {user}) does not match" |
| 166 | " current user")) |
| 167 | if (prop.st_mode & (stat.S_IRWXG | stat.S_IRWXO)): |
| 168 | raise NetrcParseError( |
| 169 | "~/.netrc access too permissive: access" |
| 170 | " permissions must restrict access to only" |
| 171 | " the owner") |
| 172 | |
| 173 | def authenticators(self, host): |
| 174 | """Return a (user, account, password) tuple for given host.""" |
no test coverage detected