Changes to address header references, platform support, error messages, and the perl module test suite.

Rearranged headers to reduce duplication and remove local header
references from fko.h.
Removed references to headers that did not need to be explicitly set.
Moved the MAX_PROTO_STR_LEN and MAX_PORT_STR_LEN definitions to the
fko_limits.h file.
Fixed bug where invalid nat_access or command messages were returning
FKO_ERROR_INVALID_SPA_ACCESS_MSG error code instead of the one
appropriate to the message type.
Fixed bad nat_access_msg test in Perl module test suite (caught by new
validation code).
This commit is contained in:
Damien Stuart 2012-12-01 11:06:41 -05:00
parent 1ec9f4ae94
commit e3c4c045c6
12 changed files with 18 additions and 29 deletions

View File

@ -32,8 +32,6 @@
#define FKO_H 1
#include <time.h>
#include "fko_limits.h"
#include "fko_message.h"
#ifdef __cplusplus
extern "C" {

View File

@ -54,6 +54,9 @@
#define MAX_IPV4_STR_LEN 16
#define MIN_IPV4_STR_LEN 7
#define MAX_PROTO_STR_LEN 4 /* tcp, udp, icmp for now */
#define MAX_PORT_STR_LEN 5
/* Misc.
*/
#define FKO_ENCODE_TMP_BUF_SIZE 1024

View File

@ -32,19 +32,6 @@
#ifndef FKO_MESSAGE_H
#define FKO_MESSAGE_H 1
#if PLATFORM_OPENBSD
#include <sys/types.h>
#include <netinet/in.h>
#else
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#endif
#include <arpa/inet.h>
#define MAX_PROTO_STR_LEN 4 /* tcp, udp, icmp for now */
#define MAX_PORT_STR_LEN 5
/* SPA message format validation functions.
*/
int validate_cmd_msg(const char *msg);

View File

@ -99,6 +99,7 @@
#endif
#include "fko.h"
#include "fko_limits.h"
/* Get our program version from VERSION (defined in config.h).
*/

View File

@ -130,8 +130,6 @@ fi
%files -n libfko-devel
%defattr(-,root,root,-)
%attr(0644,root,root) %{_includedir}/fko.h
%attr(0644,root,root) %{_includedir}/fko_limits.h
%attr(0644,root,root) %{_includedir}/fko_message.h
%attr(0644,root,root) %{_infodir}/libfko.info*
%files server
@ -143,6 +141,10 @@ fi
%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/fwknop/access.conf
%changelog
* Sat Dec 1 2012 <dstuart@dstuart.org> - 2.0.4-1
- Removed uneeded include files (which had been added to address an issue that
has since been fixed).
* Thu Nov 15 2012 <mbr@cipherdyne.org>
- fwknop-2.0.4 release.

View File

@ -16,4 +16,4 @@ libfko_la_LDFLAGS = -version-info 0:4:0 $(GPGME_LIBS)
AM_CPPFLAGS = $(GPGME_CFLAGS) -I $(top_srcdir)/common
include_HEADERS = fko.h fko_limits.h fko_message.h
include_HEADERS = fko.h

View File

@ -32,8 +32,6 @@
#define FKO_H 1
#include <time.h>
#include "fko_limits.h"
#include "fko_message.h"
#ifdef __cplusplus
extern "C" {

View File

@ -54,6 +54,9 @@
#define MAX_IPV4_STR_LEN 16
#define MIN_IPV4_STR_LEN 7
#define MAX_PROTO_STR_LEN 4 /* tcp, udp, icmp for now */
#define MAX_PORT_STR_LEN 5
/* Misc.
*/
#define FKO_ENCODE_TMP_BUF_SIZE 1024

View File

@ -232,7 +232,7 @@ validate_cmd_msg(const char *msg)
/* Should always have a valid allow IP regardless of message type
*/
if((res = have_allow_ip(msg)) != FKO_SUCCESS)
return(res);
return(FKO_ERROR_INVALID_SPA_COMMAND_MSG);
/* Commands are fairly free-form so all we can really verify is
* there is something at all. Get past the IP and comma, and make
@ -292,7 +292,7 @@ validate_nat_access_msg(const char *msg)
/* Should always have a valid allow IP regardless of message type
*/
if((res = have_allow_ip(msg)) != FKO_SUCCESS)
return(res);
return(FKO_ERROR_INVALID_SPA_NAT_ACCESS_MSG);
/* Position ourselves beyond the allow IP and make sure we have
* a single port value
@ -304,7 +304,7 @@ validate_nat_access_msg(const char *msg)
ndx++;
if((res = have_port(ndx)) != FKO_SUCCESS)
return(res);
return(FKO_ERROR_INVALID_SPA_NAT_ACCESS_MSG);
if(msg[startlen-1] == ',')
return(FKO_ERROR_INVALID_SPA_NAT_ACCESS_MSG);

View File

@ -32,9 +32,6 @@
#ifndef FKO_MESSAGE_H
#define FKO_MESSAGE_H 1
#define MAX_PROTO_STR_LEN 4 /* tcp, udp, icmp for now */
#define MAX_PORT_STR_LEN 5
/* SPA message format validation functions.
*/
int validate_cmd_msg(const char *msg);

View File

@ -1,7 +1,7 @@
/*
*****************************************************************************
*
* File: fko_message.h
* File: fko_user.h
*
* Author: Michael Rash
*

View File

@ -179,8 +179,8 @@ is($f1->spa_message(), '1.1.1.1,udp/111', 'verify spa message');
# 91-92 - Nat Access
#
ok($f1->spa_nat_access('1.2.1.1,udp/211') == 0, 'set nat_access message');
is($f1->spa_nat_access(), '1.2.1.1,udp/211', 'verify nat_access message');
ok($f1->spa_nat_access('1.2.1.1,211') == 0, 'set nat_access message');
is($f1->spa_nat_access(), '1.2.1.1,211', 'verify nat_access message');
# 93-94 - Server Auth
#