rpms/nspluginwrapper/F-10 nspluginwrapper-1.1.4-configure.patch, NONE, 1.1 nspluginwrapper-1.1.4-directory.patch, NONE, 1.1 nspluginwrapper-1.1.4-fork.patch, NONE, 1.1 nspluginwrapper-1.1.4-make.patch, NONE, 1.1 nspluginwrapper-1.1.4-params.patch, NONE, 1.1 nspluginwrapper-1.1.4-runtime-restart.patch, NONE, 1.1 nspluginwrapper.spec, 1.65, 1.66 sources, 1.11, 1.12 nspluginwrapper-1.1.0-fork.patch, 1.2, NONE nspluginwrapper-1.1.0-runtime-restart.patch, 1.2, NONE nspluginwrapper-1.1.2-build.patch, 1.1, NONE
Martin Stransky
stransky at fedoraproject.org
Wed Nov 12 20:47:17 UTC 2008
- Previous message: rpms/barry/F-8 barry.desktop, NONE, 1.1 barry.spec, NONE, 1.1 import.log, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
- Next message: rpms/kernel/F-9 linux-2.6-pci-fix-pciehp.patch, NONE, 1.1 kernel.spec, 1.848, 1.849
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: stransky
Update of /cvs/pkgs/rpms/nspluginwrapper/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv22698
Modified Files:
nspluginwrapper.spec sources
Added Files:
nspluginwrapper-1.1.4-configure.patch
nspluginwrapper-1.1.4-directory.patch
nspluginwrapper-1.1.4-fork.patch
nspluginwrapper-1.1.4-make.patch
nspluginwrapper-1.1.4-params.patch
nspluginwrapper-1.1.4-runtime-restart.patch
Removed Files:
nspluginwrapper-1.1.0-fork.patch
nspluginwrapper-1.1.0-runtime-restart.patch
nspluginwrapper-1.1.2-build.patch
Log Message:
* Wed Nov 12 2008 Martin Stransky <stransky at redhat.com> 1.1.4-1
- Updated to 1.1.4
- Consolidated build patches
nspluginwrapper-1.1.4-configure.patch:
--- NEW FILE nspluginwrapper-1.1.4-configure.patch ---
diff -up nspluginwrapper-1.1.4/configure.build nspluginwrapper-1.1.4/configure
--- nspluginwrapper-1.1.4/configure.build 2008-11-06 23:08:34.000000000 +0100
+++ nspluginwrapper-1.1.4/configure 2008-11-12 12:11:53.000000000 +0100
@@ -3,6 +3,8 @@
# nspluginwrapper configure script (C) 2005-2008 Gwenole Beauchesne
# derived from qemu configure script, (C) 2003 Fabrice Bellard
#
+#set -x
+
PACKAGE=nspluginwrapper
# set temporary file name
@@ -20,14 +22,18 @@ TMPE="${TMPDIR1}/npw-conf-${RANDOM}-$$-$
TMPS="${TMPDIR1}/npw-conf-${RANDOM}-$$-${RANDOM}.S"
# default parameters
+with_gecko="mozilla"
prefix="/usr"
lib32=""
lib64=""
-x_base_dirs=""
-biarch="guess"
-build_viewer="guess"
+base_lib=""
+base_libdir=""
+pkglibdir=""
+x_base_dir=""
+biarch="no"
+build_viewer="no"
build_player="yes"
-linux_only="guess"
+linux_only="yes"
strip="no"
cc="gcc"
cxx="g++"
@@ -85,9 +91,15 @@ fi
for opt do
case "$opt" in
+--with-gecko=*)
+ with_gecko=`echo $opt | cut -d '=' -f 2`
+ ;;
--prefix=*)
prefix=`echo "$opt" | cut -d '=' -f 2`
;;
+--pkgdir=*)
+ pkgdir=`echo $opt | cut -d '=' -f 2`
+ ;;
--pkglibdir=*)
pkglibdir=`echo "$opt" | cut -d '=' -f 2`
;;
@@ -97,6 +109,12 @@ case "$opt" in
--target-cpu=*)
target_cpu=`echo "$opt" | cut -d '=' -f 2 | sed -e 's/^i.86$/i386/'`
;;
+--with-base-lib=*)
+ base_lib=`echo $opt | cut -d '=' -f 2`
+ ;;
+--with-base-libdir=*)
+ base_libdir=`echo $opt | cut -d '=' -f 2`
+ ;;
--enable-generic)
linux_only="no"
;;
@@ -131,7 +149,7 @@ case "$opt" in
lib64=`echo "$opt" | cut -d '=' -f 2`
;;
--with-x11-prefix=*)
- x_base_dirs=`echo "$opt" | cut -d '=' -f 2`
+ x_base_dir=`echo "$opt" | cut -d '=' -f 2`
;;
--with-cc=*)
cc=`echo "$opt" | cut -d '=' -f 2`
@@ -398,8 +416,8 @@ rm -f $TMPC $TMPE
# check for GTK+ 2.0 compile CFLAGS
if test "$build_viewer" = "yes" -o "$build_player" = "yes"; then
if $pkgconfig --exists gtk+-2.0; then
- GTK_CFLAGS=`$pkgconfig --cflags gtk+-2.0`
- GTK_LDFLAGS=`$pkgconfig --libs gtk+-2.0`
+ GTK_CFLAGS=`$pkgconfig --cflags gtk+-2.0 gthread-2.0`
+ GTK_LDFLAGS=`$pkgconfig --libs gtk+-2.0 gthread-2.0`
GTK_VERSION=`$pkgconfig --modversion gtk+-2.0`
else
echo "GTK+ 2.0 environment not found"
@@ -450,25 +468,17 @@ EOF
rm -f $TMPC $TMPE
fi
+# check for Gecko compile CFLAGS
+if $pkgconfig --exists $with_gecko-plugin; then
+ GECKO_CFLAGS=`$pkgconfig --cflags $with_gecko-plugin`
+ GECKO_LDFLAGS=`$pkgconfig --libs $with_gecko-plugin`
+ GECKO_LIBDIR=""
+else
+ echo "gecko-devel not found"
+ exit 1
+fi
+
# check for X11 base dir
-if test -z "$x_base_dirs"; then
- x_base_dirs="
- /usr
- /usr/X11R6
- /usr/local/X11R6
- $prefix
- "
-fi
-for dir in $x_base_dirs; do
- x_include_dir="$dir/include"
- if test -f $x_include_dir/X11/Intrinsic.h; then
- x_lib_dir="$dir/$lib64"
- if test -f $x_lib_dir/libXt.so; then
- x_base_dir=$dir
- break
- fi
- fi
-done
if test -z "$x_base_dir"; then
echo "X11/Xt environment not found"
exit 1
@@ -608,6 +618,7 @@ EOF
echo "Standard options:"
echo " --help print this message"
echo " --prefix=PREFIX install in PREFIX [$prefix]"
+echo " --pkgdir=name name of package directory [$pkgdir]"
echo " --pkglibdir=ROOT install private files in ROOT [$pkglibdir]"
echo " --target-os=OS build plugin support for target OS [$target_os]"
echo " --target-cpu=CPU build plugin support for target CPU [$target_cpu]"
@@ -632,6 +643,7 @@ exit 1
fi
echo "Install prefix $prefix"
+echo "nspluginwrapper dir $pkgdir"
echo "nspluginwrapper root dir $pkglibdir"
echo "Strip binaries $strip"
echo "Bi-arch build $biarch"
@@ -648,6 +660,7 @@ echo "host CPU $host_cp
echo "host big endian $bigendian"
echo "target OS $target_os"
echo "target CPU $target_cpu"
+echo "Gecko $with_gecko"
echo "rpc init timeout $rpc_init_timeout secs"
echo "Memory allocation hooks $malloc_hooks"
@@ -661,18 +674,18 @@ echo "COMPILER=$compiler" >> $config_mak
echo "CC=$cc" >> $config_mak
echo "CXX=$cxx" >> $config_mak
echo "CFLAGS=$CFLAGS" >> $config_mak
+echo "LDFLAGS=$LDFLAGS" >> $config_mak
echo "GLIB_CFLAGS=$GLIB_CFLAGS" >> $config_mak
echo "GLIB_LDFLAGS=$GLIB_LDFLAGS" >> $config_mak
echo "GTK_CFLAGS=$GTK_CFLAGS" >> $config_mak
echo "GTK_LDFLAGS=$GTK_LDFLAGS" >> $config_mak
echo "CURL_CFLAGS=$CURL_CFLAGS" >> $config_mak
echo "CURL_LDFLAGS=$CURL_LDFLAGS" >> $config_mak
-if test "$biarch" = "yes"; then
-echo "LDFLAGS_32=-m32" >> $config_mak
-echo "CFLAGS_32=$CFLAGS_32" >> $config_mak
-else
-echo 'CFLAGS_32=$(CFLAGS)' >> $config_mak
-fi
+echo "GECKO_CFLAGS=$GECKO_CFLAGS" >> $config_mak
+echo "GECKO_LDFLAGS=$GECKO_LDFLAGS" >> $config_mak
+echo "GECKO_LIBDIR=$GECKO_LIBDIR" >> $config_mak
+
+host_os=$target_os
if test "$host_os" = "linux"; then
echo "OS=linux" >> $config_mak
echo "#define HOST_LINUX 1" >> $config_h
@@ -697,6 +710,8 @@ else
echo "Unsupported OS"
exit 1
fi
+
+host_cpu=$target_cpu
if test "$host_cpu" = "i386" ; then
echo "ARCH=i386" >> $config_mak
echo "#define HOST_I386 1" >> $config_h
@@ -741,20 +756,18 @@ if test -n "$fbigendian" ; then
echo "#define FLOAT_WORDS_BIGENDIAN $fbigendian" >> $config_h
fi
-echo "SRC_PATH=$source_path" >> $config_mak
-echo "build_viewer=$build_viewer" >> $config_mak
echo "build_player=$build_player" >> $config_mak
-echo "biarch=$biarch" >> $config_mak
+echo "SRC_PATH=$source_path" >> $config_mak
echo "lib32=$lib32" >> $config_mak
echo "lib64=$lib64" >> $config_mak
echo "prefix=$prefix" >> $config_mak
echo "bindir=$prefix/bin" >> $config_mak
-libdir="$prefix/$lib64"
-echo "libdir=$libdir" >> $config_mak
-echo "#define LIB \"$lib64\"" >> $config_h
-echo "#define LIBDIR \"$libdir\"" >> $config_h
+echo "base_libdir=$base_libdir" >> $config_mak
+echo "#define LIB \"$base_lib\"" >> $config_h
+echo "#define LIBDIR \"$base_libdir\"" >> $config_h
echo "x11prefix=$x_base_dir" >> $config_mak
echo "ALLOW_STRIP=$strip" >> $config_mak
+echo "#define USE_XPCOM 0" >> $config_h
VERSION=`sed < $source_path/$PACKAGE.spec -n '/^\%define version[ ]*/s///p'`
RELEASE=`sed < $source_path/$PACKAGE.spec -n '/^\%define release[ ]*/s///p'`
@@ -776,8 +789,14 @@ else
echo "#define NPW_VERSION \"$VERSION\"" >> $config_h
fi
+echo "#define NPW_PREFIX \"$prefix\"" >> $config_h
+echo "#define NPW_LIB32 \"$lib32\"" >> $config_h
+echo "#define NPW_LIB64 \"$lib64\"" >> $config_h
+
+echo "pkgdir=$pkgdir" >> $config_mak
+echo "#define NPW_DIR \"$pkgdir\"" >> $config_h
+
echo "pkglibdir=$pkglibdir" >> $config_mak
-echo "#define NPW_LIBDIR \"$pkglibdir\"" >> $config_h
echo "#define RPC_INIT_TIMEOUT $rpc_init_timeout" >> $config_h
@@ -817,9 +836,8 @@ config_h="config.h"
echo "/* Automatically generated by configure - do not modify */" > $config_h
echo "#include \"config-host.h\"" >> $config_h
-if test "$linux_only" = "yes"; then
- echo "#define BUILD_LINUX_ONLY 1" >> $config_h
-fi
+# Linux only by default
+echo "#define BUILD_LINUX_ONLY 1" >> $config_h
if test "$target_os" = "linux"; then
echo "TARGET_OS=linux" >> $config_mak
@@ -860,3 +878,7 @@ if test "$source_path_used" = "yes" ; th
esac
ln -sf $source_path/Makefile Makefile
fi
+
+# Don't strip binaries
+echo "DONT_STRIP=yes" >> $config_mak
+
nspluginwrapper-1.1.4-directory.patch:
--- NEW FILE nspluginwrapper-1.1.4-directory.patch ---
diff -up /dev/null nspluginwrapper-1.1.4/src/npw-dir.c
--- /dev/null 2008-11-11 00:56:26.161000975 +0100
+++ nspluginwrapper-1.1.4/src/npw-dir.c 2008-11-11 14:27:39.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.4/src/npw-dir.h
--- /dev/null 2008-11-11 00:56:26.161000975 +0100
+++ nspluginwrapper-1.1.4/src/npw-dir.h 2008-11-11 14:27:39.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.4/src/npw-wrapper.c.dir nspluginwrapper-1.1.4/src/npw-wrapper.c
--- nspluginwrapper-1.1.4/src/npw-wrapper.c.dir 2008-11-06 22:45:02.000000000 +0100
+++ nspluginwrapper-1.1.4/src/npw-wrapper.c 2008-11-11 14:29:25.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"
@@ -1648,8 +1649,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
@@ -2706,9 +2708,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.4/src/npw-config.c.dir nspluginwrapper-1.1.4/src/npw-config.c
--- nspluginwrapper-1.1.4/src/npw-config.c.dir 2008-10-12 17:59:47.000000000 +0200
+++ nspluginwrapper-1.1.4/src/npw-config.c 2008-11-11 14:27:39.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.4/src/npw-viewer.sh.dir nspluginwrapper-1.1.4/src/npw-viewer.sh
--- nspluginwrapper-1.1.4/src/npw-viewer.sh.dir 2008-10-12 17:06:28.000000000 +0200
+++ nspluginwrapper-1.1.4/src/npw-viewer.sh 2008-11-11 14:27:39.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.4/src/debug.h.dir nspluginwrapper-1.1.4/src/debug.h
diff -up nspluginwrapper-1.1.4/src/sysdeps.h.dir nspluginwrapper-1.1.4/src/sysdeps.h
--- nspluginwrapper-1.1.4/src/sysdeps.h.dir 2008-10-29 07:52:04.000000000 +0100
+++ nspluginwrapper-1.1.4/src/sysdeps.h 2008-11-11 14:27:39.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.4-fork.patch:
--- NEW FILE nspluginwrapper-1.1.4-fork.patch ---
diff -up nspluginwrapper-1.1.4/src/npw-viewer.c.fork nspluginwrapper-1.1.4/src/npw-viewer.c
--- nspluginwrapper-1.1.4/src/npw-viewer.c.fork 2008-11-04 00:08:58.000000000 +0100
+++ nspluginwrapper-1.1.4/src/npw-viewer.c 2008-11-12 13:06:05.000000000 +0100
@@ -62,6 +62,20 @@
// RPC global connections
rpc_connection_t *g_rpc_connection attribute_hidden = NULL;
+// Viewer orignal pid - check against incorrect plugins
+pid_t viewer_pid = 0;
+
+// Pid support routines
+void pid_set(void)
+{
+ viewer_pid = getpid();
+}
+
+int pid_check(void)
+{
+ return(viewer_pid == getpid());
+}
+
// Instance state information about the plugin
typedef struct _PluginInstance {
NPW_DECL_PLUGIN_INSTANCE;
@@ -583,6 +597,9 @@ static void
g_NPN_ForceRedraw(NPP instance)
{
D(bug("NPN_ForceRedraw instance=%p\n", instance));
+
+ if(!pid_check())
+ return;
NPW_UNIMPLEMENTED();
}
@@ -617,9 +634,11 @@ invoke_NPN_GetURL(NPP instance, const ch
static NPError
g_NPN_GetURL(NPP instance, const char *url, const char *target)
{
+ if(!pid_check())
+ return NPERR_INVALID_INSTANCE_ERROR;
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
-
+
D(bug("NPN_GetURL instance=%p\n", instance));
NPError ret = invoke_NPN_GetURL(instance, url, target);
D(bug(" return: %d [%s]\n", ret, string_of_NPError(ret)));
@@ -657,6 +676,9 @@ invoke_NPN_GetURLNotify(NPP instance, co
static NPError
g_NPN_GetURLNotify(NPP instance, const char *url, const char *target, void *notifyData)
{
+ if(!pid_check())
+ return NPERR_INVALID_INSTANCE_ERROR;
+
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
@@ -732,8 +754,11 @@ g_NPN_GetValue_real(NPP instance, NPNVar
static NPError
g_NPN_GetValue(NPP instance, NPNVariable variable, void *value)
-{
+{
D(bug("NPN_GetValue instance=%p, variable=%d [%08x]\n", instance, variable & 0xffff, variable));
+
+ if(!pid_check())
+ return NPERR_INVALID_INSTANCE_ERROR;
switch (variable) {
case NPNVxDisplay:
@@ -814,6 +839,9 @@ g_NPN_InvalidateRect(NPP instance, NPRec
{
if (instance == NULL || invalidRect == NULL)
return;
+
+ if(!pid_check())
+ return;
D(bug("NPN_InvalidateRect instance=%p\n", instance));
invoke_NPN_InvalidateRect(instance, invalidRect);
@@ -825,6 +853,9 @@ static void
g_NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
{
D(bug("NPN_InvalidateRegion instance=%p\n", instance));
+
+ if(!pid_check())
+ return;
NPW_UNIMPLEMENTED();
}
@@ -890,6 +921,8 @@ invoke_NPN_PostURL(NPP instance, const c
static NPError
g_NPN_PostURL(NPP instance, const char *url, const char *target, uint32 len, const char *buf, NPBool file)
{
+ if(!pid_check())
+ return NPERR_INVALID_INSTANCE_ERROR;
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
@@ -932,6 +965,9 @@ invoke_NPN_PostURLNotify(NPP instance, c
static NPError
g_NPN_PostURLNotify(NPP instance, const char *url, const char *target, uint32 len, const char *buf, NPBool file, void *notifyData)
{
+ if(!pid_check())
+ return NPERR_INVALID_INSTANCE_ERROR;
+
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
@@ -946,6 +982,9 @@ static void
g_NPN_ReloadPlugins(NPBool reloadPages)
{
D(bug("NPN_ReloadPlugins reloadPages=%d\n", reloadPages));
+
+ if(!pid_check())
+ return;
NPW_UNIMPLEMENTED();
}
@@ -955,6 +994,9 @@ static JRIEnv *
g_NPN_GetJavaEnv(void)
{
D(bug("NPN_GetJavaEnv\n"));
+
+ if(!pid_check())
+ return NULL;
return NULL;
}
@@ -964,6 +1006,9 @@ static jref
g_NPN_GetJavaPeer(NPP instance)
{
D(bug("NPN_GetJavaPeer instance=%p\n", instance));
+
+ if(!pid_check())
+ return NULL;
return NULL;
}
@@ -997,6 +1042,8 @@ invoke_NPN_RequestRead(NPStream *stream,
static NPError
g_NPN_RequestRead(NPStream *stream, NPByteRange *rangeList)
{
+ if(!pid_check())
+ return NPERR_INVALID_INSTANCE_ERROR;
if (stream == NULL || stream->ndata == NULL || rangeList == NULL)
return NPERR_INVALID_PARAM;
@@ -1045,10 +1092,13 @@ g_NPN_SetValue(NPP instance, NPPVariable
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
+ if(!pid_check())
+ return NPERR_INVALID_INSTANCE_ERROR;
+
PluginInstance *plugin = PLUGIN_INSTANCE(instance);
if (plugin == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
-
+
D(bug("NPN_SetValue instance=%p, variable=%d\n", instance, variable));
NPError ret = invoke_NPN_SetValue(plugin, variable, value);
D(bug(" return: %d [%s]\n", ret, string_of_NPError(ret)));
@@ -1081,6 +1131,9 @@ invoke_NPN_Status(NPP instance, const ch
static void
g_NPN_Status(NPP instance, const char *message)
{
+ if(!pid_check())
+ return;
+
D(bug("NPN_Status instance=%p\n", instance));
invoke_NPN_Status(instance, message);
D(bug(" done\n"));
@@ -1109,6 +1162,11 @@ invoke_NPN_UserAgent(void)
static const char *
g_NPN_UserAgent(NPP instance)
{
+ if(!pid_check()) {
+ static char tmp_agent_string[] = "None";
+ return tmp_agent_string;
+ }
+
D(bug("NPN_UserAgent instance=%p\n", instance));
if (g_user_agent == NULL)
g_user_agent = invoke_NPN_UserAgent();
@@ -1191,6 +1249,8 @@ invoke_NPN_NewStream(NPP instance, NPMIM
static NPError
g_NPN_NewStream(NPP instance, NPMIMEType type, const char *target, NPStream **stream)
{
+ if(!pid_check())
+ return NPERR_INVALID_INSTANCE_ERROR;
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
@@ -1236,6 +1296,9 @@ invoke_NPN_DestroyStream(NPP instance, N
static NPError
g_NPN_DestroyStream(NPP instance, NPStream *stream, NPError reason)
{
+ if(!pid_check())
+ return NPERR_INVALID_INSTANCE_ERROR;
+
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
@@ -1293,6 +1356,9 @@ invoke_NPN_Write(NPP instance, NPStream
static int32
g_NPN_Write(NPP instance, NPStream *stream, int32 len, void *buf)
{
+ if(!pid_check())
+ return -1;
+
if (instance == NULL)
return -1;
@@ -1329,6 +1395,8 @@ invoke_NPN_PushPopupsEnabledState(NPP in
static void
g_NPN_PushPopupsEnabledState(NPP instance, NPBool enabled)
{
+ if(!pid_check())
+ return;
if (instance == NULL)
return;
@@ -1360,6 +1428,8 @@ invoke_NPN_PopPopupsEnabledState(NPP ins
static void
g_NPN_PopPopupsEnabledState(NPP instance)
{
+ if(!pid_check())
+ return;
if (instance == NULL)
return;
@@ -1403,6 +1473,9 @@ invoke_NPN_CreateObject(NPP instance)
static NPObject *
g_NPN_CreateObject(NPP instance, NPClass *class)
{
+ if(!pid_check())
+ return NULL;
+
if (instance == NULL)
return NULL;
@@ -1443,6 +1516,9 @@ invoke_NPN_RetainObject(NPObject *npobj)
static NPObject *
g_NPN_RetainObject(NPObject *npobj)
{
+ if(!pid_check())
+ return NULL;
+
if (npobj == NULL)
return NULL;
@@ -1481,6 +1557,9 @@ invoke_NPN_ReleaseObject(NPObject *npobj
static void
g_NPN_ReleaseObject(NPObject *npobj)
{
+ if(!pid_check())
+ return;
+
if (npobj == NULL)
return;
@@ -1528,6 +1607,9 @@ static bool
g_NPN_Invoke(NPP instance, NPObject *npobj, NPIdentifier methodName,
const NPVariant *args, uint32_t argCount, NPVariant *result)
{
+ if(!pid_check())
+ return false;
+
if (!instance || !npobj || !npobj->_class || !npobj->_class->invoke)
return false;
@@ -1575,6 +1657,9 @@ static bool
g_NPN_InvokeDefault(NPP instance, NPObject *npobj,
const NPVariant *args, uint32_t argCount, NPVariant *result)
{
+ if(!pid_check())
+ return false;
+
if (!instance || !npobj || !npobj->_class || !npobj->_class->invokeDefault)
return false;
@@ -1620,6 +1705,9 @@ invoke_NPN_Evaluate(NPP instance, NPObje
static bool
g_NPN_Evaluate(NPP instance, NPObject *npobj, NPString *script, NPVariant *result)
{
+ if(!pid_check())
+ return false;
+
if (!instance || !npobj)
return false;
@@ -1669,6 +1757,9 @@ static bool
g_NPN_GetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName,
NPVariant *result)
{
+ if(!pid_check())
+ return false;
+
if (!instance || !npobj || !npobj->_class || !npobj->_class->getProperty)
return false;
@@ -1715,6 +1806,9 @@ static bool
g_NPN_SetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName,
const NPVariant *value)
{
+ if(!pid_check())
+ return false;
+
if (!instance || !npobj || !npobj->_class || !npobj->_class->setProperty)
return false;
@@ -1756,6 +1850,9 @@ invoke_NPN_RemoveProperty(NPP instance,
static bool
g_NPN_RemoveProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
{
+ if(!pid_check())
+ return false;
+
if (!instance || !npobj || !npobj->_class || !npobj->_class->removeProperty)
return false;
@@ -1797,6 +1894,9 @@ invoke_NPN_HasProperty(NPP instance, NPO
static bool
g_NPN_HasProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
{
+ if(!pid_check())
+ return false;
+
if (!instance || !npobj || !npobj->_class || !npobj->_class->hasProperty)
return false;
@@ -1838,6 +1938,9 @@ invoke_NPN_HasMethod(NPP instance, NPObj
static bool
g_NPN_HasMethod(NPP instance, NPObject *npobj, NPIdentifier methodName)
{
+ if(!pid_check())
+ return false;
+
if (!instance || !npobj || !npobj->_class || !npobj->_class->hasMethod)
return false;
@@ -1873,6 +1976,9 @@ invoke_NPN_SetException(NPObject *npobj,
static void
g_NPN_SetException(NPObject *npobj, const NPUTF8 *message)
{
+ if(!pid_check())
+ return;
+
D(bug("NPN_SetException npobj=%p, message='%s'\n", npobj, message));
invoke_NPN_SetException(npobj, message);
D(bug(" done\n"));
@@ -1917,6 +2023,8 @@ invoke_NPN_GetStringIdentifier(const NPU
static NPIdentifier
g_NPN_GetStringIdentifier(const NPUTF8 *name)
{
+ if(!pid_check())
+ return NULL;
if (name == NULL)
return NULL;
@@ -1966,6 +2074,9 @@ invoke_NPN_GetStringIdentifiers(const NP
static void
g_NPN_GetStringIdentifiers(const NPUTF8 **names, uint32_t nameCount, NPIdentifier *identifiers)
{
+ if(!pid_check())
+ return;
+
if (names == NULL)
return;
@@ -2007,6 +2118,9 @@ invoke_NPN_GetIntIdentifier(int32_t inti
static NPIdentifier
g_NPN_GetIntIdentifier(int32_t intid)
{
+ if(!pid_check())
+ return 0;
+
D(bug("NPN_GetIntIdentifier intid=%d\n", intid));
NPIdentifier ret = invoke_NPN_GetIntIdentifier(intid);
D(bug(" return: %p\n", ret));
@@ -2043,6 +2157,9 @@ invoke_NPN_IdentifierIsString(NPIdentifi
static bool
g_NPN_IdentifierIsString(NPIdentifier identifier)
{
+ if(!pid_check())
+ return false;
+
D(bug("NPN_IdentifierIsString identifier=%p\n", identifier));
bool ret = invoke_NPN_IdentifierIsString(identifier);
D(bug(" return: %d\n", ret));
@@ -2079,6 +2196,9 @@ invoke_NPN_UTF8FromIdentifier(NPIdentifi
static NPUTF8 *
g_NPN_UTF8FromIdentifier(NPIdentifier identifier)
{
+ if(!pid_check())
+ return NULL;
+
D(bug("NPN_UTF8FromIdentifier identifier=%p\n", identifier));
NPUTF8 *ret = invoke_NPN_UTF8FromIdentifier(identifier);
D(bug(" return: '%s'\n", ret));
@@ -2116,6 +2236,9 @@ invoke_NPN_IntFromIdentifier(NPIdentifie
static int32_t
g_NPN_IntFromIdentifier(NPIdentifier identifier)
{
+ if(!pid_check())
+ return 0;
+
D(bug("NPN_IntFromIdentifier identifier=%p\n", identifier));
int32_t ret = invoke_NPN_IntFromIdentifier(identifier);
D(bug(" return: %d\n", ret));
@@ -3208,6 +3331,9 @@ static int do_main(int argc, char **argv
}
D(bug(" Plugin connection: %s\n", connection_path));
+ pid_set();
+ D(bug(" Plugin viewer pid: %d\n", viewer_pid));
+
// Cleanup environment, the program may fork/exec a native shell
// script and having 32-bit libraries in LD_PRELOAD is not right,
// though not a fatal error
nspluginwrapper-1.1.4-make.patch:
--- NEW FILE nspluginwrapper-1.1.4-make.patch ---
diff -up nspluginwrapper-1.1.4/Makefile.build nspluginwrapper-1.1.4/Makefile
--- nspluginwrapper-1.1.4/Makefile.build 2008-10-29 07:52:04.000000000 +0100
+++ nspluginwrapper-1.1.4/Makefile 2008-11-12 11:44:00.000000000 +0100
@@ -76,23 +76,6 @@ ifneq (,$(findstring $(OS),netbsd dragon
X_LDFLAGS += -Wl,--rpath,$(x11prefix)/$(lib64)
endif
-ARCH_32 = $(ARCH)
-ifeq ($(biarch), yes)
-ARCH_32 = $(TARGET_ARCH)
-LSB_LIBS = $(LSB_OBJ_DIR)/libc.so $(LSB_OBJ_DIR)/libgcc_s_32.so
-LSB_LIBS += $(LSB_CORE_STUBS:%=$(LSB_OBJ_DIR)/%.so)
-LSB_LIBS += $(LSB_CORE_STATIC_STUBS:%=$(LSB_OBJ_DIR)/%.a)
-LSB_LIBS += $(LSB_DESKTOP_STUBS:%=$(LSB_OBJ_DIR)/%.so)
-endif
-
-LSB_TOP_DIR = $(SRC_PATH)/lsb-build
-LSB_INC_DIR = $(LSB_TOP_DIR)/headers
-LSB_SRC_DIR = $(LSB_TOP_DIR)/stub_libs
-LSB_OBJ_DIR = lsb-build-$(ARCH_32)
-LSB_CORE_STUBS = $(shell cat $(LSB_SRC_DIR)/core_filelist)
-LSB_CORE_STATIC_STUBS = $(shell cat $(LSB_SRC_DIR)/core_static_filelist)
-LSB_DESKTOP_STUBS = $(shell cat $(LSB_SRC_DIR)/desktop_filelist)
-
ifeq (i386,$(TARGET_ARCH))
TARGET_ELF_ARCH = elf32-i386
endif
@@ -100,45 +83,34 @@ ifeq (ppc,$(TARGET_ARCH))
TARGET_ELF_ARCH = elf32-powerpc
endif
-MOZILLA_CFLAGS = -I$(SRC_PATH)/npapi -I$(SRC_PATH)/npapi/nspr
+MOZILLA_CFLAGS = $(GECKO_CFLAGS)
+MOZILLA_LDFLAGS = $(GECKO_LDFLAGS)
npwrapper_LIBRARY = npwrapper.so
-npwrapper_RAWSRCS = npw-wrapper.c npw-common.c npw-malloc.c npw-rpc.c rpc.c debug.c utils.c npruntime.c
+npwrapper_RAWSRCS = npw-wrapper.c npw-common.c npw-malloc.c npw-rpc.c rpc.c debug.c utils.c npruntime.c npw-dir.c
npwrapper_SOURCES = $(npwrapper_RAWSRCS:%.c=$(SRC_PATH)/src/%.c)
npwrapper_OBJECTS = $(npwrapper_RAWSRCS:%.c=npwrapper-%.os)
npwrapper_CFLAGS = $(CFLAGS) $(X_CFLAGS) $(MOZILLA_CFLAGS) $(GLIB_CFLAGS)
-npwrapper_LDFLAGS = $(X_LDFLAGS) $(libpthread_LDFLAGS) $(libsocket_LDFLAGS)
+npwrapper_LDFLAGS = $(LDFLAGS) $(X_LDFLAGS) $(libpthread_LDFLAGS) $(libsocket_LDFLAGS) $(MOZILLA_LDFLAGS)
npwrapper_LDFLAGS += $(GLIB_LDFLAGS)
npviewer_PROGRAM = npviewer.bin
npviewer_RAWSRCS = npw-viewer.c npw-common.c npw-malloc.c npw-rpc.c rpc.c debug.c utils.c npruntime.c
npviewer_SOURCES = $(npviewer_RAWSRCS:%.c=$(SRC_PATH)/src/%.c)
npviewer_OBJECTS = $(npviewer_RAWSRCS:%.c=npviewer-%.o)
-ifeq ($(biarch),yes)
-npviewer_CFLAGS = $(CFLAGS_32)
-npviewer_CFLAGS += -I$(LSB_INC_DIR)
-npviewer_CFLAGS += -I$(LSB_INC_DIR)/glib-2.0
-npviewer_CFLAGS += -I$(LSB_INC_DIR)/gtk-2.0
-npviewer_LDFLAGS = $(LDFLAGS_32) -L$(LSB_OBJ_DIR)
-npviewer_LDFLAGS += -lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0 -ldl -lglib-2.0 -lX11 -lXt
-else
-npviewer_CFLAGS += $(GTK_CFLAGS)
-npviewer_LDFLAGS = $(GTK_LDFLAGS) $(X_LDFLAGS)
-endif
-npviewer_CFLAGS += $(MOZILLA_CFLAGS)
-npviewer_LDFLAGS += $(libdl_LDFLAGS) $(libpthread_LDFLAGS) -lgthread-2.0
-ifeq ($(TARGET_OS):$(TARGET_ARCH),linux:i386)
+npviewer_CFLAGS = $(CFLAGS) $(GTK_CFLAGS) $(MOZILLA_CFLAGS)
+npviewer_LDFLAGS = $(LDFLAGS) $(GTK_LDFLAGS) $(X_LDFLAGS) $(libdl_LDFLAGS) $(libpthread_LDFLAGS) $(MOZILLA_LDFLAGS)
npviewer_MAPFILE = $(SRC_PATH)/src/npw-viewer.map
-endif
+
ifneq ($(npviewer_MAPFILE),)
npviewer_LDFLAGS += -Wl,--export-dynamic
npviewer_LDFLAGS += -Wl,--version-script,$(npviewer_MAPFILE)
endif
-ifeq ($(TARGET_OS):$(TARGET_ARCH),linux:i386)
+
npviewer_SOURCES += $(SRC_PATH)/src/cxxabi-compat.cpp
npviewer_OBJECTS += npviewer-cxxabi-compat.o
npviewer_LDFLAGS += -lsupc++
-endif
+
ifeq ($(TARGET_OS):$(TARGET_ARCH),solaris:i386)
npviewer_LDFLAGS += $(libsocket_LDFLAGS)
endif
@@ -150,16 +122,6 @@ npplayer_CFLAGS = $(GTK_CFLAGS) $(MOZI
npplayer_LDFLAGS = $(GTK_LDFLAGS) $(CURL_LDFLAGS) $(X_LDFLAGS)
npplayer_LDFLAGS += -lgthread-2.0 $(libpthread_LDFLAGS) $(libsocket_LDFLAGS)
-libxpcom_LIBRARY = libxpcom.so
-libxpcom_RAWSRCS = libxpcom.c debug.c
-libxpcom_SOURCES = $(libxpcom_RAWSRCS:%.c=$(SRC_PATH)/src/%.c)
-libxpcom_OBJECTS = $(libxpcom_RAWSRCS:%.c=libxpcom-%.o)
-libxpcom_CFLAGS = $(PIC_CFLAGS)
-ifeq ($(biarch),yes)
-libxpcom_CFLAGS += -I$(LSB_INC_DIR)
-libxpcom_LDFLAGS = $(LDFLAGS_32) -L$(LSB_OBJ_DIR)
-endif
-
libnoxshm_LIBRARY = libnoxshm.so
libnoxshm_RAWSRCS = libnoxshm.c
libnoxshm_SOURCES = $(libnoxshm_RAWSRCS:%.c=$(SRC_PATH)/src/%.c)
@@ -171,10 +133,11 @@ libnoxshm_LDFLAGS = $(LDFLAGS_32) -L$(LS
endif
npconfig_PROGRAM = npconfig
-npconfig_RAWSRCS = npw-config.c
+npconfig_RAWSRCS = npw-config.c npw-dir.c
npconfig_SOURCES = $(npconfig_RAWSRCS:%.c=$(SRC_PATH)/src/%.c)
npconfig_OBJECTS = $(npconfig_RAWSRCS:%.c=npconfig-%.o)
-npconfig_LDFLAGS = $(libdl_LDFLAGS)
+npconfig_CFLAGS = $(CFLAGS) $(MOZILLA_CFLAGS)
+npconfig_LDFLAGS = $(LDFLAGS) $(libdl_LDFLAGS) $(MOZILLA_LDFLAGS)
ifneq (,$(findstring $(OS),netbsd dragonfly))
# We will try to dlopen() the native plugin library. If that lib is
# linked against libpthread, then so must our program too.
@@ -202,11 +165,8 @@ CPPFLAGS = -I. -I$(SRC_PATH)
TARGETS = $(npconfig_PROGRAM)
TARGETS += $(nploader_PROGRAM)
TARGETS += $(npwrapper_LIBRARY)
-ifeq ($(build_viewer),yes)
TARGETS += $(npviewer_PROGRAM)
-TARGETS += $(libxpcom_LIBRARY)
TARGETS += $(libnoxshm_LIBRARY)
-endif
ifeq ($(build_player),yes)
TARGETS += $(npplayer_PROGRAM)
endif
@@ -265,10 +225,6 @@ uninstall.wrapper:
uninstall.viewer:
rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM)
rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM:%.bin=%)
-uninstall.libxpcom:
- rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libxpcom_LIBRARY)
-uninstall.libnoxshm:
- rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libnoxshm_LIBRARY)
uninstall.loader:
rm -f $(DESTDIR)$(pkglibdir)/noarch/$(nploader_PROGRAM)
uninstall.config:
@@ -277,55 +233,25 @@ uninstall.config:
uninstall.mkruntime:
rm -f $(DESTDIR)$(pkglibdir)/noarch/mkruntime
-install: install.dirs install.player install.wrapper install.viewer install.libxpcom install.libnoxshm install.loader install.config install.mkruntime
+install: install.dirs install.player install.wrapper install.viewer install.loader install.config
install.dirs:
- mkdir -p $(DESTDIR)$(pkglibdir)/noarch
- mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH)
- mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)
-ifneq ($(ARCH),$(ARCH_32))
- mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH_32)
- mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)
-endif
+ mkdir -p $(DESTDIR)$(pkglibdir)
ifeq ($(build_player),yes)
install.player: $(npplayer_PROGRAM)
- $(INSTALL) -m 755 $(STRIP_OPT) $(npplayer_PROGRAM) $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npplayer_PROGRAM)
+ install -m 755 $(STRIP_OPT) $(npplayer_PROGRAM) $(DESTDIR)$(pkglibdir)/$(npplayer_PROGRAM)
mkdir -p $(DESTDIR)$(bindir)
- $(LN_S) $(pkglibdir)/$(ARCH)/$(OS)/$(npplayer_PROGRAM) $(DESTDIR)$(bindir)/nspluginplayer
else
install.player:
endif
install.wrapper: $(npwrapper_LIBRARY)
- $(INSTALL) -m 755 $(STRIP_OPT) $(npwrapper_LIBRARY) $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npwrapper_LIBRARY)
-ifeq ($(build_viewer),yes)
-install.viewer: install.viewer.bin install.viewer.glue
-install.libxpcom: do.install.libxpcom
-install.libnoxshm: do.install.libnoxshm
-else
-install.viewer:
-install.libxpcom:
-install.libnoxshm:
-endif
+ install -m 755 $(STRIP_OPT) $(npwrapper_LIBRARY) $(DESTDIR)$(pkglibdir)/$(npwrapper_LIBRARY)
+install.viewer: install.viewer.bin
install.viewer.bin: $(npviewer_PROGRAM)
- $(INSTALL) -m 755 $(STRIP_OPT) $(npviewer_PROGRAM) $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM)
-install.viewer.glue::
- p=$(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM:%.bin=%); \
- echo "#!/bin/sh" > $$p; \
- echo "TARGET_OS=$(TARGET_OS)" >> $$p; \
- echo "TARGET_ARCH=$(TARGET_ARCH)" >> $$p; \
- echo ". $(pkglibdir)/noarch/$(nploader_PROGRAM)" >> $$p; \
- chmod 755 $$p
-do.install.libxpcom: $(libxpcom_LIBRARY)
- $(INSTALL) -m 755 $(STRIP_OPT) $(libxpcom_LIBRARY) $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libxpcom_LIBRARY)
-do.install.libnoxshm: $(libnoxshm_LIBRARY)
- $(INSTALL) -m 755 $(STRIP_OPT) $(libnoxshm_LIBRARY) $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libnoxshm_LIBRARY)
+ install -m 755 $(STRIP_OPT) $(npviewer_PROGRAM) $(DESTDIR)$(pkglibdir)/$(npviewer_PROGRAM)
install.config: $(npconfig_PROGRAM)
- $(INSTALL) -m 755 $(STRIP_OPT) $(npconfig_PROGRAM) $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npconfig_PROGRAM)
- mkdir -p $(DESTDIR)$(bindir)
- $(LN_S) $(pkglibdir)/$(ARCH)/$(OS)/$(npconfig_PROGRAM) $(DESTDIR)$(bindir)/nspluginwrapper
+ install -m 755 $(STRIP_OPT) $(npconfig_PROGRAM) $(DESTDIR)$(pkglibdir)/$(npconfig_PROGRAM)
install.loader: $(nploader_PROGRAM)
- $(INSTALL) -m 755 $(nploader_PROGRAM) $(DESTDIR)$(pkglibdir)/noarch/$(nploader_PROGRAM)
-install.mkruntime: $(SRC_PATH)/utils/mkruntime.sh
- $(INSTALL) -m 755 $< $(DESTDIR)$(pkglibdir)/noarch/mkruntime
+ install -m 755 $(nploader_PROGRAM) $(DESTDIR)$(pkglibdir)/$(nploader_PROGRAM)
$(archivedir)::
[ -d $(archivedir) ] || mkdir $(archivedir) > /dev/null 2>&1
@@ -374,13 +300,13 @@ npwrapper-%.os: $(SRC_PATH)/src/%.c
$(CC) -o $@ -c $< $(PIC_CFLAGS) $(CPPFLAGS) $(npwrapper_CFLAGS) -DBUILD_WRAPPER
$(npviewer_PROGRAM): $(npviewer_OBJECTS) $(npviewer_MAPFILE) $(LSB_OBJ_DIR) $(LSB_LIBS)
- $(CC) $(LDFLAGS_32) -o $@ $(npviewer_OBJECTS) $(npviewer_LDFLAGS)
+ $(CC) -o $@ $(npviewer_OBJECTS) $(npviewer_LDFLAGS)
npviewer-%.o: $(SRC_PATH)/src/%.c
- $(CC) $(CFLAGS_32) -o $@ -c $< $(CPPFLAGS) $(npviewer_CFLAGS) -DBUILD_VIEWER
+ $(CC) -o $@ -c $< $(CPPFLAGS) $(npviewer_CFLAGS) -DBUILD_VIEWER
npviewer-%.o: $(SRC_PATH)/src/%.cpp
- $(CXX) $(CFLAGS_32) -o $@ -c $< $(CPPFLAGS) $(npviewer_CFLAGS) -DBUILD_VIEWER
+ $(CXX) -o $@ -c $< $(CPPFLAGS) $(npviewer_CFLAGS) -DBUILD_VIEWER
$(npplayer_PROGRAM): $(npplayer_OBJECTS) $(npplayer_MAPFILE) $(LSB_OBJ_DIR) $(LSB_LIBS)
$(CC) $(LDFLAGS) -o $@ $(npplayer_OBJECTS) $(npplayer_LDFLAGS)
@@ -390,12 +316,6 @@ npplayer-%.o: $(SRC_PATH)/src/%.c
npplayer-%.o: $(SRC_PATH)/src/tidy/%.c
$(CC) $(CFLAGS) -o $@ -c $< $(CPPFLAGS) $(npplayer_CFLAGS) -DBUILD_PLAYER
-$(libxpcom_LIBRARY): $(libxpcom_OBJECTS) $(LSB_OBJ_DIR) $(LSB_LIBS)
- $(CC) $(LDFLAGS_32) $(DSO_LDFLAGS) -o $@ $(libxpcom_OBJECTS) $(libxpcom_LDFLAGS) -Wl,$(LD_soname),libxpcom.so
-
-libxpcom-%.o: $(SRC_PATH)/src/%.c
- $(CC) $(CFLAGS_32) -o $@ -c $< $(CPPFLAGS) $(libxpcom_CFLAGS) -DBUILD_XPCOM
-
$(libnoxshm_LIBRARY): $(libnoxshm_OBJECTS) $(LSB_OBJ_DIR) $(LSB_LIBS)
$(CC) $(LDFLAGS_32) $(DSO_LDFLAGS) -o $@ $(libnoxshm_OBJECTS) $(libnoxshm_LDFLAGS) -Wl,$(LD_soname),libnoxshm.so
@@ -406,17 +326,23 @@ $(npconfig_PROGRAM): $(npconfig_OBJECTS)
$(CC) -o $@ $(npconfig_OBJECTS) $(npconfig_LDFLAGS)
npconfig-%.o: $(SRC_PATH)/src/%.c
- $(CC) -o $@ -c $< $(CPPFLAGS) $(CFLAGS)
+ $(CC) -o $@ -c $< $(CPPFLAGS) $(npconfig_CFLAGS)
$(nploader_PROGRAM): $(nploader_SOURCES)
- sed -e "s|%NPW_LIBDIR%|$(pkglibdir)|" $< > $@
+ sed -e "s|%NPW_PREFIX%|$(prefix)|" \
+ -e "s|%NPW_LIB32%|$(lib32)|" \
+ -e "s|%NPW_LIB64%|$(lib64)|" \
+ -e "s|%TARGET_OS%|$(TARGET_OS)|" \
+ -e "s|%TARGET_ARCH%|$(TARGET_ARCH)|" \
+ -e "s|%GECKO_LIBDIR%|$(GECKO_LIBDIR)|" \
+ -e "s|%NPW_DIR%|$(pkgdir)|" $< > $@
chmod 755 $@
$(LSB_OBJ_DIR)::
@[ -d $(LSB_OBJ_DIR) ] || mkdir $(LSB_OBJ_DIR) > /dev/null 2>&1
$(LSB_OBJ_DIR)/%.o: $(LSB_SRC_DIR)/%.c
- $(CC) $(CFLAGS_32) -nostdinc -fno-builtin -I. -I$(LSB_INC_DIR) -c $< -o $@
+ $(CC) $(CFLAGS) -nostdinc -fno-builtin -I. -I$(LSB_INC_DIR) -c $< -o $@
$(LSB_OBJ_DIR)/%.a: $(LSB_OBJ_DIR)/%.o
$(AR) rc $@ $<
@@ -429,7 +355,7 @@ $(LSB_OBJ_DIR)/libgcc_s_32.so: $(LSB_OBJ
$(LN_S) libgcc_s.so $@
$(LSB_OBJ_DIR)/%.so: $(LSB_OBJ_DIR)/%.o
- $(CC) $(LDFLAGS_32) -nostdlib $(DSO_LDFLAGS) $< -o $@ \
+ $(CC) $(LDFLAGS) -nostdlib $(DSO_LDFLAGS) $< -o $@ \
-Wl,--version-script,$(patsubst $(LSB_OBJ_DIR)/%.o,$(LSB_SRC_DIR)/%.Version,$<) \
-Wl,-soname,`grep "$(patsubst $(LSB_OBJ_DIR)/%.o,%,$<) " $(LSB_SRC_DIR)/LibNameMap.txt | cut -f2 -d' '`
nspluginwrapper-1.1.4-params.patch:
--- NEW FILE nspluginwrapper-1.1.4-params.patch ---
--- nspluginwrapper-1.1.2/src/npw-viewer.c.build 2008-10-12 17:03:08.000000000 +0200
+++ nspluginwrapper-1.1.2/src/npw-viewer.c 2008-10-16 11:31:00.000000000 +0200
@@ -759,11 +764,19 @@ g_NPN_GetValue(NPP instance, NPNVariable
case NPNVserviceManager: {
nsIServiceManager *sm;
int ret = NS_GetServiceManager(&sm);
- if (NS_FAILED(ret))
+ if (NS_FAILED(ret)) {
+ npw_printf("WARNING: NS_GetServiceManager failed\n");
return NPERR_GENERIC_ERROR;
+ }
*(nsIServiceManager **)value = sm;
break;
}
+ case NPNVDOMElement:
+ npw_printf("WARNING: NPNVDOMElement is not supported by NPN_GetValue()\n");
+ return NPERR_INVALID_PARAM;
+ case NPNVDOMWindow:
+ npw_printf("WARNING: NPNVDOMWindow is not supported by NPN_GetValue()\n");
+ return NPERR_INVALID_PARAM;
#endif
case NPNVnetscapeWindow: {
PluginInstance *plugin = PLUGIN_INSTANCE(instance);
nspluginwrapper-1.1.4-runtime-restart.patch:
--- NEW FILE nspluginwrapper-1.1.4-runtime-restart.patch ---
diff -up nspluginwrapper-1.1.4/src/rpc.c.restart nspluginwrapper-1.1.4/src/rpc.c
--- nspluginwrapper-1.1.4/src/rpc.c.restart 2008-10-12 17:03:08.000000000 +0200
+++ nspluginwrapper-1.1.4/src/rpc.c 2008-11-11 14:11:20.000000000 +0100
@@ -456,6 +456,7 @@ struct rpc_connection {
pthread_t server_thread;
rpc_map_t *types;
rpc_map_t *methods;
+ rpc_error_callback_t callback_error;
};
// Increment connection reference count
@@ -475,6 +476,29 @@ void rpc_connection_unref(rpc_connection
}
}
+// Set error callback
+void rpc_connection_error_callback_set(rpc_connection_t *connection,
+ rpc_error_callback_t callback)
+{
+ if (connection == NULL)
+ return;
+ if (connection->callback_error != NULL)
+ return;
+ connection->callback_error = callback;
+}
+
+// Call error callback if the connection is closed
+static void rpc_connection_error_callback_call(rpc_connection_t *connection)
+{
+ if (connection == NULL)
+ return;
+ if (connection->callback_error == NULL)
+ return;
+
+ (connection->callback_error)(connection);
+ connection->callback_error = NULL;
+}
+
// Returns connection status
static inline int _rpc_status(rpc_connection_t *connection)
{
@@ -513,6 +537,11 @@ static inline int rpc_error(rpc_connecti
assert(error < 0);
assert(connection != NULL);
_rpc_set_status(connection, error);
+
+ if(_rpc_status(connection) == RPC_STATUS_CLOSED || _rpc_status(connection) == RPC_STATUS_BROKEN) {
+ rpc_connection_error_callback_call(connection);
+ }
+
return error;
}
@@ -605,6 +634,7 @@ rpc_connection_t *rpc_init_server(const
connection->status = RPC_STATUS_CLOSED;
connection->socket = -1;
connection->server_thread_active = 0;
+ connection->callback_error = NULL;
if ((connection->types = rpc_map_new_full((free))) == NULL) {
rpc_exit(connection);
return NULL;
@@ -665,6 +695,7 @@ rpc_connection_t *rpc_init_client(const
connection->refcnt = 1;
connection->status = RPC_STATUS_CLOSED;
connection->server_socket = -1;
+ connection->callback_error = NULL;
if ((connection->types = rpc_map_new_full((free))) == NULL) {
rpc_exit(connection);
return NULL;
diff -up nspluginwrapper-1.1.4/src/npruntime.c.restart nspluginwrapper-1.1.4/src/npruntime.c
--- nspluginwrapper-1.1.4/src/npruntime.c.restart 2008-11-06 22:45:02.000000000 +0100
+++ nspluginwrapper-1.1.4/src/npruntime.c 2008-11-11 14:14:07.000000000 +0100
@@ -51,6 +51,14 @@ NPClass npclass_bridge = {
npclass_invoke_RemoveProperty
};
+int npclass_check(NPObject *npobj)
+{
+ NPObjectInfo *p_info = npobject_info_lookup(npobj);
+ if(!p_info->valid)
+ npw_printf("ERROR: NPObject %p is not valid!\n",npobj);
+ return(p_info->valid);
+}
+
// NPClass::Invalidate
int npclass_handle_Invalidate(rpc_connection_t *connection)
{
@@ -64,7 +72,7 @@ int npclass_handle_Invalidate(rpc_connec
return error;
}
- if (npobj && npobj->_class && npobj->_class->invalidate) {
+ if (npobj && npobj->_class && npclass_check(npobj) && npobj->_class->invalidate) {
D(bug("NPClass::Invalidate(npobj %p)\n", npobj));
npobj->_class->invalidate(npobj);
D(bug(" done\n"));
@@ -75,6 +83,9 @@ int npclass_handle_Invalidate(rpc_connec
void npclass_invoke_Invalidate(NPObject *npobj)
{
+ if(!npclass_check(npobj))
+ return;
+
int error = rpc_method_invoke(g_rpc_connection,
RPC_METHOD_NPCLASS_INVALIDATE,
RPC_TYPE_NP_OBJECT, npobj,
@@ -109,7 +120,7 @@ int npclass_handle_HasMethod(rpc_connect
}
uint32_t ret = false;
- if (npobj && npobj->_class && npobj->_class->hasMethod) {
+ if (npobj && npobj->_class && npclass_check(npobj) && npobj->_class->hasMethod) {
D(bug("NPClass::HasMethod(npobj %p, name id %p)\n", npobj, name));
ret = npobj->_class->hasMethod(npobj, name);
D(bug(" return: %d\n", ret));
@@ -122,6 +133,9 @@ int npclass_handle_HasMethod(rpc_connect
bool npclass_invoke_HasMethod(NPObject *npobj, NPIdentifier name)
{
+ if(!npclass_check(npobj))
+ return false;
+
int error = rpc_method_invoke(g_rpc_connection,
RPC_METHOD_NPCLASS_HAS_METHOD,
RPC_TYPE_NP_OBJECT, npobj,
@@ -165,7 +179,7 @@ int npclass_handle_Invoke(rpc_connection
uint32_t ret = false;
NPVariant result;
VOID_TO_NPVARIANT(result);
- if (npobj && npobj->_class && npobj->_class->invoke) {
+ if (npobj && npobj->_class && npclass_check(npobj) && npobj->_class->invoke) {
D(bug("NPClass::Invoke(npobj %p, name id %p)\n", npobj, name));
print_npvariant_args(args, argCount);
ret = npobj->_class->invoke(npobj, name, args, argCount, &result);
@@ -195,6 +209,9 @@ bool npclass_invoke_Invoke(NPObject *npo
if (result == NULL)
return false;
VOID_TO_NPVARIANT(*result);
+
+ if(!npclass_check(npobj))
+ return false;
int error = rpc_method_invoke(g_rpc_connection,
RPC_METHOD_NPCLASS_INVOKE,
@@ -241,7 +258,7 @@ int npclass_handle_InvokeDefault(rpc_con
uint32_t ret = false;
NPVariant result;
VOID_TO_NPVARIANT(result);
- if (npobj && npobj->_class && npobj->_class->invokeDefault) {
+ if (npobj && npobj->_class && npclass_check(npobj) && npobj->_class->invokeDefault) {
D(bug("NPClass::InvokeDefault(npobj %p)\n", npobj));
print_npvariant_args(args, argCount);
ret = npobj->_class->invokeDefault(npobj, args, argCount, &result);
@@ -271,6 +288,9 @@ bool npclass_invoke_InvokeDefault(NPObje
if (result == NULL)
return false;
VOID_TO_NPVARIANT(*result);
+
+ if(!npclass_check(npobj))
+ return false;
int error = rpc_method_invoke(g_rpc_connection,
RPC_METHOD_NPCLASS_INVOKE_DEFAULT,
@@ -313,7 +333,7 @@ int npclass_handle_HasProperty(rpc_conne
}
uint32_t ret = false;
- if (npobj && npobj->_class && npobj->_class->hasProperty) {
+ if (npobj && npobj->_class && npclass_check(npobj) && npobj->_class->hasProperty) {
D(bug("NPClass::HasProperty(npobj %p, name id %p)\n", npobj, name));
ret = npobj->_class->hasProperty(npobj, name);
D(bug(" return: %d\n", ret));
@@ -326,6 +346,9 @@ int npclass_handle_HasProperty(rpc_conne
bool npclass_invoke_HasProperty(NPObject *npobj, NPIdentifier name)
{
+ if(!npclass_check(npobj))
+ return false;
+
int error = rpc_method_invoke(g_rpc_connection,
RPC_METHOD_NPCLASS_HAS_PROPERTY,
RPC_TYPE_NP_OBJECT, npobj,
@@ -366,7 +389,7 @@ int npclass_handle_GetProperty(rpc_conne
uint32_t ret = false;
NPVariant result;
VOID_TO_NPVARIANT(result);
- if (npobj && npobj->_class && npobj->_class->getProperty) {
+ if (npobj && npobj->_class && npclass_check(npobj) && npobj->_class->getProperty) {
D(bug("NPClass::GetProperty(npobj %p, name id %p)\n", npobj, name));
ret = npobj->_class->getProperty(npobj, name, &result);
gchar *result_str = string_of_NPVariant(&result);
@@ -388,7 +411,10 @@ bool npclass_invoke_GetProperty(NPObject
if (result == NULL)
return false;
VOID_TO_NPVARIANT(*result);
-
+
+ if(!npclass_check(npobj))
+ return false;
+
int error = rpc_method_invoke(g_rpc_connection,
RPC_METHOD_NPCLASS_GET_PROPERTY,
RPC_TYPE_NP_OBJECT, npobj,
@@ -432,7 +458,7 @@ int npclass_handle_SetProperty(rpc_conne
}
uint32_t ret = false;
- if (npobj && npobj->_class && npobj->_class->setProperty) {
+ if (npobj && npobj->_class && npclass_check(npobj) && npobj->_class->setProperty) {
D(bug("NPClass::SetProperty(npobj %p, name id %p)\n", npobj, name));
ret = npobj->_class->setProperty(npobj, name, &value);
D(bug(" return: %d\n", ret));
@@ -450,6 +476,9 @@ bool npclass_invoke_SetProperty(NPObject
{
if (value == NULL)
return false;
+
+ if(!npclass_check(npobj))
+ return false;
int error = rpc_method_invoke(g_rpc_connection,
RPC_METHOD_NPCLASS_SET_PROPERTY,
@@ -492,7 +521,7 @@ int npclass_handle_RemoveProperty(rpc_co
}
uint32_t ret = false;
- if (npobj && npobj->_class && npobj->_class->removeProperty) {
+ if (npobj && npobj->_class && npclass_check(npobj) && npobj->_class->removeProperty) {
D(bug("NPClass::RemoveProperty(npobj %p, name id %p)\n", npobj, name));
ret = npobj->_class->removeProperty(npobj, name);
D(bug(" return: %d\n", ret));
@@ -505,6 +534,9 @@ int npclass_handle_RemoveProperty(rpc_co
bool npclass_invoke_RemoveProperty(NPObject *npobj, NPIdentifier name)
{
+ if(!npclass_check(npobj))
+ return false;
+
int error = rpc_method_invoke(g_rpc_connection,
RPC_METHOD_NPCLASS_REMOVE_PROPERTY,
RPC_TYPE_NP_OBJECT, npobj,
@@ -539,6 +571,7 @@ NPObjectInfo *npobject_info_new(NPObject
static uint32_t id;
npobj_info->npobj = npobj;
npobj_info->npobj_id = ++id;
+ npobj_info->valid = 1;
}
return npobj_info;
}
@@ -756,3 +789,14 @@ print_npvariant_args(const NPVariant *ar
g_string_free(str, TRUE);
#endif
}
+
+static void npruntime_deactivate_func(gpointer key, gpointer value, gpointer user_data)
+{
+ NPObjectInfo *p_info = (NPObjectInfo *)value;
+ p_info->valid = 0;
+}
+
+void npruntime_deactivate(void)
+{
+ g_hash_table_foreach(g_npobjects, npruntime_deactivate_func, NULL);
+}
diff -up nspluginwrapper-1.1.4/src/npruntime-impl.h.restart nspluginwrapper-1.1.4/src/npruntime-impl.h
--- nspluginwrapper-1.1.4/src/npruntime-impl.h.restart 2008-10-26 18:40:16.000000000 +0100
+++ nspluginwrapper-1.1.4/src/npruntime-impl.h 2008-11-11 14:11:20.000000000 +0100
@@ -25,6 +25,7 @@
typedef struct {
NPObject *npobj;
uint32_t npobj_id;
+ uint32_t valid;
} NPObjectInfo;
extern NPObjectInfo *npobject_info_new(NPObject *npobj) attribute_hidden;
@@ -65,4 +66,7 @@ extern void npvariant_clear(struct _NPVa
extern char *string_of_NPVariant(const struct _NPVariant *arg) attribute_hidden;
extern void print_npvariant_args(const struct _NPVariant *args, uint32_t nargs) attribute_hidden;
+// Deactivate all NPObject instances
+extern void npruntime_deactivate(void);
+
#endif /* NPRUNTIME_IMPL_H */
diff -up nspluginwrapper-1.1.4/src/npw-wrapper.c.restart nspluginwrapper-1.1.4/src/npw-wrapper.c
--- nspluginwrapper-1.1.4/src/npw-wrapper.c.restart 2008-11-06 22:45:02.000000000 +0100
+++ nspluginwrapper-1.1.4/src/npw-wrapper.c 2008-11-11 14:11:20.000000000 +0100
@@ -96,7 +96,11 @@ typedef struct _StreamInstance {
// Prototypes
static void plugin_init(int is_NP_Initialize);
static void plugin_exit(void);
-static NPError plugin_restart_if_needed(void);
+
+static void plugin_kill(rpc_connection_t *connection);
+static NPError plugin_start(void);
+static NPError plugin_start_if_needed(void);
+static int plugin_killed = 0;
/*
* Notes concerning NSPluginWrapper recovery model.
@@ -115,10 +119,8 @@ static NPError plugin_restart_if_needed(
* connection and thus can fail early/gracefully in subsequent calls
* to NPP_*() functions.
*
- * TODO: make NPRuntime aware of per-plugin connections? This
- * shouldn't matter from the Wrapper side because npruntime requests
- * come from the Viewer side (see NPN_*() handlers). XXX: even with a
- * running script (NPClass handlers)?
+ * All active NPRuntime objects are marked as inactive and
+ * are not processed.
*/
// Minimal time between two plugin restarts in sec
@@ -1363,7 +1365,7 @@ g_NPP_New(NPMIMEType mime_type, NPP inst
return NPERR_INVALID_INSTANCE_ERROR;
// Check if we need to restart the plug-in
- NPError ret = plugin_restart_if_needed();
+ NPError ret = plugin_start_if_needed();
if (ret != NPERR_NO_ERROR)
return ret;
@@ -2890,6 +2892,9 @@ static void plugin_init(int is_NP_Initia
return;
}
+ // Set error handler - stop plugin if there's a connection error
+ rpc_connection_error_callback_set(g_rpc_connection, plugin_kill);
+
g_plugin.initialized = 1 + is_NP_Initialize;
D(bug("--- INIT ---\n"));
}
@@ -2962,17 +2967,39 @@ static void __attribute__((destructor))
}
}
-static NPError plugin_restart(void)
+static void plugin_kill(rpc_connection_t *connection)
{
if (g_plugin.is_wrapper)
- return NPERR_NO_ERROR;
+ return;
- // Shut it down
+ D(bug("plugin_kill, connection %p\n",connection));
+
+ // Kill viewer and plugin
plugin_exit();
+
+ // Clear-up
g_plugin.initialized = 0;
g_plugin.viewer_pid = -1;
g_plugin.is_wrapper = 0;
+ npruntime_deactivate();
+
+ // Set the kill flag
+ plugin_killed = 1;
+}
+
+static NPError plugin_start(void)
+{
+ D(bug("plugin_start\n"));
+
+ if(!plugin_killed) {
+ // Plugin is still active
+ // terminate it before the restart
+ D(bug("plugin_start: plugin_killed = 0!\n"));
+ plugin_kill(g_rpc_connection);
+ }
+ plugin_killed = 0;
+
// And start it again
plugin_init(1);
if (g_plugin.initialized <= 0)
@@ -2981,7 +3008,7 @@ static NPError plugin_restart(void)
return invoke_NP_Initialize(npapi_version);
}
-static NPError plugin_restart_if_needed(void)
+static NPError plugin_start_if_needed(void)
{
if (rpc_status(g_rpc_connection) != RPC_STATUS_ACTIVE) {
static time_t last_restart = 0;
@@ -2991,7 +3018,7 @@ static NPError plugin_restart_if_needed(
last_restart = now;
D(bug("Restart plugins viewer\n"));
- NPError ret = plugin_restart();
+ NPError ret = plugin_start();
D(bug(" return: %d [%s]\n", ret, string_of_NPError(ret)));
return ret;
}
diff -up nspluginwrapper-1.1.4/src/rpc.h.restart nspluginwrapper-1.1.4/src/rpc.h
--- nspluginwrapper-1.1.4/src/rpc.h.restart 2008-10-12 17:03:08.000000000 +0200
+++ nspluginwrapper-1.1.4/src/rpc.h 2008-11-11 14:11:20.000000000 +0100
@@ -122,4 +122,10 @@ extern int rpc_method_send_reply(rpc_con
}
#endif
+// This callback is called when the connection is closed or broken
+typedef void (*rpc_error_callback_t)(rpc_connection_t *connection);
+
+// Set callback for a connection
+void rpc_connection_error_callback_set(rpc_connection_t *connection, rpc_error_callback_t callback);
+
#endif /* RPC_H */
Index: nspluginwrapper.spec
===================================================================
RCS file: /cvs/pkgs/rpms/nspluginwrapper/F-10/nspluginwrapper.spec,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- nspluginwrapper.spec 22 Oct 2008 11:52:27 -0000 1.65
+++ nspluginwrapper.spec 12 Nov 2008 20:47:14 -0000 1.66
@@ -1,14 +1,9 @@
-# Compile with XPCOM support
-%define xpcom_support 0
-
# Compile as a debug package
%define make_debug_package 0
# What gecko we use
%define gecko_flavour "mozilla"
-%define gecko_ver 1.9
-
%define plugin_config_version 1.9
%define plugin_config_name plugin-config-%{plugin_config_version}
%define plugin_config_binary plugin-config
@@ -69,17 +64,20 @@
Summary: A compatibility layer for Netscape 4 plugins
Name: nspluginwrapper
-Version: 1.1.2
-Release: 4%{?dist}
+Version: 1.1.4
+Release: 1%{?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.2-build.patch
-Patch2: nspluginwrapper-1.1.0-runtime-restart.patch
-Patch3: nspluginwrapper-1.1.0-fork.patch
-Patch4: nspluginwrapper-0.9.91.5-shutdown.patch
-Patch5: nspluginwrapper-1.1.12-event.patch
+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
Patch100: plugin-config-setuid.patch
Patch101: plugin-config-umask.patch
Patch102: plugin-config-print.patch
@@ -91,7 +89,7 @@
Requires: mozilla-filesystem
BuildRequires: pkgconfig gtk2-devel glib2-devel nspr-devel
BuildRequires: libX11-devel libXt-devel cairo-devel pango-devel libcurl-devel
-BuildRequires: gecko-devel >= %{gecko_ver}
+BuildRequires: gecko-devel
ExclusiveArch: i386 x86_64 ppc
%description
@@ -106,11 +104,18 @@
%prep
%setup -q -a 1
-%patch1 -p1 -b .build
-%patch2 -p1 -b .restart
-%patch3 -p1 -b .fork
-%patch4 -p1 -b .shutdown
-%patch5 -p1 -b .event
+
+# Installation & build patches
+%patch1 -p1 -b .make
+%patch2 -p1 -b .conf
+%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
# Plugin-config patches
pushd %plugin_config_name
@@ -145,12 +150,6 @@
export LDFLAGS="-m32 -L%{libdir32}"
%endif
-%if %{xpcom_support}
- export XPCOM_SUPPORT="yes"
-%else
- export XPCOM_SUPPORT="no"
-%endif
-
mkdir %{build_dir}
pushd %{build_dir}
../configure \
@@ -161,7 +160,7 @@
--with-lib32=%{lib32} \
--with-lib64=%{lib64} \
--with-base-lib=%{lib} \
- --with-xpcom="$XPCOM_SUPPORT" \
+ --with-xpcom=no \
--with-base-libdir=%{libdir} \
--with-x11-prefix=/usr \
--with-gecko=%{gecko_flavour}
@@ -198,10 +197,6 @@
rm -rf $RPM_BUILD_ROOT/usr/doc/plugin-config
-%if %{xpcom_support}
-GECKO_VERSION=`pkg-config --modversion %{gecko_flavour}-plugin`
-%endif
-
cat %{SOURCE2} > $RPM_BUILD_ROOT%{_bindir}/mozilla-plugin-config
chmod 755 $RPM_BUILD_ROOT%{_bindir}/mozilla-plugin-config
@@ -245,6 +240,10 @@
%config %{_sysconfdir}/sysconfig/%{name}
%changelog
+* Wed Nov 12 2008 Martin Stransky <stransky at redhat.com> 1.1.4-1
+- Updated to 1.1.4
+- Consolidated build patches
+
* Wed Oct 22 2008 Martin Stransky <stransky at redhat.com> 1.1.2-4
- Fixed #449338 - mozilla-plugin-config segfaults with -v argument
Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/nspluginwrapper/F-10/sources,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- sources 16 Oct 2008 12:06:04 -0000 1.11
+++ sources 12 Nov 2008 20:47:15 -0000 1.12
@@ -1,2 +1,2 @@
0a00e94ba608dfea365851af9deb20dc plugin-config-1.9.tar.gz
-b381adcd7627b4680d081ab2f5823111 nspluginwrapper-1.1.2.tar.bz2
+f9a36f0a15f7c9043c3a4c1b74387ba7 nspluginwrapper-1.1.4.tar.bz2
--- nspluginwrapper-1.1.0-fork.patch DELETED ---
--- nspluginwrapper-1.1.0-runtime-restart.patch DELETED ---
--- nspluginwrapper-1.1.2-build.patch DELETED ---
- Previous message: rpms/barry/F-8 barry.desktop, NONE, 1.1 barry.spec, NONE, 1.1 import.log, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
- Next message: rpms/kernel/F-9 linux-2.6-pci-fix-pciehp.patch, NONE, 1.1 kernel.spec, 1.848, 1.849
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the scm-commits
mailing list