Removing now-redundant path-size check from send_if_directory().
[rsync/rsync.git] / clientserver.c
index 496a6ab..a7996c7 100644 (file)
@@ -56,7 +56,6 @@ extern char *files_from;
 extern char *tmpdir;
 extern struct chmod_mode_struct *chmod_modes;
 extern filter_rule_list daemon_filter_list;
-extern char curr_dir[MAXPATHLEN];
 #ifdef ICONV_OPTION
 extern char *iconv_opt;
 extern iconv_t ic_send, ic_recv;
@@ -614,6 +613,11 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
        }
 
        module_dir = lp_path(i);
+       if (*module_dir == '\0') {
+               rprintf(FLOG, "No path specified for module %s\n", name);
+               io_printf(f_out, "@ERROR: no path setting.\n");
+               return -1;
+       }
        if (use_chroot) {
                if ((p = strstr(module_dir, "/./")) != NULL) {
                        *p = '\0'; /* Temporary... */
@@ -810,7 +814,11 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
        }
 
        if (set_uid) {
-               if (setuid(uid) || seteuid(uid)) {
+               if (setuid(uid) < 0
+#ifdef HAVE_SETEUID
+                || seteuid(uid) < 0
+#endif
+               ) {
                        rsyserr(FLOG, errno, "setuid %ld failed", (long)uid);
                        io_printf(f_out, "@ERROR: setuid failed\n");
                        return -1;
@@ -947,7 +955,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
         && (use_chroot ? lp_numeric_ids(i) != False : lp_numeric_ids(i) == True))
                numeric_ids = -1; /* Set --numeric-ids w/o breaking protocol. */
 
-       if (lp_timeout(i) && lp_timeout(i) > io_timeout)
+       if (lp_timeout(i) && (!io_timeout || lp_timeout(i) < io_timeout))
                set_io_timeout(lp_timeout(i));
 
        /* If we have some incoming/outgoing chmod changes, append them to