projects
/
mirror
/
userdir-ldap.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Speeling correction
[mirror/userdir-ldap.git]
/
userdir_ldap.py
diff --git
a/userdir_ldap.py
b/userdir_ldap.py
index
a8b62fe
..
888158e
100644
(file)
--- a/
userdir_ldap.py
+++ b/
userdir_ldap.py
@@
-32,6
+32,7
@@
LastNamesPre = {"van": None, "le": None, "de": None, "di": None};
# SSH Key splitting. The result is:
# (options,size,modulous,exponent,comment)
SSHAuthSplit = re.compile('^(.* )?(\d+) (\d+) (\d+) ?(.+)$');
# SSH Key splitting. The result is:
# (options,size,modulous,exponent,comment)
SSHAuthSplit = re.compile('^(.* )?(\d+) (\d+) (\d+) ?(.+)$');
+SSHDSAAuthSplit = re.compile('^ssh-dss ([a-zA-Z0-9=/+]+) (.+)$');
#'^([^\d](?:[^ "]+(?:".*")?)*)? ?(\d+) (\d+) (\d+) (.+)$');
AddressSplit = re.compile("(.*).*<([^@]*)@([^>]*)>");
#'^([^\d](?:[^ "]+(?:".*")?)*)? ?(\d+) (\d+) (\d+) (.+)$');
AddressSplit = re.compile("(.*).*<([^@]*)@([^>]*)>");
@@
-213,6
+214,14
@@
def DecDegree(Posn,Anon=0):
return "+" + Str;
return Str;
return "+" + Str;
return Str;
+def FormatSSH2Auth(Str):
+ Match = SSHDSAAuthSplit.match(Str);
+ if Match == None:
+ return "<unknown format>";
+ G = Match.groups();
+
+ return "ssh-dss %s..%s %s"%(G[0][:8],G[0][-8:],G[1]);
+
def FormatSSHAuth(Str):
Match = SSHAuthSplit.match(Str);
if Match == None:
def FormatSSHAuth(Str):
Match = SSHAuthSplit.match(Str);
if Match == None:
@@
-251,6
+260,10
@@
def FormatPGPKey(Str):
# Take an email address and split it into 3 parts, (Name,UID,Domain)
def SplitEmail(Addr):
# Take an email address and split it into 3 parts, (Name,UID,Domain)
def SplitEmail(Addr):
+ # Is not an email address at all
+ if string.find(Addr,'@') == -1:
+ return (Addr,"","");
+
Res1 = rfc822.AddrlistClass(Addr).getaddress();
if len(Res1) != 1:
return ("","",Addr);
Res1 = rfc822.AddrlistClass(Addr).getaddress();
if len(Res1) != 1:
return ("","",Addr);
@@
-290,6
+303,11
@@
def GetUID(l,Name,UnknownMap = {}):
Stat = "unknown map hit for"+str(Name);
return (UnknownMap[Name[2]],[Stat]);
Stat = "unknown map hit for"+str(Name);
return (UnknownMap[Name[2]],[Stat]);
+ # Then the name component (another ie there was no email address to match)
+ if UnknownMap.has_key(Name[0]):
+ Stat = "unknown map hit for"+str(Name);
+ return (UnknownMap[Name[0]],[Stat]);
+
# Search for a possible first/last name hit
try:
Attrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"(&(cn=%s)(sn=%s))"%(cn,sn),["uid"]);
# Search for a possible first/last name hit
try:
Attrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"(&(cn=%s)(sn=%s))"%(cn,sn),["uid"]);