aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2010-09-28 10:07:30 +0000
committerWerner Koch <[email protected]>2010-09-28 10:07:30 +0000
commitaa29ba168982e4f679ae0e869f2319bd782a7067 (patch)
tree0d2483c74f85907f15b8acfb5039844de98226f9
parent"make distcheck" fix (diff)
downloadgnupg-aa29ba168982e4f679ae0e869f2319bd782a7067.tar.gz
gnupg-aa29ba168982e4f679ae0e869f2319bd782a7067.zip
Minor changes to help the VMS port
-rw-r--r--AUTHORS4
-rw-r--r--ChangeLog4
-rw-r--r--cipher/ChangeLog12
-rw-r--r--cipher/random.c51
-rw-r--r--g10/ChangeLog26
-rw-r--r--g10/build-packet.c5
-rw-r--r--g10/gpgv.c4
-rw-r--r--g10/keyserver.c4
-rw-r--r--g10/misc.c14
-rw-r--r--g10/openfile.c5
-rw-r--r--g10/plaintext.c7
-rw-r--r--include/ChangeLog4
-rw-r--r--include/ttyio.h5
-rwxr-xr-xscripts/mk-w32-dist2
-rw-r--r--util/ChangeLog18
-rw-r--r--util/iobuf.c22
-rw-r--r--util/logger.c5
-rw-r--r--util/pka.c25
-rw-r--r--util/ttyio.c36
19 files changed, 232 insertions, 21 deletions
diff --git a/AUTHORS b/AUTHORS
index 742608e75..350f13325 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -131,6 +131,10 @@ The files cipher/rndunix.c and cipher/rndw32.c are based on rndunix.c
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.
diff --git a/ChangeLog b/ChangeLog
index a106c9b34..4559209f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-09-28 Werner Koch <[email protected]>
+
+ * configure.ac (AH_BOTTOM) [__VMS]: Fix homedir.
+
2010-09-23 Werner Koch <[email protected]>
Release 1.4.11rc1.
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index f4371b80a..aff513528 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-28 Steven M. Schweda <[email protected]> (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 <[email protected]>
* camellia-glue.c (selftest, camellia_get_info), cipher.c
diff --git a/cipher/random.c b/cipher/random.c
index c23f9ea33..f7ffb226d 100644
--- a/cipher/random.c
+++ b/cipher/random.c
@@ -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 @@ getfnc_gather_random (void))(void (*)(const void*, size_t, int), int,
# 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 @@ lock_seed_file (int fd, const char *fname, int for_write)
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 @@ read_seed_file(void)
#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 @@ update_random_seed_file()
# 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;
}
diff --git a/g10/ChangeLog b/g10/ChangeLog
index a9233c1f4..8085c097d 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,29 @@
+2010-09-28 Werner Koch <[email protected]>
+
+ * gpgv.c (ttyfp_is, init_ttyfp) [__VMS]: Add subs.
+
+2010-09-28 Steven M. Schweda <[email protected]> (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 <[email protected]>
+
+ * passphrase.c [!ENABLE_AGENT_SUPPORT]: Do not include
+ sys/socket.h to help the VMS port.
+
2010-08-31 Werner Koch <[email protected]>
* mainproc.c (print_pkenc_list): Print a STATUS_ERROR. Fixes
diff --git a/g10/build-packet.c b/g10/build-packet.c
index 4db1d5830..7eceda0e7 100644
--- a/g10/build-packet.c
+++ b/g10/build-packet.c
@@ -491,9 +491,14 @@ do_plaintext( IOBUF out, int ctb, PKT_plaintext *pt )
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;
}
diff --git a/g10/gpgv.c b/g10/gpgv.c
index c906be7b2..d93da38fb 100644
--- a/g10/gpgv.c
+++ b/g10/gpgv.c
@@ -418,6 +418,10 @@ void tty_kill_prompt(void) {}
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) {}
diff --git a/g10/keyserver.c b/g10/keyserver.c
index 0c67f9b64..80e934ef3 100644
--- a/g10/keyserver.c
+++ b/g10/keyserver.c
@@ -1012,7 +1012,9 @@ keyserver_spawn(enum ks_action action,STRLIST list,KEYDB_SEARCH_DESC *desc,
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);
diff --git a/g10/misc.c b/g10/misc.c
index f41e5b75c..8dd4e52b1 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -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 @@ trap_unaligned(void)
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 @@ get_libexecdir (void)
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 @@ path_access(const char *file,int mode)
return ret;
}
+#endif /*ndef __VMS*/
+
diff --git a/g10/openfile.c b/g10/openfile.c
index 94d00cf24..0ac5965cd 100644
--- a/g10/openfile.c
+++ b/g10/openfile.c
@@ -98,7 +98,11 @@ overwrite_filep( const char *fname )
/****************
* 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 @@ make_outfile_name( const char *iname )
log_info(_("%s: unknown suffix\n"), iname );
return NULL;
}
+#endif /* ndef __VMS */
/****************
diff --git a/g10/plaintext.c b/g10/plaintext.c
index 61c4f24a3..29324d90d 100644
--- a/g10/plaintext.c
+++ b/g10/plaintext.c
@@ -39,6 +39,13 @@
#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
diff --git a/include/ChangeLog b/include/ChangeLog
index aa0cba88a..98acf86aa 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,7 @@
+2010-09-28 Werner Koch <[email protected]>
+
+ * ttyio.h (ttyfp_is, init_ttyfp) [__VMS]: New.
+
2009-09-03 Werner Koch <[email protected]>
* util.h (xtryvasprintf): New.
diff --git a/include/ttyio.h b/include/ttyio.h
index b4fa03da5..2bd2b3ff3 100644
--- a/include/ttyio.h
+++ b/include/ttyio.h
@@ -43,6 +43,11 @@ void tty_kill_prompt(void);
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);
diff --git a/scripts/mk-w32-dist b/scripts/mk-w32-dist
index f3ed20b6a..cd4a4cb99 100755
--- a/scripts/mk-w32-dist
+++ b/scripts/mk-w32-dist
@@ -46,7 +46,7 @@ if [ "$1" = "--build-number" -a -n "$2" ]; then
shift
shift
else
- build_number=$(date -u '+%j%k' | sed 's/^0*\(.*\)/\1/')
+ build_number=$(date -u '+%j%H' | sed 's/^0*\(.*\)/\1/')
fi
diff --git a/util/ChangeLog b/util/ChangeLog
index 534e59dd3..e5928a32a 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,21 @@
+2010-09-28 Steven M. Schweda <[email protected]> (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 <[email protected]>
* ttyio.c (tty_printf) [_WIN32]: s/xtryasprintf/xtryvasprint/
diff --git a/util/iobuf.c b/util/iobuf.c
index 72322f35b..384b96644 100644
--- a/util/iobuf.c
+++ b/util/iobuf.c
@@ -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 @@ iobuf_get_filelength (IOBUF a, int *overflow )
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 @@ iobuf_get_filelength (IOBUF a, int *overflow )
}
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;
diff --git a/util/logger.c b/util/logger.c
index 5e603d678..745344443 100644
--- a/util/logger.c
+++ b/util/logger.c
@@ -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;
diff --git a/util/pka.c b/util/pka.c
index 901bfb6c4..40f4dd1d9 100644
--- a/util/pka.c
+++ b/util/pka.c
@@ -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"
diff --git a/util/ttyio.c b/util/ttyio.c
index 3adcdf9ca..05c0a3796 100644
--- a/util/ttyio.c
+++ b/util/ttyio.c
@@ -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 @@ tty_cleanup_after_signal (void)
#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 @@ do_get( const char *prompt, int hidden )
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 @@ do_get( const char *prompt, int hidden )
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;