added %m, %P and %u options to logging
authorAndrew Tridgell <tridge@samba.org>
Fri, 30 Oct 1998 05:53:05 +0000 (05:53 +0000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 30 Oct 1998 05:53:05 +0000 (05:53 +0000)
clientserver.c
loadparm.c
log.c
rsyncd.conf.yo

index f7293bf..2bf0524 100644 (file)
@@ -24,6 +24,7 @@ extern int module_id;
 extern int read_only;
 extern int verbose;
 extern int rsync_port;
+char *auth_user;
 
 int start_socket_client(char *host, char *path, int argc, char *argv[])
 {
@@ -121,7 +122,6 @@ static int rsync_module(int fd, int i)
        char *addr = client_addr(fd);
        char *host = client_name(fd);
        char *name = lp_name(i);
-       char *user;
        int use_chroot = lp_use_chroot(i);
        int start_glob=0;
        int ret;
@@ -153,9 +153,9 @@ static int rsync_module(int fd, int i)
        }
 
        
-       user = auth_server(fd, i, addr, "@RSYNCD: AUTHREQD ");
+       auth_user = auth_server(fd, i, addr, "@RSYNCD: AUTHREQD ");
 
-       if (!user) {
+       if (!auth_user) {
                rprintf(FERROR,"auth failed on module %s from %s (%s)\n",
                        name, client_name(fd), client_addr(fd));
                io_printf(fd,"@ERROR: auth failed on module %s\n",name);
@@ -285,10 +285,10 @@ static int rsync_module(int fd, int i)
        ret = parse_arguments(argc, argv);
 
        if (request) {
-               if (*user) {
+               if (*auth_user) {
                        rprintf(FINFO,"rsync %s %s from %s@%s (%s)\n",
                                am_sender?"on":"to",
-                               request, user, host, addr);
+                               request, auth_user, host, addr);
                } else {
                        rprintf(FINFO,"rsync %s %s from %s (%s)\n",
                                am_sender?"on":"to",
index 150c618..8fe8e8d 100644 (file)
@@ -151,7 +151,7 @@ static service sDefault =
        NULL,    /* secrets file */
        NULL,    /* exclude */
        NULL,    /* exclude from */
-       "%o %h [%a] %f %l",    /* log format */
+       "%o %h [%a] %m (%u) %f %l ",    /* log format */
 };
 
 
diff --git a/log.c b/log.c
index e06617a..d09094c 100644 (file)
--- a/log.c
+++ b/log.c
@@ -195,6 +195,7 @@ void rflush(int fd)
 static void log_formatted(char *op, struct file_struct *file)
 {
        extern int module_id;
+       extern char *auth_user;
        char buf[1024];
        char *p, *s, *n;
        char buf2[100];
@@ -222,6 +223,9 @@ static void log_formatted(char *op, struct file_struct *file)
                        break;
                case 'o': n = op; break;
                case 'f': n = f_name(file); break;
+               case 'm': n = lp_name(module_id); break;
+               case 'P': n = lp_path(module_id); break;
+               case 'u': n = auth_user; break;
                }
 
                if (!n) continue;
index f326f0a..fefeca9 100644 (file)
@@ -126,6 +126,9 @@ itemize(
   it() %p for the process id of this rsync session
   it() %o for the operation, which is either "send" or "recv"
   it() %f for the filename
+  it() %P for the module path
+  it() %m for the module name
+  it() %u for the authenticated username (or the null string)
 )
 
 The default log format is "%o %h [%a] %f %l"