1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

* plaintext.c (handle_plaintext): Accept 'u' as a plaintext mode that

requires end of line conversion.  This is being considered for a UTF8 text
packet.  If this doesn't take place, no major harm done.  If it does take
place, we'll get a jump on starting the changeover.

* g10.c (main): --no-use-embedded-filename.

* build-packet.c (calc_plaintext, do_plaintext): Do not create illegal
(packet header indicates a size larger than the actual packet) encrypted
data packets when not compressing and using a filename longer than 255
characters.

* keyedit.c (no_primary_warning): Cleanup. (menu_expire): Don't give
primary warning for subkey expiration changes.  These cannot reorder
primaries.
This commit is contained in:
David Shaw 2004-04-16 16:31:19 +00:00
parent 4420275b83
commit d49a7e1a7a
5 changed files with 46 additions and 27 deletions

View File

@ -1,5 +1,22 @@
2004-04-16 David Shaw <dshaw@jabberwocky.com>
* plaintext.c (handle_plaintext): Accept 'u' as a plaintext mode
that requires end of line conversion. This is being considered
for a UTF8 text packet. If this doesn't take place, no major harm
done. If it does take place, we'll get a jump on starting the
changeover.
* g10.c (main): --no-use-embedded-filename.
* build-packet.c (calc_plaintext, do_plaintext): Do not create
illegal (packet header indicates a size larger than the actual
packet) encrypted data packets when not compressing and using a
filename longer than 255 characters.
* keyedit.c (no_primary_warning): Cleanup. (menu_expire): Don't
give primary warning for subkey expiration changes. These cannot
reorder primaries.
* keygen.c (gen_elg, gen_dsa, gen_rsa, do_create,
do_generate_keypair, generate_subkeypair): New is_subkey argument
to set whether a generated key is a subkey. Do not overload the

View File

@ -460,7 +460,14 @@ do_pubkey_enc( IOBUF out, int ctb, PKT_pubkey_enc *enc )
static u32
calc_plaintext( PKT_plaintext *pt )
{
return pt->len? (1 + 1 + pt->namelen + 4 + pt->len) : 0;
/* Truncate namelen to the maximum 255 characters. Note this means
that a function that calls build_packet with an illegal literal
packet will get it back legalized. */
if(pt->namelen>255)
pt->namelen=255;
return pt->len? (1 + 1 + pt->namelen + 4 + pt->len) : 0;
}
static int
@ -471,12 +478,6 @@ do_plaintext( IOBUF out, int ctb, PKT_plaintext *pt )
byte buf[1000]; /* this buffer has the plaintext! */
int nbytes;
/* Truncate namelen to the maximum 255 characters. This does mean
that a function that calls build_packet with an illegal literal
packet will get it back legalized. */
if(pt->namelen>255)
pt->namelen=255;
write_header(out, ctb, calc_plaintext( pt ) );
iobuf_put(out, pt->mode );
iobuf_put(out, pt->namelen );

View File

@ -237,6 +237,7 @@ enum cmd_and_opt_values
oNoShowPolicyURL,
oSigKeyserverURL,
oUseEmbeddedFilename,
oNoUseEmbeddedFilename,
oComment,
oDefaultComment,
oNoComments,
@ -605,6 +606,7 @@ static ARGPARSE_OPTS opts[] = {
{ oLoggerFile, "logger-file",2, "@" },
#endif /* __riscos__ */
{ oUseEmbeddedFilename, "use-embedded-filename", 0, "@" },
{ oNoUseEmbeddedFilename, "no-use-embedded-filename", 0, "@" },
{ oUtf8Strings, "utf8-strings", 0, "@" },
{ oNoUtf8Strings, "no-utf8-strings", 0, "@" },
{ oWithFingerprint, "with-fingerprint", 0, "@" },
@ -1926,6 +1928,7 @@ main( int argc, char **argv )
break;
case oSigKeyserverURL: add_keyserver_url(pargs.r.ret_str,0); break;
case oUseEmbeddedFilename: opt.use_embedded_filename = 1; break;
case oNoUseEmbeddedFilename: opt.use_embedded_filename = 0; break;
case oComment:
if(pargs.r.ret_str[0])
append_to_strlist(&opt.comments,pargs.r.ret_str);

View File

@ -2290,13 +2290,10 @@ show_key_and_fingerprint( KBNODE keyblock )
/* Show a warning if no uids on the key have the primary uid flag
set. */
static void
no_primary_warning(KBNODE keyblock, int uids)
no_primary_warning(KBNODE keyblock)
{
KBNODE node;
int select_all=1,have_uid=0,uid_count=0;
if(uids)
select_all=!count_selected_uids(keyblock);
int have_primary=0,uid_count=0;
/* TODO: if we ever start behaving differently with a primary or
non-primary attribute ID, we will need to check for attributes
@ -2309,17 +2306,18 @@ no_primary_warning(KBNODE keyblock, int uids)
{
uid_count++;
if((select_all || (node->flag & NODFLG_SELUID))
&& node->pkt->pkt.user_id->is_primary==2)
have_uid|=2;
else
have_uid|=1;
if(node->pkt->pkt.user_id->is_primary==2)
{
have_primary=1;
break;
}
}
}
if(uid_count>1 && have_uid&1 && !(have_uid&2))
log_info(_("WARNING: no user ID has been marked as primary. This command "
"may\n cause a different user ID to become the assumed primary.\n"));
if(uid_count>1 && !have_primary)
log_info(_("WARNING: no user ID has been marked as primary. This command"
" may\n cause a different user ID to become"
" the assumed primary.\n"));
}
/****************
@ -2838,12 +2836,12 @@ menu_expire( KBNODE pub_keyblock, KBNODE sec_keyblock )
}
else if( n1 )
tty_printf(_("Changing expiration time for a secondary key.\n"));
else {
else
{
tty_printf(_("Changing expiration time for the primary key.\n"));
mainkey=1;
}
no_primary_warning(pub_keyblock,0);
no_primary_warning(pub_keyblock);
}
expiredate = ask_expiredate();
node = find_kbnode( sec_keyblock, PKT_SECRET_KEY );
@ -3099,7 +3097,7 @@ menu_set_preferences (KBNODE pub_keyblock, KBNODE sec_keyblock )
int selected, select_all;
int modified = 0;
no_primary_warning(pub_keyblock,1);
no_primary_warning(pub_keyblock);
select_all = !count_selected_uids (pub_keyblock);
@ -3184,7 +3182,7 @@ menu_set_keyserver_url (KBNODE pub_keyblock, KBNODE sec_keyblock )
int modified = 0;
char *answer;
no_primary_warning(pub_keyblock,1);
no_primary_warning(pub_keyblock);
answer=cpr_get_utf8("keyedit.add_keyserver",
_("Enter your preferred keyserver URL: "));

View File

@ -56,7 +56,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
static off_t count=0;
int rc = 0;
int c;
int convert = pt->mode == 't';
int convert = (pt->mode == 't' || pt->mode == 'u');
#ifdef __riscos__
int filetype = 0xfff;
#endif