[svn] GnuPG - r4625 - trunk/sm

svn author wk cvs at cvs.gnupg.org
Thu Nov 22 17:24:30 CET 2007


Author: wk
Date: 2007-11-22 17:24:21 +0100 (Thu, 22 Nov 2007)
New Revision: 4625

Modified:
   trunk/sm/ChangeLog
   trunk/sm/server.c
Log:
New command GETAUDITLOG


Modified: trunk/sm/ChangeLog
===================================================================
--- trunk/sm/ChangeLog	2007-11-19 16:32:05 UTC (rev 4624)
+++ trunk/sm/ChangeLog	2007-11-22 16:24:21 UTC (rev 4625)
@@ -1,3 +1,8 @@
+2007-11-22  Werner Koch  <wk at g10code.com>
+
+	* server.c (cmd_getauditlog): New.
+	(register_commands): Register GETAUDITLOG
+
 2007-11-19  Werner Koch  <wk at g10code.com>
 
 	* server.c (cmd_recipient, cmd_signer): Add error reason 11.

Modified: trunk/sm/server.c
===================================================================
--- trunk/sm/server.c	2007-11-19 16:32:05 UTC (rev 4624)
+++ trunk/sm/server.c	2007-11-22 16:24:21 UTC (rev 4625)
@@ -933,8 +933,43 @@
 }
 
 
+
+/* GETAUDITLOG
 
+   !!!WORK in PROGRESS!!!
+ */
+static int 
+cmd_getauditlog (assuan_context_t ctx, char *line)
+{
+  ctrl_t ctrl = assuan_get_pointer (ctx);
+  int  out_fd;
+  FILE *out_fp;
+  int rc;
 
+  if (!ctrl->audit)
+    return gpg_error (GPG_ERR_NO_DATA);
+
+  out_fd = translate_sys2libc_fd (assuan_get_output_fd (ctx), 1);
+  if (out_fd == -1)
+    return set_error (GPG_ERR_ASS_NO_OUTPUT, NULL);
+
+  out_fp = fdopen ( dup(out_fd), "w");
+  if (!out_fp)
+    {
+      return set_error (GPG_ERR_ASS_GENERAL, "fdopen() failed");
+    }
+  audit_print_result (ctrl->audit, out_fp);
+  rc = 0;
+  fclose (out_fp);
+
+  /* Close and reset the fd. */
+  assuan_close_output_fd (ctx);
+  return rc;
+}
+
+
+
+
 
 /* Tell the assuan library about our commands */
 static int
@@ -961,6 +996,7 @@
     { "DUMPSECRETKEYS",cmd_dumpsecretkeys },
     { "GENKEY",        cmd_genkey },
     { "DELKEYS",       cmd_delkeys },
+    { "GETAUDITLOG",   cmd_getauditlog },
     { NULL }
   };
   int i, rc;




More information about the Gnupg-commits mailing list