mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
See ChangeLog: Mon Jul 26 09:34:46 CEST 1999 Werner Koch
This commit is contained in:
parent
a06bc6ffd8
commit
4dbfb24dbb
27 changed files with 303 additions and 238 deletions
|
@ -1,3 +1,25 @@
|
|||
Mon Jul 26 09:34:46 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
|
||||
|
||||
|
||||
* pkclist.c (build_pk_list): Fixed typo in format string.
|
||||
|
||||
* trustdb.c (create_shadow_dir): Don't translate the error string.
|
||||
|
||||
* g10.c (main): Fixed spelling of user-id.
|
||||
* getkey.c (find_by_name_pk,find_by_name_sk,
|
||||
find_by_keyid,find_by_keyid_sk): Ditto and translate it.
|
||||
* import.c (mark_non_selfsigned_uids_valid,delete_inv_parts): Ditto.
|
||||
|
||||
|
||||
Mon Jul 26 01:01:39 CEST 1999 Michael Roth <mroth@nessie.de>
|
||||
|
||||
* g10.c, options.h: New options --no-literal and --set-filesize
|
||||
|
||||
* encode.c (encode_simple, encode_crypt): Support for the options
|
||||
--no-literal and --set-filesize.
|
||||
|
||||
* sign.c (sign_file): ditto.
|
||||
|
||||
Fri Jul 23 13:53:03 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
|
||||
|
||||
|
||||
|
|
144
g10/encode.c
144
g10/encode.c
|
@ -70,7 +70,7 @@ encode_simple( const char *filename, int mode )
|
|||
{
|
||||
IOBUF inp, out;
|
||||
PACKET pkt;
|
||||
PKT_plaintext *pt;
|
||||
PKT_plaintext *pt = NULL;
|
||||
STRING2KEY *s2k = NULL;
|
||||
int rc = 0;
|
||||
u32 filesize;
|
||||
|
@ -144,18 +144,22 @@ encode_simple( const char *filename, int mode )
|
|||
m_free(enc);
|
||||
}
|
||||
|
||||
/* setup the inner packet */
|
||||
if( filename || opt.set_filename ) {
|
||||
char *s = make_basename( opt.set_filename ? opt.set_filename : filename );
|
||||
pt = m_alloc( sizeof *pt + strlen(s) - 1 );
|
||||
pt->namelen = strlen(s);
|
||||
memcpy(pt->name, s, pt->namelen );
|
||||
m_free(s);
|
||||
}
|
||||
else { /* no filename */
|
||||
pt = m_alloc( sizeof *pt - 1 );
|
||||
pt->namelen = 0;
|
||||
if (!opt.no_literal) {
|
||||
/* setup the inner packet */
|
||||
if( filename || opt.set_filename ) {
|
||||
char *s = make_basename( opt.set_filename ? opt.set_filename
|
||||
: filename );
|
||||
pt = m_alloc( sizeof *pt + strlen(s) - 1 );
|
||||
pt->namelen = strlen(s);
|
||||
memcpy(pt->name, s, pt->namelen );
|
||||
m_free(s);
|
||||
}
|
||||
else { /* no filename */
|
||||
pt = m_alloc( sizeof *pt - 1 );
|
||||
pt->namelen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* pgp5 has problems to decrypt symmetrically encrypted data from
|
||||
* GnuPG if the filelength is in the inner packet. It works
|
||||
* when only partial length headers are use. Until we have
|
||||
|
@ -167,14 +171,19 @@ encode_simple( const char *filename, int mode )
|
|||
log_info(_("%s: WARNING: empty file\n"), filename );
|
||||
}
|
||||
else
|
||||
filesize = 0; /* stdin */
|
||||
pt->timestamp = make_timestamp();
|
||||
pt->mode = opt.textmode? 't' : 'b';
|
||||
pt->len = filesize;
|
||||
pt->buf = inp;
|
||||
pkt.pkttype = PKT_PLAINTEXT;
|
||||
pkt.pkt.plaintext = pt;
|
||||
cfx.datalen = filesize && !do_compress ? calc_packet_length( &pkt ) : 0;
|
||||
filesize = opt.set_filesize ? opt.set_filesize : 0; /* stdin */
|
||||
|
||||
if (!opt.no_literal) {
|
||||
pt->timestamp = make_timestamp();
|
||||
pt->mode = opt.textmode? 't' : 'b';
|
||||
pt->len = filesize;
|
||||
pt->buf = inp;
|
||||
pkt.pkttype = PKT_PLAINTEXT;
|
||||
pkt.pkt.plaintext = pt;
|
||||
cfx.datalen = filesize && !do_compress ? calc_packet_length( &pkt ) : 0;
|
||||
}
|
||||
else
|
||||
cfx.datalen = filesize && !do_compress ? filesize : 0;
|
||||
|
||||
/* register the cipher filter */
|
||||
if( mode )
|
||||
|
@ -184,13 +193,32 @@ encode_simple( const char *filename, int mode )
|
|||
iobuf_push_filter( out, compress_filter, &zfx );
|
||||
|
||||
/* do the work */
|
||||
if( (rc = build_packet( out, &pkt )) )
|
||||
log_error("build_packet failed: %s\n", g10_errstr(rc) );
|
||||
if (!opt.no_literal) {
|
||||
if( (rc = build_packet( out, &pkt )) )
|
||||
log_error("build_packet failed: %s\n", g10_errstr(rc) );
|
||||
}
|
||||
else {
|
||||
/* user requested not to create a literal packet,
|
||||
* so we copy the plain data */
|
||||
byte copy_buffer[4096];
|
||||
int bytes_copied;
|
||||
while ((bytes_copied = iobuf_read(inp, copy_buffer, 4096)) != -1)
|
||||
if (iobuf_write(out, copy_buffer, bytes_copied) == -1) {
|
||||
rc = G10ERR_WRITE_FILE;
|
||||
log_error("copying input to output failed: %s\n", g10_errstr(rc) );
|
||||
break;
|
||||
}
|
||||
memset(copy_buffer, 0, 4096); /* burn buffer */
|
||||
}
|
||||
|
||||
/* finish the stuff */
|
||||
iobuf_close(inp);
|
||||
iobuf_close(out); /* fixme: check returncode */
|
||||
pt->buf = NULL;
|
||||
if (rc)
|
||||
iobuf_cancel(out);
|
||||
else
|
||||
iobuf_close(out); /* fixme: check returncode */
|
||||
if (pt)
|
||||
pt->buf = NULL;
|
||||
free_packet(&pkt);
|
||||
m_free(cfx.dek);
|
||||
m_free(s2k);
|
||||
|
@ -270,35 +298,43 @@ encode_crypt( const char *filename, STRLIST remusr )
|
|||
if( rc )
|
||||
goto leave;
|
||||
|
||||
/* setup the inner packet */
|
||||
if( filename || opt.set_filename ) {
|
||||
char *s = make_basename( opt.set_filename ? opt.set_filename : filename );
|
||||
pt = m_alloc( sizeof *pt + strlen(s) - 1 );
|
||||
pt->namelen = strlen(s);
|
||||
memcpy(pt->name, s, pt->namelen );
|
||||
m_free(s);
|
||||
}
|
||||
else { /* no filename */
|
||||
pt = m_alloc( sizeof *pt - 1 );
|
||||
pt->namelen = 0;
|
||||
}
|
||||
if (!opt.no_literal)
|
||||
/* setup the inner packet */
|
||||
if( filename || opt.set_filename ) {
|
||||
char *s = make_basename( opt.set_filename ? opt.set_filename : filename );
|
||||
pt = m_alloc( sizeof *pt + strlen(s) - 1 );
|
||||
pt->namelen = strlen(s);
|
||||
memcpy(pt->name, s, pt->namelen );
|
||||
m_free(s);
|
||||
}
|
||||
else { /* no filename */
|
||||
pt = m_alloc( sizeof *pt - 1 );
|
||||
pt->namelen = 0;
|
||||
}
|
||||
|
||||
if( filename && !opt.textmode ) {
|
||||
if( !(filesize = iobuf_get_filelength(inp)) )
|
||||
log_info(_("%s: WARNING: empty file\n"), filename );
|
||||
}
|
||||
else
|
||||
filesize = 0; /* stdin */
|
||||
pt->timestamp = make_timestamp();
|
||||
pt->mode = opt.textmode ? 't' : 'b';
|
||||
pt->len = filesize;
|
||||
pt->new_ctb = !pt->len && !opt.rfc1991;
|
||||
pt->buf = inp;
|
||||
pkt.pkttype = PKT_PLAINTEXT;
|
||||
pkt.pkt.plaintext = pt;
|
||||
cfx.datalen = filesize && !do_compress? calc_packet_length( &pkt ) : 0;
|
||||
filesize = opt.set_filesize ? opt.set_filesize : 0; /* stdin */
|
||||
|
||||
if (!opt.no_literal) {
|
||||
pt->timestamp = make_timestamp();
|
||||
pt->mode = opt.textmode ? 't' : 'b';
|
||||
pt->len = filesize;
|
||||
pt->new_ctb = !pt->len && !opt.rfc1991;
|
||||
pt->buf = inp;
|
||||
pkt.pkttype = PKT_PLAINTEXT;
|
||||
pkt.pkt.plaintext = pt;
|
||||
cfx.datalen = filesize && !do_compress? calc_packet_length( &pkt ) : 0;
|
||||
}
|
||||
else
|
||||
cfx.datalen = filesize && !do_compress ? filesize : 0;
|
||||
|
||||
/* register the cipher filter */
|
||||
iobuf_push_filter( out, cipher_filter, &cfx );
|
||||
|
||||
/* register the compress filter */
|
||||
if( do_compress ) {
|
||||
int compr_algo = select_algo_from_prefs( pk_list, PREFTYPE_COMPR );
|
||||
|
@ -312,8 +348,22 @@ encode_crypt( const char *filename, STRLIST remusr )
|
|||
}
|
||||
|
||||
/* do the work */
|
||||
if( (rc = build_packet( out, &pkt )) )
|
||||
log_error("build_packet failed: %s\n", g10_errstr(rc) );
|
||||
if (!opt.no_literal) {
|
||||
if( (rc = build_packet( out, &pkt )) )
|
||||
log_error("build_packet failed: %s\n", g10_errstr(rc) );
|
||||
}
|
||||
else {
|
||||
/* user requested not to create a literal packet, so we copy the plain data */
|
||||
byte copy_buffer[4096];
|
||||
int bytes_copied;
|
||||
while ((bytes_copied = iobuf_read(inp, copy_buffer, 4096)) != -1)
|
||||
if (iobuf_write(out, copy_buffer, bytes_copied) == -1) {
|
||||
rc = G10ERR_WRITE_FILE;
|
||||
log_error("copying input to output failed: %s\n", g10_errstr(rc) );
|
||||
break;
|
||||
}
|
||||
memset(copy_buffer, 0, 4096); /* burn buffer */
|
||||
}
|
||||
|
||||
/* finish the stuff */
|
||||
leave:
|
||||
|
|
23
g10/g10.c
23
g10/g10.c
|
@ -175,6 +175,8 @@ enum cmd_and_opt_values { aNull = 0,
|
|||
oDisableCipherAlgo,
|
||||
oDisablePubkeyAlgo,
|
||||
oAllowNonSelfsignedUID,
|
||||
oNoLiteral,
|
||||
oSetFilesize,
|
||||
aTest };
|
||||
|
||||
|
||||
|
@ -334,6 +336,8 @@ static ARGPARSE_OPTS opts[] = {
|
|||
{ oDisableCipherAlgo, "disable-cipher-algo", 2, "@" },
|
||||
{ oDisablePubkeyAlgo, "disable-pubkey-algo", 2, "@" },
|
||||
{ oAllowNonSelfsignedUID, "allow-non-selfsigned-uid", 0, "@" },
|
||||
{ oNoLiteral, "no-literal", 0, "@" },
|
||||
{ oSetFilesize, "set-filesize", 20, "@" },
|
||||
{0} };
|
||||
|
||||
|
||||
|
@ -848,6 +852,12 @@ main( int argc, char **argv )
|
|||
case oAllowNonSelfsignedUID:
|
||||
opt.allow_non_selfsigned_uid = 1;
|
||||
break;
|
||||
case oNoLiteral:
|
||||
opt.no_literal = 1;
|
||||
break;
|
||||
case oSetFilesize:
|
||||
opt.set_filesize = pargs.r.ret_ulong;
|
||||
break;
|
||||
|
||||
default : pargs.err = configfp? 1:2; break;
|
||||
}
|
||||
|
@ -878,6 +888,17 @@ main( int argc, char **argv )
|
|||
" the OpenPGP WG has not yet aggreed on MDCs\n");
|
||||
opt.force_mdc = 0;
|
||||
}
|
||||
if (opt.no_literal) {
|
||||
log_info(_("NOTE: %s is not for normal use!\n"), "--no-literal");
|
||||
if (opt.textmode)
|
||||
log_error(_("%s not allowed with %s!\n"),
|
||||
"--textmode", "--no-literal" );
|
||||
if (opt.set_filename)
|
||||
log_error(_("%s makes no sense with %s!\n"),
|
||||
"--set-filename", "--no-literal" );
|
||||
}
|
||||
if (opt.set_filesize)
|
||||
log_info(_("NOTE: %s is not for normal use!\n"), "--set-filesize");
|
||||
if( opt.batch )
|
||||
tty_batchmode( 1 );
|
||||
|
||||
|
@ -1158,7 +1179,7 @@ main( int argc, char **argv )
|
|||
}
|
||||
}
|
||||
else
|
||||
wrong_args(_("-k[v][v][v][c] [userid] [keyring]") );
|
||||
wrong_args(_("-k[v][v][v][c] [user-id] [keyring]") );
|
||||
break;
|
||||
|
||||
case aKeygen: /* generate a key (interactive) */
|
||||
|
|
12
g10/getkey.c
12
g10/getkey.c
|
@ -1286,9 +1286,9 @@ find_by_name( KBNODE keyblock, PKT_public_key *pk, const char *name,
|
|||
return kk;
|
||||
}
|
||||
else if( is_RSA(pk->pubkey_algo) )
|
||||
log_error("RSA key cannot be used in this version\n");
|
||||
log_error(_("RSA key cannot be used in this version\n"));
|
||||
else
|
||||
log_error("No key for userid\n");
|
||||
log_error(_("No key for user-id\n"));
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
@ -1325,9 +1325,9 @@ find_by_name_sk( KBNODE keyblock, PKT_secret_key *sk, const char *name,
|
|||
return kk;
|
||||
}
|
||||
else if( is_RSA(sk->pubkey_algo) )
|
||||
log_error("RSA key cannot be used in this version\n");
|
||||
log_error(_("RSA key cannot be used in this version\n"));
|
||||
else
|
||||
log_error("No key for userid\n");
|
||||
log_error(_("No key for user-id\n"));
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
@ -1366,7 +1366,7 @@ find_by_keyid( KBNODE keyblock, PKT_public_key *pk, u32 *keyid, int mode )
|
|||
if( kk )
|
||||
cache_user_id( kk->pkt->pkt.user_id, aki );
|
||||
else
|
||||
log_error("No userid for key\n");
|
||||
log_error(_("No user-id for key\n"));
|
||||
return k; /* found */
|
||||
}
|
||||
}
|
||||
|
@ -1406,7 +1406,7 @@ find_by_keyid_sk( KBNODE keyblock, PKT_secret_key *sk, u32 *keyid, int mode )
|
|||
if( kk )
|
||||
cache_user_id( kk->pkt->pkt.user_id, aki );
|
||||
else
|
||||
log_error("No userid for key\n");
|
||||
log_error(_("No user-id for key\n"));
|
||||
return k; /* found */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -766,7 +766,7 @@ mark_non_selfsigned_uids_valid( KBNODE keyblock, u32 *kid )
|
|||
if( node->pkt->pkttype == PKT_USER_ID && !(node->flag & 1) ) {
|
||||
if( node->next && node->next->pkt->pkttype == PKT_SIGNATURE ) {
|
||||
node->flag |= 1;
|
||||
log_info( _("key %08lX: accepted non self-signed userid '"),
|
||||
log_info( _("key %08lX: accepted non self-signed user-id '"),
|
||||
(ulong)kid[1]);
|
||||
print_string( log_stream(), node->pkt->pkt.user_id->name,
|
||||
node->pkt->pkt.user_id->len, 0 );
|
||||
|
@ -795,7 +795,7 @@ delete_inv_parts( const char *fname, KBNODE keyblock, u32 *keyid )
|
|||
uid_seen = 1;
|
||||
if( (node->flag & 2) || !(node->flag & 1) ) {
|
||||
if( opt.verbose ) {
|
||||
log_info( _("key %08lX: skipped userid '"),
|
||||
log_info( _("key %08lX: skipped user-id '"),
|
||||
(ulong)keyid[1]);
|
||||
print_string( stderr, node->pkt->pkt.user_id->name,
|
||||
node->pkt->pkt.user_id->len, 0 );
|
||||
|
|
|
@ -81,6 +81,8 @@ struct {
|
|||
const char *set_policy_url;
|
||||
int use_embedded_filename;
|
||||
int allow_non_selfsigned_uid;
|
||||
int no_literal;
|
||||
ulong set_filesize;
|
||||
} opt;
|
||||
|
||||
|
||||
|
|
|
@ -765,7 +765,7 @@ build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned use )
|
|||
pk->pubkey_usage = use;
|
||||
rc = get_pubkey_byname( NULL, pk, def_rec, NULL );
|
||||
if( rc )
|
||||
log_error(_("unknown default recipient `s'\n"), def_rec );
|
||||
log_error(_("unknown default recipient `%s'\n"), def_rec );
|
||||
else if( !(rc=check_pubkey_algo2(pk->pubkey_algo, use)) ) {
|
||||
PK_LIST r = m_alloc( sizeof *r );
|
||||
r->pk = pk; pk = NULL;
|
||||
|
|
66
g10/sign.c
66
g10/sign.c
|
@ -385,17 +385,19 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||
}
|
||||
}
|
||||
else {
|
||||
if( fname || opt.set_filename ) {
|
||||
char *s = make_basename( opt.set_filename ? opt.set_filename : fname );
|
||||
pt = m_alloc( sizeof *pt + strlen(s) - 1 );
|
||||
pt->namelen = strlen(s);
|
||||
memcpy(pt->name, s, pt->namelen );
|
||||
m_free(s);
|
||||
}
|
||||
else { /* no filename */
|
||||
pt = m_alloc( sizeof *pt - 1 );
|
||||
pt->namelen = 0;
|
||||
}
|
||||
if (!opt.no_literal)
|
||||
if( fname || opt.set_filename ) {
|
||||
char *s = make_basename( opt.set_filename ? opt.set_filename : fname );
|
||||
pt = m_alloc( sizeof *pt + strlen(s) - 1 );
|
||||
pt->namelen = strlen(s);
|
||||
memcpy(pt->name, s, pt->namelen );
|
||||
m_free(s);
|
||||
}
|
||||
else { /* no filename */
|
||||
pt = m_alloc( sizeof *pt - 1 );
|
||||
pt->namelen = 0;
|
||||
}
|
||||
|
||||
if( fname ) {
|
||||
if( !(filesize = iobuf_get_filelength(inp)) )
|
||||
log_info(_("WARNING: `%s' is an empty file\n"), fname );
|
||||
|
@ -409,20 +411,38 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||
filesize = 0;
|
||||
}
|
||||
else
|
||||
filesize = 0; /* stdin */
|
||||
pt->timestamp = make_timestamp();
|
||||
pt->mode = opt.textmode && !outfile ? 't':'b';
|
||||
pt->len = filesize;
|
||||
pt->new_ctb = !pt->len && !opt.rfc1991;
|
||||
pt->buf = inp;
|
||||
pkt.pkttype = PKT_PLAINTEXT;
|
||||
pkt.pkt.plaintext = pt;
|
||||
/*cfx.datalen = filesize? calc_packet_length( &pkt ) : 0;*/
|
||||
if( (rc = build_packet( out, &pkt )) )
|
||||
log_error("build_packet(PLAINTEXT) failed: %s\n", g10_errstr(rc) );
|
||||
pt->buf = NULL;
|
||||
filesize = opt.set_filesize ? opt.set_filesize : 0; /* stdin */
|
||||
|
||||
if (!opt.no_literal) {
|
||||
pt->timestamp = make_timestamp();
|
||||
pt->mode = opt.textmode && !outfile ? 't':'b';
|
||||
pt->len = filesize;
|
||||
pt->new_ctb = !pt->len && !opt.rfc1991;
|
||||
pt->buf = inp;
|
||||
pkt.pkttype = PKT_PLAINTEXT;
|
||||
pkt.pkt.plaintext = pt;
|
||||
/*cfx.datalen = filesize? calc_packet_length( &pkt ) : 0;*/
|
||||
if( (rc = build_packet( out, &pkt )) )
|
||||
log_error("build_packet(PLAINTEXT) failed: %s\n", g10_errstr(rc) );
|
||||
pt->buf = NULL;
|
||||
}
|
||||
else {
|
||||
byte copy_buffer[4096];
|
||||
int bytes_copied;
|
||||
while ((bytes_copied = iobuf_read(inp, copy_buffer, 4096)) != -1)
|
||||
if (iobuf_write(out, copy_buffer, bytes_copied) == -1) {
|
||||
rc = G10ERR_WRITE_FILE;
|
||||
log_error("copying input to output failed: %s\n", g10_errstr(rc));
|
||||
break;
|
||||
}
|
||||
memset(copy_buffer, 0, 4096); /* burn buffer */
|
||||
}
|
||||
}
|
||||
|
||||
/* catch errors from above blocks */
|
||||
if (rc)
|
||||
goto leave;
|
||||
|
||||
/* loop over the secret certificates */
|
||||
for( sk_rover = sk_list; sk_rover; sk_rover = sk_rover->next ) {
|
||||
PKT_secret_key *sk;
|
||||
|
|
|
@ -799,7 +799,7 @@ create_shadow_dir( PKT_signature *sig )
|
|||
/* first see whether we already have such a record */
|
||||
rc = tdbio_search_sdir( sig->keyid, sig->pubkey_algo, &sdir );
|
||||
if( rc && rc != -1 ) {
|
||||
log_error(_("tdbio_search_sdir failed: %s\n"), g10_errstr(rc));
|
||||
log_error("tdbio_search_sdir failed: %s\n", g10_errstr(rc));
|
||||
tdbio_invalid();
|
||||
}
|
||||
if( rc == -1 ) { /* not found: create */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue