rpms/nspluginwrapper/F-10 nspluginwrapper-1.1.2-event.patch, NONE, 1.1 nspluginwrapper-1.1.8-directory.patch, NONE, 1.1 nspluginwrapper-1.1.8-fix-invalid-RPC-after-NPP_Destroy.patch, NONE, 1.1 .cvsignore, 1.7, 1.8 nspluginwrapper.spec, 1.66, 1.67 sources, 1.12, 1.13 nspluginwrapper-0.9.91.5-shutdown.patch, 1.1, NONE nspluginwrapper-1.1.12-event.patch, 1.1, NONE nspluginwrapper-1.1.4-directory.patch, 1.1, NONE nspluginwrapper-1.1.4-fork.patch, 1.1, NONE nspluginwrapper-1.1.4-params.patch, 1.1, NONE nspluginwrapper-1.1.4-runtime-restart.patch, 1.1, NONE
Warren Togami 砥上勇
wtogami at fedoraproject.org
Wed Dec 3 04:20:15 UTC 2008
Author: wtogami
Update of /cvs/pkgs/rpms/nspluginwrapper/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13878
Modified Files:
.cvsignore nspluginwrapper.spec sources
Added Files:
nspluginwrapper-1.1.2-event.patch
nspluginwrapper-1.1.8-directory.patch
nspluginwrapper-1.1.8-fix-invalid-RPC-after-NPP_Destroy.patch
Removed Files:
nspluginwrapper-0.9.91.5-shutdown.patch
nspluginwrapper-1.1.12-event.patch
nspluginwrapper-1.1.4-directory.patch
nspluginwrapper-1.1.4-fork.patch
nspluginwrapper-1.1.4-params.patch
nspluginwrapper-1.1.4-runtime-restart.patch
Log Message:
- fix-invalid-RPC-after-NPP_Destroy fixes a crasher
- Updated to 1.1.8
nspluginwrapper-1.1.2-event.patch:
--- NEW FILE nspluginwrapper-1.1.2-event.patch ---
diff -up nspluginwrapper-1.1.2/src/npw-viewer.c.sleep nspluginwrapper-1.1.2/src/npw-viewer.c
--- nspluginwrapper-1.1.2/src/npw-viewer.c.sleep 2008-10-21 14:03:07.000000000 +0200
+++ nspluginwrapper-1.1.2/src/npw-viewer.c 2008-10-21 14:14:53.000000000 +0200
@@ -3345,8 +3345,7 @@ static GSourceFuncs xt_event_funcs = {
static gboolean xt_event_polling_timer_callback(gpointer user_data)
{
- int i;
- for (i = 0; i < 5; i++) {
+ while(1) {
if ((XtAppPending(x_app_context) & (XtIMAll & ~XtIMXEvent)) == 0)
break;
XtAppProcessEvent(x_app_context, XtIMAll & ~XtIMXEvent);
nspluginwrapper-1.1.8-directory.patch:
--- NEW FILE nspluginwrapper-1.1.8-directory.patch ---
diff -up /dev/null nspluginwrapper-1.1.8/src/npw-dir.c
--- /dev/null 2008-12-01 09:15:08.160001035 +0100
+++ nspluginwrapper-1.1.8/src/npw-dir.c 2008-12-01 16:10:00.000000000 +0100
@@ -0,0 +1,97 @@
+/*
+ * npw-dir.h - Directory management for nspluginwrapper
+ *
+ * by Martin Stransky <stransky at redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "sysdeps.h"
+#include "npw-dir.h"
+
+#include <assert.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+/*
+Expect defined:
+#define NPW_PREFIX (/usr)
+#define NPW_LIB32 (lib)
+#define NPW_LIB64 (lib64)
+#define NPW_DIR (nspluginwrapper)
+*/
+
+char * get_plugin_path(char *p_path, int max_path, const char *p_arch)
+{
+ char *p_arch_lib = NULL;
+
+ if(!strcmp(p_arch, "i386")) {
+ p_arch_lib = NPW_LIB32;
+ }
+ else if(!strcmp(p_arch, "x86_64")) {
+ p_arch_lib = NPW_LIB64;
+ }
+ else {
+ assert(0);
+ }
+ snprintf(p_path,max_path,"%s/%s/%s",NPW_PREFIX,p_arch_lib,NPW_DIR);
+ return(p_path);
+}
+
+char * get_plugin(char *p_path, int max_path, const char *p_arch, const char *p_plugin)
+{
+ char *p_arch_lib = NULL;
+
+ if(!strcmp(p_arch, "i386")) {
+ p_arch_lib = NPW_LIB32;
+ }
+ else if(!strcmp(p_arch, "x86_64")) {
+ p_arch_lib = NPW_LIB64;
+ }
+ else {
+ assert(0);
+ }
+ snprintf(p_path,max_path,"%s/%s/%s/%s",NPW_PREFIX,p_arch_lib,NPW_DIR,p_plugin);
+ return(p_path);
+}
+
+//#define NPW_DEFAULT_PLUGIN_PATH NPW_LIBDIR "/" HOST_ARCH "/" HOST_OS "/" NPW_WRAPPER
+char * get_default_plugin(char *p_path, int max_path)
+{
+ snprintf(p_path,max_path,"%s/%s/%s",LIBDIR,NPW_DIR,NPW_WRAPPER);
+ return(p_path);
+}
+
+//#define NPW_OLD_DEFAULT_PLUGIN_PATH NPW_LIBDIR "/" HOST_ARCH "/" NPW_WRAPPER
+char * get_old_default_plugin(char *p_path, int max_path)
+{
+ return(get_default_plugin(p_path, max_path));
+}
+
+char * get_viewer_path(char *p_path, int max_path, const char *p_arch)
+{
+ return(get_plugin_path(p_path, max_path, p_arch));
+}
+
+char * get_viewer(char *p_path, int max_path, const char *p_arch, const char *p_viewer)
+{
+ return(get_plugin(p_path, max_path, p_arch, p_viewer));
+}
+
+char * get_connection_path(char *p_path, int max_path, const char *p_plugin, int init_count)
+{
+ snprintf(p_path, max_path, "%s/%s/%d-%d", NPW_CONNECTION_PATH, p_plugin, getpid(), init_count);
+ return(p_path);
+}
diff -up /dev/null nspluginwrapper-1.1.8/src/npw-dir.h
--- /dev/null 2008-12-01 09:15:08.160001035 +0100
+++ nspluginwrapper-1.1.8/src/npw-dir.h 2008-12-01 16:10:00.000000000 +0100
@@ -0,0 +1,35 @@
+/*
+ * npw-dir.h - Directory management for nspluginwrapper
+ *
+ * by Martin Stransky <stransky at redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef NPW_DIR_H
+#define NPW_DIR_H
+
+char * get_plugin_path(char *p_path, int max_path, const char *p_arch);
+char * get_plugin(char *p_path, int max_path, const char *p_arch, const char *p_plugin);
+
+char * get_viewer_path(char *p_path, int max_path, const char *p_arch);
+char * get_viewer(char *p_path, int max_path, const char *p_arch, const char *p_viewer);
+
+char * get_default_plugin(char *p_path, int max_path);
+char * get_old_default_plugin(char *p_path, int max_path);
+
+char * get_connection_path(char *p_path, int max_path, const char *p_plugin, int init_count);
+
+#endif
diff -up nspluginwrapper-1.1.8/src/npw-wrapper.c.dir nspluginwrapper-1.1.8/src/npw-wrapper.c
--- nspluginwrapper-1.1.8/src/npw-wrapper.c.dir 2008-12-01 13:37:41.000000000 +0100
+++ nspluginwrapper-1.1.8/src/npw-wrapper.c 2008-12-01 16:10:00.000000000 +0100
@@ -42,6 +42,7 @@
#include <X11/Shell.h>
#include <X11/StringDefs.h>
+#include "npw-dir.h"
#include "utils.h"
#include "npw-common.h"
#include "npw-malloc.h"
@@ -2068,8 +2069,9 @@ invoke_NPP_URLNotify(PluginInstance *plu
error = rpc_method_wait_for_reply(plugin->connection, RPC_TYPE_INVALID);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
npw_perror("NPP_URLNotify() wait for reply", error);
+ }
}
static void
@@ -3254,9 +3256,9 @@ static void plugin_init(int is_NP_Initia
static int init_count = 0;
++init_count;
char viewer_path[PATH_MAX];
- sprintf(viewer_path, "%s/%s/%s/%s", NPW_LIBDIR, NPW_Plugin.target_arch, NPW_Plugin.target_os, NPW_VIEWER);
+ get_viewer(viewer_path,PATH_MAX,NPW_Plugin.target_arch,NPW_VIEWER);
char connection_path[128];
- sprintf(connection_path, "%s/%s/%d-%d", NPW_CONNECTION_PATH, plugin_file_name, getpid(), init_count);
+ get_connection_path(connection_path, 128, plugin_file_name, init_count);
// Cache MIME info and plugin name/description
if (g_plugin.name == NULL && g_plugin.description == NULL && g_plugin.formats == NULL) {
diff -up nspluginwrapper-1.1.8/src/npw-config.c.dir nspluginwrapper-1.1.8/src/npw-config.c
--- nspluginwrapper-1.1.8/src/npw-config.c.dir 2008-12-01 13:37:41.000000000 +0100
+++ nspluginwrapper-1.1.8/src/npw-config.c 2008-12-01 16:10:00.000000000 +0100
@@ -38,11 +38,15 @@
#include <pwd.h>
#include <dirent.h>
+#include <asm/types.h>
+#include "npw-dir.h"
static bool g_auto = false;
static bool g_verbose = false;
static bool g_allow_native = false;
static const char NPW_CONFIG[] = "nspluginwrapper";
+static char *p_plugin_dir = NULL;
+static char *p_plugin_prefix = NULL;
static void error(const char *format, ...)
{
@@ -489,81 +493,29 @@ enum {
EXIT_VIEWER_NATIVE = 20
};
-static int detect_plugin_viewer(const char *filename, NPW_PluginInfo *out_plugin_info)
-{
- static const char *target_arch_table[] = {
- NULL,
- "i386",
- NULL
- };
- const int target_arch_table_size = sizeof(target_arch_table) / sizeof(target_arch_table[0]);
- if (out_plugin_info && out_plugin_info->target_arch[0] != '\0')
- target_arch_table[0] = out_plugin_info->target_arch;
- else
- target_arch_table[0] = NULL;
-
- static const char *target_os_table[] = {
- NULL,
- "linux",
- NULL
- };
- const int target_os_table_size = sizeof(target_os_table) / sizeof(target_os_table[0]);
+static int detect_plugin_viewer_fast(const char *filename, NPW_PluginInfo *out_plugin_info)
+{
+ char viewer_arch_path[PATH_MAX];
+ get_viewer_path(viewer_arch_path,PATH_MAX,out_plugin_info->target_arch);
+ if (access(viewer_arch_path, F_OK) != 0) {
+ return(EXIT_VIEWER_NOT_FOUND);
+ }
+ char viewer_path[PATH_MAX];
+ sprintf(viewer_path, "%s/%s", viewer_arch_path, NPW_VIEWER);
+ if (access(viewer_path, F_OK) != 0)
+ return(EXIT_VIEWER_NOT_FOUND);
+ return(EXIT_VIEWER_OK);
+}
- if (out_plugin_info && out_plugin_info->target_os[0] != '\0')
- target_os_table[0] = out_plugin_info->target_os;
- else
- target_os_table[0] = NULL;
-
- // don't wrap plugins for host OS/ARCH
- if (!g_allow_native
- && out_plugin_info
- && out_plugin_info->target_arch && strcmp(out_plugin_info->target_arch, HOST_ARCH) == 0
- && out_plugin_info->target_os && strcmp(out_plugin_info->target_os, HOST_OS) == 0)
- return EXIT_VIEWER_NATIVE;
-
- for (int i = 0; i < target_arch_table_size; i++) {
- const char *target_arch = target_arch_table[i];
- if (target_arch == NULL)
- continue;
- char viewer_arch_path[PATH_MAX];
- sprintf(viewer_arch_path, "%s/%s", NPW_LIBDIR, target_arch);
- if (access(viewer_arch_path, F_OK) != 0) {
- target_arch_table[i] = NULL; // this target ARCH is not available, skip it for good
- continue;
- }
- for (int j = 0; j < target_os_table_size; j++) {
- const char *target_os = target_os_table[j];
- if (target_os == NULL)
- continue;
- char viewer_path[PATH_MAX];
- sprintf(viewer_path, "%s/%s/%s", viewer_arch_path, target_os, NPW_VIEWER);
- if (access(viewer_path, F_OK) != 0)
- continue;
- int pid = fork();
- if (pid < 0)
- continue;
- else if (pid == 0) {
- execl(viewer_path, NPW_VIEWER, "--test", "--plugin", filename, NULL);
- exit(1);
- }
- else {
- int status;
- while (waitpid(pid, &status, 0) != pid)
- ;
- if (WIFEXITED(status)) {
- status = WEXITSTATUS(status);
- if (status == EXIT_VIEWER_OK && out_plugin_info) {
- strcpy(out_plugin_info->target_arch, target_arch);
- strcpy(out_plugin_info->target_os, target_os);
- }
- return status;
- }
- return EXIT_VIEWER_ERROR;
- }
- }
+static int detect_plugin_viewer(const char *filename, NPW_PluginInfo *out_plugin_info)
+{
+ if(out_plugin_info && out_plugin_info->target_arch) {
+ return(detect_plugin_viewer_fast(filename, out_plugin_info));
+ }
+ else {
+ return(EXIT_VIEWER_NOT_FOUND);
}
- return EXIT_VIEWER_NOT_FOUND;
}
static bool is_plugin_viewer_available(const char *filename, NPW_PluginInfo *out_plugin_info)
@@ -730,7 +682,9 @@ static int do_install_plugin(const char
plugin_base += 1;
char d_plugin_path[PATH_MAX];
- int n = snprintf(d_plugin_path, sizeof(d_plugin_path), "%s/%s.%s", plugin_dir, NPW_WRAPPER_BASE, plugin_base);
+ int n = snprintf(d_plugin_path, sizeof(d_plugin_path),
+ "%s/%s.%s", plugin_dir, p_plugin_prefix ? p_plugin_prefix : NPW_WRAPPER_BASE,
+ plugin_base);
if (n < 0 || n >= sizeof(d_plugin_path))
return 3;
@@ -817,28 +771,32 @@ static int install_plugin(const char *pl
if (g_verbose)
printf("Install plugin %s\n", plugin_path);
- // don't install plugin system-wide if it is only accessible by root
- if (!is_root_only_accessible_plugin(plugin_path)) {
- ret = do_install_plugin(plugin_path, get_system_mozilla_plugin_dir(), plugin_info);
- if (ret == 0)
- return 0;
+ if(p_plugin_dir) {
+ ret = do_install_plugin(plugin_path, p_plugin_dir, plugin_info);
}
+ else {
+ // don't install plugin system-wide if it is only accessible by root
+ if (!is_root_only_accessible_plugin(plugin_path)) {
+ ret = do_install_plugin(plugin_path, get_system_mozilla_plugin_dir(), plugin_info);
+ if (ret == 0)
+ return 0;
+ }
- // don't install plugin in user home dir if already available system-wide
- if (has_system_wide_wrapper_plugin(plugin_path, true)) {
- if (g_verbose)
- printf(" ... already installed system-wide, skipping\n");
- return 0;
+ // don't install plugin in user home dir if already available system-wide
+ if (has_system_wide_wrapper_plugin(plugin_path, true)) {
+ if (g_verbose)
+ printf(" ... already installed system-wide, skipping\n");
+ return 0;
+ }
+
+ const char *user_plugin_dir = get_user_mozilla_plugin_dir();
+ if (access(user_plugin_dir, R_OK | W_OK) < 0 && mkdir_p(user_plugin_dir) < 0)
+ return 1;
+
+ ret = do_install_plugin(plugin_path, user_plugin_dir, plugin_info);
+ if (ret == 0)
+ return 0;
}
-
- const char *user_plugin_dir = get_user_mozilla_plugin_dir();
- if (access(user_plugin_dir, R_OK | W_OK) < 0 && mkdir_p(user_plugin_dir) < 0)
- return 1;
-
- ret = do_install_plugin(plugin_path, user_plugin_dir, plugin_info);
- if (ret == 0)
- return 0;
-
return ret;
}
@@ -981,6 +939,8 @@ static void print_usage(void)
printf(" -h --help print this message\n");
printf(" -v --verbose flag: set verbose mode\n");
printf(" -a --auto flag: set automatic mode for plugins discovery\n");
+ printf(" -d --dir plugin-dir flag: target plugin(s) directory\n");
+ printf(" -p --prefix prefix flag: a prefix of wrapped plugin file\n");
printf(" -n --native flag: allow native plugin(s) to be wrapped\n");
printf(" -l --list list plugins currently installed\n");
printf(" -u --update update plugin(s) currently installed\n");
@@ -1013,6 +973,18 @@ static int process_native(int argc, char
return 0;
}
+static int process_dir(int argc, char *argv[])
+{
+ p_plugin_dir = argv[0];
+ return 0;
+}
+
+static int process_prefix(int argc, char *argv[])
+{
+ p_plugin_prefix = argv[0];
+ return 0;
+}
+
static int process_list(int argvc, char *argv[])
{
const char **plugin_dirs = get_mozilla_plugin_dirs();
@@ -1068,8 +1040,6 @@ static int process_install(int argc, cha
error("%s is not a valid NPAPI plugin", plugin_path);
ret = detect_plugin_viewer(plugin_path, &plugin_info);
if (ret != EXIT_VIEWER_OK) {
- if (ret == EXIT_VIEWER_NATIVE)
- return 0; /* silently ignore exit status */
error("no appropriate viewer found for %s", plugin_path);
}
ret = install_plugin(plugin_path, &plugin_info);
@@ -1104,57 +1074,55 @@ static int process_remove(int argc, char
int main(int argc, char *argv[])
{
- char **args;
- int i, j, n_args;
-
- n_args = argc - 1;
- args = argv + 1;
+ int i, j;
- if (n_args < 1) {
+ if (argc < 2) {
print_usage();
return 1;
}
-
- if (args[0][0] != '-') {
- print_usage();
- return 1;
+
+ if (argv[1][0] != '-') {
+ print_usage();
+ return 1;
}
-
+
static const struct option {
- char short_option;
- const char *long_option;
- int (*process_callback)(int argc, char *argv[]);
- bool terminal;
+ const char *short_option;
+ const char *long_option;
+ int (*process_callback)(int argc, char *argv[]);
+ bool terminal;
+ int extra_args;
}
options[] = {
- { 'h', "help", process_help, 1 },
- { 'v', "verbose", process_verbose, 0 },
- { 'a', "auto", process_auto, 0 },
- { 'n', "native", process_native, 0 },
- { 'l', "list", process_list, 1 },
- { 'u', "update", process_update, 1 },
- { 'i', "install", process_install, 1 },
- { 'r', "remove", process_remove, 1 },
- { 0, NULL, NULL, 1 }
- };
-
- for (i = 0; i < n_args; i++) {
- const char *arg = args[i];
+ { "-h", "--help", process_help, 1, 0 },
+ { "-v", "--verbose", process_verbose, 0, 0 },
+ { "-a", "--auto", process_auto, 0, 0 },
+ { "-d", "--dir", process_dir, 0, 1 },
+ { "-p", "--prefix", process_prefix, 0, 1 },
+ { "-l", "--list", process_list, 1, 0 },
+ { "-u", "--update", process_update, 1, 0 },
+ { "-i", "--install", process_install, 1, 0 },
+ { "-r", "--remove", process_remove, 1, 0 }
+ };
+
+ for (i = 1; i < argc; i++) {
const struct option *opt = NULL;
- for (j = 0; opt == NULL && options[j].process_callback != NULL; j++) {
- if ((arg[0] == '-' && arg[1] == options[j].short_option && arg[2] == '\0') ||
- (arg[0] == '-' && arg[1] == '-' && strcmp(&arg[2], options[j].long_option) == 0))
- opt = &options[j];
- }
- if (opt == NULL) {
- fprintf(stderr, "invalid option %s\n", arg);
- print_usage();
- return 1;
- }
- int ret = opt->process_callback(n_args - i - 1, args + i + 1);
- if (opt->terminal)
- return ret;
+ for (j = 0; j < sizeof(options)/sizeof(options[0]); j++) {
+ if (!strcmp(options[j].short_option,argv[i]) || !strcmp(options[j].long_option,argv[i])) {
+ opt = &options[j];
+ break;
+ }
+ }
+ if (opt == NULL) {
+ fprintf(stderr, "invalid option %s\n", argv[i]);
+ print_usage();
+ return 1;
+ }
+ int ret = opt->process_callback(argc - i - 1, argv + i + 1);
+ if (opt->terminal)
+ return ret;
+ i += opt->extra_args;
}
-
+
return 0;
}
diff -up nspluginwrapper-1.1.8/src/npw-viewer.sh.dir nspluginwrapper-1.1.8/src/npw-viewer.sh
--- nspluginwrapper-1.1.8/src/npw-viewer.sh.dir 2008-12-01 13:37:41.000000000 +0100
+++ nspluginwrapper-1.1.8/src/npw-viewer.sh 2008-12-01 16:10:00.000000000 +0100
@@ -4,7 +4,13 @@
#
OS="`uname -s`"
ARCH="`uname -m`"
-NPW_LIBDIR="%NPW_LIBDIR%"
+NPW_PREFIX="%NPW_PREFIX%"
+NPW_LIB32="%NPW_LIB32%"
+NPW_LIB64="%NPW_LIB64%"
+TARGET_OS="%TARGET_OS%"
+TARGET_ARCH="%TARGET_ARCH%"
+NPW_DIR="%NPW_DIR%"
+GECKO_LIBDIR="%GECKO_LIBDIR%"
if test -z "$TARGET_OS"; then
echo "*** NSPlugin Viewer *** error, TARGET_OS not initialized"
@@ -16,11 +22,6 @@ if test -z "$TARGET_ARCH"; then
exit 1
fi
-NPW_VIEWER_DIR=$NPW_LIBDIR/$TARGET_ARCH/$TARGET_OS
-
-# Set a new LD_LIBRARY_PATH that is TARGET specific
-export LD_LIBRARY_PATH=$NPW_VIEWER_DIR
-
# Note that a clever DBT will work at the function level and XShm
# should be possible with a proper native replacement to emulated code
# XXX: BTW, anything other than "yes" is interpreted as "no"
@@ -58,6 +59,9 @@ if test "$ARCH" != "$TARGET_ARCH"; then
NPW_USE_XSHM=no
fi
;;
+ x86_64)
+ LOADER=""
+ ;;
ppc)
if test "$ARCH" = "ppc64"; then
case "$OS" in
@@ -92,6 +96,25 @@ if test "$NPW_USE_XSHM" != "yes"; then
fi
fi
+# Set NPW_VIEWER_DIR (TARGET specific)
+case $TARGET_ARCH in
+ i386)
+ NPW_VIEWER_DIR=$NPW_PREFIX/$NPW_LIB32/$NPW_DIR
+ ;;
+ x86_64)
+ NPW_VIEWER_DIR=$NPW_PREFIX/$NPW_LIB64/$NPW_DIR
+ ;;
+ ppc)
+ NPW_VIEWER_DIR=$NPW_PREFIX/$NPW_LIB32/$NPW_DIR
+ ;;
+ ppc64)
+ NPW_VIEWER_DIR=$NPW_PREFIX/$NPW_LIB64/$NPW_DIR
+ ;;
+esac
+
+# Set a new LD_LIBRARY_PATH that is TARGET specific
+export LD_LIBRARY_PATH=$NPW_VIEWER_DIR:$GECKO_LIBDIR
+
# Expand PATH for RealPlayer package on NetBSD (realplay)
if test "$OS" = "NetBSD"; then
REALPLAYER_HOME="/usr/pkg/lib/RealPlayer"
diff -up nspluginwrapper-1.1.8/src/sysdeps.h.dir nspluginwrapper-1.1.8/src/sysdeps.h
--- nspluginwrapper-1.1.8/src/sysdeps.h.dir 2008-12-01 13:37:41.000000000 +0100
+++ nspluginwrapper-1.1.8/src/sysdeps.h 2008-12-01 16:10:00.000000000 +0100
@@ -45,8 +45,8 @@
#define NPW_VIEWER NPW_VIEWER_BASE
#define NPW_WRAPPER_BASE "npwrapper"
#define NPW_WRAPPER NPW_WRAPPER_BASE ".so"
-#define NPW_OLD_DEFAULT_PLUGIN_PATH NPW_LIBDIR "/" HOST_ARCH "/" NPW_WRAPPER
-#define NPW_DEFAULT_PLUGIN_PATH NPW_LIBDIR "/" HOST_ARCH "/" HOST_OS "/" NPW_WRAPPER
+#define NPW_OLD_DEFAULT_PLUGIN_PATH LIBDIR "/" NPW_DIR "/" NPW_WRAPPER
+#define NPW_DEFAULT_PLUGIN_PATH LIBDIR "/" NPW_DIR "/" NPW_WRAPPER
#define NPW_PLUGIN_IDENT "NPW:" NPW_VERSION
#define NPW_PLUGIN_IDENT_SIZE 32
typedef struct __attribute__((packed)) {
nspluginwrapper-1.1.8-fix-invalid-RPC-after-NPP_Destroy.patch:
--- NEW FILE nspluginwrapper-1.1.8-fix-invalid-RPC-after-NPP_Destroy.patch ---
2008-12-02 21:49 Gwenole Beauchesne <gb.public at free.fr>
* src/npw-viewer.c, src/npw-wrapper.c: Fix invalid RPC beyond
NPP_Destroy(). This fixes the following scenario:
Browser: NPP_Destroy()
-> rpc_method_invoke()
Viewer: NPN_InvalidateRect()
-> rpc_method_invoke()
-> rpc_dispatch() pending messages
-> handle_NPP_Destroy()
-> PluginInstance is killed
-> send PluginInstance but it was killed...
Now, with the help of reference counting, we can hold the
PluginInstance. Besides, NPP_Destroy() will reset instance_id,
thus RPC won't be sending a "valid" PluginInstance to the other
side, thus reducing the other side call to a no-op. i.e. don't
try to do anything with the browser NPP instance that was killed
previously (the NPP_Destroy() call would have completed by the
time the browser-side needs to handle incoming RPC).
2008-12-02 21:00 Gwenole Beauchesne <gb.public at free.fr>
* src/npw-viewer.c: Preserve PluginInstance objects during
invoke_NPN_*() function calls. This is because
rpc_method_invoke() can handle pending messages, among which an
NPP_Destroy() is possible. Since the latter unref the
PluginInstance, we could arrive in a situation where we are
dereferencing deallocated data.
2008-12-02 20:44 Gwenole Beauchesne <gb.public at free.fr>
* src/npw-common.h, src/npw-viewer.c, src/npw-wrapper.c: Replace
all RPC_TYPE_NPP with RPC_TYPE_NPW_PLUGIN_INSTANCE.
2008-12-02 20:15 Gwenole Beauchesne <gb.public at free.fr>
* src/npw-rpc.c, src/npw-rpc.h: Add RPC_TYPE_NPW_PLUGIN_INSTANCE
to marshal PluginInstance objects.
2008-12-01 23:01 Gwenole Beauchesne <gb.public at free.fr>
* src/npw-viewer.c: Pass PluginInstance to invoke_NP*() functions.
The next step is to replace RPC_TYPE_NPP with
RPC_TYPE_NPW_PLUGIN_INSTANCE.
2008-12-01 21:55 Gwenole Beauchesne <gb.public at free.fr>
* src/npw-viewer.c, src/npw-wrapper.c: Minor cleanups. Make sure
plugin->instance is NULL on exit from NPP_Destroy().
2008-12-01 21:47 Gwenole Beauchesne <gb.public at free.fr>
* src/npw-common.h: Remove extraneous "extern" linkage keyword,
this is default behaviour.
2008-12-01 21:46 Gwenole Beauchesne <gb.public at free.fr>
* src/npw-common.c, src/npw-common.h, src/npw-viewer.c,
src/npw-wrapper.c: Add infrastructure to refcount PlugInstances.
Index: src/npw-common.h
===================================================================
--- src/npw-common.h (révision 775)
+++ src/npw-common.h (révision 783)
@@ -55,17 +55,47 @@
/* PluginInstance */
#define NPW_DECL_PLUGIN_INSTANCE \
- NPP instance; \
- uint32_t instance_id;
+ NPW_PluginInstanceClass *klass; \
+ uint32_t refcount; \
+ NPP instance; \
+ uint32_t instance_id;
-typedef struct _NPW_PluginInstance NPW_PluginInstance;
+typedef struct _NPW_PluginInstance NPW_PluginInstance;
+typedef struct _NPW_PluginInstanceClass NPW_PluginInstanceClass;
+
struct _NPW_PluginInstance
{
NPW_DECL_PLUGIN_INSTANCE;
};
-#define NPW_PLUGIN_INSTANCE(instance) npw_get_plugin_instance (instance)
+typedef void *
+(*NPW_PluginInstanceAllocateFunctionPtr) (void);
+typedef void
+(*NPW_PluginInstanceDeallocateFunctionPtr) (NPW_PluginInstance *plugin);
+
+typedef void
+(*NPW_PluginInstanceFinalizeFunctionPtr) (NPW_PluginInstance *plugin);
+
+struct _NPW_PluginInstanceClass
+{
+ NPW_PluginInstanceAllocateFunctionPtr allocate;
+ NPW_PluginInstanceDeallocateFunctionPtr deallocate;
+ NPW_PluginInstanceFinalizeFunctionPtr finalize;
+};
+
+void *
+npw_plugin_instance_new(NPW_PluginInstanceClass *klass) attribute_hidden;
+
+void *
+npw_plugin_instance_ref(void *ptr) attribute_hidden;
+
+void
+npw_plugin_instance_unref(void *ptr) attribute_hidden;
+
+#define NPW_PLUGIN_INSTANCE(instance) npw_get_plugin_instance (instance)
+#define NPW_PLUGIN_INSTANCE_NPP(plugin) npw_get_plugin_instance_npp (plugin)
+
static inline NPW_PluginInstance *
_npw_get_plugin_instance (NPP instance)
{
@@ -95,6 +125,12 @@
return NULL;
}
+static inline NPP
+npw_get_plugin_instance_npp (NPW_PluginInstance *plugin)
+{
+ return plugin ? plugin->instance : NULL;
+}
+
/* StreamInstance */
#define NPW_DECL_STREAM_INSTANCE \
NPStream *stream; \
@@ -136,7 +172,7 @@
__func__, __FILE__, __LINE__)
/* Initialize NPAPI hooks */
-extern void
+void
NPW_InitializeFuncs (NPNetscapeFuncs *mozilla_funcs,
NPPluginFuncs *plugin_funcs)
attribute_hidden;
@@ -158,19 +194,19 @@
};
/* Create identifier from an integer */
-extern NPW_Identifier
+NPW_Identifier
NPW_CreateIntIdentifier (int32_t value);
/* Create identifier from a string (that is copied) */
-extern NPW_Identifier
+NPW_Identifier
NPW_CreateStringIdentifier (const char *str);
/* Create identifier from a string (that is now owned by the identifier) */
-extern NPW_Identifier
+NPW_Identifier
NPW_CreateStringIdentifierSink (char *str);
/* Destroy identifier */
-extern void
+void
NPW_DestroyIdentifier (NPW_Identifier id);
/* Check whether identifier is an integer */
Index: src/npw-viewer.c
===================================================================
--- src/npw-viewer.c (révision 775)
+++ src/npw-viewer.c (révision 783)
@@ -79,6 +79,9 @@
#define PLUGIN_INSTANCE(instance) \
((PluginInstance *)NPW_PLUGIN_INSTANCE(instance))
+#define PLUGIN_INSTANCE_NPP(plugin) \
+ NPW_PLUGIN_INSTANCE_NPP((NPW_PluginInstance *)(plugin))
+
// Browser side data for an NPStream instance
typedef struct _StreamInstance {
NPW_DECL_STREAM_INSTANCE;
@@ -103,6 +106,25 @@
/* === Helpers === */
/* ====================================================================== */
+// PluginInstance vfuncs
+static void *plugin_instance_allocate(void);
+static void plugin_instance_deallocate(PluginInstance *plugin);
+
+static NPW_PluginInstanceClass PluginInstanceClass = {
+ (NPW_PluginInstanceAllocateFunctionPtr)plugin_instance_allocate,
+ (NPW_PluginInstanceDeallocateFunctionPtr)plugin_instance_deallocate,
+};
+
+static void *plugin_instance_allocate(void)
+{
+ return NPW_MemNew0(PluginInstance, 1);
+}
+
+static void plugin_instance_deallocate(PluginInstance *plugin)
+{
+ NPW_MemFree(plugin);
[...1951 lines suppressed...]
if (plugin == NULL)
return -1;
@@ -2393,7 +2441,7 @@
int error = rpc_method_invoke(plugin->connection,
RPC_METHOD_NPP_PRINT,
- RPC_TYPE_NPP, plugin->instance,
+ RPC_TYPE_NPW_PLUGIN_INSTANCE, plugin,
RPC_TYPE_UINT32, platform_print_id,
RPC_TYPE_NP_PRINT, PrintInfo,
RPC_TYPE_INVALID);
@@ -2425,6 +2473,7 @@
{
if (instance == NULL)
return;
+
PluginInstance *plugin = PLUGIN_INSTANCE(instance);
if (plugin == NULL)
return;
@@ -2445,7 +2494,7 @@
int error = rpc_method_invoke(plugin->connection,
RPC_METHOD_NPP_HANDLE_EVENT,
- RPC_TYPE_NPP, plugin->instance,
+ RPC_TYPE_NPW_PLUGIN_INSTANCE, plugin,
RPC_TYPE_NP_EVENT, event,
RPC_TYPE_INVALID);
Index: src/npw-rpc.c
===================================================================
--- src/npw-rpc.c (révision 775)
+++ src/npw-rpc.c (révision 783)
@@ -90,22 +90,19 @@
/*
- * Process NPP objects
+ * Process NPW_PluginInstance objects
*/
-static int do_send_NPP(rpc_message_t *message, void *p_value)
+static int do_send_NPW_PluginInstance(rpc_message_t *message, void *p_value)
{
+ NPW_PluginInstance *plugin = (NPW_PluginInstance *)p_value;
uint32_t instance_id = 0;
- NPP instance = (NPP)p_value;
- if (instance) {
- NPW_PluginInstance *plugin = NPW_PLUGIN_INSTANCE(instance);
- if (plugin)
- instance_id = plugin->instance_id;
- }
+ if (plugin)
+ instance_id = plugin->instance_id;
return rpc_message_send_uint32(message, instance_id);
}
-static int do_recv_NPP(rpc_message_t *message, void *p_value)
+static int do_recv_NPW_PluginInstance(rpc_message_t *message, void *p_value)
{
int error;
uint32_t instance_id;
@@ -115,9 +112,35 @@
NPW_PluginInstance *plugin = id_lookup(instance_id);
if (instance_id && plugin == NULL)
- npw_printf("ERROR: passing an unknown instance\n");
- if (plugin && plugin->instance == NULL)
- npw_printf("ERROR: passing a NULL instance through plugin instance id\n");
+ npw_printf("ERROR: no valid NPP -> PluginInstance mapping found\n");
+ else if (plugin && plugin->instance == NULL)
+ npw_printf("ERROR: no valid PluginInstance -> NPP mapping found\n");
+ *((NPW_PluginInstance **)p_value) = plugin;
+ return RPC_ERROR_NO_ERROR;
+}
+
+
+/*
+ * Process NPP objects
+ */
+
+static int do_send_NPP(rpc_message_t *message, void *p_value)
+{
+ NPP instance = (NPP)p_value;
+ NPW_PluginInstance *plugin = NULL;
+ if (instance)
+ plugin = NPW_PLUGIN_INSTANCE(instance);
+ return do_send_NPW_PluginInstance(message, plugin);
+}
+
+static int do_recv_NPP(rpc_message_t *message, void *p_value)
+{
+ int error;
+ NPW_PluginInstance *plugin;
+
+ if ((error = do_recv_NPW_PluginInstance(message, &plugin)) < 0)
+ return error;
+
*((NPP *)p_value) = plugin ? plugin->instance : NULL;
return RPC_ERROR_NO_ERROR;
}
@@ -1476,6 +1499,12 @@
do_recv_NPP
},
{
+ RPC_TYPE_NPW_PLUGIN_INSTANCE,
+ sizeof(NPW_PluginInstance *),
+ do_send_NPW_PluginInstance,
+ do_recv_NPW_PluginInstance
+ },
+ {
RPC_TYPE_NP_STREAM,
sizeof(NPStream *),
do_send_NPStream,
Index: src/npw-common.c
===================================================================
--- src/npw-common.c (révision 775)
+++ src/npw-common.c (révision 783)
@@ -25,6 +25,57 @@
#define DEBUG 0
#include "debug.h"
+
+/* ====================================================================== */
+/* === Plugin instances === */
+/* ====================================================================== */
+
+void *
+npw_plugin_instance_new(NPW_PluginInstanceClass *klass)
+{
+ NPW_PluginInstance *plugin;
+ if (klass && klass->allocate)
+ plugin = klass->allocate ();
+ else
+ plugin = NPW_MemNew0 (NPW_PluginInstance, 1);
+ if (plugin)
+ {
+ plugin->klass = klass;
+ plugin->refcount = 1;
+ }
+ return plugin;
+}
+
+void *
+npw_plugin_instance_ref(void *ptr)
+{
+ NPW_PluginInstance *plugin = (NPW_PluginInstance *)ptr;
+ if (plugin)
+ plugin->refcount++;
+ return plugin;
+}
+
+void
+npw_plugin_instance_unref(void *ptr)
+{
+ NPW_PluginInstance *plugin = (NPW_PluginInstance *)ptr;
+ if (plugin == NULL)
+ return;
+ if (--plugin->refcount > 0)
+ return;
+ NPW_PluginInstanceClass *klass = plugin->klass;
+ if (klass && klass->finalize)
+ klass->finalize (plugin);
+ if (klass && klass->deallocate)
+ klass->deallocate (plugin);
+ else
+ NPW_MemFree (plugin);
+}
+
+/* ====================================================================== */
+/* === NPAPI interface === */
+/* ====================================================================== */
+
static NPNetscapeFuncs g_mozilla_funcs;
static NPPluginFuncs g_plugin_funcs;
@@ -38,10 +89,6 @@
MIN (sizeof (g_plugin_funcs), plugin_funcs->size));
}
-/* ====================================================================== */
-/* === NPAPI interface === */
-/* ====================================================================== */
-
void *
NPN_MemAlloc (uint32_t size)
{
Index: src/npw-rpc.h
===================================================================
--- src/npw-rpc.h (révision 775)
+++ src/npw-rpc.h (révision 783)
@@ -115,7 +115,8 @@
RPC_TYPE_NP_IDENTIFIER,
RPC_TYPE_NP_STRING, /* 15 */
RPC_TYPE_NP_VARIANT,
- RPC_TYPE_NP_UTF8
+ RPC_TYPE_NP_UTF8,
+ RPC_TYPE_NPW_PLUGIN_INSTANCE
};
// NPPrintData is used to get the plugin printed tmpfile
Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/nspluginwrapper/F-10/.cvsignore,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- .cvsignore 26 Feb 2008 12:01:02 -0000 1.7
+++ .cvsignore 3 Dec 2008 04:19:43 -0000 1.8
@@ -4,3 +4,5 @@
nspluginwrapper-0.9.91.5.tar.bz2
plugin-config-1.6.tar.gz
plugin-config-1.9.tar.gz
+nspluginwrapper-1.1.4.tar.bz2
+nspluginwrapper-1.1.8.tar.bz2
Index: nspluginwrapper.spec
===================================================================
RCS file: /cvs/pkgs/rpms/nspluginwrapper/F-10/nspluginwrapper.spec,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- nspluginwrapper.spec 12 Nov 2008 20:47:14 -0000 1.66
+++ nspluginwrapper.spec 3 Dec 2008 04:19:44 -0000 1.67
@@ -64,20 +64,17 @@
Summary: A compatibility layer for Netscape 4 plugins
Name: nspluginwrapper
-Version: 1.1.4
-Release: 1%{?dist}
+Version: 1.1.8
+Release: 2%{?dist}
Source0: %{name}-%{version}%{?svndate:-%{svndate}}.tar.bz2
Source1: %{plugin_config_name}.tar.gz
Source2: plugin-config.sh.in
Source3: %{name}.sh.in
Patch1: nspluginwrapper-1.1.4-make.patch
Patch2: nspluginwrapper-1.1.4-configure.patch
-Patch3: nspluginwrapper-1.1.4-directory.patch
-Patch10: nspluginwrapper-1.1.4-runtime-restart.patch
-Patch11: nspluginwrapper-1.1.4-fork.patch
-Patch12: nspluginwrapper-0.9.91.5-shutdown.patch
-Patch13: nspluginwrapper-1.1.12-event.patch
-Patch14: nspluginwrapper-1.1.4-params.patch
+Patch3: nspluginwrapper-1.1.8-directory.patch
+Patch10: nspluginwrapper-1.1.2-event.patch
+Patch11: nspluginwrapper-1.1.8-fix-invalid-RPC-after-NPP_Destroy.patch
Patch100: plugin-config-setuid.patch
Patch101: plugin-config-umask.patch
Patch102: plugin-config-print.patch
@@ -111,11 +108,8 @@
%patch3 -p1 -b .dir
# Package fixes
-%patch10 -p1 -b .restart
-%patch11 -p1 -b .fork
-%patch12 -p1 -b .shutdown
-%patch13 -p1 -b .event
-%patch14 -p1 -b .params
+%patch10 -p1 -b .event
+%patch11 -p0 -b .invalid-RPC
# Plugin-config patches
pushd %plugin_config_name
@@ -240,6 +234,13 @@
%config %{_sysconfdir}/sysconfig/%{name}
%changelog
+* Tue Dec 02 2008 Warren Togami <wtogami at redhat.com> 1.1.8-2
+- fix-invalid-RPC-after-NPP_Destroy fixes a crasher
+
+* Mon Dec 1 2008 Martin Stransky <stransky at redhat.com> 1.1.8-1
+- Updated to 1.1.8
+- Removed already upstreamed patches
+
* Wed Nov 12 2008 Martin Stransky <stransky at redhat.com> 1.1.4-1
- Updated to 1.1.4
- Consolidated build patches
Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/nspluginwrapper/F-10/sources,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- sources 12 Nov 2008 20:47:15 -0000 1.12
+++ sources 3 Dec 2008 04:19:44 -0000 1.13
@@ -1,2 +1,2 @@
0a00e94ba608dfea365851af9deb20dc plugin-config-1.9.tar.gz
-f9a36f0a15f7c9043c3a4c1b74387ba7 nspluginwrapper-1.1.4.tar.bz2
+73ea7ed696cd9d0502ad0522036ee68b nspluginwrapper-1.1.8.tar.bz2
--- nspluginwrapper-0.9.91.5-shutdown.patch DELETED ---
--- nspluginwrapper-1.1.12-event.patch DELETED ---
--- nspluginwrapper-1.1.4-directory.patch DELETED ---
--- nspluginwrapper-1.1.4-fork.patch DELETED ---
--- nspluginwrapper-1.1.4-params.patch DELETED ---
--- nspluginwrapper-1.1.4-runtime-restart.patch DELETED ---
More information about the fedora-extras-commits
mailing list