*
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
*
- * $Id: conffile.c,v 1.1 2000/11/20 11:43:22 laforge Exp $
+ * $Id: conffile.c,v 1.2 2001/02/04 13:08:02 laforge Exp $
*
* This code is distributed under the terms of GNU GPL */
* Return value: pointer to first char after word
* This function can deal with "" quotes
*/
-char* get_word(char *line, char *not, char *buf)
+static char *get_word(char *line, char *not, char *buf)
{
char *p, *start = NULL, *stop = NULL;
int inquote = 0;
if (!stop)
return NULL;
- strncpy(buf, start, stop-start);
+ strncpy(buf, start, (size_t) (stop-start));
*(buf + (stop-start)) = '\0';
/* skip quote character */
*
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
*
- * $Id: conffile.h,v 1.5 2000/09/12 14:29:37 laforge Exp $
+ * $Id: conffile.h,v 1.1 2000/11/20 11:43:22 laforge Exp $
*
* This code is distributed under the terms of GNU GPL */
} config_entry_t;
/* if an error occurs, config_errce is set to the erroneous ce */
-config_entry_t *config_errce;
+extern config_entry_t *config_errce;
/* tell us the name of the config file */
int config_register_file(const char *file);
#ifndef _ULOGD_H
#define _ULOGD_H
-/* ulogd, Version $Revision: 1.11 $
+/* ulogd, Version $Revision: 1.12 $
*
* userspace logging daemon for netfilter ULOG target
* of the linux 2.4 netfilter subsystem.
*
* this code is released under the terms of GNU GPL
*
- * $Id: ulogd.h,v 1.11 2001/02/04 10:15:19 laforge Exp $
+ * $Id: ulogd.h,v 1.12 2001/02/04 13:07:22 laforge Exp $
*/
#include <libipulog/libipulog.h>
ulog_iret_t *keyh_getres(unsigned int id);
/* the key hash itself */
-struct ulogd_keyh_entry *ulogd_keyh;
+extern struct ulogd_keyh_entry *ulogd_keyh;
#define IS_VALID(x) (x.flags & ULOGD_RETF_VALID)
-/* ulogd, Version $Revision: 1.14 $
+/* ulogd, Version $Revision: 1.15 $
*
* userspace logging daemon for the netfilter ULOG target
* of the linux 2.4 netfilter subsystem.
*
* this code is released under the terms of GNU GPL
*
- * $Id: ulogd.c,v 1.14 2001/01/29 11:45:22 laforge Exp $
+ * $Id: ulogd.c,v 1.15 2001/02/04 10:15:19 laforge Exp $
*/
#include <stdio.h>
/* get interpreter id by name */
unsigned int interh_getid(const char *name)
{
- int i;
+ unsigned int i;
for (i = 1; i <= ulogd_interh_ids; i++)
if (!strcmp(name, (ulogd_interh[i])->name))
return i;
/* dump out the contents of the interpreter hash */
static void interh_dump(void)
{
- int i;
+ unsigned int i;
for (i = 1; i <= ulogd_interh_ids; i++)
ulogd_log(ULOGD_DEBUG, "ulogd_interh[%d] = %s\n",
/* dump the keyhash to standard output */
static void keyh_dump(void)
{
- int i;
+ unsigned int i;
printf("dumping keyh\n");
for (i = 1; i <= ulogd_keyh_ids; i++)
- printf("ulogd_keyh[%d] = %s:%d\n", i, ulogd_keyh[i].interp->name,
- ulogd_keyh[i].offset);
+ printf("ulogd_keyh[%lu] = %s:%u\n", i,
+ ulogd_keyh[i].interp->name, ulogd_keyh[i].offset);
}
/* get keyid by name */
unsigned int keyh_getid(const char *name)
{
- int i;
+ unsigned int i;
for (i = 1; i <= ulogd_keyh_ids; i++)
if (!strcmp(name, ulogd_keyh[i].name))
return i;
/* try to lookup a registered interpreter for a given name */
static ulog_interpreter_t *find_interpreter(const char *name)
{
- int id;
+ unsigned int id;
id = interh_getid(name);
if (!id)
* target. */
void register_interpreter(ulog_interpreter_t *me)
{
- int i;
+ unsigned int i;
/* check if we already have an interpreter with this name */
if (find_interpreter(me->name)) {
/* all work done, we can prepend the new interpreter to the list */
if (ulogd_interpreters)
- me->result[me->key_num - 1].next = &ulogd_interpreters->result[0];
+ me->result[me->key_num - 1].next =
+ &ulogd_interpreters->result[0];
me->next = ulogd_interpreters;
ulogd_interpreters = me;
}
if (find_output(me->name)) {
ulogd_log(ULOGD_NOTICE, "output `%s' already registered\n",
me->name);
- exit(1);
+ exit(EXIT_FAILURE);
}
ulogd_log(ULOGD_NOTICE, "registering output `%s'\n", me->name);
me->next = ulogd_outputs;
ulog_iret_t *r;
for (r = ret; r; r = r->next) {
- if (r->flags & ULOGD_RETF_FREE)
+ if (r->flags & ULOGD_RETF_FREE) {
free(r->value.ptr);
+ r->value.ptr = NULL;
+ }
memset(&r->value, 0, sizeof(r->value));
r->flags &= ~ULOGD_RETF_VALID;
}