Add --egd-socket option to override hard-coded default

Albert Chin gnupg-devel at thewrittenword.com
Fri Jun 7 16:06:02 CEST 2002


Attached is a patch against 1.0.7 to add a new command-line option,
--egd-socket=PATH, to override the pre-compiled
--with-egd-socket=PATH.

-- 
albert chin (china at thewrittenword.com)

-- snip snip
--- cipher/rndegd.c.orig	Fri Jun  7 06:50:37 2002
+++ cipher/rndegd.c	Fri Jun  7 07:03:20 2002
@@ -35,6 +35,7 @@
 #include "ttyio.h"
 #include "dynload.h"
 #include "cipher.h"
+#include "options.h"
 
 #ifdef IS_MODULE
   #define _(a) (a)
@@ -120,7 +121,10 @@
 	int addr_len;
       
       #ifdef EGD_SOCKET_NAME
-        bname = EGD_SOCKET_NAME;
+        if (opt.egd_socket)
+            bname = opt.egd_socket;
+        else
+            bname = EGD_SOCKET_NAME;
       #endif
         if ( !bname || !*bname )
             bname = "=entropy";
--- cipher/Makefile.am.orig	Fri Jun  7 07:04:39 2002
+++ cipher/Makefile.am	Fri Jun  7 07:05:03 2002
@@ -19,7 +19,8 @@
 ## Process this file with automake to produce Makefile.in
 
 
-INCLUDES = -I.. -I$(top_srcdir)/include -I$(top_srcdir)/intl
+INCLUDES = -I.. -I$(top_srcdir)/include -I$(top_srcdir)/intl \
+	-I$(top_srcdir)/g10
 
 noinst_LIBRARIES = libcipher.a
 
--- g10/options.h.orig	Fri Jun  7 06:52:24 2002
+++ g10/options.h	Fri Jun  7 06:52:45 2002
@@ -155,6 +155,7 @@
     int preserve_permissions;
     int no_homedir_creation;
     int show_keyring;
+    const char *egd_socket; /* override pre-compiled path to EGD socket */
 } opt;
 
 
--- g10/g10.c.orig	Fri Jun  7 06:53:11 2002
+++ g10/g10.c	Fri Jun  7 06:55:20 2002
@@ -68,6 +68,7 @@
     oUser	  = 'u',
     oVerbose	  = 'v',
     oCompress	  = 'z',
+    oEgdSocket	  = 'E',
     oNotation	  = 'N',
     oShowNotation,
     oNoShowNotation,
@@ -429,6 +430,7 @@
     { oNoShowPhotos, "no-show-photos", 0, N_("Don't show Photo IDs")},
     { oPhotoViewer,  "photo-viewer", 2, N_("Set command line to view Photo IDs")},
     { oNotation,   "notation-data", 2, N_("|NAME=VALUE|use this notation data")},
+    { oEgdSocket, "egd-socket", 2, N_("|PATH|override pre-compiled path to EGD socket")},
 
     { 302, NULL, 0, N_(
   "@\n(See the man page for a complete listing of all commands and options)\n"
@@ -1279,6 +1281,7 @@
           case oAllowSecretKeyImport: /* obsolete */ break;
 	  case oTryAllSecrets: opt.try_all_secrets = 1; break;
           case oTrustedKey: register_trusted_key( pargs.r.ret_str ); break;
+          case oEgdSocket: opt.egd_socket = m_strdup(pargs.r.ret_str); break;
           case oEnableSpecialFilenames:
             iobuf_enable_special_filenames (1);
             break;
--- doc/gpg.1.orig	Fri Jun  7 06:56:00 2002
+++ doc/gpg.1	Fri Jun  7 06:56:15 2002
@@ -366,6 +366,9 @@
 or zero, an endless sequence of random bytes will be emitted. 
 PLEASE, don't use this command unless you know what you are doing; it may 
 remove precious entropy from the system! 
+.IP "-E, --egd-socket \fBpath\fR" 10
+Use \fBpath\fR as the path to the entropy socket rathern than the
+compiled-in default.
 .IP "--gen-prime \fBmode\fR 		  \fBbits\fR 		   [\fBqbits\fR]" 10 
 Use the source, Luke :-). The output format is still subject to change. 
 .IP "--version" 10 




More information about the Gnupg-devel mailing list