python:gp: Avoid path check for cepces-submit
authorAndreas Schneider <asn@samba.org>
Mon, 22 Jan 2024 13:14:30 +0000 (14:14 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 29 Jan 2024 09:32:46 +0000 (09:32 +0000)
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 <asn@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
python/samba/gp/gp_cert_auto_enroll_ext.py

index 8ba1960efe5d568254d4d03046e02ced27ceb07f..ddc14ae8e8d748777287f9897b58e82ae01a4422 100644 (file)
@@ -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)],