|
|
@ -28,12 +28,6 @@ |
|
|
|
*/ |
|
|
|
#include "config.h" |
|
|
|
|
|
|
|
#if 'A' == '\301' |
|
|
|
# define NETPGP_EBCDIC 1 |
|
|
|
#else |
|
|
|
# define NETPGP_ASCII 1 |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef HAVE_SYS_CDEFS_H |
|
|
|
#include <sys/cdefs.h> |
|
|
|
#endif |
|
|
@ -189,12 +183,6 @@ readkeyring(netpgp_t *netpgp, |
|
|
|
char *filename; |
|
|
|
char f[MAXPATHLEN]; |
|
|
|
char *homedir; |
|
|
|
int armour=0; |
|
|
|
//#ifdef NETPGP_EBCDIC |
|
|
|
// armour=1; |
|
|
|
//#else |
|
|
|
// armour=0; |
|
|
|
//#endif |
|
|
|
|
|
|
|
if ((filename = netpgp_getvar(netpgp, name)) == NULL) { |
|
|
|
homedir = netpgp_getvar(netpgp, "homedir"); |
|
|
@ -235,20 +223,12 @@ readkeyring(netpgp_t *netpgp, |
|
|
|
if ((file = fopen(filename, "r"))) { // file exists for reading. all peachy. |
|
|
|
fclose(file); |
|
|
|
} else { |
|
|
|
//fprintf(stdout, "File %s doesn't exist. Creating it.\n", filename); |
|
|
|
if(creat(filename, 0600)<0) { |
|
|
|
//fprintf(stderr, "Can't create %s %s.\nCheck directory access pemissions!\n", name, filename); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!pgp_keyring_fileread(netpgp->io, pubring, secring, armour, filename)) { |
|
|
|
/* |
|
|
|
* Well... THAT shouldn't happen... |
|
|
|
*/ |
|
|
|
(void) fprintf(stderr, "Can't read %s %s.\nCheck the file pemissions!\n", name, filename); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
pgp_keyring_fileread(netpgp->io, pubring, secring, 0, filename); |
|
|
|
|
|
|
|
netpgp_setvar(netpgp, name, filename); |
|
|
|
return 1; |
|
|
@ -452,12 +432,6 @@ netpgp_save_ring(netpgp_t *netpgp, |
|
|
|
int cur; |
|
|
|
time_t curtime; |
|
|
|
char f[MAXPATHLEN]; |
|
|
|
int armour=0; |
|
|
|
//#ifdef NETPGP_EBCDIC |
|
|
|
// armour=1; |
|
|
|
//#else |
|
|
|
// armour=0; |
|
|
|
//#endif |
|
|
|
|
|
|
|
io = netpgp->io; |
|
|
|
|
|
|
@ -488,7 +462,7 @@ netpgp_save_ring(netpgp_t *netpgp, |
|
|
|
} |
|
|
|
|
|
|
|
for (n = 0, key = keyring->keys; n < keyring->keyc; ++n, ++key) { |
|
|
|
pgp_write_xfer_key(output, key, armour); |
|
|
|
pgp_write_xfer_key(output, key, 0); |
|
|
|
} |
|
|
|
|
|
|
|
pgp_teardown_file_write(output, fd); |
|
|
@ -627,3 +601,4 @@ netpgp_set_homedir(netpgp_t *netpgp, char *home, const char *subdir, const int q |
|
|
|
netpgp_setvar(netpgp, "homedir", d); |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|