#42 koji-ssl-admin: use re.sub for pkcs12 filename
Merged 5 years ago by tkopecek. Opened 5 years ago by ktdreyer.
ktdreyer/koji-tools ssl-admin-web-regex  into  master

file modified
+1 -1
@@ -402,7 +402,7 @@ 

  

  

  def bundle_user_browser_cert(crt_path, key_path, ca_crt_path, force):

-     pkcs12_path = key_path.replace('.key', '_browser_cert.p12')

+     pkcs12_path = re.sub(r'\.key$', '_browser_cert.p12', key_path)

      # If this is a user cert, and we have a matching .key file in the same

      # directory, then generate a pkcs12 bundle file with the cert and key.

      write_pkcs12(crt_path, key_path, ca_crt_path, pkcs12_path, force)

Prior to this change, koji-ssl-admin would determine the path for the pkcs12 bundle file by globally searching-and-replacing the string ".key" in the key filename.

This would cause problems if the Koji server hostname or Koji username contained the string ".key".

Use a regular expression to determine the correct filename instead, by only replacing the final occurrences of ".key".

This fix is similar to the change in b0d83f3.

Commit 826b464 fixes this pull-request

Pull-Request has been merged by tkopecek

5 years ago

Pull-Request has been merged by tkopecek

5 years ago
Metadata