X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=blobdiff_plain;f=ud-gpgsigfetch;h=4bca3cc0acec12d16c29e811c010b330086067a1;hp=592b3198fe4da215694ebd97bdc1dfe4a1282a66;hb=HEAD;hpb=a86d975ac15e074f142c75ba5c74596be92e740d diff --git a/ud-gpgsigfetch b/ud-gpgsigfetch index 592b319..4bca3cc 100755 --- a/ud-gpgsigfetch +++ b/ud-gpgsigfetch @@ -1,12 +1,12 @@ #!/usr/bin/env python # -*- mode: python -*- -import string, re, time, ldap, getopt, sys, pwd, posix; +import re, time, ldap, getopt, sys, pwd, os; from userdir_gpg import *; Output = "extrakeys.gpg"; # Process options -AdminUser = pwd.getpwuid(posix.getuid())[0]; +AdminUser = pwd.getpwuid(os.getuid())[0]; (options, arguments) = getopt.getopt(sys.argv[1:], "o:") for (switch, val) in options: if (switch == '-o'): @@ -20,14 +20,14 @@ if len(arguments) == 0: Args = [GPGPath] + GPGBasicOptions; for x in arguments: Args.append("--keyring"); - if string.find(x,"/") == -1: + if x.find("/") == -1: Args.append("./"+x); else: Args.append(x); Args.append("--fast-list-mode"); Args.append("--list-sigs"); Args = Args + GPGSearchOptions + [" 2> /dev/null"] -Keys = os.popen(string.join(Args," "),"r"); +Keys = os.popen(" ".join(Args),"r"); # Loop over the GPG key file HaveKeys = {}; @@ -38,7 +38,7 @@ while(1): if Line == "": break; - Split = string.split(Line,":"); + Split = Line.split(":"); if len(Split) >= 8 and Split[0] == "pub": HaveKeys[Split[4]] = ""; continue; @@ -52,13 +52,13 @@ Keys.close(); Args = [GPGPath] + GPGBasicOptions; for x in [Output]: Args.append("--keyring"); - if string.find(x,"/") == -1: + if x.find("/") == -1: Args.append("./"+x); else: Args.append(x); OldArgs = Args; Args = Args + GPGSearchOptions + [" 2> /dev/null"] -Keys = os.popen(string.join(Args," "),"r"); +Keys = os.popen(" ".join(Args),"r"); print "Reading keys from output ring"; while(1): @@ -66,7 +66,7 @@ while(1): if Line == "": break; - Split = string.split(Line,":"); + Split = Line.split(":"); if len(Split) >= 8 and Split[0] == "pub": HaveKeys[Split[4]] = ""; continue; @@ -87,8 +87,8 @@ while (I > 0): OldI = I; I = I - 20; if I < 0: I = 0; - print string.join(Args+KeysToFetch[I:OldI]," ") - Fetcher = os.popen(string.join(Args+KeysToFetch[I:OldI]," "),"r"); + print " ".join(Args+KeysToFetch[I:OldI]) + Fetcher = os.popen(" ".join(Args+KeysToFetch[I:OldI]),"r"); while(1): Line = Fetcher.readline(); if Line == "":