From: Andreas Schneider Date: Mon, 22 Jan 2024 13:14:30 +0000 (+0100) Subject: python:gp: Avoid path check for cepces-submit X-Git-Tag: talloc-2.4.2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a9630eff624643fd725219775784e68d967d04c;p=thirdparty%2Fsamba.git python:gp: Avoid path check for cepces-submit find_cepces_submit() uses which(), which returns None if not found. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15559 Signed-off-by: Andreas Schneider Reviewed-by: David Mulder Reviewed-by: Pavel Filipenský --- diff --git a/python/samba/gp/gp_cert_auto_enroll_ext.py b/python/samba/gp/gp_cert_auto_enroll_ext.py index 8ba1960efe5..ddc14ae8e8d 100644 --- a/python/samba/gp/gp_cert_auto_enroll_ext.py +++ b/python/samba/gp/gp_cert_auto_enroll_ext.py @@ -185,7 +185,7 @@ def find_cepces_submit(): def get_supported_templates(server): cepces_submit = find_cepces_submit() - if not cepces_submit or not os.path.exists(cepces_submit): + if not cepces_submit: log.error('Failed to find cepces-submit') return [] @@ -301,7 +301,7 @@ def cert_enroll(ca, ldb, trust_dir, private_dir, auth='Kerberos'): # Setup Certificate Auto Enrollment getcert = which('getcert') cepces_submit = find_cepces_submit() - if getcert is not None and os.path.exists(cepces_submit): + if getcert is not None and cepces_submit is not None: p = Popen([getcert, 'add-ca', '-c', ca['name'], '-e', '%s --server=%s --auth=%s' % (cepces_submit, ca['hostname'], auth)],