Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: third_party/twisted_8_1/twisted/cred/pamauth.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/twisted_8_1/twisted/cred/error.py ('k') | third_party/twisted_8_1/twisted/cred/portal.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/twisted_8_1/twisted/cred/pamauth.py
diff --git a/third_party/twisted_8_1/twisted/cred/pamauth.py b/third_party/twisted_8_1/twisted/cred/pamauth.py
deleted file mode 100644
index 1537a5fa46d0fd76bd5d3a61b93802d0f7dd5c21..0000000000000000000000000000000000000000
--- a/third_party/twisted_8_1/twisted/cred/pamauth.py
+++ /dev/null
@@ -1,79 +0,0 @@
-# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
-# See LICENSE for details.
-
-"""
-Support for asynchronously authenticating using PAM.
-"""
-
-
-import PAM
-
-import getpass, threading, os
-
-from twisted.internet import threads, defer
-
-def pamAuthenticateThread(service, user, conv):
- def _conv(items):
- from twisted.internet import reactor
- try:
- d = conv(items)
- except:
- import traceback
- traceback.print_exc()
- return
- ev = threading.Event()
- def cb(r):
- ev.r = (1, r)
- ev.set()
- def eb(e):
- ev.r = (0, e)
- ev.set()
- reactor.callFromThread(d.addCallbacks, cb, eb)
- ev.wait()
- done = ev.r
- if done[0]:
- return done[1]
- else:
- raise done[1].type, done[1].value
-
- return callIntoPAM(service, user, _conv)
-
-def callIntoPAM(service, user, conv):
- """A testing hook.
- """
- pam = PAM.pam()
- pam.start(service)
- pam.set_item(PAM.PAM_USER, user)
- pam.set_item(PAM.PAM_CONV, conv)
- gid = os.getegid()
- uid = os.geteuid()
- os.setegid(0)
- os.seteuid(0)
- try:
- pam.authenticate() # these will raise
- pam.acct_mgmt()
- return 1
- finally:
- os.setegid(gid)
- os.seteuid(uid)
-
-def defConv(items):
- resp = []
- for i in range(len(items)):
- message, kind = items[i]
- if kind == 1: # password
- p = getpass.getpass(message)
- resp.append((p, 0))
- elif kind == 2: # text
- p = raw_input(message)
- resp.append((p, 0))
- elif kind in (3,4):
- print message
- resp.append(("", 0))
- else:
- return defer.fail('foo')
- d = defer.succeed(resp)
- return d
-
-def pamAuthenticate(service, user, conv):
- return threads.deferToThread(pamAuthenticateThread, service, user, conv)
« no previous file with comments | « third_party/twisted_8_1/twisted/cred/error.py ('k') | third_party/twisted_8_1/twisted/cred/portal.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698