75 |
|
|
76 |
|
ihost_config_t ihost_config; |
77 |
|
|
78 |
+ |
extern int errno; |
79 |
+ |
|
80 |
+ |
/* Taken from the OpenSSH code. Its licence included in function.*/ |
81 |
+ |
#ifndef HAVE_STRLCAT |
82 |
+ |
|
83 |
+ |
/* |
84 |
+ |
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> |
85 |
+ |
* All rights reserved. |
86 |
+ |
* |
87 |
+ |
* Redistribution and use in source and binary forms, with or without |
88 |
+ |
* modification, are permitted provided that the following conditions |
89 |
+ |
* are met: |
90 |
+ |
* 1. Redistributions of source code must retain the above copyright |
91 |
+ |
* notice, this list of conditions and the following disclaimer. |
92 |
+ |
* 2. Redistributions in binary form must reproduce the above copyright |
93 |
+ |
* notice, this list of conditions and the following disclaimer in the |
94 |
+ |
* documentation and/or other materials provided with the distribution. |
95 |
+ |
* 3. The name of the author may not be used to endorse or promote products |
96 |
+ |
* derived from this software without specific prior written permission. |
97 |
+ |
* |
98 |
+ |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
99 |
+ |
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
100 |
+ |
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
101 |
+ |
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
102 |
+ |
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
103 |
+ |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
104 |
+ |
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
105 |
+ |
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
106 |
+ |
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
107 |
+ |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
108 |
+ |
*/ |
109 |
+ |
|
110 |
+ |
/* |
111 |
+ |
* Appends src to string dst of size siz (unlike strncat, siz is the |
112 |
+ |
* full size of dst, not space left). At most siz-1 characters |
113 |
+ |
* will be copied. Always NUL terminates (unless siz <= strlen(dst)). |
114 |
+ |
* Returns strlen(src) + MIN(siz, strlen(initial dst)). |
115 |
+ |
* If retval >= siz, truncation occurred. |
116 |
+ |
*/ |
117 |
+ |
size_t |
118 |
+ |
strlcat(dst, src, siz) |
119 |
+ |
char *dst; |
120 |
+ |
const char *src; |
121 |
+ |
size_t siz; |
122 |
+ |
{ |
123 |
+ |
register char *d = dst; |
124 |
+ |
register const char *s = src; |
125 |
+ |
register size_t n = siz; |
126 |
+ |
size_t dlen; |
127 |
+ |
|
128 |
+ |
/* Find the end of dst and adjust bytes left but don't go past end */ |
129 |
+ |
while (n-- != 0 && *d != '\0') |
130 |
+ |
d++; |
131 |
+ |
dlen = d - dst; |
132 |
+ |
n = siz - dlen; |
133 |
+ |
|
134 |
+ |
if (n == 0) |
135 |
+ |
return(dlen + strlen(s)); |
136 |
+ |
while (*s != '\0') { |
137 |
+ |
if (n != 1) { |
138 |
+ |
*d++ = *s; |
139 |
+ |
n--; |
140 |
+ |
} |
141 |
+ |
s++; |
142 |
+ |
} |
143 |
+ |
*d = '\0'; |
144 |
+ |
|
145 |
+ |
return(dlen + (s - src)); /* count does not include NUL */ |
146 |
+ |
} |
147 |
+ |
|
148 |
+ |
#endif |
149 |
+ |
/* End strlcat function taken from OpenSSH */ |
150 |
+ |
|
151 |
|
void log_msg(int level, char *format, ...){ |
79 |
– |
extern int errno; |
152 |
|
int cur_errno; |
153 |
|
va_list ap; |
154 |
|
|
163 |
|
}else{ |
164 |
|
fprintf(ihost_config.log, "\n"); |
165 |
|
} |
166 |
+ |
fflush(ihost_config.log); |
167 |
|
} |
168 |
|
} |
169 |
|
|
294 |
|
time_t config_ttl=0; |
295 |
|
|
296 |
|
if((tcp_con=create_tcp_connection(ihost_state->filtermanager_host, ihost_state->filtermanager_port))==NULL){ |
297 |
< |
goto error; |
297 |
> |
return -1; |
298 |
|
} |
299 |
|
|
300 |
|
if(ihost_state->file_list!=NULL || ihost_state->last_modified!=NULL){ |
311 |
|
} |
312 |
|
|
313 |
|
if((tcp_comm(tcp_con, ihost_state->last_modified, &response, "OK"))==0){ |
314 |
< |
if((tcp_comm(tcp_con, "END", &response, "OK"))==0){ |
314 |
> |
if((tcp_comm(tcp_con, "END", &response, "OK"))!=0){ |
315 |
|
goto error; |
316 |
|
} |
317 |
|
fclose(tcp_con); |
579 |
|
y=page_stats->pages_pageout; |
580 |
|
} |
581 |
|
snprintf(tmp, size, \ |
582 |
< |
"<pages><swapins>%lld</swapins><swapouts>%lld</swapouts></pages>", \ |
582 |
> |
"<pages><pageins>%lld</pageins><pageouts>%lld</pageouts></pages>", \ |
583 |
|
x, \ |
584 |
|
y); |
585 |
|
|