return (changep);
}
+/* --- @kh_clear@ --- *
+ *
+ * Arguments: @keyhalf *kh@ = pointer to keyhalf structure
+ *
+ * Returns: ---
+ *
+ * Use: Clears out the keyhalf's keyring and flushes the cache.
+ */
+
+static void kh_clear(keyhalf *kh)
+{
+ sym_iter i;
+ knode *kn;
+
+ if (!kh->kf) return;
+ for (sym_mkiter(&i, &kh->tab); (kn = sym_next(&i)) != 0; )
+ if (kn->kd) km_unref(kn->kd);
+ sym_destroy(&kh->tab);
+ key_close(kh->kf);
+ kh->kf = 0;
+}
+
/*----- Main code ---------------------------------------------------------*/
const char *tag_priv;
return (changep);
}
+/* --- @km_clear@ --- *
+ *
+ * Arguments: ---
+ *
+ * Returns: ---
+ *
+ * Use: Forget the currently loaded keyrings. The @master@ key will
+ * be cleared, but other keys already loaded will continue to
+ * exist until their reference count drops to zero. Call
+ * @km_init@ to make everything work again.
+ */
+
+void km_clear(void)
+{
+ kh_clear(&priv);
+ kh_clear(&pub);
+ if (master) { km_unref(master); master = 0; }
+}
+
/* --- @km_findpub@, @km_findpriv@ --- *
*
* Arguments: @const char *tag@ = key tag to load
extern int km_reload(void);
+/* --- @km_clear@ --- *
+ *
+ * Arguments: ---
+ *
+ * Returns: ---
+ *
+ * Use: Forget the currently loaded keyrings. The @master@ key will
+ * be cleared, but other keys already loaded will continue to
+ * exist until their reference count drops to zero. Call
+ * @km_init@ to make everything work again.
+ */
+
+extern void km_clear(void);
+
/* --- @km_findpub@, @km_findpriv@ --- *
*
* Arguments: @const char *tag@ = key tag to load