From: Mark Hymers Date: Thu, 10 Jan 2008 13:44:07 +0000 (+0000) Subject: Don't convert strings to integers, just check that they could be converted. X-Git-Tag: userdir-ldap-0.3.16~5^2~2 X-Git-Url: https://wiki.adam-barratt.org.uk/gitweb/?a=commitdiff_plain;h=5aa344463ac8ad92dc9109e2a17cc7ce894f0ba4;p=mirror%2Fuserdir-ldap.git Don't convert strings to integers, just check that they could be converted. Noticed by Peter (again) --- diff --git a/ud-userimport b/ud-userimport index 2d2a958..f2e0ba1 100755 --- a/ud-userimport +++ b/ud-userimport @@ -83,8 +83,10 @@ def DoPasswd(l,Passwd): Split = re.split("[:\n]",Line); (Split[4],cn,mn,sn) = ParseGecos(Split[4]); - Split[2] = int(Split[2]) - Split[3] = int(Split[3]) + # This just tests whether these are integers and throws an + # exception if not + int(Split[2]) + int(Split[3]) Rec = [("uid",Split[0]), ("uidNumber",Split[2]), ("gidNumber",Split[3]),