gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, master, updated. gnutls_3_0_13-58-g194abfa


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_0_13-58-g194abfa
Date: Sun, 26 Feb 2012 10:39:22 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=194abfaa5869b19d737df5e0c640056fad9384ec

The branch, master has been updated
       via  194abfaa5869b19d737df5e0c640056fad9384ec (commit)
       via  f66383eff7fad47bd61b84f63325eb6e2825669b (commit)
       via  912479ea08018840da770963cb8666de62a3be6e (commit)
       via  c1d8f27d72a6efc96bf4f1901456bc4227a057ac (commit)
       via  b6f7c1f52c573c2b034e323208691c528c75c8d8 (commit)
       via  42116c1bc8a7579e5db33a8903c3eb93250e5584 (commit)
       via  50684ae4cdabf10228db865d0c5c4ebea8dcc747 (commit)
       via  de235d84bb5005cd936dac581229964f9465b69c (commit)
       via  3c3b03ec397a535057b45c094facae280f7fd686 (commit)
       via  c6ecdd8fa190fe2efddc03631d9f754368a3c25f (commit)
       via  ae3033fee01f058a028406648ebc32294774e282 (commit)
      from  cb2d61723ce1aadc1ee6d082f0bdcd59e27067da (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 194abfaa5869b19d737df5e0c640056fad9384ec
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sun Feb 26 11:44:50 2012 +0100

    documented fix

commit f66383eff7fad47bd61b84f63325eb6e2825669b
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sun Feb 26 11:43:53 2012 +0100

    When rehandshake is requested by server force the cleanup of the previous 
handshake state.

commit 912479ea08018840da770963cb8666de62a3be6e
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sun Feb 26 11:43:01 2012 +0100

    Added mini-dtls-rehandshake.c to test rehandshake in DTLS.

commit c1d8f27d72a6efc96bf4f1901456bc4227a057ac
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sun Feb 26 10:50:53 2012 +0100

    Corrected session resumption for DTLS

commit b6f7c1f52c573c2b034e323208691c528c75c8d8
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sun Feb 26 10:42:56 2012 +0100

    removed redundant test.

commit 42116c1bc8a7579e5db33a8903c3eb93250e5584
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sun Feb 26 02:36:07 2012 +0100

    fixes in DTLS rehandshake and epoch cleanup.

commit 50684ae4cdabf10228db865d0c5c4ebea8dcc747
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sun Feb 26 01:46:20 2012 +0100

    rehandshake command works in udp mode as well.

commit de235d84bb5005cd936dac581229964f9465b69c
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sun Feb 26 00:00:42 2012 +0100

    properly break lines.

commit 3c3b03ec397a535057b45c094facae280f7fd686
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sat Feb 25 23:57:27 2012 +0100

    updated

commit c6ecdd8fa190fe2efddc03631d9f754368a3c25f
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sat Feb 25 23:45:30 2012 +0100

    Updated libopts.

commit ae3033fee01f058a028406648ebc32294774e282
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sat Feb 25 21:59:12 2012 +0100

    always link against the distributed libopts

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                                         |    4 +-
 NEWS                                               |    3 +
 configure.ac                                       |    3 +-
 doc/cha-gtls-app.texi                              |    3 +-
 doc/scripts/cleanup-autogen.pl                     |    3 +-
 lib/gnutls_buffers.c                               |    1 -
 lib/gnutls_constate.c                              |   33 ++-
 lib/gnutls_dtls.c                                  |   13 +-
 lib/gnutls_dtls.h                                  |   22 +-
 lib/gnutls_handshake.c                             |   32 ++-
 lib/gnutls_record.c                                |   10 +-
 src/common.c                                       |   16 +
 src/common.h                                       |    1 +
 src/libopts/Makefile.am                            |    2 +-
 src/libopts/ag-char-map.h                          |    6 +-
 src/libopts/alias.c                                |    2 +-
 src/libopts/ao-strs.c                              |    2 +-
 src/libopts/ao-strs.h                              |    2 +-
 src/libopts/autoopts.h                             |    2 +-
 src/libopts/autoopts/options.h                     |    6 +-
 src/libopts/autoopts/usage-txt.h                   |  334 ++++++++++----------
 src/libopts/compat/compat.h                        |    2 +-
 src/libopts/configfile.c                           |    4 +-
 src/libopts/cook.c                                 |    4 +-
 src/libopts/genshell.c                             |   18 +-
 src/libopts/genshell.h                             |    6 +-
 src/libopts/m4/libopts.m4                          |   36 +-
 src/libopts/numeric.c                              |    4 +-
 src/libopts/proto.h                                |    2 +-
 src/libopts/putshell.c                             |    2 +-
 src/libopts/value-type.h                           |    2 +-
 src/libopts/xat-attribute.h                        |    2 +-
 src/ocsptool-args.def                              |   13 +-
 src/p11tool-args.def                               |   26 +-
 src/serv.c                                         |    9 +-
 src/udp-serv.c                                     |   29 ++-
 tests/Makefile.am                                  |    4 +-
 tests/{mini-loss.c => mini-dtls-rehandshake.c}     |  176 ++++++-----
 ...{mini-x509-rehandshake.c => mini-rehandshake.c} |    2 +-
 tests/{resume.c => resume-dtls.c}                  |    8 +-
 40 files changed, 464 insertions(+), 385 deletions(-)
 rename tests/{mini-loss.c => mini-dtls-rehandshake.c} (73%)
 rename tests/{mini-x509-rehandshake.c => mini-rehandshake.c} (99%)
 copy tests/{resume.c => resume-dtls.c} (98%)

diff --git a/.gitignore b/.gitignore
index 9b7090c..9d9be4b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -520,7 +520,8 @@ tests/mini-deflate
 tests/mini-eagain
 tests/mini-eagain-dtls
 tests/mini-x509
-tests/mini-x509-rehandshake
+tests/mini-dtls-rehandshake
+tests/mini-rehandshake
 tests/moredn
 tests/mpi
 tests/netconf-psk
@@ -588,3 +589,4 @@ tests/dtls/dtls-stress
 doc/gnutls.epub
 doc/gnutls.xml
 tests/mini-tdb
+tests/resume-dtls
diff --git a/NEWS b/NEWS
index 8a06d66..f03470f 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,9 @@ is an old one.
 ** libgnutls: Corrected issue with select() that affected
 FreeBSD. This prevented establishing DTLS sessions.
 
+** libgnutls: Corrected rehandshake and resumption
+operations in DTLS. Reported by Sean Buckheister.
+
 ** API and ABI modifications:
 No changes since last version.
 
diff --git a/configure.ac b/configure.ac
index 4550adf..3d0a617 100644
--- a/configure.ac
+++ b/configure.ac
@@ -148,8 +148,8 @@ fi
 AM_CONDITIONAL(ENABLE_PKCS11, test "$with_p11_kit" != "no")
 
 dnl Checks for programs in src/ 
-PKG_CHECK_MODULES([autoopts], autoopts >= 36.2.11,, [enable_local_libopts=yes])
 
+enable_local_libopts=yes
 NEED_LIBOPTS_DIR=true
 LIBOPTS_CHECK([src/libopts])
 
@@ -504,7 +504,6 @@ if features are disabled)
 AC_MSG_NOTICE([Optional applications:
 
   crywrap app:      $libidn
-  local libopts:    $enable_local_libopts
 ])
 
 AC_MSG_NOTICE([Optional libraries:
diff --git a/doc/cha-gtls-app.texi b/doc/cha-gtls-app.texi
index 397da46..9319f64 100644
--- a/doc/cha-gtls-app.texi
+++ b/doc/cha-gtls-app.texi
@@ -954,7 +954,8 @@ Specifying RSA with AES-128-CBC:
 Specifying the defaults except ARCFOUR-128:
     "NORMAL:-ARCFOUR-128"
 
-Enabling the 128-bit secure ciphers, while disabling SSL 3.0 and enabling 
compression:
+Enabling the 128-bit secure ciphers, while disabling SSL 3.0 and 
+enabling compression:
     "SECURE128:-VERS-SSL3.0:+COMP-DEFLATE"
 @end example
 
diff --git a/doc/scripts/cleanup-autogen.pl b/doc/scripts/cleanup-autogen.pl
index d792195..fdc9ecd 100755
--- a/doc/scripts/cleanup-autogen.pl
+++ b/doc/scripts/cleanup-autogen.pl
@@ -26,10 +26,11 @@ my $menu = 0;
 my $i = 0;
 
 while ($line = <>) {
-  if ($line =~ /address@hidden/) {
+  if ($line =~ /address@hidden (.*)/) {
     if ($init == 0) {
       $init = 1;
     } else {
+      print "address@hidden";
       next;
     }
   }
diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c
index eee4dc3..bdef974 100644
--- a/lib/gnutls_buffers.c
+++ b/lib/gnutls_buffers.c
@@ -722,7 +722,6 @@ _gnutls_handshake_io_cache_int (gnutls_session_t session,
     &session->internals.handshake_send_buffer;
 
   bufel->epoch = (uint16_t)_gnutls_epoch_refcount_inc(session, 
EPOCH_WRITE_CURRENT);
-
   bufel->htype = htype;
   if (bufel->htype == GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC)
     bufel->type = GNUTLS_CHANGE_CIPHER_SPEC;
diff --git a/lib/gnutls_constate.c b/lib/gnutls_constate.c
index 7303010..84e6fe3 100644
--- a/lib/gnutls_constate.c
+++ b/lib/gnutls_constate.c
@@ -757,14 +757,10 @@ _gnutls_epoch_alloc (gnutls_session_t session, uint16_t 
epoch,
 }
 
 static inline int
-epoch_alive (gnutls_session_t session, record_parameters_st * params)
+epoch_is_active(gnutls_session_t session, record_parameters_st * params)
 {
   const security_parameters_st *sp = &session->security_parameters;
 
-  /* DTLS will, in addition, need to check the epoch timeout value. */
-  if (params->usage_cnt > 0)
-    return 1;
-
   if (params->epoch == sp->epoch_read)
     return 1;
   
@@ -777,6 +773,15 @@ epoch_alive (gnutls_session_t session, 
record_parameters_st * params)
   return 0;
 }
 
+static inline int
+epoch_alive (gnutls_session_t session, record_parameters_st * params)
+{
+  if (params->usage_cnt > 0)
+    return 1;
+
+  return epoch_is_active(session, params);
+}
+
 void
 _gnutls_epoch_gc (gnutls_session_t session)
 {
@@ -787,12 +792,18 @@ _gnutls_epoch_gc (gnutls_session_t session)
 
   /* Free all dead cipher state */
   for (i = 0; i < MAX_EPOCH_INDEX; i++)
-    if (session->record_parameters[i] != NULL
-        && !epoch_alive (session, session->record_parameters[i]))
-      {
-        _gnutls_epoch_free (session, session->record_parameters[i]);
-        session->record_parameters[i] = NULL;
-      }
+    {
+      if (session->record_parameters[i] != NULL)
+        {
+          if (!epoch_is_active(session, session->record_parameters[i]) && 
session->record_parameters[i]->usage_cnt)
+            _gnutls_record_log ("REC[%p]: Note inactive epoch %d has %d 
users\n", session, session->record_parameters[i]->epoch, 
session->record_parameters[i]->usage_cnt);
+          if (!epoch_alive (session, session->record_parameters[i]))
+            {
+              _gnutls_epoch_free (session, session->record_parameters[i]);
+              session->record_parameters[i] = NULL;
+            }
+        }
+    }
 
   /* Look for contiguous NULLs at the start of the array */
   for (i = 0; i < MAX_EPOCH_INDEX && session->record_parameters[i] == NULL;
diff --git a/lib/gnutls_dtls.c b/lib/gnutls_dtls.c
index f61fea3..93ba467 100644
--- a/lib/gnutls_dtls.c
+++ b/lib/gnutls_dtls.c
@@ -170,6 +170,14 @@ int ret;
     return gnutls_assert_val(GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET);
 }
 
+void _dtls_reset_hsk_state(gnutls_session_t session)
+{
+  session->internals.dtls.flight_init = 0;
+  drop_usage_count(session, &session->internals.handshake_send_buffer);
+  _mbuffer_head_clear(&session->internals.handshake_send_buffer);
+}
+
+
 #define UPDATE_TIMER { \
       session->internals.dtls.actual_retrans_timeout_ms *= 2; \
       session->internals.dtls.actual_retrans_timeout_ms %= MAX_DTLS_TIMEOUT; \
@@ -370,10 +378,7 @@ keep_up:
 
 end_flight:
   _gnutls_dtls_log ("DTLS[%p]: End of flight transmission.\n", session);
-
-  session->internals.dtls.flight_init = 0;
-  drop_usage_count(session, send_buffer);
-  _mbuffer_head_clear(send_buffer);
+  _dtls_reset_hsk_state(session);
 
 cleanup:
   if (buf != NULL)
diff --git a/lib/gnutls_dtls.h b/lib/gnutls_dtls.h
index f8b1a72..8ba67bf 100644
--- a/lib/gnutls_dtls.h
+++ b/lib/gnutls_dtls.h
@@ -24,14 +24,16 @@
 # define DTLS_H
 
 #include <config.h>
-#include "gnutls_int.h"
-#include "gnutls_buffers.h"
-#include "gnutls_mbuffers.h"
+#include <gnutls_int.h>
+#include <gnutls_buffers.h>
+#include <gnutls_mbuffers.h>
+#include <gnutls_constate.h>
 #include <timespec.h>
 
 int _dtls_transmit(gnutls_session_t session);
 int _dtls_retransmit(gnutls_session_t session);
 int _dtls_record_check(struct record_parameters_st *rp, uint64 * _seq);
+void _dtls_reset_hsk_state(gnutls_session_t session);
 
 #define MAX_DTLS_TIMEOUT 60000
 
@@ -87,16 +89,24 @@ inline static void _dtls_async_timer_init(gnutls_session_t 
session)
       session->internals.dtls.async_term = gnutls_time(0) + 
MAX_DTLS_TIMEOUT/1000;
     }
   else
-    session->internals.dtls.async_term = 0;
+    {
+      _dtls_reset_hsk_state(session);
+      _gnutls_handshake_io_buffer_clear (session);
+      _gnutls_epoch_gc(session);
+      session->internals.dtls.async_term = 0;
+    }
 }
 
 inline static void _dtls_async_timer_delete(gnutls_session_t session)
 {
   if (session->internals.dtls.async_term != 0)
     {
-      _gnutls_dtls_log ("DTLS[%p]: Deinitializing handshake state.\n", 
session);
-      _gnutls_handshake_io_buffer_clear (session);
+      _gnutls_dtls_log ("DTLS[%p]: Deinitializing previous handshake 
state.\n", session);
       session->internals.dtls.async_term = 0; /* turn off "timer" */
+
+      _dtls_reset_hsk_state(session);
+      _gnutls_handshake_io_buffer_clear (session);
+      _gnutls_epoch_gc(session);
     }
 }
 
diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c
index 573635a..3761b17 100644
--- a/lib/gnutls_handshake.c
+++ b/lib/gnutls_handshake.c
@@ -436,10 +436,20 @@ _gnutls_read_client_hello (gnutls_session_t session, 
uint8_t * data,
       return GNUTLS_E_UNEXPECTED_PACKET_LENGTH;
     }
   DECR_LEN (len, session_id_len);
-
   session_id = &data[pos];
-  ret = _gnutls_server_restore_session (session, session_id, session_id_len);
   pos += session_id_len;
+
+  if (IS_DTLS(session))
+   {
+     int cookie_size;
+
+     DECR_LEN (len, 1);
+     cookie_size = data[pos++];
+     DECR_LEN (len, cookie_size);
+     pos+=cookie_size;
+   }
+
+  ret = _gnutls_server_restore_session (session, session_id, session_id_len);
   
   if (session_id_len > 0) session->internals.resumption_requested = 1;
 
@@ -486,16 +496,6 @@ _gnutls_read_client_hello (gnutls_session_t session, 
uint8_t * data,
       session->internals.resumed = RESUME_FALSE;
     }
 
-  if (IS_DTLS(session))
-   {
-     int cookie_size;
-
-     DECR_LEN (len, 1);
-     cookie_size = data[pos++];
-     DECR_LEN (len, cookie_size);
-     pos+=cookie_size;
-   }
-
   /* Remember ciphersuites for later
    */
   DECR_LEN (len, 2);
@@ -2210,6 +2210,8 @@ gnutls_rehandshake (gnutls_session_t session)
   if (session->security_parameters.entity == GNUTLS_CLIENT)
     return GNUTLS_E_INVALID_REQUEST;
 
+  _dtls_async_timer_delete(session);
+
   ret =
     _gnutls_send_empty_handshake (session, GNUTLS_HANDSHAKE_HELLO_REQUEST,
                                   AGAIN (STATE50));
@@ -2945,7 +2947,11 @@ _gnutls_recv_hello_request (gnutls_session_t session, 
void *data,
     }
   type = ((uint8_t *) data)[0];
   if (type == GNUTLS_HANDSHAKE_HELLO_REQUEST)
-    return GNUTLS_E_REHANDSHAKE;
+    {
+      if (IS_DTLS(session))
+        session->internals.dtls.hsk_read_seq++;
+      return GNUTLS_E_REHANDSHAKE;
+    }
   else
     {
       gnutls_assert ();
diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c
index 1df5be6..8bf608b 100644
--- a/lib/gnutls_record.c
+++ b/lib/gnutls_record.c
@@ -458,12 +458,14 @@ _gnutls_send_int (gnutls_session_t session, 
content_type_t type,
 
   session->internals.record_send_buffer_user_size = 0;
 
-  _gnutls_record_log ("REC[%p]: Sent Packet[%d] %s(%d) with length: %d\n",
+  _gnutls_record_log ("REC[%p]: Sent Packet[%d] %s(%d) in epoch %d and length: 
%d\n",
                       session,
                       (unsigned int)
                       _gnutls_uint64touint32
                       (&record_state->sequence_number),
-                      _gnutls_packet2str (type), type, (int) cipher_size);
+                      _gnutls_packet2str (type), type, 
+                      (int) record_params->epoch,
+                      (int) cipher_size);
 
   return retval;
 }
@@ -831,10 +833,10 @@ record_read_headers (gnutls_session_t session,
           record->epoch = 0;
         }
 
-      _gnutls_record_log ("REC[%p]: SSL %d.%d %s packet received. Length: 
%d\n",
+      _gnutls_record_log ("REC[%p]: SSL %d.%d %s packet received. Epoch %d, 
length: %d\n",
                           session, (int)record->version[0], 
(int)record->version[1], 
                           _gnutls_packet2str (record->type),
-                          record->length);
+                          (int)record->epoch, record->length);
 
     }
 
diff --git a/src/common.c b/src/common.c
index f35f16f..65e9c72 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1029,3 +1029,19 @@ print_list (const char *priorities, int verbose)
     }
 }
 
+int check_command(gnutls_session_t session, const char* str)
+{
+int len = strlen(str);
+
+  if (len > 2 && str[0] == str[1] && str[0] == '*')
+    {
+      if (strncmp(str, "**REHANDSHAKE**",
+          sizeof ("**REHANDSHAKE**") - 1) == 0)
+        {
+          fprintf (stderr, "*** Sending rehandshake request\n");
+                   gnutls_rehandshake (session);
+          return 1;
+        }
+    }
+  return 0;
+}
diff --git a/src/common.h b/src/common.h
index da42835..0495bdb 100644
--- a/src/common.h
+++ b/src/common.h
@@ -58,3 +58,4 @@ int cert_verify (gnutls_session_t session, const char* 
hostname);
 
 const char *raw_to_string (const unsigned char *raw, size_t raw_size);
 void pkcs11_common (void);
+int check_command(gnutls_session_t session, const char* str);
diff --git a/src/libopts/Makefile.am b/src/libopts/Makefile.am
index 80b01e3..0346557 100644
--- a/src/libopts/Makefile.am
+++ b/src/libopts/Makefile.am
@@ -7,7 +7,7 @@ noinst_LTLIBRARIES      = libopts.la
 endif
 libopts_la_SOURCES      = libopts.c
 libopts_la_CPPFLAGS     = -I$(top_srcdir)
-libopts_la_LDFLAGS      = -version-info  36:2:11
+libopts_la_LDFLAGS      = -version-info  36:3:11
 EXTRA_DIST              = \
     ag-char-map.h           alias.c                 ao-strs.c  \
     ao-strs.h               autoopts/options.h      autoopts/project.h  \
diff --git a/src/libopts/ag-char-map.h b/src/libopts/ag-char-map.h
index 2a9105f..8c9b4f0 100644
--- a/src/libopts/ag-char-map.h
+++ b/src/libopts/ag-char-map.h
@@ -1,5 +1,5 @@
 /*
- *   Character mapping generated 02/10/12 19:53:35
+ *   Character mapping generated 02/25/12 13:14:41
  *
  *  This file contains the character classifications
  *  used by AutoGen and AutoOpts for identifying tokens.
@@ -26,6 +26,7 @@
 #ifdef HAVE_CONFIG_H
 # if defined(HAVE_INTTYPES_H)
 #   include <inttypes.h>
+
 # elif defined(HAVE_STDINT_H)
 #   include <stdint.h>
 
@@ -100,6 +101,7 @@
 //
 #endif /* 0 -- mapping spec. source */
 
+
 typedef uint32_t ag_char_map_mask_t;
 
 #define  IS_LOWER_CASE_CHAR( _c)       is_ag_char_map_char((char)( _c), 
0x000001)
@@ -218,7 +220,6 @@ static ag_char_map_mask_t const ag_char_map_table[128] = {
   /* x */ 0x002801, /* y */ 0x002801, /* z */ 0x002801, /* { */ 0x00A000,
   /* | */ 0x40A800, /* } */ 0x00A000, /* ~ */ 0x00A800, /*x7F*/ 0x000000
 };
-
 static inline int
 is_ag_char_map_char(char ch, ag_char_map_mask_t mask)
 {
@@ -239,5 +240,4 @@ brk_ag_char_map_chars(char * p, ag_char_map_mask_t mask)
     while ((*p != '\0') && (! is_ag_char_map_char(*p, mask)))  p++;
     return p;
 }
-
 #endif /* AG_CHAR_MAP_H_GUARD */
diff --git a/src/libopts/alias.c b/src/libopts/alias.c
index ad9606b..18a2fd6 100644
--- a/src/libopts/alias.c
+++ b/src/libopts/alias.c
@@ -2,7 +2,7 @@
 /**
  * \file alias.c
  *
- * Time-stamp:      "2012-02-10 19:41:42 bkorb"
+ * Time-stamp:      "2012-02-12 09:41:42 bkorb"
  *
  *   Automated Options Paged Usage module.
  *
diff --git a/src/libopts/ao-strs.c b/src/libopts/ao-strs.c
index f6e835e..34f7843 100644
--- a/src/libopts/ao-strs.c
+++ b/src/libopts/ao-strs.c
@@ -2,7 +2,7 @@
  * 
  * DO NOT EDIT THIS FILE   (ao-strs.c)
  * 
- * It has been AutoGen-ed  February 10, 2012 at 07:53:35 PM by AutoGen 5.15pre7
+ * It has been AutoGen-ed  February 25, 2012 at 01:14:41 PM by AutoGen 
5.15pre14
  * From the definitions    ao-strs.def
  * and the template file   strings
  *
diff --git a/src/libopts/ao-strs.h b/src/libopts/ao-strs.h
index 96f3750..8def7e0 100644
--- a/src/libopts/ao-strs.h
+++ b/src/libopts/ao-strs.h
@@ -2,7 +2,7 @@
  * 
  * DO NOT EDIT THIS FILE   (ao-strs.h)
  * 
- * It has been AutoGen-ed  February 10, 2012 at 07:53:35 PM by AutoGen 5.15pre7
+ * It has been AutoGen-ed  February 25, 2012 at 01:14:41 PM by AutoGen 
5.15pre14
  * From the definitions    ao-strs.def
  * and the template file   strings
  *
diff --git a/src/libopts/autoopts.h b/src/libopts/autoopts.h
index 14cbbf1..6c3fee7 100644
--- a/src/libopts/autoopts.h
+++ b/src/libopts/autoopts.h
@@ -2,7 +2,7 @@
 /*
  *  \file autoopts.h
  *
- *  Time-stamp:      "2012-02-10 19:04:40 bkorb"
+ *  Time-stamp:      "2012-02-12 09:04:40 bkorb"
  *
  *  This file defines all the global structures and special values
  *  used in the automated option processing library.
diff --git a/src/libopts/autoopts/options.h b/src/libopts/autoopts/options.h
index d425611..c23e2ba 100644
--- a/src/libopts/autoopts/options.h
+++ b/src/libopts/autoopts/options.h
@@ -2,7 +2,7 @@
  *  
  *  DO NOT EDIT THIS FILE   (options.h)
  *  
- *  It has been AutoGen-ed  February 10, 2012 at 07:53:40 PM by AutoGen 
5.15pre7
+ *  It has been AutoGen-ed  February 25, 2012 at 01:14:45 PM by AutoGen 
5.15pre14
  *  From the definitions    funcs.def
  *  and the template file   options_h
  *
@@ -65,8 +65,8 @@
  *  See the relevant generated header file to determine which and what
  *  values for "opt_name" are available.
  */
-#define OPTIONS_STRUCT_VERSION      147458
-#define OPTIONS_VERSION_STRING      "36:2:11"
+#define OPTIONS_STRUCT_VERSION      147459
+#define OPTIONS_VERSION_STRING      "36:3:11"
 #define OPTIONS_MINIMUM_VERSION     102400
 #define OPTIONS_MIN_VER_STRING      "25:0:0"
 #define OPTIONS_VER_TO_NUM(_v, _r)  (((_v) * 4096) + (_r))
diff --git a/src/libopts/autoopts/usage-txt.h b/src/libopts/autoopts/usage-txt.h
index 0e29fc1..53dde87 100644
--- a/src/libopts/autoopts/usage-txt.h
+++ b/src/libopts/autoopts/usage-txt.h
@@ -2,12 +2,12 @@
  *  
  *  DO NOT EDIT THIS FILE   (usage-txt.h)
  *  
- *  It has been AutoGen-ed  February 10, 2012 at 07:53:38 PM by AutoGen 
5.15pre7
+ *  It has been AutoGen-ed  February 25, 2012 at 01:14:43 PM by AutoGen 
5.15pre14
  *  From the definitions    usage-txt.def
  *  and the template file   usage-txt.tpl
  *
  *  This file handles all the bookkeeping required for tracking all the little
- *  tiny strings used by the AutoOpts library.  There are 145
+ *  tiny strings used by the AutoOpts library.  There are 144
  *  of them.  This is not versioned because it is entirely internal to the
  *  library and accessed by client code only in a very well-controlled way:
  *  they may substitute translated strings using a procedure that steps through
@@ -50,7 +50,7 @@ typedef struct {
   char*     utpz_GnuTimeArg;
   char*     utpz_GnuNumArg;
   char*     utpz_GnuStrArg;
-  cch_t*    apz_str[ 138 ];
+  cch_t*    apz_str[ 137 ];
 } usage_text_t;
 
 /*
@@ -136,78 +136,77 @@ extern usage_text_t option_usage_text;
 #define zMust                 (option_usage_text.apz_str[ 63])
 #define zNeedOne              (option_usage_text.apz_str[ 64])
 #define zNoArg                (option_usage_text.apz_str[ 65])
-#define zNoArgv               (option_usage_text.apz_str[ 66])
-#define zNoArgs               (option_usage_text.apz_str[ 67])
-#define zNoCreat              (option_usage_text.apz_str[ 68])
-#define zNoFlags              (option_usage_text.apz_str[ 69])
-#define zNoKey                (option_usage_text.apz_str[ 70])
-#define zNoLim                (option_usage_text.apz_str[ 71])
-#define zNoPreset             (option_usage_text.apz_str[ 72])
-#define zNoResetArg           (option_usage_text.apz_str[ 73])
-#define zNoRq_NoShrtTtl       (option_usage_text.apz_str[ 74])
-#define zNoRq_ShrtTtl         (option_usage_text.apz_str[ 75])
-#define zNoStat               (option_usage_text.apz_str[ 76])
-#define zNoState              (option_usage_text.apz_str[ 77])
-#define zNone                 (option_usage_text.apz_str[ 78])
-#define zNotDef               (option_usage_text.apz_str[ 79])
-#define zNotCmdOpt            (option_usage_text.apz_str[ 80])
-#define zNotEnough            (option_usage_text.apz_str[ 81])
-#define zNotFile              (option_usage_text.apz_str[ 82])
-#define zNotNumber            (option_usage_text.apz_str[ 83])
-#define zNotDate              (option_usage_text.apz_str[ 84])
-#define zNotDuration          (option_usage_text.apz_str[ 85])
-#define zNrmOptFmt            (option_usage_text.apz_str[ 86])
-#define zNumberOpt            (option_usage_text.apz_str[ 87])
-#define zOnlyOne              (option_usage_text.apz_str[ 88])
-#define zOptsOnly             (option_usage_text.apz_str[ 89])
-#define zOutputFail           (option_usage_text.apz_str[ 90])
-#define zPathFmt              (option_usage_text.apz_str[ 91])
-#define zPlsSendBugs          (option_usage_text.apz_str[ 92])
-#define zPreset               (option_usage_text.apz_str[ 93])
-#define zPresetFile           (option_usage_text.apz_str[ 94])
-#define zPresetIntro          (option_usage_text.apz_str[ 95])
-#define zProhib               (option_usage_text.apz_str[ 96])
-#define zReorder              (option_usage_text.apz_str[ 97])
-#define zRange                (option_usage_text.apz_str[ 98])
-#define zRangeAbove           (option_usage_text.apz_str[ 99])
-#define zRangeLie             (option_usage_text.apz_str[100])
-#define zRangeOnly            (option_usage_text.apz_str[101])
-#define zRangeOr              (option_usage_text.apz_str[102])
-#define zRangeErr             (option_usage_text.apz_str[103])
-#define zRangeExact           (option_usage_text.apz_str[104])
-#define zRangeScaled          (option_usage_text.apz_str[105])
-#define zRangeUpto            (option_usage_text.apz_str[106])
-#define zResetNotConfig       (option_usage_text.apz_str[107])
-#define zReqFmt               (option_usage_text.apz_str[108])
-#define zReqOptFmt            (option_usage_text.apz_str[109])
-#define zReqThese             (option_usage_text.apz_str[110])
-#define zReq_NoShrtTtl        (option_usage_text.apz_str[111])
-#define zReq_ShrtTtl          (option_usage_text.apz_str[112])
-#define zSepChars             (option_usage_text.apz_str[113])
-#define zSetMemberSettings    (option_usage_text.apz_str[114])
-#define zShrtGnuOptFmt        (option_usage_text.apz_str[115])
-#define zSixSpaces            (option_usage_text.apz_str[116])
-#define zStdBoolArg           (option_usage_text.apz_str[117])
-#define zStdBreak             (option_usage_text.apz_str[118])
-#define zStdFileArg           (option_usage_text.apz_str[119])
-#define zStdKeyArg            (option_usage_text.apz_str[120])
-#define zStdKeyLArg           (option_usage_text.apz_str[121])
-#define zStdTimeArg           (option_usage_text.apz_str[122])
-#define zStdNestArg           (option_usage_text.apz_str[123])
-#define zStdNoArg             (option_usage_text.apz_str[124])
-#define zStdNumArg            (option_usage_text.apz_str[125])
-#define zStdOptArg            (option_usage_text.apz_str[126])
-#define zStdReqArg            (option_usage_text.apz_str[127])
-#define zStdStrArg            (option_usage_text.apz_str[128])
-#define zTabHyp               (option_usage_text.apz_str[129])
-#define zTabHypAnd            (option_usage_text.apz_str[130])
-#define zTabout               (option_usage_text.apz_str[131])
-#define zThreeSpaces          (option_usage_text.apz_str[132])
-#define zTwoSpaces            (option_usage_text.apz_str[133])
-#define zUpTo                 (option_usage_text.apz_str[134])
-#define zValidKeys            (option_usage_text.apz_str[135])
-#define zVendOptsAre          (option_usage_text.apz_str[136])
-#define zVendIntro            (option_usage_text.apz_str[137])
+#define zNoArgs               (option_usage_text.apz_str[ 66])
+#define zNoCreat              (option_usage_text.apz_str[ 67])
+#define zNoFlags              (option_usage_text.apz_str[ 68])
+#define zNoKey                (option_usage_text.apz_str[ 69])
+#define zNoLim                (option_usage_text.apz_str[ 70])
+#define zNoPreset             (option_usage_text.apz_str[ 71])
+#define zNoResetArg           (option_usage_text.apz_str[ 72])
+#define zNoRq_NoShrtTtl       (option_usage_text.apz_str[ 73])
+#define zNoRq_ShrtTtl         (option_usage_text.apz_str[ 74])
+#define zNoStat               (option_usage_text.apz_str[ 75])
+#define zNoState              (option_usage_text.apz_str[ 76])
+#define zNone                 (option_usage_text.apz_str[ 77])
+#define zNotDef               (option_usage_text.apz_str[ 78])
+#define zNotCmdOpt            (option_usage_text.apz_str[ 79])
+#define zNotEnough            (option_usage_text.apz_str[ 80])
+#define zNotFile              (option_usage_text.apz_str[ 81])
+#define zNotNumber            (option_usage_text.apz_str[ 82])
+#define zNotDate              (option_usage_text.apz_str[ 83])
+#define zNotDuration          (option_usage_text.apz_str[ 84])
+#define zNrmOptFmt            (option_usage_text.apz_str[ 85])
+#define zNumberOpt            (option_usage_text.apz_str[ 86])
+#define zOnlyOne              (option_usage_text.apz_str[ 87])
+#define zOptsOnly             (option_usage_text.apz_str[ 88])
+#define zOutputFail           (option_usage_text.apz_str[ 89])
+#define zPathFmt              (option_usage_text.apz_str[ 90])
+#define zPlsSendBugs          (option_usage_text.apz_str[ 91])
+#define zPreset               (option_usage_text.apz_str[ 92])
+#define zPresetFile           (option_usage_text.apz_str[ 93])
+#define zPresetIntro          (option_usage_text.apz_str[ 94])
+#define zProhib               (option_usage_text.apz_str[ 95])
+#define zReorder              (option_usage_text.apz_str[ 96])
+#define zRange                (option_usage_text.apz_str[ 97])
+#define zRangeAbove           (option_usage_text.apz_str[ 98])
+#define zRangeLie             (option_usage_text.apz_str[ 99])
+#define zRangeOnly            (option_usage_text.apz_str[100])
+#define zRangeOr              (option_usage_text.apz_str[101])
+#define zRangeErr             (option_usage_text.apz_str[102])
+#define zRangeExact           (option_usage_text.apz_str[103])
+#define zRangeScaled          (option_usage_text.apz_str[104])
+#define zRangeUpto            (option_usage_text.apz_str[105])
+#define zResetNotConfig       (option_usage_text.apz_str[106])
+#define zReqFmt               (option_usage_text.apz_str[107])
+#define zReqOptFmt            (option_usage_text.apz_str[108])
+#define zReqThese             (option_usage_text.apz_str[109])
+#define zReq_NoShrtTtl        (option_usage_text.apz_str[110])
+#define zReq_ShrtTtl          (option_usage_text.apz_str[111])
+#define zSepChars             (option_usage_text.apz_str[112])
+#define zSetMemberSettings    (option_usage_text.apz_str[113])
+#define zShrtGnuOptFmt        (option_usage_text.apz_str[114])
+#define zSixSpaces            (option_usage_text.apz_str[115])
+#define zStdBoolArg           (option_usage_text.apz_str[116])
+#define zStdBreak             (option_usage_text.apz_str[117])
+#define zStdFileArg           (option_usage_text.apz_str[118])
+#define zStdKeyArg            (option_usage_text.apz_str[119])
+#define zStdKeyLArg           (option_usage_text.apz_str[120])
+#define zStdTimeArg           (option_usage_text.apz_str[121])
+#define zStdNestArg           (option_usage_text.apz_str[122])
+#define zStdNoArg             (option_usage_text.apz_str[123])
+#define zStdNumArg            (option_usage_text.apz_str[124])
+#define zStdOptArg            (option_usage_text.apz_str[125])
+#define zStdReqArg            (option_usage_text.apz_str[126])
+#define zStdStrArg            (option_usage_text.apz_str[127])
+#define zTabHyp               (option_usage_text.apz_str[128])
+#define zTabHypAnd            (option_usage_text.apz_str[129])
+#define zTabout               (option_usage_text.apz_str[130])
+#define zThreeSpaces          (option_usage_text.apz_str[131])
+#define zTwoSpaces            (option_usage_text.apz_str[132])
+#define zUpTo                 (option_usage_text.apz_str[133])
+#define zValidKeys            (option_usage_text.apz_str[134])
+#define zVendOptsAre          (option_usage_text.apz_str[135])
+#define zVendIntro            (option_usage_text.apz_str[136])
 
   /*
    *  First, set up the strings.  Some of these are writable.  These are all in
@@ -222,7 +221,7 @@ extern usage_text_t option_usage_text;
   static char    eng_zGnuTimeArg[] = "=Tim";
   static char    eng_zGnuNumArg[] = "=num";
   static char    eng_zGnuStrArg[] = "=str";
-static char const usage_txt[4619] =
+static char const usage_txt[4575] =
 /*     0 */ "malloc of %d bytes failed\n\0"
 /*    27 */ "AutoOpts function called without option descriptor\n\0"
 /*    79 */ "\tThis exceeds the compiled library version:  \0"
@@ -300,85 +299,84 @@ static char const usage_txt[4619] =
 /*  2359 */ "\t\t\t\t- must appear between %d and %d times\n\0"
 /*  2402 */ "ERROR:  The %s option is required\n\0"
 /*  2437 */ "%s: option `%s' cannot have an argument\n\0"
-/*  2478 */ "%s: cannot allocate new argument vector\n\0"
-/*  2519 */ "%s: Command line arguments not allowed\n\0"
-/*  2559 */ "error %d (%s) creating %s\n\0"
-/*  2586 */ "Options are specified by single or double hyphens and their 
name.\n\0"
-/*  2653 */ "%s error:  `%s' does not match any %s keywords\n\0"
-/*  2701 */ "\t\t\t\t- may appear multiple times\n\0"
-/*  2734 */ "\t\t\t\t- may not be preset\n\0"
-/*  2759 */ "The 'reset-option' option requires an argument\n\0"
-/*  2807 */ "   Arg Option-Name    Description\n\0"
-/*  2842 */ "  Flg Arg Option-Name    Description\n\0"
-/*  2880 */ "error %d (%s) stat-ing %s\n\0"
-/*  2907 */ "%s(optionRestore): error: no saved option state\n\0"
-/*  2956 */ "none\0"
-/*  2961 */ "'%s' not defined\n\0"
-/*  2979 */ "'%s' is not a command line option\n\0"
-/*  3014 */ "ERROR:  The %s option must appear %d times\n\0"
-/*  3058 */ "error:  cannot load options from non-regular file %s\n\0"
-/*  3112 */ "%s error:  `%s' is not a recognizable number\n\0"
-/*  3158 */ "%s error:  `%s' is not a recognizable date/time\n\0"
-/*  3207 */ "%s error:  `%s' is not a recognizable time duration\n\0"
-/*  3260 */ " %3s %s\0"
-/*  3268 */ "The '-#<number>' option may omit the hash char\n\0"
-/*  3316 */ "one %s%s option allowed\n\0"
-/*  3341 */ "All arguments are named options.\n\0"
-/*  3375 */ "Write failure to output file\0"
-/*  3404 */ " - reading file %s\0"
-/*  3423 */ "\n"
+/*  2478 */ "%s: Command line arguments not allowed\n\0"
+/*  2518 */ "error %d (%s) creating %s\n\0"
+/*  2545 */ "Options are specified by single or double hyphens and their 
name.\n\0"
+/*  2612 */ "%s error:  `%s' does not match any %s keywords\n\0"
+/*  2660 */ "\t\t\t\t- may appear multiple times\n\0"
+/*  2693 */ "\t\t\t\t- may not be preset\n\0"
+/*  2718 */ "The 'reset-option' option requires an argument\n\0"
+/*  2766 */ "   Arg Option-Name    Description\n\0"
+/*  2801 */ "  Flg Arg Option-Name    Description\n\0"
+/*  2839 */ "error %d (%s) stat-ing %s\n\0"
+/*  2866 */ "%s(optionRestore): error: no saved option state\n\0"
+/*  2915 */ "none\0"
+/*  2920 */ "'%s' not defined\n\0"
+/*  2938 */ "'%s' is not a command line option\n\0"
+/*  2973 */ "ERROR:  The %s option must appear %d times\n\0"
+/*  3017 */ "error:  cannot load options from non-regular file %s\n\0"
+/*  3071 */ "%s error:  `%s' is not a recognizable number\n\0"
+/*  3117 */ "%s error:  `%s' is not a recognizable date/time\n\0"
+/*  3166 */ "%s error:  `%s' is not a recognizable time duration\n\0"
+/*  3219 */ " %3s %s\0"
+/*  3227 */ "The '-#<number>' option may omit the hash char\n\0"
+/*  3275 */ "one %s%s option allowed\n\0"
+/*  3300 */ "All arguments are named options.\n\0"
+/*  3334 */ "Write failure to output file\0"
+/*  3363 */ " - reading file %s\0"
+/*  3382 */ "\n"
             "please send bug reports to:  %s\n\0"
-/*  3457 */ "\t\t\t\t- may NOT appear - preset only\n\0"
-/*  3493 */ "#  preset/initialization file\n"
+/*  3416 */ "\t\t\t\t- may NOT appear - preset only\n\0"
+/*  3452 */ "#  preset/initialization file\n"
             "#  %s#\n\0"
-/*  3531 */ "\n"
+/*  3490 */ "\n"
             "The following option preset mechanisms are supported:\n\0"
-/*  3587 */ "prohibits these options:\n\0"
-/*  3613 */ "Operands and options may be intermixed.  They will be 
reordered.\n\0"
-/*  3679 */ "%s%ld to %ld\0"
-/*  3692 */ "%sgreater than or equal to %ld\0"
-/*  3723 */ "%sIt must lie in one of the ranges:\n\0"
-/*  3760 */ "%sIt must be in the range:\n\0"
-/*  3788 */ ", or\n\0"
-/*  3794 */ "%s error:  %s option value ``%s'' is out of range.\n\0"
-/*  3846 */ "%s%ld exactly\0"
-/*  3860 */ "%sis scalable with a suffix: k/K/m/M/g/G/t/T\n\0"
-/*  3906 */ "%sless than or equal to %ld\0"
-/*  3934 */ "The --reset-option has not been configured.\n\0"
-/*  3979 */ "ERROR:  %s option requires the %s option\n\0"
-/*  4021 */ " %3s %-14s %s\0"
-/*  4035 */ "requires these options:\n\0"
-/*  4060 */ "   Arg Option-Name   Req?  Description\n\0"
-/*  4100 */ "  Flg Arg Option-Name   Req?  Description\n\0"
-/*  4143 */ "-_^\0"
-/*  4147 */ "or you may use a numeric representation.  Preceding these with a 
'!' will\n"
+/*  3546 */ "prohibits these options:\n\0"
+/*  3572 */ "Operands and options may be intermixed.  They will be 
reordered.\n\0"
+/*  3638 */ "%s%ld to %ld\0"
+/*  3651 */ "%sgreater than or equal to %ld\0"
+/*  3682 */ "%sIt must lie in one of the ranges:\n\0"
+/*  3719 */ "%sIt must be in the range:\n\0"
+/*  3747 */ ", or\n\0"
+/*  3753 */ "%s error:  %s option value %ld is out of range.\n\0"
+/*  3802 */ "%s%ld exactly\0"
+/*  3816 */ "%sis scalable with a suffix: k/K/m/M/g/G/t/T\n\0"
+/*  3862 */ "%sless than or equal to %ld\0"
+/*  3890 */ "The --reset-option has not been configured.\n\0"
+/*  3935 */ "ERROR:  %s option requires the %s option\n\0"
+/*  3977 */ " %3s %-14s %s\0"
+/*  3991 */ "requires these options:\n\0"
+/*  4016 */ "   Arg Option-Name   Req?  Description\n\0"
+/*  4056 */ "  Flg Arg Option-Name   Req?  Description\n\0"
+/*  4099 */ "-_^\0"
+/*  4103 */ "or you may use a numeric representation.  Preceding these with a 
'!' will\n"
             "clear the bits, specifying 'none' will clear all bits, and 'all' 
will set them\n"
             "all.  Multiple entries may be passed as an option argument 
list.\n\0"
-/*  4366 */ "%s\0"
-/*  4369 */ "      \0"
-/*  4376 */ "T/F\0"
-/*  4380 */ "\n"
+/*  4322 */ "%s\0"
+/*  4325 */ "      \0"
+/*  4332 */ "T/F\0"
+/*  4336 */ "\n"
             "%s\n\n"
             "%s\0"
-/*  4388 */ "Fil\0"
-/*  4392 */ "KWd\0"
-/*  4396 */ "Mbr\0"
-/*  4400 */ "Tim\0"
-/*  4404 */ "Cpx\0"
-/*  4408 */ "no \0"
-/*  4412 */ "Num\0"
-/*  4416 */ "opt\0"
-/*  4420 */ "YES\0"
-/*  4424 */ "Str\0"
-/*  4428 */ "\t\t\t\t- \0"
-/*  4435 */ "\t\t\t\t-- and \0"
-/*  4447 */ "\t\t\t\t%s\n\0"
-/*  4455 */ "   \0"
-/*  4459 */ "  \0"
-/*  4462 */ "\t\t\t\t- may appear up to %d times\n\0"
-/*  4495 */ "The valid \"%s\" option keywords are:\n\0"
-/*  4532 */ "These additional options are:\0"
-/*  4562 */ "The next option supports vendor supported extra options:";
+/*  4344 */ "Fil\0"
+/*  4348 */ "KWd\0"
+/*  4352 */ "Mbr\0"
+/*  4356 */ "Tim\0"
+/*  4360 */ "Cpx\0"
+/*  4364 */ "no \0"
+/*  4368 */ "Num\0"
+/*  4372 */ "opt\0"
+/*  4376 */ "YES\0"
+/*  4380 */ "Str\0"
+/*  4384 */ "\t\t\t\t- \0"
+/*  4391 */ "\t\t\t\t-- and \0"
+/*  4403 */ "\t\t\t\t%s\n\0"
+/*  4411 */ "   \0"
+/*  4415 */ "  \0"
+/*  4418 */ "\t\t\t\t- may appear up to %d times\n\0"
+/*  4451 */ "The valid \"%s\" option keywords are:\n\0"
+/*  4488 */ "These additional options are:\0"
+/*  4518 */ "The next option supports vendor supported extra options:";
 
 
   /*
@@ -387,7 +385,7 @@ static char const usage_txt[4619] =
    *  Aren't you glad you don't maintain this by hand?
    */
   usage_text_t option_usage_text = {
-    145,
+    144,
     eng_zGnuBoolArg, eng_zGnuKeyArg,  eng_zGnuFileArg, eng_zGnuKeyLArg,
     eng_zGnuTimeArg, eng_zGnuNumArg,  eng_zGnuStrArg,
     {
@@ -407,25 +405,25 @@ static char const usage_txt[4619] =
       usage_txt +1966, usage_txt +1973, usage_txt +1984, usage_txt +2010,
       usage_txt +2036, usage_txt +2079, usage_txt +2115, usage_txt +2166,
       usage_txt +2222, usage_txt +2256, usage_txt +2294, usage_txt +2359,
-      usage_txt +2402, usage_txt +2437, usage_txt +2478, usage_txt +2519,
-      usage_txt +2559, usage_txt +2586, usage_txt +2653, usage_txt +2701,
-      usage_txt +2734, usage_txt +2759, usage_txt +2807, usage_txt +2842,
-      usage_txt +2880, usage_txt +2907, usage_txt +2956, usage_txt +2961,
-      usage_txt +2979, usage_txt +3014, usage_txt +3058, usage_txt +3112,
-      usage_txt +3158, usage_txt +3207, usage_txt +3260, usage_txt +3268,
-      usage_txt +3316, usage_txt +3341, usage_txt +3375, usage_txt +3404,
-      usage_txt +3423, usage_txt +3457, usage_txt +3493, usage_txt +3531,
-      usage_txt +3587, usage_txt +3613, usage_txt +3679, usage_txt +3692,
-      usage_txt +3723, usage_txt +3760, usage_txt +3788, usage_txt +3794,
-      usage_txt +3846, usage_txt +3860, usage_txt +3906, usage_txt +3934,
-      usage_txt +3979, usage_txt +4021, usage_txt +4035, usage_txt +4060,
-      usage_txt +4100, usage_txt +4143, usage_txt +4147, usage_txt +4366,
-      usage_txt +4369, usage_txt +4376, usage_txt +4380, usage_txt +4388,
-      usage_txt +4392, usage_txt +4396, usage_txt +4400, usage_txt +4404,
-      usage_txt +4408, usage_txt +4412, usage_txt +4416, usage_txt +4420,
-      usage_txt +4424, usage_txt +4428, usage_txt +4435, usage_txt +4447,
-      usage_txt +4455, usage_txt +4459, usage_txt +4462, usage_txt +4495,
-      usage_txt +4532, usage_txt +4562
+      usage_txt +2402, usage_txt +2437, usage_txt +2478, usage_txt +2518,
+      usage_txt +2545, usage_txt +2612, usage_txt +2660, usage_txt +2693,
+      usage_txt +2718, usage_txt +2766, usage_txt +2801, usage_txt +2839,
+      usage_txt +2866, usage_txt +2915, usage_txt +2920, usage_txt +2938,
+      usage_txt +2973, usage_txt +3017, usage_txt +3071, usage_txt +3117,
+      usage_txt +3166, usage_txt +3219, usage_txt +3227, usage_txt +3275,
+      usage_txt +3300, usage_txt +3334, usage_txt +3363, usage_txt +3382,
+      usage_txt +3416, usage_txt +3452, usage_txt +3490, usage_txt +3546,
+      usage_txt +3572, usage_txt +3638, usage_txt +3651, usage_txt +3682,
+      usage_txt +3719, usage_txt +3747, usage_txt +3753, usage_txt +3802,
+      usage_txt +3816, usage_txt +3862, usage_txt +3890, usage_txt +3935,
+      usage_txt +3977, usage_txt +3991, usage_txt +4016, usage_txt +4056,
+      usage_txt +4099, usage_txt +4103, usage_txt +4322, usage_txt +4325,
+      usage_txt +4332, usage_txt +4336, usage_txt +4344, usage_txt +4348,
+      usage_txt +4352, usage_txt +4356, usage_txt +4360, usage_txt +4364,
+      usage_txt +4368, usage_txt +4372, usage_txt +4376, usage_txt +4380,
+      usage_txt +4384, usage_txt +4391, usage_txt +4403, usage_txt +4411,
+      usage_txt +4415, usage_txt +4418, usage_txt +4451, usage_txt +4488,
+      usage_txt +4518
     }
   };
 
diff --git a/src/libopts/compat/compat.h b/src/libopts/compat/compat.h
index 24abed2..9fe9b29 100644
--- a/src/libopts/compat/compat.h
+++ b/src/libopts/compat/compat.h
@@ -3,7 +3,7 @@
 /**
  * \file compat.h --- fake the preprocessor into handlng portability
  *
- *  Time-stamp:      "2012-02-10 17:00:09 bkorb"
+ *  Time-stamp:      "2012-02-12 09:00:09 bkorb"
  *
  *  compat.h is free software.
  *  This file is part of AutoGen.
diff --git a/src/libopts/configfile.c b/src/libopts/configfile.c
index 40d31c6..e3da1bb 100644
--- a/src/libopts/configfile.c
+++ b/src/libopts/configfile.c
@@ -1,7 +1,7 @@
 /**
  * \file configfile.c
  *
- *  Time-stamp:      "2012-01-29 15:57:40 bkorb"
+ *  Time-stamp:      "2012-02-25 12:54:32 bkorb"
  *
  *  configuration/rc/ini file handling.
  *
@@ -1369,7 +1369,7 @@ validate_struct(tOptions * pOpts, char const * pzProgram)
           || (pOpts->structVersion < OPTIONS_MINIMUM_VERSION )
        )  )  {
         static char const aover[] =
-            __STR(AO_CURRENT)":"__STR(AO_REVISION)":"__STR(AO_AGE)"\n";
+            STR(AO_CURRENT)":"STR(AO_REVISION)":"STR(AO_AGE)"\n";
 
         fprintf(stderr, zAO_Err, pzProgram, NUM_TO_VER(pOpts->structVersion));
         if (pOpts->structVersion > OPTIONS_STRUCT_VERSION )
diff --git a/src/libopts/cook.c b/src/libopts/cook.c
index a81ce91..c681ea3 100644
--- a/src/libopts/cook.c
+++ b/src/libopts/cook.c
@@ -1,7 +1,7 @@
 /**
  * \file cook.c
  *
- *  Time-stamp:      "2012-02-10 17:00:47 bkorb"
+ *  Time-stamp:      "2012-02-12 09:00:47 bkorb"
  *
  *  This file contains the routines that deal with processing quoted strings
  *  into an internal format.
@@ -59,7 +59,7 @@ contiguous_quote(char ** pps, char * pq, int * lnct_p);
  * err:  @code{NULL} is returned if the string is mal-formed.
 =*/
 unsigned int
-ao_string_cook_escape_char( char const* pzIn, char* pRes, uint_t nl )
+ao_string_cook_escape_char(char const* pzIn, char* pRes, uint_t nl)
 {
     unsigned int  res = 1;
 
diff --git a/src/libopts/genshell.c b/src/libopts/genshell.c
index 71e2c7d..9b62a3b 100644
--- a/src/libopts/genshell.c
+++ b/src/libopts/genshell.c
@@ -2,11 +2,11 @@
  *  
  *  DO NOT EDIT THIS FILE   (genshell.c)
  *  
- *  It has been AutoGen-ed  February 10, 2012 at 07:53:37 PM by AutoGen 
5.15pre7
+ *  It has been AutoGen-ed  February 25, 2012 at 01:14:42 PM by AutoGen 
5.15pre14
  *  From the definitions    genshell.def
  *  and the template file   options
  *
- * Generated from AutoOpts 36:2:11 templates.
+ * Generated from AutoOpts 36:3:11 templates.
  *
  *  AutoOpts is a copyrighted work.  This source file is not encumbered
  *  by AutoOpts licensing, but is provided under the licensing terms chosen
@@ -39,14 +39,14 @@
  *  with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#define OPTION_CODE_COMPILE 1
+#include "genshell.h"
 #include <sys/types.h>
 
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-#define OPTION_CODE_COMPILE 1
-#include "genshell.h"
 #ifdef  __cplusplus
 extern "C" {
 #endif
@@ -245,7 +245,7 @@ static tOptDesc optDesc[GENSHELL_OPTION_CT] = {
 #define zExplain        (genshellopt_opt_strs+1271)
 #define zDetail         (genshellopt_opt_strs+1452)
 #define zFullVersion    (genshellopt_opt_strs+1677)
-/* extracted from optcode.tlib near line 315 */
+/* extracted from optcode.tlib near line 349 */
 
 #if defined(ENABLE_NLS)
 # define OPTPROC_BASE OPTPROC_TRANSLATE
@@ -263,13 +263,19 @@ static tOptDesc optDesc[GENSHELL_OPTION_CT] = {
 /*
  *  Create the static procedure(s) declared above.
  */
+/**
+ * The callout function that invokes the GENSHELL_USAGE() macro.
+ *
+ * @param pOptions the AutoOpts option description structure
+ * @param pOptDesc the descriptor for the "help" (usage) option.
+ */
 static void
 doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
 {
     (void)pOptions;
     GENSHELL_USAGE(GENSHELLOPT_EXIT_SUCCESS);
 }
-/* extracted from optmain.tlib near line 1133 */
+/* extracted from optmain.tlib near line 1093 */
 
 #ifndef  PKGDATADIR
 # define PKGDATADIR ""
diff --git a/src/libopts/genshell.h b/src/libopts/genshell.h
index eecbe44..f0d36da 100644
--- a/src/libopts/genshell.h
+++ b/src/libopts/genshell.h
@@ -2,11 +2,11 @@
  *  
  *  DO NOT EDIT THIS FILE   (genshell.h)
  *  
- *  It has been AutoGen-ed  February 10, 2012 at 07:53:37 PM by AutoGen 
5.15pre7
+ *  It has been AutoGen-ed  February 25, 2012 at 01:14:42 PM by AutoGen 
5.15pre14
  *  From the definitions    genshell.def
  *  and the template file   options
  *
- * Generated from AutoOpts 36:2:11 templates.
+ * Generated from AutoOpts 36:3:11 templates.
  *
  *  AutoOpts is a copyrighted work.  This header file is not encumbered
  *  by AutoOpts licensing, but is provided under the licensing terms chosen
@@ -55,7 +55,7 @@
  *  tolerable version is at least as old as what was current when the header
  *  template was released.
  */
-#define AO_TEMPLATE_VERSION 147458
+#define AO_TEMPLATE_VERSION 147459
 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
  || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
 # error option template version mismatches autoopts/options.h header
diff --git a/src/libopts/m4/libopts.m4 b/src/libopts/m4/libopts.m4
index 0a01666..da55011 100644
--- a/src/libopts/m4/libopts.m4
+++ b/src/libopts/m4/libopts.m4
@@ -2,7 +2,7 @@ dnl  -*- buffer-read-only: t -*- vi: set ro:
 dnl 
 dnl DO NOT EDIT THIS FILE   (libopts.m4)
 dnl 
-dnl It has been AutoGen-ed  February 10, 2012 at 07:53:33 PM by AutoGen 
5.15pre7
+dnl It has been AutoGen-ed  February 25, 2012 at 01:14:39 PM by AutoGen 
5.15pre14
 dnl From the definitions    libopts.def
 dnl and the template file   conftest.tpl
 dnl
@@ -88,10 +88,6 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
   ])
   AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
   intptr_t, uintptr_t, uint_t, pid_t, size_t])
-  
-  # =====
-  # sizes
-  # =====
   AC_CHECK_SIZEOF(char*, 8)
   AC_CHECK_SIZEOF(int,   4)
   AC_CHECK_SIZEOF(long,  8)
@@ -158,7 +154,7 @@ AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[
   ) # end of AC_ARG_WITH libregex
 
   if test "${with_libregex+set}" = set && \
-     test "${withval}" = no
+     test "X${withval}" = Xno
   then ## disabled by request
     libopts_cv_with_libregex_root=no
     libopts_cv_with_libregex_cflags=no
@@ -167,14 +163,14 @@ AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[
 
   AC_ARG_WITH([libregex-cflags],
     AS_HELP_STRING([--with-libregex-cflags], [libregex compile flags]),
-    [libopts_cv_with_libregex_cflags=${with_regex_cflags}],
+    [libopts_cv_with_libregex_cflags=${with_libregex_cflags}],
     AC_CACHE_CHECK([whether with-libregex-cflags was specified], 
libopts_cv_with_libregex_cflags,
       libopts_cv_with_libregex_cflags=no)
   ) # end of AC_ARG_WITH libregex-cflags
 
   AC_ARG_WITH([libregex-libs],
     AS_HELP_STRING([--with-libregex-libs], [libregex link command arguments]),
-    [libopts_cv_with_libregex_libs=${with_regex_libs}],
+    [libopts_cv_with_libregex_libs=${with_libregex_libs}],
     AC_CACHE_CHECK([whether with-libregex-libs was specified], 
libopts_cv_with_libregex_libs,
       libopts_cv_with_libregex_libs=no)
   ) # end of AC_ARG_WITH libregex-libs
@@ -446,7 +442,7 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS],[
 
 dnl @synopsis  LIBOPTS_CHECK
 dnl
-dnl Time-stamp:        "2011-12-13 21:26:37 bkorb"
+dnl Time-stamp:        "2012-02-25 12:54:32 bkorb"
 dnl
 dnl If autoopts-config works, add the linking information to LIBS.
 dnl Otherwise, add ``libopts-${ao_rev}'' to SUBDIRS and run all
@@ -543,20 +539,24 @@ AC_DEFUN([LIBOPTS_CHECK_COMMON],[
   m4_popdef([AO_Libopts_Dir])
 [# end of AC_DEFUN of LIBOPTS_CHECK_COMMON]
 ])
+dnl
 dnl AC_CONFIG_FILES conditionalization requires using AM_COND_IF, however
 dnl AM_COND_IF is new to Automake 1.11.  To use it on new Automake without
 dnl requiring same, a fallback implementation for older Automake is provided.
 dnl Note that disabling of AC_CONFIG_FILES requires Automake 1.11, this code
 dnl is correct only in terms of m4sh generated script.
-m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [
-if test -z "$$1_TRUE"; then :
-  m4_n([$2])[]dnl
-m4_ifval([$3],
-[else
-  $3
-])dnl
-fi[]dnl
-])])
+dnl
+m4_ifndef([AM_COND_IF],
+  [AC_DEFUN([AM_COND_IF], [
+    if test -z "$$1_TRUE"; then :
+      m4_n([$2])[]dnl
+      m4_ifval([$3],[
+    else
+      $3
+    ])dnl
+    fi[]dnl
+  ])dnl
+])
 dnl
 AC_DEFUN([LIBOPTS_CHECK_NOBUILD], [
   m4_pushdef([AO_Libopts_Dir],
diff --git a/src/libopts/numeric.c b/src/libopts/numeric.c
index c6e6ba7..b709d07 100644
--- a/src/libopts/numeric.c
+++ b/src/libopts/numeric.c
@@ -2,7 +2,7 @@
 /**
  * \file numeric.c
  *
- *  Time-stamp:      "2012-01-29 19:10:40 bkorb"
+ *  Time-stamp:      "2012-02-25 12:54:32 bkorb"
  *
  *  This file is part of AutoOpts, a companion to AutoGen.
  *  AutoOpts is free software.
@@ -54,7 +54,7 @@ optionShowRange(tOptions * pOpts, tOptDesc * pOD, void * 
rng_table, int rng_ct)
         pz_indent = ONE_TAB_STR;
 
         fprintf(option_usage_fp, zRangeErr, pOpts->pzProgName,
-                pOD->pz_Name, pOD->optArg.argString);
+                pOD->pz_Name, pOD->optArg.argInt);
         pz_indent = "";
     }
 
diff --git a/src/libopts/proto.h b/src/libopts/proto.h
index 3f77b2c..de5f343 100644
--- a/src/libopts/proto.h
+++ b/src/libopts/proto.h
@@ -1,7 +1,7 @@
 /* -*- buffer-read-only: t -*- vi: set ro:
  *
  * Prototypes for autoopts
- * Generated Fri Feb 10 19:53:45 PST 2012
+ * Generated Sat Feb 25 13:14:51 PST 2012
  */
 #ifndef AUTOOPTS_PROTO_H_GUARD
 #define AUTOOPTS_PROTO_H_GUARD 1
diff --git a/src/libopts/putshell.c b/src/libopts/putshell.c
index 10d14bd..2c9dde5 100644
--- a/src/libopts/putshell.c
+++ b/src/libopts/putshell.c
@@ -2,7 +2,7 @@
 /**
  * \file putshell.c
  *
- * Time-stamp:      "2012-02-10 19:14:49 bkorb"
+ * Time-stamp:      "2012-02-12 09:14:49 bkorb"
  *
  *  This module will interpret the options set in the tOptions
  *  structure and print them to standard out in a fashion that
diff --git a/src/libopts/value-type.h b/src/libopts/value-type.h
index a2ca5ad..c459b7e 100644
--- a/src/libopts/value-type.h
+++ b/src/libopts/value-type.h
@@ -1,5 +1,5 @@
 /*
- *  Generated header for gperf generated source Fri Feb 10 19:53:37 PST 2012
+ *  Generated header for gperf generated source Sat Feb 25 13:14:42 PST 2012
  *  This file enumerates the list of names and declares the
  *  procedure for mapping string names to the enum value.
  */
diff --git a/src/libopts/xat-attribute.h b/src/libopts/xat-attribute.h
index b452b30..653c1ee 100644
--- a/src/libopts/xat-attribute.h
+++ b/src/libopts/xat-attribute.h
@@ -1,5 +1,5 @@
 /*
- *  Generated header for gperf generated source Fri Feb 10 19:53:37 PST 2012
+ *  Generated header for gperf generated source Sat Feb 25 13:14:42 PST 2012
  *  This file enumerates the list of names and declares the
  *  procedure for mapping string names to the enum value.
  */
diff --git a/src/ocsptool-args.def b/src/ocsptool-args.def
index b6efe43..ad9e4dd 100644
--- a/src/ocsptool-args.def
+++ b/src/ocsptool-args.def
@@ -172,7 +172,8 @@ format is used for these files, although @code{--inder} can 
be used to
 specify that the input files are in DER format.
 
 @example
-$ ocsptool -q --load-issuer issuer.pem --load-cert client.pem --outfile 
ocsp-request.der
+$ ocsptool -q --load-issuer issuer.pem --load-cert client.pem \
+           --outfile ocsp-request.der
 @end example
 
 When generating OCSP requests, the tool will add an OCSP extension
@@ -193,7 +194,8 @@ certificate needs to be in the set of trust anchors and the 
OCSP
 Extended Key Usage bit has to be asserted in the signer certificate.
 
 @example
-$ ocsptool -e --load-trust issuer.pem --load-response ocsp-response.der
+$ ocsptool -e --load-trust issuer.pem \
+           --load-response ocsp-response.der
 @end example
 
 The tool will print status of verification.
@@ -208,7 +210,8 @@ one certificate and it will be used to verify the signature 
in the
 OCSP response.  It will not check the Extended Key Usage bit.
 
 @example
-$ ocsptool -e --load-signer ocsp-signer.pem --load-response ocsp-response.der
+$ ocsptool -e --load-signer ocsp-signer.pem \
+           --load-response ocsp-response.der
 @end example
 
 This approach is normally only relevant in two situations.  The first
@@ -251,8 +254,8 @@ This means the CA support OCSP queries over HTTP.  We are 
now ready to
 create a OCSP request for the certificate.
 
 @example
-$ ocsptool --ask ocsp.CAcert.org --load-issuer issuer.pem  --load-cert 
cert.pem \
-           --outfile ocsp-response.der
+$ ocsptool --ask ocsp.CAcert.org --load-issuer issuer.pem \
+           --load-cert cert.pem --outfile ocsp-response.der
 @end example
 
 The request is sent via HTTP to the OCSP server address specified. If the
diff --git a/src/p11tool-args.def b/src/p11tool-args.def
index 5a058e4..b45d044 100644
--- a/src/p11tool-args.def
+++ b/src/p11tool-args.def
@@ -85,19 +85,19 @@ flag = {
 
 flag = {
     name      = generate-rsa;
-    descrip   = "Generates an RSA private-public key pair on the specified 
token";
-    doc = "";
+    descrip   = "Generate an RSA private-public key pair";
+    doc = "Generates an RSA private-public key pair on the specified token.";
 };
 
 flag = {
     name      = generate-dsa;
-    descrip   = "Generates an RSA private-public key pair on the specified 
token";
-    doc = "";
+    descrip   = "Generate an RSA private-public key pair";
+    doc = "Generates an RSA private-public key pair on the specified token.";
 };
 flag = {
     name      = generate-ecc;
-    descrip   = "Generates an RSA private-public key pair on the specified 
token";
-    doc = "";
+    descrip   = "Generate an RSA private-public key pair";
+    doc = "Generates an RSA private-public key pair on the specified token.";
 };
 
 flag = {
@@ -188,17 +188,17 @@ flag = {
     name      = sec-param;
     arg-type  = string;
     arg-name  = "Security parameter";
-    descrip   = "Specify the security level [low|legacy|normal|high|ultra].";
-    doc      = "This is alternative to the bits option.";
+    descrip   = "Specify the security level";
+    doc      = "This is alternative to the bits option. Available options are 
[low|legacy|normal|high|ultra].";
 };
 
 
 flag = {
     name      = inder;
-    descrip   = "Use DER/RAW format for input certificates and private keys";
+    descrip   = "Use DER/RAW format for input";
     disabled;
     disable   = "no";
-    doc      = "";
+    doc      = "Use DER/RAW format for input certificates and private keys.";
 };
 
 flag = {
@@ -239,8 +239,10 @@ $ p11tool --login --list-all "pkcs11:TOKEN-URL"
 
 To store a private key and a certificate in a token run:
 @example
-$ p11tool --login --write "pkcs11:URL" --load-privkey key.pem --label "Mykey"
-$ p11tool --login --write "pkcs11:URL" --load-certificate cert.pem --label 
"MyCert"
+$ p11tool --login --write "pkcs11:URL" --load-privkey key.pem \
+          --label "Mykey"
+$ p11tool --login --write "pkcs11:URL" --load-certificate cert.pem \
+          --label "MyCert"
 @end example
 _EOT_;
 };
diff --git a/src/serv.c b/src/serv.c
index e3a62e1..07ca200 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -839,15 +839,8 @@ get_response (gnutls_session_t session, char *request,
     {
       strip (request);
       fprintf (stderr, "received: %s\n", request);
-      if (request[0] == request[1] && request[0] == '*')
+      if (check_command(session, *response))
         {
-          if (strncmp
-              (request, "**REHANDSHAKE**",
-               sizeof ("**REHANDSHAKE**") - 1) == 0)
-            {
-              fprintf (stderr, "*** Sending rehandshake request\n");
-              gnutls_rehandshake (session);
-            }
           *response = NULL;
           *response_length = 0;
           return;
diff --git a/src/udp-serv.c b/src/udp-serv.c
index c4a376b..478435f 100644
--- a/src/udp-serv.c
+++ b/src/udp-serv.c
@@ -34,6 +34,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
+#include <common.h>
 #include "udp-serv.h"
 #include "list.h"
 
@@ -147,6 +148,18 @@ void udp_server(const char* name, int port, int mtu)
               ret = gnutls_record_recv_seq(session, buffer, MAX_BUFFER, 
sequence);
             } while(ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
 
+            if (ret == GNUTLS_E_REHANDSHAKE)
+              {
+                fprintf (stderr, "*** Received hello message\n");
+                do
+                  {
+                    ret = gnutls_handshake (session);
+                  }
+                while (ret == GNUTLS_E_INTERRUPTED ||
+                       ret == GNUTLS_E_AGAIN);
+                
+                if (ret == 0) continue;
+              }
             if (ret < 0)
               {
                 fprintf(stderr, "Error in recv(): %s\n", gnutls_strerror(ret));
@@ -157,16 +170,20 @@ void udp_server(const char* name, int port, int mtu)
                 printf("EOF\n\n");
                 break;
               }
+              
             buffer[ret] = 0;
             printf("received[%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x]: %s\n", 
sequence[0], sequence[1], sequence[2],
-              sequence[3], sequence[4], sequence[5], sequence[6], sequence[7], 
buffer);
+                   sequence[3], sequence[4], sequence[5], sequence[6], 
sequence[7], buffer);
 
-            /* reply back */
-            ret = gnutls_record_send(session, buffer, ret);
-            if (ret < 0)
+            if (check_command(session, buffer) == 0)
               {
-                fprintf(stderr, "Error in send(): %s\n", gnutls_strerror(ret));
-                break;
+                /* reply back */
+                ret = gnutls_record_send(session, buffer, ret);
+                if (ret < 0)
+                  {
+                    fprintf(stderr, "Error in send(): %s\n", 
gnutls_strerror(ret));
+                    break;
+                  }
               }
           }
       }
diff --git a/tests/Makefile.am b/tests/Makefile.am
index adfa354..40ce2c6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -65,9 +65,9 @@ ctests = mini-deflate simple gc set_pkcs12_cred certder 
certuniqueid  \
         crq_key_id x509sign-verify cve-2009-1415 cve-2009-1416         \
         crq_apis init_roundtrip pkcs12_s2k_pem dn2 mini-eagain         \
         nul-in-x509-names x509_altname pkcs12_encode mini-x509         \
-        mini-x509-rehandshake rng-fork mini-eagain-dtls mini-loss      \
+        mini-rehandshake rng-fork mini-eagain-dtls resume-dtls \
         x509cert x509cert-tl infoaccess rsa-encrypt-decrypt \
-        mini-loss-time mini-tdb
+        mini-loss-time mini-tdb mini-dtls-rehandshake
 
 if ENABLE_OCSP
 ctests += ocsp
diff --git a/tests/mini-loss.c b/tests/mini-dtls-rehandshake.c
similarity index 73%
rename from tests/mini-loss.c
rename to tests/mini-dtls-rehandshake.c
index a541c29..50fe6e4 100644
--- a/tests/mini-loss.c
+++ b/tests/mini-dtls-rehandshake.c
@@ -48,37 +48,10 @@ int main()
 
 #include "utils.h"
 
-/* This program simulates packet loss in DTLS datagrams using
- * the blocking functions. Idea taken from test app of
- * Sean Buckheister.
- */
+static void terminate(void);
 
-static void print_type(const unsigned char* buf, int size)
-{
-  if (buf[0] == 22 && size >= 13) {
-    if (buf[13] == 1)
-      fprintf(stderr, "Client Hello\n");
-    else if (buf[13] == 2)
-      fprintf(stderr, "Server Hello\n");
-    else if (buf[13] == 12)
-      fprintf(stderr, "Server Key exchange\n");
-    else if (buf[13] == 14)
-      fprintf(stderr, "Server Hello Done\n");
-    else if (buf[13] == 11)
-      fprintf(stderr, "Certificate\n");
-    else if (buf[13] == 16)
-      fprintf(stderr, "Client Key Exchange\n");
-    else if (buf[4] == 1)
-      fprintf(stderr, "Finished\n");
-    else if (buf[13] == 11)
-      fprintf(stderr, "Server Hello Done\n");
-    else
-      fprintf(stderr, "Unknown handshake\n");
-  } else if (buf[0] == 20) {
-    fprintf(stderr, "Change Cipher Spec\n");
-  } else
-    fprintf(stderr, "Unknown\n");
-}
+/* This program tests the rehandshake in DTLS
+ */
 
 static void
 server_log_func (int level, const char *str)
@@ -98,8 +71,6 @@ client_log_func (int level, const char *str)
 #define MAX_BUF 1024
 #define MSG "Hello TLS"
 
-static int counter;
-static int packet_to_lose;
 gnutls_session_t session;
 
 static ssize_t
@@ -107,23 +78,13 @@ push (gnutls_transport_ptr_t tr, const void *data, size_t 
len)
 {
 int fd = (long int)tr;
 
-  counter++;
-
-  if (packet_to_lose != -1 && packet_to_lose == counter) {
-    if (debug)
-      {
-        fprintf(stderr, "Discarding packet %d: ", counter);
-        print_type(data, len);
-      }
-    return len;
-  }
   return send(fd, data, len, 0);
 }
 
 static void
-client (int fd, int packet)
+client (int fd, int server_init)
 {
-  int ret, ii;
+  int ret;
   char buffer[MAX_BUF + 1];
   gnutls_anon_client_credentials_t anoncred;
   /* Need to enable anonymous KX specifically. */
@@ -150,9 +111,6 @@ client (int fd, int packet)
    */
   gnutls_credentials_set (session, GNUTLS_CRD_ANON, anoncred);
 
-  counter = 0;
-  packet_to_lose = packet;
-
   gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) fd);
   gnutls_transport_set_push_function (session, push);
 
@@ -181,13 +139,31 @@ client (int fd, int packet)
              gnutls_protocol_get_name (gnutls_protocol_get_version
                                        (session)));
 
-  do {
-    ret = gnutls_record_send (session, MSG, strlen (MSG));
-  } while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
+  if (!server_init)
+    {
+      do {
+        ret = gnutls_record_send (session, MSG, strlen (MSG));
+      } while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
 
-  do {
-    ret = gnutls_record_recv (session, buffer, MAX_BUF);
-  } while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
+      if (debug) success("Initiating client rehandshake\n");
+      do 
+        {
+          ret = gnutls_handshake (session);
+        }
+      while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
+
+      if (ret < 0)
+        {
+          fail ("2nd client gnutls_handshake: %s\n", gnutls_strerror(ret));
+          terminate();
+        }
+    }
+  else
+    {
+      do {
+        ret = gnutls_record_recv (session, buffer, MAX_BUF);
+      } while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
+    }
 
   if (ret == 0)
     {
@@ -197,21 +173,27 @@ client (int fd, int packet)
     }
   else if (ret < 0)
     {
-      fail ("client: Error: %s\n", gnutls_strerror (ret));
-      exit(1);
-    }
+      if (server_init && ret == GNUTLS_E_REHANDSHAKE)
+        {
+          if (debug) success("Initiating rehandshake due to server request\n");
+          do 
+            {
+              ret = gnutls_handshake (session);
+            }
+          while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
+        }
 
-  if (debug)
-    {
-      printf ("- Received %d bytes: ", ret);
-      for (ii = 0; ii < ret; ii++)
+      if (ret != 0)
         {
-          fputc (buffer[ii], stdout);
+          fail ("client: Error: %s\n", gnutls_strerror (ret));
+          exit(1);
         }
-      fputs ("\n", stdout);
     }
 
-  gnutls_bye (session, GNUTLS_SHUT_RDWR);
+  do {
+    ret = gnutls_record_send (session, MSG, strlen (MSG));
+  } while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
+  gnutls_bye (session, GNUTLS_SHUT_WR);
 
 end:
 
@@ -257,7 +239,7 @@ int status;
 }
 
 static void
-server (int fd, int packet)
+server (int fd, int server_init)
 {
 int ret;
 char buffer[MAX_BUF + 1];
@@ -275,9 +257,6 @@ char buffer[MAX_BUF + 1];
 
   session = initialize_tls_session ();
 
-  counter = 0;
-  packet_to_lose = packet;
-
   gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) fd);
   gnutls_transport_set_push_function (session, push);
 
@@ -304,10 +283,34 @@ char buffer[MAX_BUF + 1];
   /* see the Getting peer's information example */
   /* print_info(session); */
 
+  if (server_init)
+    {
+      if (debug) success("server: Sending dummy packet\n");
+      ret = gnutls_rehandshake(session);
+      if (ret < 0)
+        {
+          fail ("gnutls_rehandshake: %s\n", gnutls_strerror(ret));
+          terminate();
+        }
+
+      if (debug) success("server: Initiating rehandshake\n");
+      do 
+        {
+          ret = gnutls_handshake (session);
+        }
+      while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
+
+      if (ret < 0)
+        {
+          fail ("server: 2nd gnutls_handshake: %s\n", gnutls_strerror(ret));
+          terminate();
+        }
+    }
+
   for (;;)
     {
       memset (buffer, 0, MAX_BUF + 1);
-      
+
       do {
         ret = gnutls_record_recv (session, buffer, MAX_BUF);
       } while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
@@ -320,7 +323,18 @@ char buffer[MAX_BUF + 1];
         }
       else if (ret < 0)
         {
-          fail ("server: Received corrupted data(%d). Closing...\n", ret);
+          if (!server_init && ret == GNUTLS_E_REHANDSHAKE)
+            {
+              if (debug) success("Initiating rehandshake due to client 
request\n");
+              do 
+                {
+                  ret = gnutls_handshake (session);
+                }
+              while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
+              if (ret == 0) break;
+            }
+
+          fail ("server: Received corrupted data(%s). Closing...\n", 
gnutls_strerror(ret));
           terminate();
         }
       else if (ret > 0)
@@ -332,6 +346,8 @@ char buffer[MAX_BUF + 1];
           } while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
         }
     }
+  
+
   /* do not wait for the peer to close the connection.
    */
   gnutls_bye (session, GNUTLS_SHUT_WR);
@@ -347,15 +363,11 @@ char buffer[MAX_BUF + 1];
     success ("server: finished\n");
 }
 
-static void start (int server_packet, int client_packet)
+static void start (int server_initiated)
 {
   int fd[2];
   int ret;
   
-  if (debug)
-    fprintf(stderr, "\nWill discard %s packet %d\n", 
-      (client_packet!=-1)?"client":"server", 
(client_packet!=-1)?client_packet:server_packet);
-  
   ret = socketpair(AF_LOCAL, SOCK_DGRAM, 0, fd);
   if (ret < 0)
     {
@@ -375,14 +387,14 @@ static void start (int server_packet, int client_packet)
     {
       int status;
       /* parent */
-      server (fd[0], server_packet);
+      server (fd[0], server_initiated);
       wait (&status);
       if (WEXITSTATUS(status) != 0)
         fail("Child died with status %d\n", WEXITSTATUS(status));
     }
   else 
     {
-      client (fd[1], client_packet);
+      client (fd[1], server_initiated);
       exit(0);
     }
 }
@@ -390,16 +402,8 @@ static void start (int server_packet, int client_packet)
 void
 doit (void)
 {
-  start(-1, 1);
-  start(-1, 2);
-  start(-1, 3);
-  start(-1, 4);
-
-  start(1, -1);
-  start(2, -1);
-  start(3, -1);
-  start(4, -1);
-  start(5, -1);
+  start(0);
+  start(1);
 }
 
 #endif /* _WIN32 */
diff --git a/tests/mini-x509-rehandshake.c b/tests/mini-rehandshake.c
similarity index 99%
rename from tests/mini-x509-rehandshake.c
rename to tests/mini-rehandshake.c
index afad1bf..a5dc901 100644
--- a/tests/mini-x509-rehandshake.c
+++ b/tests/mini-rehandshake.c
@@ -32,7 +32,7 @@
 #include "utils.h"
 #include "eagain-common.h"
 
-const char* side;
+const char* side = "";
 
 static void
 tls_log_func (int level, const char *str)
diff --git a/tests/resume.c b/tests/resume-dtls.c
similarity index 98%
copy from tests/resume.c
copy to tests/resume-dtls.c
index 7388dc0..acdb8b5 100644
--- a/tests/resume.c
+++ b/tests/resume-dtls.c
@@ -113,10 +113,10 @@ client (struct params_res *params)
 
       /* Initialize TLS session
        */
-      gnutls_init (&session, GNUTLS_CLIENT);
+      gnutls_init (&session, GNUTLS_CLIENT|GNUTLS_DATAGRAM);
 
       /* Use default priorities */
-      gnutls_priority_set_direct (session, 
"NONE:+VERS-TLS-ALL:+CIPHER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-ALL:+ANON-DH", NULL);
+      gnutls_priority_set_direct (session, 
"NONE:+VERS-DTLS1.0:+CIPHER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-ALL:+ANON-DH", NULL);
 
       /* put the anonymous credentials to the current session
        */
@@ -240,12 +240,12 @@ initialize_tls_session (struct params_res *params)
 {
   gnutls_session_t session;
 
-  gnutls_init (&session, GNUTLS_SERVER);
+  gnutls_init (&session, GNUTLS_SERVER|GNUTLS_DATAGRAM);
 
   /* avoid calling all the priority functions, since the defaults
    * are adequate.
    */
-  gnutls_priority_set_direct (session, 
"NONE:+VERS-TLS-ALL:+CIPHER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-ALL:+ANON-DH", NULL);
+  gnutls_priority_set_direct (session, 
"NONE:+VERS-DTLS1.0:+CIPHER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-ALL:+ANON-DH", NULL);
 
   gnutls_credentials_set (session, GNUTLS_CRD_ANON, anoncred);
 


hooks/post-receive
-- 
GNU gnutls



reply via email to

[Prev in Thread] Current Thread [Next in Thread]