606 |
|
|
607 |
|
|
608 |
int |
int |
609 |
fm_assume_onepass_sig (const char * fname) |
fm_assume_onepass_sig (const char *fname) |
610 |
{ |
{ |
611 |
armor_filter_context_t afx; |
armor_filter_context_t afx; |
612 |
gpg_iobuf_t fp; |
gpg_iobuf_t fp; |
1276 |
memcpy (orig, output, (dir-output)+1); |
memcpy (orig, output, (dir-output)+1); |
1277 |
strcat (orig, file_name); |
strcat (orig, file_name); |
1278 |
} |
} |
1279 |
|
/* XXX: we need to find out if the string needs to be utf8 decoded. */ |
1280 |
if (overwrite_file (orig)) { |
if (overwrite_file (orig)) { |
1281 |
DeleteFile (orig); |
DeleteFile (orig); |
1282 |
if (!MoveFile (output, orig)) |
if (!MoveFile (output, orig)) |
1323 |
goto leave; |
goto leave; |
1324 |
} |
} |
1325 |
|
|
1326 |
|
/* we fetch all recipients here to make sure they list is complete. */ |
1327 |
|
release_gpg_recipients (&c->pass_cb.recipients); |
1328 |
|
gpg_get_recipients (name, &c->pass_cb.recipients); |
1329 |
|
|
1330 |
err = gpg_file_data_new (name, F_DATA_READ, &in); |
err = gpg_file_data_new (name, F_DATA_READ, &in); |
1331 |
if (err) |
if (err) |
1332 |
goto leave; |
goto leave; |
1334 |
err = gpg_file_data_new (c->output, F_DATA_WRITE, &out); |
err = gpg_file_data_new (c->output, F_DATA_WRITE, &out); |
1335 |
if (err) |
if (err) |
1336 |
goto leave; |
goto leave; |
1337 |
|
|
1338 |
op_begin (); |
op_begin (); |
1339 |
err = gpgme_op_decrypt_verify (ctx, in->dat, out->dat); |
err = gpgme_op_decrypt_verify (ctx, in->dat, out->dat); |
1340 |
op_end (); |
op_end (); |
1371 |
goto leave; |
goto leave; |
1372 |
} |
} |
1373 |
else if (res && res->file_name) { |
else if (res && res->file_name) { |
1374 |
char *file = strrchr (c->output, '\\'); |
char *file; |
1375 |
int id = log_box (_("Decrypt"), MB_QUEST_ASK, |
int id; |
1376 |
_("The original file name is '%s'.\n\n" |
|
1377 |
"Do you want to use this instead of '%s'?"), |
file = strrchr (c->output, '\\'); |
1378 |
res->file_name, file? file+1 : c->output); |
if (!file) |
1379 |
|
file = c->output; |
1380 |
|
else |
1381 |
|
file++; |
1382 |
|
id = log_box (_("Decrypt"), MB_QUEST_ASK, |
1383 |
|
_("The original file name is '%s'.\n\n" |
1384 |
|
"Do you want to use this instead of '%s'?"), |
1385 |
|
res->file_name, file); |
1386 |
if (id == IDYES) { |
if (id == IDYES) { |
1387 |
/* before we can move the file, it needs to be closed first. */ |
/* before we can move the file, it needs to be closed first. */ |
1388 |
gpg_file_data_release (out); |
gpg_file_data_release (out); |