X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=blobdiff_plain;f=ud-useradd;h=d1c6b79a2d34e4db1459c1234508699907d3b719;hp=dae191413d9a3d9223050b21141df9cbc74ce33a;hb=2525bf73603cb6487cfcea096e2dc347ad360394;hpb=10ed90c0bd35fb4538ef4e1b28fce41052aa124f diff --git a/ud-useradd b/ud-useradd index dae1914..d1c6b79 100755 --- a/ud-useradd +++ b/ud-useradd @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- mode: python -*- -import string, re, time, ldap, getopt, sys, posix, pwd; +import string, re, time, ldap, getopt, sys, os, pwd; from userdir_ldap import *; from userdir_gpg import *; @@ -176,13 +176,13 @@ if Res != "yes": # Initialize the substitution Map Subst = {} Subst["__REALNAME__"] = FullName; -Subst["__WHOAMI__"] = pwd.getpwuid(posix.getuid())[0]; +Subst["__WHOAMI__"] = pwd.getpwuid(os.getuid())[0]; Subst["__DATE__"] = time.strftime("%a, %d %b %Y %H:%M:%S +0000",time.gmtime(time.time())); Subst["__LOGIN__"] = account; Subst["__PRIVATE__"] = privsub; Subst["__EMAIL__"] = email; Subst["__PASSWORD__"] = CryptedPass; -Subst["__LISTPASS__"] = string.strip(open(pwd.getpwuid(posix.getuid())[5]+"/.debian-lists_passwd","r").read()); +Subst["__LISTPASS__"] = string.strip(open(pwd.getpwuid(os.getuid())[5]+"/.debian-lists_passwd","r").read()); # Generate the LDAP request Rec = [(ldap.MOD_REPLACE,"uid",account), @@ -236,8 +236,8 @@ if privsub != " ": # Send the Welcome message print "Sending Welcome Email" Reply = TemplateSubst(Subst,open("templates/welcome-message-"+gidnumber,"r").read()); -Child = posix.popen("/usr/sbin/sendmail -t","w"); -#Child = posix.popen("cat","w"); +Child = os.popen("/usr/sbin/sendmail -t","w"); +#Child = os.popen("cat","w"); Child.write(Reply); if Child.close() != None: raise Error, "Sendmail gave a non-zero return code";