1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
diff -uNr proftpd-1.2.0pre10.old/contrib/mod_ratio.c proftpd-1.2.0pre10/contrib/mod_ratio.c
--- proftpd-1.2.0pre10.old/contrib/mod_ratio.c Mon Oct 11 05:13:12 1999
+++ proftpd-1.2.0pre10/contrib/mod_ratio.c Thu Feb 8 12:52:05 2001
@@ -338,7 +338,7 @@
if (stats.frate && stats.files < 1)
{
- add_response_err (R_550, g.filemsg);
+ add_response_err (R_550, "%s",g.filemsg);
add_response_err (R_550,
"%s: FILE RATIO: %s Down: %i Up: only %i!",
cmd->arg, stats.ftext, stats.fretr, stats.fstor);
@@ -355,7 +355,7 @@
if ((stats.bytes - fsize) < 0)
{
- add_response_err (R_550, g.bytemsg);
+ add_response_err (R_550, "%s",g.bytemsg);
add_response_err (R_550,
"%s: BYTE RATIO: %s Down: %i Up: only %i!",
cmd->arg, stats.btext, stats.bretr, stats.bstor);
@@ -447,9 +447,9 @@
{
add_response (r, "%s%s%s", sbuf1, sbuf2, sbuf3);
if (stats.frate && stats.files < 0)
- add_response (r, g.filemsg);
+ add_response (r, "%s",g.filemsg);
if (stats.brate && stats.bytes < 0)
- add_response (r, g.bytemsg);
+ add_response (r, "%s",g.bytemsg);
}
else
add_response (r, "%s%s%s", sbuf1, g.leechmsg ? " " : "", g.leechmsg);
diff -uNr proftpd-1.2.0pre10.old/src/dirtree.c proftpd-1.2.0pre10/src/dirtree.c
--- proftpd-1.2.0pre10.old/src/dirtree.c Tue Mar 7 20:16:03 2000
+++ proftpd-1.2.0pre10/src/dirtree.c Thu Feb 8 12:51:48 2001
@@ -332,25 +332,35 @@
/* Adds a config_rec to the specified set */
config_rec *add_config_set(xaset_t **set,const char *name)
{
- pool *p;
+ pool *conf_pool = NULL, *set_pool = NULL;
config_rec *c,*parent = NULL;
if(!*set) {
- p = make_sub_pool(permanent_pool);
- *set = xaset_create(p,NULL);
+ /* allocate a subpool from permanent_pool for the set
+ */
+ set_pool = make_sub_pool(permanent_pool);
+ *set = xaset_create(set_pool,NULL);
+ (*set)->mempool = set_pool;
+ /* now, make a subpool for the config_rec to be allocated
+ */
+ conf_pool = make_sub_pool(set_pool);
} else {
+ /* find the parent set for the config_rec to be allocated
+ */
if((*set)->xas_list)
parent = ((config_rec*)((*set)->xas_list))->parent;
- p = (*set)->mempool;
+ /* allocate a subpool for the config_rec from the parent's pool
+ */
+ conf_pool = make_sub_pool((*set)->mempool);
}
- c = (config_rec*)pcalloc(p,sizeof(config_rec));
+ c = (config_rec*) pcalloc(conf_pool,sizeof(config_rec));
- c->pool = p;
+ c->pool = conf_pool;
c->set = *set;
c->parent = parent;
if(name)
- c->name = pstrdup(p,name);
+ c->name = pstrdup(conf_pool,name);
xaset_insert_end(*set,(xasetmember_t*)c);
return c;
}
@@ -1919,15 +1929,27 @@
fset = c->set;
xaset_remove(fset,(xasetmember_t*)c);
-
+
+ /* if the set is empty, and has no more contained members in
+ * the xas_list, destroy the set
+ */
if(!fset->xas_list) {
- if(c->parent && c->parent->subset == fset) {
+
+ /* first, set any pointers to the container of the set to NULL
+ */
+ if(c->parent && c->parent->subset == fset)
c->parent->subset = NULL;
- destroy_pool(fset->mempool);
- } else if(s->conf == fset) {
+ else if(s->conf == fset)
s->conf = NULL;
+
+ /* next, destroy the set's pool, which destroys the set as well
+ */
destroy_pool(fset->mempool);
- }
+ } else {
+
+ /* if the set was not empty, destroy only the requested config_rec
+ */
+ destroy_pool(c->pool);
}
}
diff -uNr proftpd-1.2.0pre10.old/src/log.c proftpd-1.2.0pre10/src/log.c
--- proftpd-1.2.0pre10.old/src/log.c Tue Mar 7 20:16:03 2000
+++ proftpd-1.2.0pre10/src/log.c Thu Feb 8 12:51:39 2001
@@ -179,12 +179,15 @@
if(runfd > -1)
return 0;
- if(!mpid)
- snprintf(fname, sizeof(fname), "%s/proftpd-inetd",scoreboard_path);
- else
- snprintf(fname, sizeof(fname), "%s/proftpd-%d",scoreboard_path,(int)mpid);
+ if ( ! runfn ) {
+ if(!mpid)
+ snprintf(fname, sizeof(fname), "%s/proftpd-inetd",scoreboard_path);
+ else
+ snprintf(fname, sizeof(fname), "%s/proftpd-%d",scoreboard_path,(int)mpid);
+ fname[sizeof(fname-1)] = '\0';
- runfn = pstrdup(permanent_pool,fname);
+ runfn = pstrdup(permanent_pool,fname);
+ }
if((runfd = open(runfn,O_RDWR|O_CREAT|(trunc ? O_TRUNC : 0),
0644)) == -1)
return -1;
diff -uNr proftpd-1.2.0pre10.old/src/main.c proftpd-1.2.0pre10/src/main.c
--- proftpd-1.2.0pre10.old/src/main.c Thu Feb 8 12:47:06 2001
+++ proftpd-1.2.0pre10/src/main.c Thu Feb 8 12:51:35 2001
@@ -656,7 +656,7 @@
char *log = (char *) lv;
int exitcode = (int) ev;
- log_pri(pri, log);
+ log_pri(pri,"%s", log);
if(standalone && master)
log_pri(LOG_NOTICE, "ProFTPD %s standalone mode SHUTDOWN", VERSION);
@@ -789,9 +789,9 @@
log_pri(LOG_NOTICE,"%s",MODRET_ERRMSG(mr));
} else if(send_error) {
if(MODRET_ERRNUM(mr) && MODRET_ERRMSG(mr))
- add_response_err(MODRET_ERRNUM(mr),MODRET_ERRMSG(mr));
+ add_response_err(MODRET_ERRNUM(mr),"%s",MODRET_ERRMSG(mr));
else if(MODRET_ERRMSG(mr))
- send_response_raw(MODRET_ERRMSG(mr));
+ send_response_raw("%s",MODRET_ERRMSG(mr));
}
success = -1;
|