# -*- mode: python -*-
# Prior copyright probably rmurray, troup, joey, jgg -- weasel 2008
# -*- mode: python -*-
# Prior copyright probably rmurray, troup, joey, jgg -- weasel 2008
# Copyright (c) 2008 Peter Palfrader <peter@palfrader.org>
# Copyright (c) 2008 Joerg Jaspert <joerg@debian.org>
# Copyright (c) 2008 Peter Palfrader <peter@palfrader.org>
# Copyright (c) 2008 Joerg Jaspert <joerg@debian.org>
Attrs.append((ldap.MOD_REPLACE,"latitude",sLat));
Attrs.append((ldap.MOD_REPLACE,"longitude",sLong));
Attrs.append((ldap.MOD_REPLACE,"latitude",sLat));
Attrs.append((ldap.MOD_REPLACE,"longitude",sLong));
- raise Error, "SSH keys must have at least 1024 bits, processing halted, NOTHING MODIFIED AT ALL"
+ raise UDFormatError, "SSH keys must have at least 1024 bits, processing halted, NOTHING MODIFIED AT ALL"
- raise Error, "Submitted SSH Key known to be bad and insecure, processing halted, NOTHING MODIFIED AT ALL"
+ raise UDFormatError, "Submitted SSH Key known to be bad and insecure, processing halted, NOTHING MODIFIED AT ALL"
# Check if the name is already taken
G = re.match('^([-\w+]+)\s',Str)
if G == None:
# Check if the name is already taken
G = re.match('^([-\w+]+)\s',Str)
if G == None:
res = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid="+uid, ['sudoPassword']);
if len(res) != 1:
res = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid="+uid, ['sudoPassword']);
if len(res) != 1:
oldAttrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid="+GetAttr(DnRecord,"uid"));
if ((GetAttr(oldAttrs[0],"userPassword").find("*LK*") != -1)
or GetAttr(oldAttrs[0],"userPassword").startswith("!")):
oldAttrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid="+GetAttr(DnRecord,"uid"));
if ((GetAttr(oldAttrs[0],"userPassword").find("*LK*") != -1)
or GetAttr(oldAttrs[0],"userPassword").startswith("!")):
if Show == 1:
Attrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid="+GetAttr(DnRecord,"uid"));
if len(Attrs) == 0:
if Show == 1:
Attrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid="+GetAttr(DnRecord,"uid"));
if len(Attrs) == 0:
Attrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid="+GetAttr(DnRecord,"uid"));
if (GetAttr(Attrs[0],"userPassword").find("*LK*") != -1) \
or GetAttr(Attrs[0],"userPassword").startswith("!"):
Attrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid="+GetAttr(DnRecord,"uid"));
if (GetAttr(Attrs[0],"userPassword").find("*LK*") != -1) \
or GetAttr(Attrs[0],"userPassword").startswith("!"):
# Modify the password
Rec = [(ldap.MOD_REPLACE,"userPassword","{crypt}"+Pass),
# Modify the password
Rec = [(ldap.MOD_REPLACE,"userPassword","{crypt}"+Pass),
ErrMsg = "Message is not PGP signed:"
if Msg[0].find("-----BEGIN PGP SIGNED MESSAGE-----") == -1 and \
Msg[0].find("-----BEGIN PGP MESSAGE-----") == -1:
ErrMsg = "Message is not PGP signed:"
if Msg[0].find("-----BEGIN PGP SIGNED MESSAGE-----") == -1 and \
Msg[0].find("-----BEGIN PGP MESSAGE-----") == -1:
Reply = HandlePing(Reply,Attrs[0],Res[2]);
elif sys.argv[1] == "chpass":
if PlainText.strip().find("Please change my Debian password") != 0:
Reply = HandlePing(Reply,Attrs[0],Res[2]);
elif sys.argv[1] == "chpass":
if PlainText.strip().find("Please change my Debian password") != 0:
Reply = HandleChPass(Reply,Attrs[0],Res[2]);
elif sys.argv[1] == "change":
Reply = HandleChange(Reply,Attrs[0],Res[2]);
else:
print sys.argv;
Reply = HandleChPass(Reply,Attrs[0],Res[2]);
elif sys.argv[1] == "change":
Reply = HandleChange(Reply,Attrs[0],Res[2]);
else:
print sys.argv;
# Child = os.popen("cat","w");
Child.write(Reply);
if Child.close() != None:
# Child = os.popen("cat","w");
Child.write(Reply);
if Child.close() != None: