[svn] GnuPG - r5425 - in branches/STABLE-BRANCH-1-4: . cipher g10 include scripts util
svn author wk
cvs at cvs.gnupg.org
Tue Sep 28 12:07:33 CEST 2010
Author: wk
Date: 2010-09-28 12:07:30 +0200 (Tue, 28 Sep 2010)
New Revision: 5425
Modified:
branches/STABLE-BRANCH-1-4/AUTHORS
branches/STABLE-BRANCH-1-4/ChangeLog
branches/STABLE-BRANCH-1-4/cipher/ChangeLog
branches/STABLE-BRANCH-1-4/cipher/random.c
branches/STABLE-BRANCH-1-4/g10/ChangeLog
branches/STABLE-BRANCH-1-4/g10/build-packet.c
branches/STABLE-BRANCH-1-4/g10/gpgv.c
branches/STABLE-BRANCH-1-4/g10/keyserver.c
branches/STABLE-BRANCH-1-4/g10/misc.c
branches/STABLE-BRANCH-1-4/g10/openfile.c
branches/STABLE-BRANCH-1-4/g10/plaintext.c
branches/STABLE-BRANCH-1-4/include/ChangeLog
branches/STABLE-BRANCH-1-4/include/ttyio.h
branches/STABLE-BRANCH-1-4/scripts/mk-w32-dist
branches/STABLE-BRANCH-1-4/util/ChangeLog
branches/STABLE-BRANCH-1-4/util/iobuf.c
branches/STABLE-BRANCH-1-4/util/logger.c
branches/STABLE-BRANCH-1-4/util/pka.c
branches/STABLE-BRANCH-1-4/util/ttyio.c
Log:
Minor changes to help the VMS port
Modified: branches/STABLE-BRANCH-1-4/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/ChangeLog 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/ChangeLog 2010-09-28 10:07:30 UTC (rev 5425)
@@ -1,3 +1,7 @@
+2010-09-28 Werner Koch <wk at g10code.com>
+
+ * configure.ac (AH_BOTTOM) [__VMS]: Fix homedir.
+
2010-09-23 Werner Koch <wk at g10code.com>
Release 1.4.11rc1.
Modified: branches/STABLE-BRANCH-1-4/cipher/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/cipher/ChangeLog 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/cipher/ChangeLog 2010-09-28 10:07:30 UTC (rev 5425)
@@ -1,3 +1,15 @@
+2010-09-28 Steven M. Schweda <sms at antinode.info> (wk)
+
+ Changes to help the VMS port. See
+ http://antinode.info/dec/sw/gnupg.html .
+
+ * random.c [__VMS]: Include rmsdef.h and vms.h.
+ (LOCK_SEED_FILE) [__VMS]: Set to 0.
+ (getfnc_gather_random) [USE_RNDVMS]: Call rndvms_gather_random.
+ (read_seed_file) [__VMS]: Allow reading by others.
+ (update_random_seed_file) [__VMS]: Use VMS specific open call.
+ * rand-internal.h (rndvms_gather_random): New.
+
2008-04-17 David Shaw <dshaw at jabberwocky.com>
* camellia-glue.c (selftest, camellia_get_info), cipher.c
Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/ChangeLog 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/g10/ChangeLog 2010-09-28 10:07:30 UTC (rev 5425)
@@ -1,3 +1,29 @@
+2010-09-28 Werner Koch <wk at g10code.com>
+
+ * gpgv.c (ttyfp_is, init_ttyfp) [__VMS]: Add subs.
+
+2010-09-28 Steven M. Schweda <sms at antinode.info> (wk)
+
+ Changes to help the VMS port. See
+ http://antinode.info/dec/sw/gnupg.html .
+
+ * build-packet.c (do_plaintext) [__VMS]: Disable error message.
+ * keyserver.c (keyserver_spawn) [__VMS]: Do not add the DIRSEP_S.
+ * misc.c [__VMS]: Include <time.h>.
+ * signal.c [__VMS]: Include vms.h.
+ (got_fatal_signal) [__VMS]: Restore terminal echo.
+ * plaintext.c [__VMS]: Include vms.h.
+ * openfile.c (make_outfile_name): __VMS] Do not use.
+ (open_outfile) [__VMS]: Use vms_append_ext.
+ (try_make_homedir) [__VMS]: chmod directory.
+ * misc.c (disable_core_dumps) [__VMS]: Disable.
+ (path_access) [__VMS]: Do not use.
+
+2010-09-28 Werner Koch <wk at g10code.com>
+
+ * passphrase.c [!ENABLE_AGENT_SUPPORT]: Do not include
+ sys/socket.h to help the VMS port.
+
2010-08-31 Werner Koch <wk at g10code.com>
* mainproc.c (print_pkenc_list): Print a STATUS_ERROR. Fixes
Modified: branches/STABLE-BRANCH-1-4/include/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/include/ChangeLog 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/include/ChangeLog 2010-09-28 10:07:30 UTC (rev 5425)
@@ -1,3 +1,7 @@
+2010-09-28 Werner Koch <wk at g10code.com>
+
+ * ttyio.h (ttyfp_is, init_ttyfp) [__VMS]: New.
+
2009-09-03 Werner Koch <wk at g10code.com>
* util.h (xtryvasprintf): New.
Modified: branches/STABLE-BRANCH-1-4/util/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/util/ChangeLog 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/util/ChangeLog 2010-09-28 10:07:30 UTC (rev 5425)
@@ -1,3 +1,21 @@
+2010-09-28 Steven M. Schweda <sms at antinode.info> (wk)
+
+ Changes to help the VMS port. See
+ http://antinode.info/dec/sw/gnupg.html .
+
+ * cert.c [__VMS]: Include cert_vms.h.
+ * ttyio.c [__VMS]: Include vms.h.
+ (init_ttyfp) [__VMS]: Make global.
+ (ttyfp_is) [__VMS]: New.
+ (do_get) [__VMS]: Disable terminal echo.
+ * srv.c [__VMS]: Include cert_vms.h.
+ * secmem.c (lock_pool) [__VMS]: Use log_warning.
+ * pka.c [USE_DNS_PKA]: Define T_CERT.
+ * logger.c [__VMS]: Include unistd.h and ttyio.h.
+ (g10_log_print_prefix) [__VMS]: Init logfp.
+ * iobuf.c [__VMS]: Include vms.h.
+ (iobuf_get_filelength) [__VMS]: Use VMS specific method.
+
2009-09-03 Werner Koch <wk at g10code.com>
* ttyio.c (tty_printf) [_WIN32]: s/xtryasprintf/xtryvasprint/
Modified: branches/STABLE-BRANCH-1-4/AUTHORS
===================================================================
--- branches/STABLE-BRANCH-1-4/AUTHORS 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/AUTHORS 2010-09-28 10:07:30 UTC (rev 5425)
@@ -131,6 +131,10 @@
and rndwin32.c from cryptlib.
Copyright Peter Gutmann, Paul Kendall, and Chris Wedgwood 1996-1999.
+The code to help with the VMS port (indicated by __VMS and
+corresponding Changelog entries) was contributed by Steven M. Schweda.
+<sms at antinode dot info>.
+
The RPM specs file scripts/gnupg.spec has been contributed by
several people.
Modified: branches/STABLE-BRANCH-1-4/cipher/random.c
===================================================================
--- branches/STABLE-BRANCH-1-4/cipher/random.c 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/cipher/random.c 2010-09-28 10:07:30 UTC (rev 5425)
@@ -63,13 +63,23 @@
#include "rand-internal.h"
#include "algorithms.h"
+#ifdef __VMS
+# include <rmsdef.h>
+# include "vms.h"
+#endif /* def __VMS */
+
#ifndef RAND_MAX /* for SunOS */
#define RAND_MAX 32767
#endif
+/* 2008-03-31 SMS.
+ * VMS C RTL before V8.3 lacks byte-range file locking, but by default,
+ * a file opened for write access is not shared, so mutual exclusion can
+ * most generally be handled at the open(). */
/* Check whether we can lock the seed file read write. */
-#if defined(HAVE_FCNTL) && defined(HAVE_FTRUNCATE) && !defined(HAVE_W32_SYSTEM)
+#if defined(HAVE_FCNTL) && defined(HAVE_FTRUNCATE) \
+ && !defined(HAVE_W32_SYSTEM) && !defined(__VMS)
#define LOCK_SEED_FILE 1
#else
#define LOCK_SEED_FILE 0
@@ -177,6 +187,9 @@
# ifdef USE_RNDUNIX
return rndunix_gather_random;
# endif
+# ifdef USE_RNDVMS
+ return rndvms_gather_random;
+# endif
# ifdef USE_RNDEGD
return rndegd_gather_random;
# endif
@@ -402,7 +415,7 @@
return -1;
}
- if (backoff > 2) /* Show the first message after ~2.25 seconds. */
+ if (backoff > 2) /* Show the first message after ~3.75 seconds. */
log_info( _("waiting for lock on `%s'...\n"), fname);
tv.tv_sec = backoff;
@@ -434,6 +447,9 @@
#if defined(HAVE_DOSISH_SYSTEM) || defined(__CYGWIN__)
fd = open( seed_file_name, O_RDONLY | O_BINARY );
+#elif defined( __VMS)
+ /* We're only reading, so allow others to do anything. */
+ fd = open( seed_file_name, O_RDONLY, 0777, "shr=get,put,upd" );
#else
fd = open( seed_file_name, O_RDONLY );
#endif
@@ -535,11 +551,40 @@
# if LOCK_SEED_FILE
fd = open( seed_file_name, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR );
# else
+# ifdef __VMS
+ /* Open the seed file for exclusive write access, but allow other
+ * readers. Loop until success. Complain after a few failures. */
+ {
+ int backoff = 0;
+
+ while ((fd = open( seed_file_name,
+ O_WRONLY|O_CREAT,
+ S_IRUSR|S_IWUSR,
+ "shr=get")) == -1 )
+ {
+ if ((errno != EVMSERR) || (vaxc$errno != RMS$_FLK))
+ {
+ /* Some unexpected open failure. */
+ log_info (_("can't lock `%s': %s\n"),
+ seed_file_name, strerror (errno));
+ return;
+ }
+
+ if (backoff > 2) /* Show the first message after ~3.75 seconds. */
+ log_info( _("waiting for lock on `%s'...\n"), seed_file_name);
+
+ wait_vms( backoff+ 0.25);
+ if (backoff < 10)
+ backoff++ ;
+ }
+ }
+# else /* !def __VMS */
fd = open( seed_file_name, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR );
+# endif /* !def __VMS */
# endif
#endif
if( fd == -1 ) {
- log_info(_("can't create `%s': %s\n"), seed_file_name, strerror(errno) );
+ log_info(_("can't create `%s': %s\n"), seed_file_name, strerror(errno));
return;
}
Modified: branches/STABLE-BRANCH-1-4/g10/build-packet.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/build-packet.c 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/g10/build-packet.c 2010-09-28 10:07:30 UTC (rev 5425)
@@ -491,9 +491,14 @@
wipememory(buf,1000); /* burn the buffer */
if( (ctb&0x40) && !pt->len )
iobuf_set_partial_block_mode(out, 0 ); /* turn off partial */
+
+ /* On VMS, byte counts will not match for some file record
+ * formats, so it's best to disable the following error. */
+#ifndef __VMS
if( pt->len && n != pt->len )
log_error("do_plaintext(): wrote %lu bytes but expected %lu bytes\n",
(ulong)n, (ulong)pt->len );
+#endif
return rc;
}
Modified: branches/STABLE-BRANCH-1-4/g10/gpgv.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/gpgv.c 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/g10/gpgv.c 2010-09-28 10:07:30 UTC (rev 5425)
@@ -418,6 +418,10 @@
int tty_get_answer_is_yes( const char *prompt ) {return 0;}
int tty_no_terminal(int onoff) {return 0;}
void tty_cleanup_after_signal (void) {}
+#ifdef __VMS
+FILE *ttyfp_is (void) { return stderr; }
+void init_ttyfp (void) { }
+#endif /*__VMS*/
#ifdef HAVE_LIBREADLINE
void tty_enable_completion(rl_completion_func_t *completer) {}
void tty_disable_completion(void) {}
Modified: branches/STABLE-BRANCH-1-4/g10/keyserver.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/keyserver.c 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/g10/keyserver.c 2010-09-28 10:07:30 UTC (rev 5425)
@@ -1012,7 +1012,9 @@
command=xmalloc(strlen(libexecdir)+strlen(DIRSEP_S)+
GPGKEYS_PREFIX_LEN+strlen(scheme)+3+strlen(EXEEXT)+1);
strcpy(command,libexecdir);
- strcat(command,DIRSEP_S);
+#ifndef __VMS
+ strcat (command, DIRSEP_S);
+#endif
}
end=command+strlen(command);
Modified: branches/STABLE-BRANCH-1-4/g10/misc.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/misc.c 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/g10/misc.c 2010-09-28 10:07:30 UTC (rev 5425)
@@ -54,6 +54,10 @@
#include "dynload.h"
#endif /*_WIN32*/
+#ifdef __VMS
+# include <time.h>
+#endif /* def __VMS */
+
#include "util.h"
#include "main.h"
#include "photoid.h"
@@ -106,7 +110,7 @@
int
disable_core_dumps()
{
-#ifdef HAVE_DOSISH_SYSTEM
+#if defined(HAVE_DOSISH_SYSTEM) || defined(__VMS)
return 0;
#else
#ifdef HAVE_SETRLIMIT
@@ -1333,7 +1337,11 @@
return GNUPG_LIBEXECDIR;
}
-/* Similar to access(2), but uses PATH to find the file. */
+/* Similar to access(2), but uses PATH to find the file.
+
+ (2006-07-08 SMS: See "vmslib/vms.c" for a VMS-specific replacement
+ function) */
+#ifndef __VMS
int
path_access(const char *file,int mode)
{
@@ -1376,3 +1384,5 @@
return ret;
}
+#endif /*ndef __VMS*/
+
Modified: branches/STABLE-BRANCH-1-4/g10/openfile.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/openfile.c 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/g10/openfile.c 2010-09-28 10:07:30 UTC (rev 5425)
@@ -98,7 +98,11 @@
/****************
* Strip know extensions from iname and return a newly allocated
* filename. Return NULL if we can't do that.
+ *
+ * (See vmslib/vms.c for the VMS-specific replacement function,
+ * vms_make_outfile_name())
*/
+#ifndef __VMS
char *
make_outfile_name( const char *iname )
{
@@ -125,6 +129,7 @@
log_info(_("%s: unknown suffix\n"), iname );
return NULL;
}
+#endif /* ndef __VMS */
/****************
Modified: branches/STABLE-BRANCH-1-4/g10/plaintext.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/plaintext.c 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/g10/plaintext.c 2010-09-28 10:07:30 UTC (rev 5425)
@@ -39,7 +39,14 @@
#include "status.h"
#include "i18n.h"
+#ifdef __VMS
+# include "vms.h" /* Not part of the standard GnuPG tarball. See
+ http://antinode.info/dec/sw/gnupg.html */
+# define fopen fopen_vms
+#endif /* def __VMS */
+
+
/****************
* Handle a plaintext packet. If MFX is not NULL, update the MDs
* Note: we should use the filter stuff here, but we have to add some
Modified: branches/STABLE-BRANCH-1-4/include/ttyio.h
===================================================================
--- branches/STABLE-BRANCH-1-4/include/ttyio.h 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/include/ttyio.h 2010-09-28 10:07:30 UTC (rev 5425)
@@ -43,6 +43,11 @@
int tty_get_answer_is_yes( const char *prompt );
int tty_no_terminal(int onoff);
+#ifdef __VMS
+FILE *ttyfp_is (void);
+void init_ttyfp (void);
+#endif /*__VMS*/
+
#ifdef HAVE_LIBREADLINE
void tty_enable_completion(rl_completion_func_t *completer);
void tty_disable_completion(void);
Modified: branches/STABLE-BRANCH-1-4/scripts/mk-w32-dist
===================================================================
--- branches/STABLE-BRANCH-1-4/scripts/mk-w32-dist 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/scripts/mk-w32-dist 2010-09-28 10:07:30 UTC (rev 5425)
@@ -46,7 +46,7 @@
shift
shift
else
- build_number=$(date -u '+%j%k' | sed 's/^0*\(.*\)/\1/')
+ build_number=$(date -u '+%j%H' | sed 's/^0*\(.*\)/\1/')
fi
Modified: branches/STABLE-BRANCH-1-4/util/iobuf.c
===================================================================
--- branches/STABLE-BRANCH-1-4/util/iobuf.c 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/util/iobuf.c 2010-09-28 10:07:30 UTC (rev 5425)
@@ -41,6 +41,11 @@
#include "util.h"
#include "dynload.h"
#include "iobuf.h"
+
+#ifdef __VMS
+# include "vms.h"
+# define open open_vms
+#endif /* def __VMS */
/* The size of the internal buffers.
NOTE: If you change this value you MUST also adjust the regression
@@ -1916,13 +1921,24 @@
if (overflow)
*overflow = 0;
- if( a->directfp ) {
+ if (a->directfp)
+ {
FILE *fp = a->directfp;
- if( !fstat(fileno(fp), &st) )
+#ifdef __VMS
+ /* 2009-02-19 SMS.
+ * On VMS, use a VMS-specific method to determine file size.
+ * For some non-UNIX-like file formats, the fstat() result
+ * will not agree with the C Standard I/O functions such as
+ * getc() and fread(), so these must be detected and handled
+ * specially. */
+ return vms_file_size (fileno( fp));
+#else /*!__VMS */
+ if( !fstat(fileno(fp), &st) )
return st.st_size;
log_error("fstat() failed: %s\n", strerror(errno) );
return 0;
+#endif /*!__VMS */
}
/* Hmmm: file_filter may have already been removed */
@@ -1975,6 +1991,8 @@
}
log_error ("GetFileSize for handle %p failed: %s\n",
fp, w32_strerror (0));
+#elif defined(__VMS)
+ return vms_file_size (my_fileno (fp));
#else
if( !fstat(my_fileno(fp), &st) )
return st.st_size;
Modified: branches/STABLE-BRANCH-1-4/util/logger.c
===================================================================
--- branches/STABLE-BRANCH-1-4/util/logger.c 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/util/logger.c 2010-09-28 10:07:30 UTC (rev 5425)
@@ -27,6 +27,11 @@
#include "util.h"
#include "i18n.h"
+#ifdef __VMS
+# include <unistd.h>
+# include "ttyio.h"
+#endif /* def __VMS */
+
static char pidstring[15];
static char *pgm_name;
static int errorcount;
Modified: branches/STABLE-BRANCH-1-4/util/pka.c
===================================================================
--- branches/STABLE-BRANCH-1-4/util/pka.c 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/util/pka.c 2010-09-28 10:07:30 UTC (rev 5425)
@@ -24,15 +24,22 @@
#include <string.h>
#ifdef USE_DNS_PKA
-#include <sys/types.h>
-#ifdef _WIN32
-#include <windows.h>
-#else
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <arpa/inet.h>
-#include <resolv.h>
-#endif
+# include <sys/types.h>
+# ifdef _WIN32
+# include <windows.h>
+# else
+# include <netinet/in.h>
+# include <arpa/nameser.h>
+# include <arpa/inet.h>
+# include <resolv.h>
+ /* Not every installation has gotten around to supporting CERTs yet... */
+# ifndef T_CERT
+# define T_CERT 37
+# ifdef __VMS
+# include "cert_vms.h"
+# endif /* def __VMS */
+# endif
+# endif
#endif /* USE_DNS_PKA */
#include "memory.h"
Modified: branches/STABLE-BRANCH-1-4/util/ttyio.c
===================================================================
--- branches/STABLE-BRANCH-1-4/util/ttyio.c 2010-09-28 08:29:13 UTC (rev 5424)
+++ branches/STABLE-BRANCH-1-4/util/ttyio.c 2010-09-28 10:07:30 UTC (rev 5425)
@@ -50,6 +50,10 @@
#include <readline/history.h>
#endif
+#ifdef __VMS
+# include "vms.h"
+#endif /* __VMS */
+
#include "util.h"
#include "memory.h"
#include "ttyio.h"
@@ -130,7 +134,23 @@
#endif
}
-static void
+#ifdef __VMS
+/* 2006-08-10 SMS.
+ Interface function needed for VMS (unless someone
+ wishes to make "ttyfp" global). See g10_log_print_prefix() in
+ util/logger.c. */
+FILE *
+ttyfp_is (void)
+{
+ return ttyfp;
+}
+#endif /* def __VMS */
+
+
+#ifndef __VMS
+static
+#endif
+ void
init_ttyfp(void)
{
if( initialized )
@@ -507,6 +527,11 @@
if( tcsetattr( fileno(ttyfp), TCSAFLUSH, &term ) )
log_fatal("tcsetattr() failed: %s\n", strerror(errno) );
#endif
+# ifdef __VMS
+ /* Disable terminal echo. */
+ if (vms_set_term_echo (0))
+ log_fatal ("error disabling terminal echo: %s\n", strerror (errno));
+# endif /* __VMS */
}
tty_printf( "%s", prompt );
@@ -539,11 +564,16 @@
if( hidden ) {
-#ifdef HAVE_TCGETATTR
+# ifdef HAVE_TCGETATTR
if( tcsetattr(fileno(ttyfp), TCSAFLUSH, &termsave) )
log_error("tcsetattr() failed: %s\n", strerror(errno) );
restore_termios = 0;
-#endif
+# endif
+# ifdef __VMS
+ /* Restore (most likely enable) terminal echo. */
+ if (vms_set_term_echo( -1))
+ log_fatal ("error enabling terminal echo: %s\n", strerror (errno));
+# endif /* __VMS */
}
#endif /* end unix version */
buf[i] = 0;
More information about the Gnupg-commits
mailing list