X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=userdir_gpg.py;h=59e7400ae2d0d45f39f54d0faf8bd5cbde631003;hb=f4298d3c8cce17256396c5be7d1d3c920ee87938;hp=9f494fb6788245b42e2d175f630bb78a77ccaae1;hpb=5335eb0fbeb3600dfcffe9082b9c4f88ad21333b;p=mirror%2Fuserdir-ldap.git diff --git a/userdir_gpg.py b/userdir_gpg.py index 9f494fb..59e7400 100644 --- a/userdir_gpg.py +++ b/userdir_gpg.py @@ -1,4 +1,5 @@ # Copyright (c) 1999-2001 Jason Gunthorpe +# Copyright (c) 2005 Joey Schulze # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,7 +27,7 @@ # pgp2 encrypting mode. import string, mimetools, multifile, sys, StringIO, os, tempfile, re; -import rfc822, time, fcntl, FCNTL, anydbm +import rfc822, time, fcntl, anydbm # General GPG options GPGPath = "gpg" @@ -424,6 +425,11 @@ def GPGKeySearch(SearchCriteria): Owner = ""; KeyID = ""; Hits = {}; + + dir = os.path.expanduser("~/.gnupg") + if not os.path.isdir(dir): + os.mkdir(dir, 0700) + try: Strm = os.popen(string.join(Args," "),"r"); @@ -479,7 +485,7 @@ def TemplateSubst(Map,Template): class ReplayCache: def __init__(self,Database): self.Lock = open(Database + ".lock","w",0600); - fcntl.flock(self.Lock.fileno(),FCNTL.LOCK_EX); + fcntl.flock(self.Lock.fileno(),fcntl.LOCK_EX); self.DB = anydbm.open(Database,"c",0600); self.CleanCutOff = CleanCutOff; self.AgeCutOff = AgeCutOff;