85 |
break; |
break; |
86 |
} |
} |
87 |
} |
} |
88 |
if (p) |
free (p); |
|
free (p); |
|
89 |
return 0; |
return 0; |
90 |
} |
} |
91 |
|
|
177 |
break; |
break; |
178 |
} |
} |
179 |
} |
} |
180 |
if (p) |
free (p); |
|
free (p); |
|
181 |
return 0; |
return 0; |
182 |
} |
} |
183 |
|
|
238 |
static gpgme_error_t |
static gpgme_error_t |
239 |
list_handler (void *opaque, gpgme_status_code_t code, const char *key, int fd) |
list_handler (void *opaque, gpgme_status_code_t code, const char *key, int fd) |
240 |
{ |
{ |
241 |
static int step=0; |
static int step = 0; |
242 |
const char *s=""; |
const char *s = ""; |
243 |
DWORD n; |
DWORD n; |
244 |
|
|
245 |
if (!strcmp (key, "keyedit.prompt") && step == 0) { |
if (!strcmp (key, "keyedit.prompt") && step == 0) { |
274 |
err = gpgme_data_new (&out); |
err = gpgme_data_new (&out); |
275 |
if (err) |
if (err) |
276 |
goto leave; |
goto leave; |
|
|
|
277 |
err = gpgme_op_edit (ctx, key, list2_handler, NULL, out); |
err = gpgme_op_edit (ctx, key, list2_handler, NULL, out); |
278 |
if (err) |
if (err) |
279 |
goto leave; |
goto leave; |
311 |
err = gpgme_data_new (&out); |
err = gpgme_data_new (&out); |
312 |
if (err) |
if (err) |
313 |
goto leave; |
goto leave; |
|
|
|
314 |
err = gpgme_op_edit (ctx, key, list_handler, NULL, out); |
err = gpgme_op_edit (ctx, key, list_handler, NULL, out); |
315 |
if (err) |
if (err) |
316 |
goto leave; |
goto leave; |
336 |
void |
void |
337 |
GpgKeyEdit::clear (void) |
GpgKeyEdit::clear (void) |
338 |
{ |
{ |
339 |
pass = NULL; |
pass = NULL; |
340 |
name = NULL; |
name = NULL; |
341 |
cmt = NULL; |
cmt = NULL; |
342 |
email = NULL; |
email = NULL; |
344 |
cnt = 0; |
cnt = 0; |
345 |
cmd_sent = 0; |
cmd_sent = 0; |
346 |
resval = 0; |
resval = 0; |
347 |
uid_index = sig_index = key_index = -1; |
uid_index = -1; |
348 |
|
sig_index = -1; |
349 |
|
key_index = -1; |
350 |
key_has_passwd = true; |
key_has_passwd = true; |
351 |
} |
} |
352 |
|
|
353 |
|
|
354 |
GpgKeyEdit::GpgKeyEdit (void) |
GpgKeyEdit::GpgKeyEdit (void) |
355 |
{ |
{ |
356 |
clear (); |
clear (); |
357 |
key = NULL; |
key = NULL; |
358 |
gpgme_new (&ctx); /*FIXME */ |
gpgme_new (&ctx); /*FIXME */ |
359 |
|
|
360 |
} |
} |
361 |
|
|
362 |
|
|
372 |
GpgKeyEdit::GpgKeyEdit (const char *_keyid) |
GpgKeyEdit::GpgKeyEdit (const char *_keyid) |
373 |
{ |
{ |
374 |
clear (); |
clear (); |
375 |
get_pubkey (_keyid, &this->key); |
get_pubkey (_keyid, &this->key); /*FIXME: check return code*/ |
376 |
gpgme_new (&ctx); /* FIXME */ |
gpgme_new (&ctx); /* FIXME */ |
377 |
} |
} |
378 |
|
|
379 |
/* Delete the given object. */ |
/* Delete the given object. */ |
381 |
{ |
{ |
382 |
free_if_alloc (name); |
free_if_alloc (name); |
383 |
free_if_alloc (cmt); |
free_if_alloc (cmt); |
384 |
free_if_alloc (email); |
free_if_alloc (email); |
385 |
gpgme_release (ctx); |
gpgme_release (ctx); |
386 |
} |
} |
387 |
|
|
437 |
key_has_passwd = !val; |
key_has_passwd = !val; |
438 |
} |
} |
439 |
|
|
440 |
|
|
441 |
|
void |
442 |
|
GpgKeyEdit::setPassphraseCallback (gpgme_passphrase_cb_t cb, void *cb_value) |
443 |
|
{ |
444 |
|
key_has_passwd = false; |
445 |
|
gpgme_set_passphrase_cb (ctx, cb, cb_value); |
446 |
|
} |
447 |
|
|
448 |
|
|
449 |
|
bool |
450 |
|
GpgKeyEdit::usePassphraseCallback (void) |
451 |
|
{ |
452 |
|
gpgme_passphrase_cb_t cb_ptr; |
453 |
|
void *cb_value; |
454 |
|
|
455 |
|
gpgme_get_passphrase_cb (ctx, &cb_ptr, &cb_value); |
456 |
|
if (cb_ptr) |
457 |
|
return true; |
458 |
|
return false; |
459 |
|
} |
460 |
|
|
461 |
/* Set the passphrase to @pass. */ |
/* Set the passphrase to @pass. */ |
462 |
void |
void |
463 |
GpgKeyEdit::setPassphrase (const char *_pass) |
GpgKeyEdit::setPassphrase (const char *_pass) |
486 |
{ |
{ |
487 |
if (!_keyid) |
if (!_keyid) |
488 |
return; |
return; |
489 |
get_pubkey (_keyid, &this->key); |
get_pubkey (_keyid, &this->key); /* FIXME: check return code */ |
490 |
} |
} |
491 |
|
|
492 |
|
|