[svn] assuan - r384 - in trunk: . doc src

svn author wk cvs at cvs.gnupg.org
Wed Aug 11 15:10:09 CEST 2010


Author: wk
Date: 2010-08-11 15:10:08 +0200 (Wed, 11 Aug 2010)
New Revision: 384

Modified:
   trunk/NEWS
   trunk/doc/assuan.texi
   trunk/src/ChangeLog
   trunk/src/assuan-defs.h
   trunk/src/assuan-pipe-connect.c
   trunk/src/assuan-socket-connect.c
   trunk/src/assuan.h.in
   trunk/src/client.c
   trunk/src/context.c
Log:
Add ASSUAN_CONVEY_COMMENTS flag.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2010-08-09 10:48:47 UTC (rev 383)
+++ trunk/src/ChangeLog	2010-08-11 13:10:08 UTC (rev 384)
@@ -1,3 +1,17 @@
+2010-08-11  Werner Koch  <wk at g10code.com>
+
+	* assuan.h.in (ASSUAN_CONVEY_COMMENTS): New.
+	* assuan-defs.h (struct assuan_context_s): Add flags.CONVEY_COMMENTS.
+	* context.c (assuan_set_flag, assuan_get_flag): Support this flag.
+	(_assuan_read_from_server): Add arg CONVEY_COMMENTS.  Change all
+	callers.
+	* client.c (assuan_transact): Implement new flags.
+
+2010-08-09  Werner Koch  <wk at g10code.com>
+
+	* assuan-socket-connect.c (assuan_socket_connect): Fix ipv6
+	literal IP case.
+
 2010-08-03  Marcus Brinkmann  <marcus at g10code.de>
 
 	* gpgcedev.c (GPGCEDEV_IOCTL_ASSIGN_RVID): New call ASSIGN_RVID.

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2010-08-09 10:48:47 UTC (rev 383)
+++ trunk/NEWS	2010-08-11 13:10:08 UTC (rev 384)
@@ -1,7 +1,14 @@
 Noteworthy changes in version 2.0.2
 ------------------------------------------------
 
+ * A new flag may now be used to convey comments via assuan_transact.
 
+ * Interface changes relative to the 2.0.1 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ASSUAN_CONVEY_COMMENTS   NEW.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+
 Noteworthy changes in version 2.0.1 (2010-08-09)
 ------------------------------------------------
 

Modified: trunk/doc/assuan.texi
===================================================================
--- trunk/doc/assuan.texi	2010-08-09 10:48:47 UTC (rev 383)
+++ trunk/doc/assuan.texi	2010-08-11 13:10:08 UTC (rev 384)
@@ -251,7 +251,7 @@
 @item S @var{keyword} <status information depending on keyword>
 Informational output by the server, still processing the request.  A
 client may not send such lines to the server while processing an Inquiry
-command.
+command.  @var{keyword} shall start with a letter or an underscore.
 
 @item # <string>
 Comment line issued only for debugging purposes.  Totally ignored.

Modified: trunk/src/assuan-defs.h
===================================================================
--- trunk/src/assuan-defs.h	2010-08-09 10:48:47 UTC (rev 383)
+++ trunk/src/assuan-defs.h	2010-08-11 13:10:08 UTC (rev 384)
@@ -87,6 +87,7 @@
     unsigned int no_waitpid : 1;
     unsigned int confidential : 1;
     unsigned int no_fixsignals : 1;
+    unsigned int convey_comments : 1;
   } flags;
 
   /* If set, this is called right before logging an I/O line.  */
@@ -281,7 +282,8 @@
 
 /*-- client.c --*/
 gpg_error_t _assuan_read_from_server (assuan_context_t ctx,
-				      assuan_response_t *okay, int *off);
+				      assuan_response_t *okay, int *off,
+                                      int convey_comments);
 
 /*-- assuan-error.c --*/
 

Modified: trunk/src/assuan-pipe-connect.c
===================================================================
--- trunk/src/assuan-pipe-connect.c	2010-08-09 10:48:47 UTC (rev 383)
+++ trunk/src/assuan-pipe-connect.c	2010-08-11 13:10:08 UTC (rev 384)
@@ -96,7 +96,7 @@
   int off;
   gpg_error_t err;
   
-  err = _assuan_read_from_server (ctx, &response, &off);
+  err = _assuan_read_from_server (ctx, &response, &off, 0);
   if (err)
     TRACE1 (ctx, ASSUAN_LOG_SYSIO, "initial_handshake", ctx,
 	    "can't connect server: %s", gpg_strerror (err));

Modified: trunk/src/assuan-socket-connect.c
===================================================================
--- trunk/src/assuan-socket-connect.c	2010-08-09 10:48:47 UTC (rev 383)
+++ trunk/src/assuan-socket-connect.c	2010-08-11 13:10:08 UTC (rev 384)
@@ -100,7 +100,7 @@
 
       file://<fname>
 
-        This is the same as the defualt just with an explicit schemata.
+        This is the same as the default just with an explicit schemata.
 
       assuan://<ipaddr>:<port>
       assuan://[<ip6addr>]:<port>
@@ -175,7 +175,7 @@
       if (!addrstr)
         return _assuan_error (ctx, gpg_err_code_from_syserror ());
 
-      if (*addrstr == '[')
+      if (*name == '[')
         {
           strcpy (addrstr, name+1);
           p = strchr (addrstr, ']');
@@ -276,7 +276,7 @@
     assuan_response_t response;
     int off;
 
-    err = _assuan_read_from_server (ctx, &response, &off);
+    err = _assuan_read_from_server (ctx, &response, &off, 0);
     if (err)
       TRACE1 (ctx, ASSUAN_LOG_SYSIO, "assuan_socket_connect", ctx,
 	      "can't connect to server: %s\n", gpg_strerror (err));

Modified: trunk/src/assuan.h.in
===================================================================
--- trunk/src/assuan.h.in	2010-08-09 10:48:47 UTC (rev 383)
+++ trunk/src/assuan.h.in	2010-08-11 13:10:08 UTC (rev 384)
@@ -161,6 +161,9 @@
 #define ASSUAN_CONFIDENTIAL 2
 /* This flag suppresses fix up of signal handlers for pipes.  */
 #define ASSUAN_NO_FIXSIGNALS 3
+/* This flag changes assuan_transact to return comment lines via the
+   status callback.  The default is to skip comment lines.  */
+#define ASSUAN_CONVEY_COMMENTS 4
 
 /* For context CTX, set the flag FLAG to VALUE.  Values for flags
    are usually 1 or 0 but certain flags might allow for other values;

Modified: trunk/src/client.c
===================================================================
--- trunk/src/client.c	2010-08-09 10:48:47 UTC (rev 383)
+++ trunk/src/client.c	2010-08-11 13:10:08 UTC (rev 384)
@@ -195,7 +195,7 @@
 
 gpg_error_t
 _assuan_read_from_server (assuan_context_t ctx, assuan_response_t *response,
-			  int *off)
+			  int *off, int convey_comments)
 {
   gpg_error_t rc;
   char *line;
@@ -209,7 +209,7 @@
       if (!rc)
         rc = assuan_client_parse_response (ctx, line, linelen, response, off);
     }
-  while (!rc && *response == ASSUAN_RESPONSE_COMMENT);
+  while (!rc && *response == ASSUAN_RESPONSE_COMMENT && !convey_comments);
 
   return rc;
 }
@@ -258,7 +258,8 @@
     return 0; /* Don't expect a response for a comment line.  */
 
  again:
-  rc = _assuan_read_from_server (ctx, &response, &off);
+  rc = _assuan_read_from_server (ctx, &response, &off,
+                                 ctx->flags.convey_comments);
   if (rc)
     return rc; /* error reading from server */
 
@@ -283,7 +284,7 @@
       if (!inquire_cb)
         {
           assuan_write_line (ctx, "END"); /* get out of inquire mode */
-          _assuan_read_from_server (ctx, &response, &off); /* dummy read */
+          _assuan_read_from_server (ctx, &response, &off, 0); /* dummy read */
           rc = _assuan_error (ctx, GPG_ERR_ASS_NO_INQUIRE_CB);
         }
       else
@@ -302,6 +303,14 @@
       if (!rc)
         goto again;
     }
+  else if (response == ASSUAN_RESPONSE_COMMENT && ctx->flags.convey_comments)
+    {
+      line -= off; /* Send line with the comment marker.  */
+      if (status_cb)
+        rc = status_cb (status_cb_arg, line);
+      if (!rc)
+        goto again;
+    }
   else if (response == ASSUAN_RESPONSE_END)
     {
       if (!data_cb)

Modified: trunk/src/context.c
===================================================================
--- trunk/src/context.c	2010-08-09 10:48:47 UTC (rev 383)
+++ trunk/src/context.c	2010-08-11 13:10:08 UTC (rev 384)
@@ -80,6 +80,10 @@
     case ASSUAN_NO_FIXSIGNALS:
       ctx->flags.no_fixsignals = value;
       break;
+
+    case ASSUAN_CONVEY_COMMENTS:
+      ctx->flags.convey_comments = value;
+      break;
     }
 }
 
@@ -108,6 +112,10 @@
     case ASSUAN_NO_FIXSIGNALS:
       res = ctx->flags.no_fixsignals;
       break;
+
+    case ASSUAN_CONVEY_COMMENTS:
+      res = ctx->flags.convey_comments;
+      break;
     }
 
   return TRACE_SUC1 ("flag_value=%i", res);





More information about the Gnupg-commits mailing list