Stanislav Ochotnicky ca084f
From f1a95250e28d69acf85819ad8a792c39f8b0d393 Mon Sep 17 00:00:00 2001
Stanislav Ochotnicky ca084f
From: Stanislav Ochotnicky <sochotnicky@redhat.com>
Stanislav Ochotnicky ca084f
Date: Tue, 11 May 2010 13:29:15 +0200
Stanislav Ochotnicky ca084f
Subject: [PATCH 1/3] Patch to force absolute or relative paths (no PATH searching)
Stanislav Ochotnicky ca084f
Stanislav Ochotnicky ca084f
---
Stanislav Ochotnicky ca084f
 src/native/unix/native/jsvc-unix.c |   10 ++++++++++
Stanislav Ochotnicky ca084f
 1 files changed, 10 insertions(+), 0 deletions(-)
Stanislav Ochotnicky ca084f
Stanislav Ochotnicky ca084f
diff --git a/src/native/unix/native/jsvc-unix.c b/src/native/unix/native/jsvc-unix.c
Stanislav Ochotnicky ca084f
index 6f39365..abbebb7 100644
Stanislav Ochotnicky ca084f
--- a/src/native/unix/native/jsvc-unix.c
Stanislav Ochotnicky ca084f
+++ b/src/native/unix/native/jsvc-unix.c
Stanislav Ochotnicky ca084f
@@ -702,6 +702,16 @@ int main(int argc, char *argv[]) {
Stanislav Ochotnicky ca084f
         char *p1=NULL;
Stanislav Ochotnicky ca084f
         char *p2=NULL;
Stanislav Ochotnicky ca084f
 
Stanislav Ochotnicky ca084f
+        /* We don't want to use a form of exec() that searches the
Stanislav Ochotnicky ca084f
+           PATH, so require that argv[0] be either an absolute or
Stanislav Ochotnicky ca084f
+           relative path.  Error out if this isn't the case.  */
Stanislav Ochotnicky ca084f
+        tmp=strchr(oldpath,'/');
Stanislav Ochotnicky ca084f
+        if (tmp==NULL) {
Stanislav Ochotnicky ca084f
+          log_error("JSVC re-exec requires execution with an absolute or relative path");
Stanislav Ochotnicky ca084f
+          return(1);
Stanislav Ochotnicky ca084f
+        }
Stanislav Ochotnicky ca084f
+
Stanislav Ochotnicky ca084f
+
Stanislav Ochotnicky ca084f
         /*
Stanislav Ochotnicky ca084f
          * There is no need to change LD_LIBRARY_PATH
Stanislav Ochotnicky ca084f
          * if we were not able to find a path to libjvm.so
Stanislav Ochotnicky ca084f
-- 
Stanislav Ochotnicky ca084f
1.6.6.1
Stanislav Ochotnicky ca084f