mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-17 14:07:03 +01:00
Minor changes to help the VMS port
This commit is contained in:
parent
9921fb3a8c
commit
aa29ba1689
4
AUTHORS
4
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.
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2010-09-28 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac (AH_BOTTOM) [__VMS]: Fix homedir.
|
||||
|
||||
2010-09-23 Werner Koch <wk@g10code.com>
|
||||
|
||||
Release 1.4.11rc1.
|
||||
|
@ -1,3 +1,15 @@
|
||||
2010-09-28 Steven M. Schweda <sms@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@jabberwocky.com>
|
||||
|
||||
* camellia-glue.c (selftest, camellia_get_info), cipher.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,7 +551,36 @@ 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 ) {
|
||||
|
@ -1,3 +1,29 @@
|
||||
2010-09-28 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpgv.c (ttyfp_is, init_ttyfp) [__VMS]: Add subs.
|
||||
|
||||
2010-09-28 Steven M. Schweda <sms@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@g10code.com>
|
||||
|
||||
* passphrase.c [!ENABLE_AGENT_SUPPORT]: Do not include
|
||||
sys/socket.h to help the VMS port.
|
||||
|
||||
2010-08-31 Werner Koch <wk@g10code.com>
|
||||
|
||||
* mainproc.c (print_pkenc_list): Print a STATUS_ERROR. Fixes
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) {}
|
||||
|
@ -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);
|
||||
#ifndef __VMS
|
||||
strcat (command, DIRSEP_S);
|
||||
#endif
|
||||
}
|
||||
|
||||
end=command+strlen(command);
|
||||
|
14
g10/misc.c
14
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*/
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
|
||||
/****************
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,7 @@
|
||||
2010-09-28 Werner Koch <wk@g10code.com>
|
||||
|
||||
* ttyio.h (ttyfp_is, init_ttyfp) [__VMS]: New.
|
||||
|
||||
2009-09-03 Werner Koch <wk@g10code.com>
|
||||
|
||||
* util.h (xtryvasprintf): New.
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -1,3 +1,21 @@
|
||||
2010-09-28 Steven M. Schweda <sms@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@g10code.com>
|
||||
|
||||
* ttyio.c (tty_printf) [_WIN32]: s/xtryasprintf/xtryvasprint/
|
||||
|
20
util/iobuf.c
20
util/iobuf.c
@ -42,6 +42,11 @@
|
||||
#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
|
||||
test "armored_key_8192" and "nopad_armored_msg" in armor.test! */
|
||||
@ -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;
|
||||
|
||||
#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;
|
||||
|
@ -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;
|
||||
|
@ -32,6 +32,13 @@
|
||||
# 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 */
|
||||
|
||||
|
32
util/ttyio.c
32
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 );
|
||||
@ -544,6 +569,11 @@ do_get( const char *prompt, int hidden )
|
||||
log_error("tcsetattr() failed: %s\n", strerror(errno) );
|
||||
restore_termios = 0;
|
||||
# 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user