[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-901-gaa6dc21

Jelmer Vernooij jelmer at samba.org
Mon Sep 21 08:16:12 MDT 2009


Hi Matthias,

Matthias Dieter Wallnöfer wrote:
> +try:
> +	pwd_props = int(res[0]["pwdProperties"][0])
> +	pwd_hist_len = int(res[0]["pwdHistoryLength"][0])
> +	min_pwd_len = int(res[0]["minPwdLength"][0])
> +	min_pwd_age = int(res[0]["minPwdAge"][0])
> +	max_pwd_age = int(res[0]["maxPwdAge"][0])
> +except:
>   
^^^ Please don't use "catch-all" exception handling but rather
explicitly catch the exception you want to handle (ValueError?).
Catch-all exception handling makes it very easy to miss bugs that would
otherwise cause an exception.

> +	if args[0] == "show":
> +		print "ERROR: Password informations missing in your AD domain object!"
> +		print "So no settings can be displayed!"
> +		sys.exit(1)
> +	else:
> +		if pwd_props is None:
> +			pwd_props = 0
> +			print "WARNING: Assuming previous password properties 0 (used for password complexity setting)"
> +

Cheers,

Jelmer


More information about the samba-technical mailing list