19 Commits

Author SHA1 Message Date
Michael Rash
0015da4442 bug fix to honor the fwknop client --time-offset-plus and --time-offset-minus options 2011-11-22 22:34:10 -05:00
Michael Rash
50b48147c0 This commit fixes two memory leaks and adds a common exit function.
The two memory leaks were found with the test suite running in
--enable-valgrind mode - here are the relevant error messages:

For fwknopd server GPG clean up:

==345== 9 bytes in 1 blocks are definitely lost in loss record 2 of 2
==345==   at 0x4C2815C: malloc (vg_replace_malloc.c:236)
==345==   by 0x52F6B81: strdup (strdup.c:43)
==345==   by 0x10FA57: add_string_list_ent (access.c:308)
==345==   by 0x110513: parse_access_file (access.c:387)
==345==   by 0x10B5FB: main (fwknopd.c:193)

For fwknop client rc file processing:

==8045== 568 bytes in 1 blocks are still reachable in loss record 12 of 12
==8045==    at 0x4C2815C: malloc (vg_replace_malloc.c:236)
==8045==    by 0x50A53AA: __fopen_internal (iofopen.c:76)
==8045==    by 0x10C3FF: process_rc (config_init.c:446)
==8045==    by 0x10C8F6: config_init (config_init.c:671)
==8045==    by 0x10AC9E: main (fwknop.c:62)

There is also a new clean_exit() function that makes it easier to ensure that
resources are deallocated upon existing.
2011-11-10 22:33:32 -05:00
Michael Rash
044ea54d93 updated client SPA verbose message to include the server IP/host 2011-10-29 23:49:29 -04:00
Michael Rash
6388e8ac7f added 'const' to function prototype vars where possible
Added the 'const' qualifier to function prototype variables where possible.
In addition, reduced some functions to file-scope with 'static' where possible.

Also made a few minor changes to remove extra whitespace, and fixed a bug
in create_fwknoprc() to ensure the new fwknoprc filehandle is closed.
2011-10-25 21:00:40 -04:00
Michael Rash
87416c0cdf Replaced all strcpy() calls with strlcpy()
OpenBSD especially gives compiler warnings whenever strcpy() is used.  All such
calls have been replaced with strlcpy().
2011-09-09 22:09:37 -04:00
Michael Rash
1e47243574 Bug fix for uninitialized variable found with splint static analyzer
In the save_args() function the args_str_len variable was being used before
being initialized as reported via the splint static code analysis tool.  Here
is the splint output that found this bug:

client/fwknop.c:650:13: Variable args_str_len used before definition
  An rvalue is used that may not be initialized to a value on some execution
  path. (Use -usedef to inhibit warning)
2011-08-08 22:24:22 -04:00
Michael Rash
ca5f82c067 Removed legacy $Id$ tags from svn
$Id$ tags don't really mean anything to git so they have been removed from all
source files.
2011-06-18 20:53:40 -04:00
Damien Stuart
0f6ca00ac4 Updated the GPL blurb at the top of the source files. Added some missing copyright statements (Thanks to Franck Joncourt).
git-svn-id: file:///home/mbr/svn/fwknop/trunk@300 510a4753-2344-4c79-9c09-4d669213fbeb
2010-11-13 03:04:36 +00:00
Damien Stuart
5035cf0fed Added .fwknoprc file creation and processing. This allows for saved default and named configuration profiles. Updated fwknop manpage to reflect the new capability. Also cleaned up messages (errors, info) from the program.
git-svn-id: file:///home/mbr/svn/fwknop/trunk@234 510a4753-2344-4c79-9c09-4d669213fbeb
2010-07-05 22:49:03 +00:00
Damien Stuart
4373172289 Tweaks to eliminate warnings on win32 build of libfko and client.
git-svn-id: file:///home/mbr/svn/fwknop/trunk@207 510a4753-2344-4c79-9c09-4d669213fbeb
2010-02-06 19:27:54 +00:00
Damien Stuart
d0373a5b33 Fixed libfko so gpgme engine is gpg by default. Added functions to libfko to set/get path to gpgme engine. Fixed some memory leaks. Reworkd the get_user_pw routine. Added code in fwknopd to put back the "hQ" string on the front of incoming GPG-encypted message data. Removed the previously add pretty-print routine to configure. Updated configure to check for path to gpg executable. Updated docs accordingly.
git-svn-id: file:///home/mbr/svn/fwknop/trunk@205 510a4753-2344-4c79-9c09-4d669213fbeb
2010-02-06 03:43:54 +00:00
Michael Rash
b34c506a90 bug fix to ensure the --last-cmd re-parsing of command line args via getopt_long() has a reset index
git-svn-id: file:///home/mbr/svn/fwknop/trunk@200 510a4753-2344-4c79-9c09-4d669213fbeb
2010-01-20 01:18:12 +00:00
Michael Rash
d1fae9bee1 * Added a new command line argument "--last-cmd" to run the fwknop client
with the same command line arguments as the previous time it was
executed.  The previous arguments are parsed out of the ~/.fwknop.run
file (if it exists).
* Bug fix to not send any SPA packet out on the wire if a NULL password/key
is provided to the fwknop client.  This could happen if the user tried to
abort fwknop execution by sending the process a SIGINT while being
prompted to enter the password/key for SPA encryption.



git-svn-id: file:///home/mbr/svn/fwknop/trunk@193 510a4753-2344-4c79-9c09-4d669213fbeb
2010-01-16 01:05:41 +00:00
Michael Rash
768606906e updated SPA over HTTP packets to always begin the a slash right after the GET string, updated to print SPA packets over HTTP to stderr in test/verbose mode
git-svn-id: file:///home/mbr/svn/fwknop/trunk@134 510a4753-2344-4c79-9c09-4d669213fbeb
2009-08-11 03:11:57 +00:00
Damien Stuart
1781e9e758 Updated ip,port format and value check.
git-svn-id: file:///home/mbr/svn/fwknop/trunk@133 510a4753-2344-4c79-9c09-4d669213fbeb
2009-08-11 02:04:51 +00:00
Damien Stuart
78fb936a55 Some minor refactoring of the TIME_OFFSET handling. Other minor code formatting tweaks.
git-svn-id: file:///home/mbr/svn/fwknop/trunk@130 510a4753-2344-4c79-9c09-4d669213fbeb
2009-08-09 16:33:02 +00:00
Damien Stuart
53b7fae8bb Major rearrangement. Renamed directories: "fko" to "lib", "src" to "client". Added "common" and "server" directories. Setup autoconf to allow disabling the server and/or client builds.
git-svn-id: file:///home/mbr/svn/fwknop/trunk@127 510a4753-2344-4c79-9c09-4d669213fbeb
2009-08-09 15:43:16 +00:00
Damien Stuart
a82c361e28 Another major re-write of the fwknop library.
git-svn-id: file:///home/mbr/svn/fwknop/trunk@13 510a4753-2344-4c79-9c09-4d669213fbeb
2008-12-24 04:31:45 +00:00
Damien Stuart
deb85ddddf Total re-arrangement for autoconf/automake implementation.
git-svn-id: file:///home/mbr/svn/fwknop/trunk@12 510a4753-2344-4c79-9c09-4d669213fbeb
2008-12-21 19:11:51 +00:00