From 97cb8dc29b9e6a4f46f9b7162d410fdab0f7d8af Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 30 Oct 1998 05:53:05 +0000 Subject: [PATCH] added %m, %P and %u options to logging --- clientserver.c | 10 +++++----- loadparm.c | 2 +- log.c | 4 ++++ rsyncd.conf.yo | 3 +++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/clientserver.c b/clientserver.c index f7293bf5..2bf0524a 100644 --- a/clientserver.c +++ b/clientserver.c @@ -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", diff --git a/loadparm.c b/loadparm.c index 150c618c..8fe8e8d8 100644 --- a/loadparm.c +++ b/loadparm.c @@ -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 e06617ae..d09094c6 100644 --- 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; diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo index f326f0a9..fefeca92 100644 --- a/rsyncd.conf.yo +++ b/rsyncd.conf.yo @@ -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" -- 2.34.1