Skip to content

Commit

Permalink
Merge effectively-pointless-6405
Browse files Browse the repository at this point in the history
Author: exarkun
Reviewer: tom.prince
Fixes: twisted#6405

Remove some unnecessary code from the implementation of
`SSHPublicKeyDatabase.checkKey`.


git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/trunk@37949 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb
  • Loading branch information
exarkun committed Apr 5, 2013
1 parent 832ec8e commit a4bb809
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
3 changes: 1 addition & 2 deletions twisted/conch/checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Provide L{ICredentialsChecker} implementations to be used in Conch protocols.
"""

import os, base64, binascii, errno
import base64, binascii, errno
try:
import pwd
except ImportError:
Expand Down Expand Up @@ -199,7 +199,6 @@ def checkKey(self, credentials):
Retrieve files containing authorized keys and check against user
credentials.
"""
uid, gid = os.geteuid(), os.getegid()
ouid, ogid = self._userdb.getpwnam(credentials.username)[2:4]
for filepath in self.getAuthorizedKeysFiles(credentials):
if not filepath.exists():
Expand Down
6 changes: 0 additions & 6 deletions twisted/conch/test/test_checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ def test_shadowGetByName(self):

self.mockos.euid = 2345
self.mockos.egid = 1234
self.patch(checkers, 'os', self.mockos)
self.patch(util, 'os', self.mockos)

self.assertEquals(
Expand All @@ -147,7 +146,6 @@ def test_shadowGetByNameWithoutSpwd(self):
userdb.addUser('bob', 'passphrase', 1, 2, 3, 4, 5, 6, 7)
self.patch(checkers, 'spwd', None)
self.patch(checkers, 'shadow', userdb)
self.patch(checkers, 'os', self.mockos)
self.patch(util, 'os', self.mockos)

self.mockos.euid = 2345
Expand All @@ -166,7 +164,6 @@ def test_shadowGetByNameWithoutEither(self):
"""
self.patch(checkers, 'spwd', None)
self.patch(checkers, 'shadow', None)
self.patch(checkers, 'os', self.mockos)

self.assertIdentical(checkers._shadowGetByName('bob'), None)
self.assertEquals(self.mockos.seteuidCalls, [])
Expand All @@ -189,7 +186,6 @@ def setUp(self):
self.mockos = MockOS()
self.mockos.path = FilePath(self.mktemp())
self.mockos.path.makedirs()
self.patch(checkers, 'os', self.mockos)
self.patch(util, 'os', self.mockos)
self.sshDir = self.mockos.path.child('.ssh')
self.sshDir.makedirs()
Expand Down Expand Up @@ -250,7 +246,6 @@ def seteuid(euid):
self.mockos.euid = 2345
self.mockos.egid = 1234
self.patch(self.mockos, "seteuid", seteuid)
self.patch(checkers, 'os', self.mockos)
self.patch(util, 'os', self.mockos)
user = UsernamePassword("user", "password")
user.blob = "foobar"
Expand Down Expand Up @@ -478,7 +473,6 @@ def crypted(username, password):
self.patch(checkers, 'spwd', spwd)

mockos = MockOS()
self.patch(checkers, 'os', mockos)
self.patch(util, 'os', mockos)

mockos.euid = 2345
Expand Down
Empty file.

0 comments on commit a4bb809

Please sign in to comment.