*** empty log message ***

This commit is contained in:
Marcus Brinkmann 2004-03-11 14:31:20 +00:00
parent f7e02a469f
commit 9ee42a1e47
2 changed files with 53 additions and 47 deletions

View File

@ -1,5 +1,8 @@
2004-03-11 Marcus Brinkmann <marcus@g10code.de> 2004-03-11 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_new): Protect all tty related code with
isatty().
* rungpg.c (gpg_cancel): Set GPG->fd_data_map to NULL after * rungpg.c (gpg_cancel): Set GPG->fd_data_map to NULL after
releasing it. releasing it.
* engine-gpgsm.c (gpgsm_cancel): Only call assuan_disconnect if * engine-gpgsm.c (gpgsm_cancel): Only call assuan_disconnect if

View File

@ -445,40 +445,20 @@ gpgsm_new (void **engine, const char *lc_ctype, const char *lc_messages)
} }
} }
if (ttyname_r (1, dft_ttyname, sizeof (dft_ttyname))) if (isatty (1))
{ {
err = gpg_error_from_errno (errno); if (ttyname_r (1, dft_ttyname, sizeof (dft_ttyname)))
goto leave; {
}
else
{
if (asprintf (&optstr, "OPTION ttyname=%s", dft_ttyname) < 0)
{
err = gpg_error_from_errno (errno); err = gpg_error_from_errno (errno);
goto leave; goto leave;
} }
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, NULL, else
NULL, NULL, NULL);
free (optstr);
if (err)
{ {
err = map_assuan_error (err); if (asprintf (&optstr, "OPTION ttyname=%s", dft_ttyname) < 0)
goto leave;
}
err = _gpgme_getenv ("TERM", &dft_ttytype);
if (err)
goto leave;
if (dft_ttytype)
{
if (asprintf (&optstr, "OPTION ttytype=%s", dft_ttytype) < 0)
{ {
free (dft_ttytype);
err = gpg_error_from_errno (errno); err = gpg_error_from_errno (errno);
goto leave; goto leave;
} }
free (dft_ttytype);
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, NULL, err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, NULL,
NULL, NULL, NULL); NULL, NULL, NULL);
free (optstr); free (optstr);
@ -487,39 +467,62 @@ gpgsm_new (void **engine, const char *lc_ctype, const char *lc_messages)
err = map_assuan_error (err); err = map_assuan_error (err);
goto leave; goto leave;
} }
}
if (lc_ctype) err = _gpgme_getenv ("TERM", &dft_ttytype);
{ if (err)
if (asprintf (&optstr, "OPTION lc-ctype=%s", lc_ctype) < 0) goto leave;
err = gpg_error_from_errno (errno); if (dft_ttytype)
else
{ {
if (asprintf (&optstr, "OPTION ttytype=%s", dft_ttytype) < 0)
{
free (dft_ttytype);
err = gpg_error_from_errno (errno);
goto leave;
}
free (dft_ttytype);
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL,
NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL);
free (optstr); free (optstr);
if (err) if (err)
err = map_assuan_error (err); {
err = map_assuan_error (err);
goto leave;
}
} }
}
if (err)
goto leave;
if (lc_messages) if (lc_ctype)
{
if (asprintf (&optstr, "OPTION lc-messages=%s", lc_messages) < 0)
err = gpg_error_from_errno (errno);
else
{ {
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, if (asprintf (&optstr, "OPTION lc-ctype=%s", lc_ctype) < 0)
NULL, NULL, NULL, NULL); err = gpg_error_from_errno (errno);
free (optstr); else
if (err) {
err = map_assuan_error (err); err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL,
NULL, NULL, NULL, NULL);
free (optstr);
if (err)
err = map_assuan_error (err);
}
} }
if (err)
goto leave;
if (lc_messages)
{
if (asprintf (&optstr, "OPTION lc-messages=%s", lc_messages) < 0)
err = gpg_error_from_errno (errno);
else
{
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL,
NULL, NULL, NULL, NULL);
free (optstr);
if (err)
err = map_assuan_error (err);
}
}
if (err)
goto leave;
} }
if (err)
goto leave;
} }
if (!err if (!err