diff svr-session.c @ 1654:cc0fc5131c5c

Rename EPKA -> Plugin
author Matt Johnston <matt@ucc.asn.au>
date Wed, 15 May 2019 21:59:45 +0800
parents 76189c9ffea2
children 7c17995bcdfb
line wrap: on
line diff
--- a/svr-session.c	Wed May 15 09:43:57 2019 -0400
+++ b/svr-session.c	Wed May 15 21:59:45 2019 +0800
@@ -89,15 +89,15 @@
 	m_free(svr_ses.childpids);
 	svr_ses.childpidsize = 0;
 
-#if DROPBEAR_EPKA
-        if (svr_ses.epka_plugin_handle != NULL) {
-            if (svr_ses.epka_instance) {
-                svr_ses.epka_instance->delete_plugin(svr_ses.epka_instance);
-                svr_ses.epka_instance = NULL;
+#if DROPBEAR_PLUGIN
+        if (svr_ses.plugin_handle != NULL) {
+            if (svr_ses.plugin_instance) {
+                svr_ses.plugin_instance->delete_plugin(svr_ses.plugin_instance);
+                svr_ses.plugin_instance = NULL;
             }
 
-            dlclose(svr_ses.epka_plugin_handle);
-            svr_ses.epka_plugin_handle = NULL;
+            dlclose(svr_ses.plugin_handle);
+            svr_ses.plugin_handle = NULL;
         }
 #endif
 }
@@ -122,10 +122,10 @@
 	m_free(host);
 	m_free(port);
 
-#if DROPBEAR_EPKA
-        /* Initializes the EPKA Plugin */
-        svr_ses.epka_plugin_handle = NULL;
-        svr_ses.epka_instance = NULL;
+#if DROPBEAR_PLUGIN
+        /* Initializes the PLUGIN Plugin */
+        svr_ses.plugin_handle = NULL;
+        svr_ses.plugin_instance = NULL;
         if (svr_opts.pubkey_plugin) {
 #if DEBUG_TRACE
             const int verbose = debug_trace;
@@ -135,33 +135,33 @@
             PubkeyExtPlugin_newFn  pluginConstructor;
 
             /* RTLD_NOW: fails if not all the symbols are resolved now. Better fail now than at run-time */
-            svr_ses.epka_plugin_handle = dlopen(svr_opts.pubkey_plugin, RTLD_NOW);
-            if (svr_ses.epka_plugin_handle == NULL) {
+            svr_ses.plugin_handle = dlopen(svr_opts.pubkey_plugin, RTLD_NOW);
+            if (svr_ses.plugin_handle == NULL) {
                 dropbear_exit("failed to load external pubkey plugin '%s': %s", svr_opts.pubkey_plugin, dlerror());
             }
-            pluginConstructor = (PubkeyExtPlugin_newFn)dlsym(svr_ses.epka_plugin_handle, DROPBEAR_PUBKEY_PLUGIN_FNNAME_NEW);
+            pluginConstructor = (PubkeyExtPlugin_newFn)dlsym(svr_ses.plugin_handle, DROPBEAR_PUBKEY_PLUGIN_FNNAME_NEW);
             if (!pluginConstructor) {
                 dropbear_exit("plugin constructor method not found in external pubkey plugin");
             }
 
             /* Create an instance of the plugin */
-            svr_ses.epka_instance = pluginConstructor(verbose, svr_opts.pubkey_plugin_options, svr_ses.addrstring);
-            if (svr_ses.epka_instance == NULL) {
+            svr_ses.plugin_instance = pluginConstructor(verbose, svr_opts.pubkey_plugin_options, svr_ses.addrstring);
+            if (svr_ses.plugin_instance == NULL) {
                 dropbear_exit("external plugin initialization failed");
             }
             /* Check if the plugin is compatible */
-            if ( (svr_ses.epka_instance->api_version[0] != DROPBEAR_EPKA_VERSION_MAJOR) ||
-                 (svr_ses.epka_instance->api_version[1] < DROPBEAR_EPKA_VERSION_MINOR) ) {
+            if ( (svr_ses.plugin_instance->api_version[0] != DROPBEAR_PLUGIN_VERSION_MAJOR) ||
+                 (svr_ses.plugin_instance->api_version[1] < DROPBEAR_PLUGIN_VERSION_MINOR) ) {
                 dropbear_exit("plugin version check failed: "
                               "Dropbear=%d.%d, plugin=%d.%d",
-                        DROPBEAR_EPKA_VERSION_MAJOR, DROPBEAR_EPKA_VERSION_MINOR,
-                        svr_ses.epka_instance->api_version[0], svr_ses.epka_instance->api_version[1]);
+                        DROPBEAR_PLUGIN_VERSION_MAJOR, DROPBEAR_PLUGIN_VERSION_MINOR,
+                        svr_ses.plugin_instance->api_version[0], svr_ses.plugin_instance->api_version[1]);
             }
-            if (svr_ses.epka_instance->api_version[1] > DROPBEAR_EPKA_VERSION_MINOR) {
+            if (svr_ses.plugin_instance->api_version[1] > DROPBEAR_PLUGIN_VERSION_MINOR) {
                 dropbear_log(LOG_WARNING, "plugin API newer than dropbear API: "
                               "Dropbear=%d.%d, plugin=%d.%d",
-                        DROPBEAR_EPKA_VERSION_MAJOR, DROPBEAR_EPKA_VERSION_MINOR,
-                        svr_ses.epka_instance->api_version[0], svr_ses.epka_instance->api_version[1]);
+                        DROPBEAR_PLUGIN_VERSION_MAJOR, DROPBEAR_PLUGIN_VERSION_MINOR,
+                        svr_ses.plugin_instance->api_version[0], svr_ses.plugin_instance->api_version[1]);
             }
             dropbear_log(LOG_INFO, "successfully loaded and initialized pubkey plugin '%s'", svr_opts.pubkey_plugin);
         }
@@ -209,11 +209,11 @@
 	char fullmsg[300];
 	int i;
 
-#if DROPBEAR_EPKA
-        if ((ses.epka_session != NULL)) {
-            svr_ses.epka_instance->delete_session(ses.epka_session);
+#if DROPBEAR_PLUGIN
+        if ((ses.plugin_session != NULL)) {
+            svr_ses.plugin_instance->delete_session(ses.plugin_session);
         }
-        ses.epka_session = NULL;
+        ses.plugin_session = NULL;
 #endif
 
 	/* Render the formatted exit message */