projects
/
mirror
/
userdir-ldap.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add VoIP fiels to the LDAP shema and teach ud-info and ud-mailgate about it. [zobel]
[mirror/userdir-ldap.git]
/
ud-generate
diff --git
a/ud-generate
b/ud-generate
index
feec2b1
..
b5594fe
100755
(executable)
--- a/
ud-generate
+++ b/
ud-generate
@@
-6,6
+6,7
@@
# Copyright (c) 2003-2004 James Troup <troup@debian.org>
# Copyright (c) 2004-2005,7 Joey Schulze <joey@infodrom.org>
# Copyright (c) 2001-2007 Ryan Murray <rmurray@debian.org>
# Copyright (c) 2003-2004 James Troup <troup@debian.org>
# Copyright (c) 2004-2005,7 Joey Schulze <joey@infodrom.org>
# Copyright (c) 2001-2007 Ryan Murray <rmurray@debian.org>
+# Copyright (c) 2008 Peter Palfrader <peter@palfrader.org>
#
# 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
#
# 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
@@
-21,7
+22,7
@@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-import string, re, time, ldap, getopt, sys, os, pwd, posix, socket, base64, sha
+import string, re, time, ldap, getopt, sys, os, pwd, posix, socket, base64, sha
, shutil
from userdir_ldap import *;
global Allowed;
from userdir_ldap import *;
global Allowed;
@@
-35,6
+36,8
@@
CurrentHost = "";
EmailCheck = re.compile("^([^ <>@]+@[^ ,<>@]+)?$");
BSMTPCheck = re.compile(".*mx 0 (gluck)\.debian\.org\..*",re.DOTALL);
DNSZone = ".debian.net"
EmailCheck = re.compile("^([^ <>@]+@[^ ,<>@]+)?$");
BSMTPCheck = re.compile(".*mx 0 (gluck)\.debian\.org\..*",re.DOTALL);
DNSZone = ".debian.net"
+Keyrings = [ "/org/keyring.debian.org/keyrings/debian-keyring.gpg",
+ "/org/keyring.debian.org/keyrings/debian-keyring.pgp" ]
def Sanitize(Str):
return Str.translate(string.maketrans("\n\r\t","$$$"))
def Sanitize(Str):
return Str.translate(string.maketrans("\n\r\t","$$$"))
@@
-88,7
+91,7
@@
def Done(File,F,Fdb):
os.rename(File + ".tdb.tmp",File+".tdb");
# Generate the password list
os.rename(File + ".tdb.tmp",File+".tdb");
# Generate the password list
-def GenPasswd(l,File,HomePrefix,PwdMarker
,UidShift
):
+def GenPasswd(l,File,HomePrefix,PwdMarker):
F = None;
try:
F = open(File + ".tdb.tmp","w");
F = None;
try:
F = open(File + ".tdb.tmp","w");
@@
-116,7
+119,7
@@
def GenPasswd(l,File,HomePrefix,PwdMarker,UidShift):
Line = Sanitize(Line) + "\n";
F.write("0%u %s" % (I,Line));
F.write(".%s %s" % (GetAttr(x,"uid"),Line));
Line = Sanitize(Line) + "\n";
F.write("0%u %s" % (I,Line));
F.write(".%s %s" % (GetAttr(x,"uid"),Line));
- F.write("=%s %s" % (
(int(GetAttr(x,"uidNumber"))+UidShift
),Line));
+ F.write("=%s %s" % (
GetAttr(x,"uidNumber"
),Line));
I = I + 1;
# Oops, something unspeakable happened.
I = I + 1;
# Oops, something unspeakable happened.
@@
-209,7
+212,7
@@
def GenSSHShadow(l,File):
Done(File,F,None);
# Generate the group list
Done(File,F,None);
# Generate the group list
-def GenGroup(l,File
,UidShift
):
+def GenGroup(l,File):
F = None;
try:
F = open(File + ".tdb.tmp","w");
F = None;
try:
F = open(File + ".tdb.tmp","w");
@@
-242,10
+245,7
@@
def GenGroup(l,File,UidShift):
for x in GroupMap.keys():
if GroupIDMap.has_key(x) == 0:
continue;
for x in GroupMap.keys():
if GroupIDMap.has_key(x) == 0:
continue;
- NewGid = int(GroupIDMap[x]);
- if NewGid >= 500:
- NewGid = NewGid + UidShift
- Line = "%s:x:%u:" % (x,NewGid)
+ Line = "%s:x:%u:" % (x,GroupIDMap[x]);
Comma = '';
for I in GroupMap[x]:
Line = Line + ("%s%s" % (Comma,I));
Comma = '';
for I in GroupMap[x]:
Line = Line + ("%s%s" % (Comma,I));
@@
-253,7
+253,7
@@
def GenGroup(l,File,UidShift):
Line = Sanitize(Line) + "\n";
F.write("0%u %s" % (J,Line));
F.write(".%s %s" % (x,Line));
Line = Sanitize(Line) + "\n";
F.write("0%u %s" % (J,Line));
F.write(".%s %s" % (x,Line));
- F.write("=%u %s" % (
NewGid
,Line));
+ F.write("=%u %s" % (
GroupIDMap[x]
,Line));
J = J + 1;
# Oops, something unspeakable happened.
J = J + 1;
# Oops, something unspeakable happened.
@@
-762,6
+762,10
@@
def GenHosts(l,File):
raise;
Done(File,F,None);
raise;
Done(File,F,None);
+def GenKeyrings(l,OutDir):
+ for k in Keyrings:
+ shutil.copy(k, OutDir)
+
# Connect to the ldap server
l = ldap.open(LDAPServer);
F = open(PassDir+"/pass-"+pwd.getpwuid(os.getuid())[0],"r");
# Connect to the ldap server
l = ldap.open(LDAPServer);
F = open(PassDir+"/pass-"+pwd.getpwuid(os.getuid())[0],"r");
@@
-815,10
+819,11
@@
GenMailBool(l,GlobalDir+"mail-callout","mailCallout");
GenMailList(l,GlobalDir+"mail-rbl","mailRBL");
GenMailList(l,GlobalDir+"mail-rhsbl","mailRHSBL");
GenMailList(l,GlobalDir+"mail-whitelist","mailWhitelist");
GenMailList(l,GlobalDir+"mail-rbl","mailRBL");
GenMailList(l,GlobalDir+"mail-rhsbl","mailRHSBL");
GenMailList(l,GlobalDir+"mail-whitelist","mailWhitelist");
+GenKeyrings(l,GlobalDir);
# Compatibility.
GenForward(l,GlobalDir+"forward-alias");
# Compatibility.
GenForward(l,GlobalDir+"forward-alias");
-
+
while(1):
Line = F.readline();
if Line == "":
while(1):
Line = F.readline();
if Line == "":
@@
-856,14
+861,12
@@
while(1):
DoLink(GlobalDir,OutDir,"disabled-accounts")
sys.stdout.flush();
DoLink(GlobalDir,OutDir,"disabled-accounts")
sys.stdout.flush();
- UidShift = 0
- if ExtraList.has_key("[UIDSHIFT]"): UidShift=1000
if ExtraList.has_key("[NOPASSWD]"):
if ExtraList.has_key("[NOPASSWD]"):
- GenPasswd(l,OutDir+"passwd",Split[1], "*"
, UidShift
);
+ GenPasswd(l,OutDir+"passwd",Split[1], "*");
else:
else:
- GenPasswd(l,OutDir+"passwd",Split[1], "x"
, UidShift
);
+ GenPasswd(l,OutDir+"passwd",Split[1], "x");
sys.stdout.flush();
sys.stdout.flush();
- GenGroup(l,OutDir+"group"
, UidShift
);
+ GenGroup(l,OutDir+"group");
if ExtraList.has_key("[UNTRUSTED]"):
continue;
if not ExtraList.has_key("[NOPASSWD]"):
if ExtraList.has_key("[UNTRUSTED]"):
continue;
if not ExtraList.has_key("[NOPASSWD]"):
@@
-891,3
+894,11
@@
while(1):
if ExtraList.has_key("[PRIVATE]"):
DoLink(GlobalDir,OutDir,"debian-private")
if ExtraList.has_key("[PRIVATE]"):
DoLink(GlobalDir,OutDir,"debian-private")
+
+ if ExtraList.has_key("[KEYRING]"):
+ for k in Keyrings:
+ DoLink(GlobalDir,OutDir,os.path.basename(k))
+ else:
+ for k in Keyrings:
+ try: posix.remove(OutDir+os.path.basename(k));
+ except: pass;