Test harness for unsafe_symlink: just passes in argv[].
[rsync/rsync.git] / util.c
diff --git a/util.c b/util.c
index 940bf28..9b54c05 100644 (file)
--- a/util.c
+++ b/util.c
@@ -179,7 +179,8 @@ pid_t piped_child(char **command, int *f_in, int *f_out)
        return pid;
 }
 
-pid_t local_child(int argc, char **argv,int *f_in,int *f_out)
+pid_t local_child(int argc, char **argv,int *f_in,int *f_out,
+                 int (*child_main)(int, char **))
 {
        pid_t pid;
        int to_child_pipe[2];
@@ -215,7 +216,7 @@ pid_t local_child(int argc, char **argv,int *f_in,int *f_out)
                }
                if (to_child_pipe[0] != STDIN_FILENO) close(to_child_pipe[0]);
                if (from_child_pipe[1] != STDOUT_FILENO) close(from_child_pipe[1]);
-               start_server(STDIN_FILENO, STDOUT_FILENO, argc, argv);
+               child_main(argc, argv);
        }
 
        if (close(from_child_pipe[1]) < 0 ||
@@ -985,6 +986,18 @@ void show_progress(OFF_T ofs, OFF_T size)
 
 /**
  * Determine if a symlink points outside the current directory tree.
+ * This is considered "unsafe" because e.g. when mirroring somebody
+ * else's machine it might allow them to establish a symlink to
+ * /etc/passwd, and then read it through a web server.
+ *
+ * @param dest Target of the symlink in question.
+ *
+ * @param src Top source directory currently applicable.  Basically this
+ * is the first parameter to rsync in a simple invocation, but it's
+ * modified by flist.c in slightly complex ways.
+ *
+ * @retval True if unsafe
+ * @retval False is unsafe
  **/
 int unsafe_symlink(char *dest, char *src)
 {