Blob Blame History Raw
diff --git a/client-src/rundump.c b/client-src/rundump.c
index bba569984..85962d11c 100644
--- a/client-src/rundump.c
+++ b/client-src/rundump.c
@@ -43,6 +43,16 @@ int main(int argc, char **argv);
 static void validate_dump_option(int argc, char ** argv);
 static void validate_xfsdump_options(int argc, char ** argv);
 
+/*
+ * Has USE_RUNDUMP been explicitly requsted?
+ * If not, we will not use rundump for DUMP,
+ * although we sill may need to use it for
+ * VDUMP or XFSDUMP
+ */
+#if defined(USE_RUNDUMP)
+#  define USE_RUNDUMP_FOR_DUMP
+#endif
+
 #if defined(VDUMP) || defined(XFSDUMP)
 #  undef USE_RUNDUMP
 #  define USE_RUNDUMP
@@ -138,9 +148,10 @@ main(
 
 #ifdef XFSDUMP
 
-    if (g_str_equal(argv[0], "xfsdump"))
+    if (g_str_equal(argv[0], "xfsdump")) {
         dump_program = XFSDUMP;
-    else /* strcmp(argv[0], "xfsdump") != 0 */
+        validate_xfsdump_options(argc, argv);
+    } else /* strcmp(argv[0], "xfsdump") != 0 */
 
 #endif
 
@@ -160,9 +171,14 @@ main(
 
 #endif
 
+      {
 #if defined(DUMP)
+# if defined(USE_RUNDUMP_FOR_DUMP)
         dump_program = DUMP;
         validate_dump_option(argc, argv);
+# else
+        error("error [%s not running %s : run it directly]\n", get_pname(), DUMP);
+# endif
 #else
 # if defined(XFSDUMP)
         dump_program = XFSDUMP;
@@ -176,6 +192,7 @@ main(
 #  endif
 # endif
 #endif
+      }
 
 
     /*
@@ -197,6 +214,24 @@ main(
     amfree(cmdline);
 
     env = safe_env();
+    //Filter or Discard RSH Environmental variable
+    int env_count = 0;
+    for (int i = 0; env[i] != NULL; i++){
+        env_count++;
+    }
+    for (int i = 0; i < env_count; i++){
+        if (strncmp(env[i], "RSH=", 4) == 0){
+            // Remove RSH
+            g_free(env[i]);
+            // move array elements one step left - which are after "RSH"
+            for (int j = i; j < env_count; j++){
+                env[j] = env[j + 1];
+            }
+            //decrease the variable count
+            env[env_count-1] = NULL;
+            break;
+        }
+    }
     execve(dump_program, argv, env);
     free_env(env);
 
diff --git a/client-src/runtar.c b/client-src/runtar.c
index 499c7dfec..880068bc4 100644
--- a/client-src/runtar.c
+++ b/client-src/runtar.c
@@ -191,9 +191,13 @@ main(
 		g_str_has_prefix(argv[i],"--newer") ||
 		g_str_has_prefix(argv[i],"--exclude-from") ||
 		g_str_has_prefix(argv[i],"--files-from")) {
-		good_option++;
+		if (strchr(argv[i], '=')) {
+		    good_option++;
+		} else {
+		    /* Accept theses options with the following argument */
+		    good_option += 2;
+		}
 	    } else if (argv[i][0] != '-') {
-		/* argument values are accounted for here */
 		good_option++;
 	    }
 	}