Got rid of RERR_LOG_FAILURE.
[rsync.git] / clientserver.c
index 0ed05145ec2e28a2d0eafc823cd039a04141d150..7c46c707b9850bde1b07bc12a0d14d88097227fc 100644 (file)
@@ -87,15 +87,12 @@ int start_socket_client(char *host, char *path, int argc, char *argv[])
                return -1;
        }
 
-       if ((p = strchr(host, '@')) != NULL) {
+       if ((p = strrchr(host, '@')) != NULL) {
                user = host;
                host = p+1;
                *p = '\0';
        }
 
-       if (rsync_port == 0)
-               rsync_port = RSYNC_PORT;
-
        fd = open_socket_out_wrapped(host, rsync_port, bind_address,
                                     default_af_hint);
        if (fd == -1)
@@ -103,7 +100,7 @@ int start_socket_client(char *host, char *path, int argc, char *argv[])
 
        ret = start_inband_exchange(user, path, fd, fd, argc);
 
-       return ret < 0? ret : client_run(fd, fd, -1, argc, argv);
+       return ret ? ret : client_run(fd, fd, -1, argc, argv);
 }
 
 int start_inband_exchange(char *user, char *path, int f_in, int f_out, 
@@ -199,10 +196,10 @@ int start_inband_exchange(char *user, char *path, int f_in, int f_out,
                        rprintf(FERROR, "%s\n", line);
                        /* This is always fatal; the server will now
                         * close the socket. */
-                       return RERR_STARTCLIENT;
-               } else {
-                       rprintf(FINFO,"%s\n", line);
+                       return -1;
                }
+
+               rprintf(FINFO, "%s\n", line);
        }
        kluge_around_eof = 0;
 
@@ -271,11 +268,9 @@ static int rsync_module(int f_in, int f_out, int i)
                return -1;
        }
 
-       auth_user = auth_server(f_in, f_out, i, addr, "@RSYNCD: AUTHREQD ");
+       auth_user = auth_server(f_in, f_out, i, host, addr, "@RSYNCD: AUTHREQD ");
 
        if (!auth_user) {
-               rprintf(FLOG, "auth failed on module %s from %s (%s)\n",
-                       name, host, addr);
                io_printf(f_out, "@ERROR: auth failed on module %s\n", name);
                return -1;
        }
@@ -286,10 +281,10 @@ static int rsync_module(int f_in, int f_out, int i)
                read_only = 1;
 
        if (lp_transfer_logging(i)) {
-               if (strstr(lp_log_format(i), "%i") != NULL)
+               if (log_format_has(lp_log_format(i), 'i'))
                        daemon_log_format_has_i = 1;
                if (daemon_log_format_has_i
-                   || strstr(lp_log_format(i), "%o") != NULL)
+                   || log_format_has(lp_log_format(i), 'o'))
                        daemon_log_format_has_o_or_i = 1;
        }
 
@@ -324,13 +319,11 @@ static int rsync_module(int f_in, int f_out, int i)
        /* TODO: Perhaps take a list of gids, and make them into the
         * supplementary groups. */
 
-       if (use_chroot) {
+       if (use_chroot || (module_dirlen = strlen(lp_path(i))) == 1) {
                module_dirlen = 0;
                set_filter_dir("/", 1);
-       } else {
-               module_dirlen = strlen(lp_path(i));
+       } else
                set_filter_dir(lp_path(i), module_dirlen);
-       }
 
        p = lp_filter(i);
        parse_rule(&server_filter_list, p, MATCHFLG_WORD_SPLIT,