diff --git a/ssl/panel/admin/ssl_view.php b/ssl/panel/admin/ssl_view.php index 3e19be60..35b76716 100644 --- a/ssl/panel/admin/ssl_view.php +++ b/ssl/panel/admin/ssl_view.php @@ -107,8 +107,6 @@ if ($cert["status"] == $ssl::STATUS_PENDING) { -
- "/>

diff --git a/ssl/panel/class/m_ssl.php b/ssl/panel/class/m_ssl.php index d2ed2712..74efc1b8 100644 --- a/ssl/panel/class/m_ssl.php +++ b/ssl/panel/class/m_ssl.php @@ -545,21 +545,27 @@ class m_ssl { $uid = intval($uid); // 1st search for a valid certificate in my account or shared by the admin: // the ORDER BY make it so that we try VALID then EXPIRED one (sad) - $wildcard = "*" . substr($fqdn, strpos($fqdn, ".") + 1); + $wildcard = "*." . substr($fqdn, strpos($fqdn, ".") + 1); $db->query("SELECT * FROM certificates WHERE (status=".self::STATUS_OK." OR status=".self::STATUS_EXPIRED.") " . "AND (uid=" . $uid . " OR shared=1) " . "AND (fqdn='" . $fqdn . "' OR fqdn='" . $wildcard . "' OR altnames LIKE '%" . $fqdn . "%') " . "ORDER BY (validstart<=NOW() AND validend>=NOW()) DESC, validstart DESC "); while ($db->next_record()) { + // name if ($db->Record["fqdn"] == $fqdn) { return $db->Record; } + // or alternative names $altnames = explode("\n", $db->Record["altnames"]); foreach ($altnames as $altname) { if (trim($altname) == $fqdn) { return $db->Record; } } + // or wildcard + if ($db->Record["fqdn"] == $wildcard) { + return $db->Record; + } } // not found, we generate a one-time self-signed certificate for this host. $crt = $this->selfSigned($fqdn);