- distinguish downloads and uploads in the syslog messages
authorAndrew Tridgell <tridge@samba.org>
Sat, 16 May 1998 03:03:57 +0000 (03:03 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 16 May 1998 03:03:57 +0000 (03:03 +0000)
- add stats on uploads in syslog

clientserver.c
main.c

index 3647718..765cba7 100644 (file)
@@ -110,6 +110,8 @@ static int rsync_module(int fd, int i)
        char *host = client_name(fd);
        char *name = lp_name(i);
        int start_glob=0;
+       char *request=NULL;
+       extern int am_sender;
 
        if (!allow_access(addr, host, lp_hosts_allow(i), lp_hosts_deny(i))) {
                rprintf(FERROR,"rsync denied on module %s from %s (%s)\n",
@@ -211,8 +213,7 @@ static int rsync_module(int fd, int i)
 
                if (start_glob) {
                        if (start_glob == 1) {
-                               rprintf(FINFO,"rsync on %s from %s (%s)\n",
-                                       p, host, addr);
+                               request = strdup(p);
                                start_glob++;
                        }
                        glob_expand(name, argv, &argc, MAX_ARGS);
@@ -231,6 +232,13 @@ static int rsync_module(int fd, int i)
 
        parse_arguments(argc, argv);
 
+       if (request) {
+               rprintf(FINFO,"rsync %s %s from %s (%s)\n",
+                       am_sender?"on":"to",
+                       request, host, addr);
+               free(request);
+       }
+
        /* don't allow the logs to be flooded too fast */
        if (verbose > 1) verbose = 1;
 
diff --git a/main.c b/main.c
index 6dfaf39..0408f61 100644 (file)
--- a/main.c
+++ b/main.c
@@ -34,14 +34,15 @@ static void report(int f)
        extern int am_sender;
        extern int am_daemon;
 
-       if (!verbose) return;
-
        if (am_daemon) {
                rprintf(FINFO, "wrote %.0f bytes  read %.0f bytes  total size %.0f\n",
                        (double)write_total(),(double)read_total(),
                        (double)total_size);
+               if (f == -1 || !am_sender) return;
        }
 
+       if (!verbose) return;
+
        if (am_server && am_sender) {
                write_longint(f,read_total());
                write_longint(f,write_total());
@@ -295,6 +296,7 @@ static void do_server_recv(int f_in, int f_out, int argc,char *argv[])
        }
 
        status = do_recv(f_in,f_out,flist,local_name);
+       report(-1);
        exit_cleanup(status);
 }