r46890 - remove shadow
hawkowl-TA+aISz0psMTMxyoc4vAAJOcrHinNvQL0E9HWUfgJXw@public.gmane.org
| Newsgroups | gmane.comp.python.twisted.commits |
|---|---|
| Message-ID | <[email protected]> |
Author: hawkowl
Date: Thu Mar 3 08:52:16 2016
New Revision: 46890
Modified:
branches/conch-checkers-py3-8225/twisted/conch/checkers.py
branches/conch-checkers-py3-8225/twisted/conch/test/test_checkers.py
Log:
remove shadow
Modified: branches/conch-checkers-py3-8225/twisted/conch/checkers.py
==============================================================================
--- branches/conch-checkers-py3-8225/twisted/conch/checkers.py (original)
+++ branches/conch-checkers-py3-8225/twisted/conch/checkers.py Thu Mar 3 08:52:16 2016
@@ -19,12 +19,6 @@
import spwd
except ImportError:
spwd = None
- try:
- import shadow
- except ImportError:
- shadow = None
-else:
- shadow = None
from zope.interface import providedBy, implementer, Interface
@@ -64,16 +58,14 @@
def _shadowGetByName(username):
"""
- Look up a user in the /etc/shadow database using the spwd or shadow
- modules. If neither module is available, return None.
+ Look up a user in the /etc/shadow database using the spwd module. If it is
+ not available, return C{None}.
@param username: the username of the user to return the shadow database
information for.
"""
if spwd is not None:
f = spwd.getspnam
- elif shadow is not None:
- f = shadow.getspnam
else:
return None
return runAsEffectiveUser(0, 0, f, username)
Modified: branches/conch-checkers-py3-8225/twisted/conch/test/test_checkers.py
==============================================================================
--- branches/conch-checkers-py3-8225/twisted/conch/test/test_checkers.py (original)
+++ branches/conch-checkers-py3-8225/twisted/conch/test/test_checkers.py Thu Mar 3 08:52:16 2016
@@ -140,32 +140,9 @@
def test_shadowGetByNameWithoutSpwd(self):
"""
- L{_shadowGetByName} uses the C{shadow} module to return a tuple of items
- from the UNIX /etc/shadow database if the C{spwd} module is not present
- and the C{shadow} module is.
+ L{_shadowGetByName} returns C{None} if C{spwd} is not present.
"""
- userdb = ShadowDatabase()
- userdb.addUser('bob', 'passphrase', 1, 2, 3, 4, 5, 6, 7)
self.patch(checkers, 'spwd', None)
- self.patch(checkers, 'shadow', userdb)
- self.patch(util, 'os', self.mockos)
-
- self.mockos.euid = 2345
- self.mockos.egid = 1234
-
- self.assertEqual(
- checkers._shadowGetByName('bob'), userdb.getspnam('bob'))
- self.assertEqual(self.mockos.seteuidCalls, [0, 2345])
- self.assertEqual(self.mockos.setegidCalls, [0, 1234])
-
-
- def test_shadowGetByNameWithoutEither(self):
- """
- L{_shadowGetByName} returns C{None} if neither C{spwd} nor C{shadow} is
- present.
- """
- self.patch(checkers, 'spwd', None)
- self.patch(checkers, 'shadow', None)
self.assertIs(checkers._shadowGetByName('bob'), None)
self.assertEqual(self.mockos.seteuidCalls, [])