Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Mar 2008 17:53:14 GMT
From:      Aaron Meihm <alm@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 136756 for review
Message-ID:  <200803031753.m23HrEY5069490@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=136756

Change 136756 by alm@alm_praetorian on 2008/03/03 17:52:28

	Adjust configuration parser for crypto commands.

Affected files ...

.. //depot/projects/trustedbsd/netauditd/conf.c#5 edit
.. //depot/projects/trustedbsd/netauditd/netauditd.h#9 edit

Differences ...

==== //depot/projects/trustedbsd/netauditd/conf.c#5 (text+ko) ====

@@ -51,19 +51,27 @@
 				exit(1); }
 
 static const struct conf_ent {
-	char		*c_mode;
-	char		*c_type;
+	char		*c_cmd;
+	char		*c_arg1;
+	char		*c_arg2;
 	int		c_min_args;
 	int		(*c_func)(args_t *);
 } conftab[] = {
-	{ "src", "pipe", 4, conf_parse_src_pipe },
-	{ "src", "net", 5, conf_parse_net },
-	{ "dst", "trail", 5, conf_parse_dst_trail },
-	{ "dst", "net", 6, conf_parse_net },
-	{ NULL, NULL, 0, NULL }
+	{ "src", NULL, "pipe", 4, conf_parse_src_pipe },
+	{ "src", NULL, "net", 5, conf_parse_net },
+	{ "dst", NULL, "trail", 5, conf_parse_dst_trail },
+	{ "dst", NULL, "net", 6, conf_parse_net },
+	{ "crypto", "keyfile", NULL, 3, conf_parse_keyfile },
+	{ NULL, NULL, NULL, 0, NULL }
 };
 
 int
+conf_parse_keyfile(args_t *a)
+{
+	return (0);
+}
+
+int
 conf_parse_net(args_t *a)
 {
 	struct addrinfo hints;
@@ -210,9 +218,12 @@
 	/* The minimum number of arguments for a command is 3. */
 	if (a->args_n < 3)
 		SYNTAX_ERROR(conf_path, lc)
-	for (cptr = conftab; cptr->c_type != NULL; cptr++) {
-		if ((strcmp(cptr->c_mode, a->args[0]) == 0) &&
-		    (strcmp(cptr->c_type, a->args[2]) == 0)) {
+	for (cptr = conftab; cptr->c_cmd != NULL; cptr++) {
+		if ((strcmp(cptr->c_cmd, a->args[0]) == 0) &&
+		    (cptr->c_arg1 ? (strcmp(cptr->c_arg1, a->args[1]) == 0)
+		    : 1) &&
+		    (cptr->c_arg2 ? (strcmp(cptr->c_arg2, a->args[2]) == 0)
+		    : 1)) {
 			if (a->args_n < cptr->c_min_args)
 				SYNTAX_ERROR(conf_path, lc)
 			if (cptr->c_func(a) == -1)
@@ -220,7 +231,7 @@
 			break;
 		}
 	}
-	if (cptr->c_type == NULL)
+	if (cptr->c_cmd == NULL)
 		SYNTAX_ERROR(conf_path, lc)
 	conf_free_args(a);
 }

==== //depot/projects/trustedbsd/netauditd/netauditd.h#9 (text+ko) ====

@@ -90,6 +90,7 @@
 void		conf_load(char *);
 int		conf_link_consumers(struct au_cmpnt *, args_t *, int);
 void		conf_parse(char *, int);
+int		conf_parse_keyfile(args_t *);
 int		conf_parse_src_pipe(args_t *);
 int		conf_parse_dst_trail(args_t *);
 int		conf_parse_net(args_t *);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803031753.m23HrEY5069490>