[prev in list] [next in list] [prev in thread] [next in thread] 

List:       proftpd-committers
Subject:    [ProFTPD-committers] proftpd/modules mod_log.c,1.147,1.148
From:       TJ Saunders <castaglia () users ! sourceforge ! net>
Date:       2013-08-01 6:07:29
Message-ID: E1V4m2s-0002Cl-LS () sfs-ml-3 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/proftp/proftpd/modules
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv15227/modules

Modified Files:
	mod_log.c 
Log Message:

Make mod_log stash the configured LogFormat directives in the config tree,
so that other modules might also look up and use the LogFormat data.


Index: mod_log.c
===================================================================
RCS file: /cvsroot/proftp/proftpd/modules/mod_log.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -d -r1.147 -r1.148
--- mod_log.c	17 Jul 2013 06:26:26 -0000	1.147
+++ mod_log.c	1 Aug 2013 06:07:27 -0000	1.148
@@ -212,7 +212,7 @@
   return ret;
 }
 
-static void logformat(char *nickname, char *fmts) {
+static void logformat(const char *directive, char *nickname, char *fmts) {
   char *tmp, *arg;
   unsigned char format[4096] = {'\0'}, *outs;
   logformat_t *lf;
@@ -476,6 +476,20 @@
 
   xaset_insert_end(format_set, (xasetmember_t *) lf);
   formats = (logformat_t *) format_set->xas_list;
+
+  if (directive != NULL) {
+    config_rec *c;
+
+    /* Store the parsed format in the config tree as well, for use by other
+     * logging-related modules.
+     */
+    c = add_config_param(directive, 2, NULL, NULL);
+    c->argv[0] = pstrdup(c->pool, nickname);
+    c->argv[1] = palloc(c->pool, outs - format);
+
+    tmp = c->argv[1];
+    memcpy(tmp, format, outs - format); 
+  }
 }
 
 /* Syntax: LogFormat nickname "format string" */
@@ -483,7 +497,7 @@
   CHECK_ARGS(cmd, 2);
   CHECK_CONF(cmd, CONF_ROOT);
 
-  logformat(cmd->argv[1], cmd->argv[2]);
+  logformat(cmd->argv[0], cmd->argv[1], cmd->argv[2]);
   return PR_HANDLED(cmd);
 }
 
@@ -1690,7 +1704,7 @@
   log_pool = make_sub_pool(permanent_pool);
   pr_pool_tag(log_pool, "mod_log pool");
 
-  logformat("", "%h %l %u %t \"%r\" %s %b");
+  logformat(NULL, "", "%h %l %u %t \"%r\" %s %b");
   return;
 }
 
@@ -1712,7 +1726,7 @@
   pr_pool_tag(log_pool, "mod_log pool");
 
   /* Add the "default" extendedlog format */
-  logformat("", "%h %l %u %t \"%r\" %s %b");
+  logformat(NULL, "", "%h %l %u %t \"%r\" %s %b");
 
   pr_event_register(&log_module, "core.postparse", log_postparse_ev, NULL);
   pr_event_register(&log_module, "core.restart", log_restart_ev, NULL);


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
ProFTPD Committers Mailing List
proftpd-committers@proftpd.org
https://lists.sourceforge.net/lists/listinfo/proftp-committers
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic