Changeset b42118c
- Timestamp:
- Sep 17, 2012, 2:08:56 AM (13 years ago)
- Branches:
- master, space-access, stable, stage
- Children:
- 49724e4
- Parents:
- ac9b167
- git-author:
- Alex Dehnert <adehnert@…> (09/17/12 02:08:56)
- git-committer:
- Alex Dehnert <adehnert@…> (09/17/12 02:08:56)
- Location:
- asadb
- Files:
-
- 2 edited
-
mit/__init__.py (modified) (3 diffs)
-
util/mailinglist.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
asadb/mit/__init__.py
r08d4fa6 rb42118c 1 1 import os 2 2 import subprocess 3 import tempfile 3 4 import ldap 4 5 import ldap.filter … … 13 14 from django.core.validators import URLValidator, ValidationError 14 15 15 import settings16 from django.conf import settings 16 17 17 18 def zephyr(msg, clas='message', instance='log', rcpt='nobody',): … … 56 57 def pag_check_output(args, **kwargs): 57 58 return pag_check_helper(subprocess.check_output, args, **kwargs) 59 60 def kinit(keytab=None, principal=None, autodelete=True, ): 61 if not keytab: 62 keytab = settings.KRB_KEYTAB 63 if not principal: 64 principal = settings.KRB_PRINCIPAL 65 assert keytab and principal 66 fd = tempfile.NamedTemporaryFile(mode='rb', prefix="krb5cc_djmit_", delete=autodelete, ) 67 env = dict(KRB5CCNAME=fd.name) 68 kinit_cmd = ['kinit', '-k', '-t', keytab, principal, ] 69 subprocess.check_call(kinit_cmd, env=env) 70 return fd 58 71 59 72 class ScriptsRemoteUserMiddleware(RemoteUserMiddleware): -
asadb/util/mailinglist.py
rac9b167 rb42118c 1 1 import subprocess 2 3 import mit 2 4 3 5 … … 15 17 BLANCHE_PATH="/usr/bin/blanche" 16 18 class MoiraList(MailingList): 19 def __init__(self, *args, **kwargs): 20 super(MoiraList, self).__init__(*args, **kwargs) 21 self.ccache = mit.kinit() 22 17 23 def list_members(self, ): 18 24 raise NotImplementedError … … 55 61 # changes, and use -al / -dl with a tempfile as appropriate. 56 62 63 env = dict(KRB5CCNAME=self.ccache.name) 57 64 cmdline = [BLANCHE_PATH, self.name, ] 58 65 … … 72 79 stdout=subprocess.PIPE, 73 80 stderr=subprocess.STDOUT, 81 env=env, 74 82 ) 75 83 stdout, stderr = res.communicate()
Note: See TracChangeset
for help on using the changeset viewer.