chiark / gitweb /
server/keymgmt.c: Fix warning message to match documentation.
[tripe] / server / keymgmt.c
index 69ea74a5e53e22b39a4f70e7eb34d85c93204585..0ef633c0c0ead18dc79a990a368b5fd10fa8ce9a 100644 (file)
@@ -462,7 +462,7 @@ static int kh_reopen(keyhalf *kh)
 
   if (key_open(kf, kh->kr, KOPEN_READ, keymoan, kh)) {
     a_warn("KEYMGMT", "%s-keyring", kh->kind, "%s", kh->kr,
-          "read-error", "?ERRNO", A_END);
+          "io-error", "?ERRNO", A_END);
     DESTROY(kf);
     return (-1);
   } else {
@@ -727,46 +727,6 @@ static int kh_refresh(keyhalf *kh)
 const char *tag_priv;
 kdata *master;
 
-group *gg;
-mp *kpriv;
-ge *kpub;
-algswitch algs;
-size_t indexsz;
-
-/* --- @update_compat@ --- *
- *
- * Arguments:  @kdata *kd@ = proposed new master key
- *
- * Returns:    Zero on success, nonzero to refuse the replacement.
- *
- * Use:                Updates the exported private key variables for compatibility.
- */
-
-static int update_compat(kdata *kd)
-{
-  if (gg) {
-    if (!group_samep(kd->g, gg)) {
-      a_warn("KEYMGMT", "private-keyring",
-            "%s", kd->kn->kh->kr, "key", "%s", kd->tag,
-            "changed-group", A_END);
-      return (-1);
-    }
-    G_DESTROYGROUP(gg);
-  }
-  gg = kd->g;
-
-  if (kpriv) mp_drop(kpriv);
-  kpriv = MP_COPY(kd->kpriv);
-  if (kpub) G_DESTROY(gg, kpub);
-  kpub = G_CREATE(gg);
-  G_COPY(gg, kpub, kd->kpub);
-
-  algs = kd->algs;
-  indexsz = kd->indexsz;
-
-  return (0);
-}
-
 /* --- @km_init@ --- *
  *
  * Arguments:  @const char *privkr@ = private keyring file
@@ -795,8 +755,6 @@ void km_init(const char *privkr, const char *pubkr, const char *ptag)
 
   tag_priv = ptag;
   if ((master = km_findpriv(ptag)) == 0) exit(EXIT_FAILURE);
-
-  if (update_compat(master)) exit(EXIT_FAILURE);
 }
 
 /* --- @km_reload@ --- *
@@ -816,7 +774,7 @@ int km_reload(void)
   if (kh_refresh(&priv)) {
     changep = 1;
     kd = master->kn->kd;
-    if (kd != master && !update_compat(kd)) {
+    if (kd != master) {
       km_unref(master);
       km_ref(kd);
       master = kd;
@@ -885,38 +843,4 @@ void km_unref(kdata *kd)
   G_DESTROYGROUP(kd->g);
 }
 
-/* --- @km_getpubkey@ --- *
- *
- * Arguments:  @const char *tag@ = public key tag to load
- *             @ge *kpub@ = where to put the public key
- *             @time_t *t_exp@ = where to put the expiry time
- *
- * Returns:    Zero if OK, nonzero if it failed.
- *
- * Use:                Fetches a public key from the keyring.  (Temporary
- *             compatibility hack.)
- */
-
-int km_getpubkey(const char *tag, ge *kpub, time_t *t_exp)
-{
-  kdata *kd;
-  int rc = -1;
-
-  if ((kd = km_findpub(tag)) == 0)
-    goto done_0;
-  if (!km_samealgsp(kd, master)) {
-    a_warn("KEYMGMT", "public-keyring",
-          "%s", kd->kn->kh->kr, "key", "%s", kd->tag,
-          "algorithm-mismatch", A_END);
-    goto done_1;
-  }
-  G_COPY(gg, kpub, kd->kpub);
-  *t_exp = kd->t_exp;
-  rc = 0;
-done_1:
-  km_unref(kd);
-done_0:
-  return (rc);
-}
-
 /*----- That's all, folks -------------------------------------------------*/