#include <openssl/pem.h>
#ifndef W_OK
-#include <sys/file.h>
+# ifdef VMS
+# if defined(__DECC)
+# include <unistd.h>
+# else
+# include <unixlib.h>
+# endif
+# else
+# include <sys/file.h>
+# endif
+#endif
+
+#ifndef W_OK
+# define F_OK 0
+# define X_OK 1
+# define W_OK 2
+# define R_OK 4
#endif
#undef PROG
#define PROG ca_main
#define BASE_SECTION "ca"
-#define CONFIG_FILE "lib/openssl.cnf"
+#define CONFIG_FILE "openssl.cnf"
#define ENV_DEFAULT_CA "default_ca"
extern int EF_ALIGNMENT;
#endif
-#ifndef NOPROTO
static int add_oid_section(LHASH *conf);
static void lookup_fail(char *name,char *tag);
static int MS_CALLBACK key_callback(char *buf,int len,int verify);
LHASH *conf);
static int do_revoke(X509 *x509, TXT_DB *db);
static int check_time_format(char *str);
-#else
-static int add_oid_section();
-static void lookup_fail();
-static int MS_CALLBACK key_callback();
-static unsigned long index_serial_hash();
-static int index_serial_cmp();
-static unsigned long index_name_hash();
-static int index_name_qual();
-static int index_name_cmp();
-static int fix_data();
-static BIGNUM *load_serial();
-static int save_serial();
-static int certify();
-static int certify_cert();
-static int certify_spkac();
-static void write_new_certificate();
-static int do_body();
-static int do_revoke();
-static int check_time_format();
-#endif
-
static LHASH *conf;
static char *key=NULL;
static char *section=NULL;
ERR_load_crypto_strings();
/*****************************************************************/
+ if (configfile == NULL) configfile = getenv("OPENSSL_CONF");
+ if (configfile == NULL) configfile = getenv("SSLEAY_CONF");
if (configfile == NULL)
{
/* We will just use 'buf[0]' as a temporary buffer. */
+#ifdef VMS
+ strncpy(buf[0],X509_get_default_cert_area(),
+ sizeof(buf[0])-1-sizeof(CONFIG_FILE));
+#else
strncpy(buf[0],X509_get_default_cert_area(),
sizeof(buf[0])-2-sizeof(CONFIG_FILE));
strcat(buf[0],"/");
+#endif
strcat(buf[0],CONFIG_FILE);
configfile=buf[0];
}
BIO_printf(bio_err,"there needs to be defined a directory for new certificate to be placed in\n");
goto err;
}
+#ifdef VMS
+ /* For technical reasons, VMS misbehaves with X_OK */
+ if (access(outdir,R_OK|W_OK) != 0)
+#else
if (access(outdir,R_OK|W_OK|X_OK) != 0)
+#endif
{
BIO_printf(bio_err,"I am unable to acces the %s directory\n",outdir);
perror(outdir);
BIO_printf(bio_err,"Write out database with %d new entries\n",sk_num(cert_sk));
strncpy(buf[0],serialfile,BSIZE-4);
+
+#ifdef VMS
+ strcat(buf[0],"-new");
+#else
strcat(buf[0],".new");
+#endif
if (!save_serial(buf[0],serial)) goto err;
strncpy(buf[1],dbfile,BSIZE-4);
+
+#ifdef VMS
+ strcat(buf[1],"-new");
+#else
strcat(buf[1],".new");
+#endif
+
if (BIO_write_filename(out,buf[1]) <= 0)
{
perror(dbfile);
p=(char *)x->cert_info->serialNumber->data;
strncpy(buf[2],outdir,BSIZE-(j*2)-6);
+
+#ifndef VMS
strcat(buf[2],"/");
+#endif
+
n=(unsigned char *)&(buf[2][strlen(buf[2])]);
if (j > 0)
{
{
/* Rename the database and the serial file */
strncpy(buf[2],serialfile,BSIZE-4);
+
+#ifdef VMS
+ strcat(buf[2],"-old");
+#else
strcat(buf[2],".old");
+#endif
+
BIO_free(in);
BIO_free(out);
in=NULL;
}
strncpy(buf[2],dbfile,BSIZE-4);
+
+#ifdef VMS
+ strcat(buf[2],"-old");
+#else
strcat(buf[2],".old");
+#endif
+
if (rename(dbfile,buf[2]) < 0)
{
BIO_printf(bio_err,"unabel to rename %s to %s\n",
/* Free the current entries if any, there should not
* be any I belive */
if (ci->extensions != NULL)
- sk_pop_free(ci->extensions,X509_EXTENSION_free);
+ sk_X509_EXTENSION_pop_free(ci->extensions,
+ X509_EXTENSION_free);
ci->extensions = NULL;