Check in some work on the NPAPI; probably abandoned, but why lose the work if we...
authorMark Donnelly <mark@painless-security.com>
Sun, 22 Dec 2013 17:56:51 +0000 (12:56 -0500)
committerMark Donnelly <mark@painless-security.com>
Sun, 22 Dec 2013 17:56:51 +0000 (12:56 -0500)
dependencies.txt [new file with mode: 0644]
npapi/CMakeLists.txt
npapi/npapi.c

diff --git a/dependencies.txt b/dependencies.txt
new file mode 100644 (file)
index 0000000..fe33252
--- /dev/null
@@ -0,0 +1,3 @@
+Ubuntu dependencies:
+firefox-dev
+libcunit1
index 7eaa6af..b7a3391 100644 (file)
@@ -1,10 +1,10 @@
 cmake_minimum_required (VERSION 2.8)
 
-project (WebShot)
+project (GSSWeb)
 
 #include_directories ("${PROJECT_SOURCE_DIR}/Win")
 #add_subdirectory (Win) 
 
 # add the library
-add_library (WebShot SHARED js_gss_api.c npapi.c)
-#target_link_libraries (WebShot Win)
+add_library (GSSWeb SHARED npapiplugin.cpp js_gss_api.c npapi.c)
+#target_link_libraries (GSSWeb Win)
index f6840e1..165d1d1 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <string.h>
+#include <stddef.h>
 #include <firefox/npapi.h>
 #include <firefox/nptypes.h>
 #include <firefox/npfunctions.h>
@@ -7,8 +8,27 @@
 /*
  * Loading and unloading the library 
  */
-NPError NP_Initialize(NPNetscapeFuncs *aNPNFuncs, NPPluginFuncs *aNPPFuncs)
+NPError NP_Initialize(NPNetscapeFuncs *aNPNFuncs, NPPluginFuncs *pFuncs)
 {
+  
+  /*
+   * Setup - Ensure a sane environment
+   */  
+  if( pFuncs == NULL || 
+      pFuncs->size < sizeof(NPNetscapeFuncs) )
+    return NPERR_INVALID_FUNCTABLE_ERROR;
+
+  if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR)
+    return NPERR_INCOMPATIBLE_VERSION_ERROR;
+
+  /*
+   * Main body:
+   *   Tell the browser about the API functions we implement
+   */
+  pFuncs->newp = NPP_New;
+  pFuncs->destroy = NPP_Destroy;
+  pFuncs->getvalue = NPP_GetValue;
+
   return NPERR_NO_ERROR;
 }
 
@@ -38,7 +58,7 @@ NPError NPP_Destroy(NPP instance, NPSavedData **save)
 /*
  * Register the plugin for MIME type, and name, etc.
  */
-#define MIME_TYPES_DESCRIPTION "application/web-shot:wsht:Web plugin for the Moonshot libraries"
+#define MIME_TYPES_DESCRIPTION "application/gss-web:gssw:Web plugin for the Moonshot GSS-EAP libraries"
 const char* NP_GetMIMEDescription(void)
 {
   return(MIME_TYPES_DESCRIPTION);
@@ -48,6 +68,8 @@ NPError NP_GetValue(void *instance,
                     NPPVariable variable, 
                     void *value)
 {
+  // fprintf(stderr, "Called NP_GetValue with variable: %i\n", variable);
+  
   switch(variable)
   {
   case NPPVpluginNameString:
@@ -62,3 +84,18 @@ NPError NP_GetValue(void *instance,
   
   return NPERR_NO_ERROR;
 }
+
+NPError NPP_GetValue(NPP instance,
+                    NPPVariable variable,
+                    void *value)
+{
+  switch(variable)
+  {
+    case NPPVpluginScriptableNPObject:
+      fprintf(stderr, "Received the scriptable object call!\n");
+      //value = NPN_CreateObject(instance, )
+      break;
+  }
+  fprintf(stderr, "Called NPP_GetValue with %i.\n", variable);
+  return NPERR_NO_ERROR;
+}