Branch: Tag:

2020-04-27

2020-04-27 13:26:42 by Henrik Grubbström (Grubba) <grubba@grubba.org>

CertDB: Added get_keypairs_by_name().

Needed for [WS-580].

650:       return res;   } +  + array(int) get_keypairs_by_name(string name) + { +  Sql.Sql db = DBManager.cached_get("roxen"); +  +  array(int) res = +  db->typed_query("SELECT cert_keypairs.id AS id " +  " FROM cert_keypairs, certs " +  " WHERE name = %s " +  " AND cert_id = certs.id " +  " AND pem_id IS NOT NULL " +  " ORDER BY expires ASC", name)->id; +  if (!sizeof(res)) { +  res = +  db->typed_query("SELECT cert_keypairs.id AS id " +  " FROM cert_keypairs, certs " +  " WHERE name = %s " +  " AND cert_id = certs.id " +  " ORDER BY expires DESC " +  " LIMIT 1", name)->id; +  } +  return res; + }