Re: [evolution-patches] Re: [Evolution-hackers] Deadlock in camel-gpg-context.c



committed

On Mon, 2003-04-21 at 15:27, Jeffrey Stedfast wrote:
> Attached is a patch to clean up the camel-gpg-context code to deal with
> this scenerio.
> 
> We don't even need the seen_eof1 bit in gpg_verify() for determining if
> we've gotten a TRUST_* status message since we can easily tell by
> checking gpg->trust != GPG_TRUST_UNKNOWN.
> 
> Jeff
> 
> On Mon, 2003-04-21 at 15:05, Jeffrey Stedfast wrote:
> > On Mon, 2003-04-21 at 13:55, Christophe Saout wrote:
> > > Am Mon, 2003-04-21 um 19.41 schrieb Jeffrey Stedfast:
> > > 
> > > > > In camel/camel-gpg-context.c (evo 1.3 cvs) there is a problem:
> > > > > 
> > > > > In gpg_ctx_op_step the file descriptors stdout_fd, stderr_fd and
> > > > > status_fd are polled for input.
> > > > > 
> > > > > But stdout_fd is not read when there is no gpg->ostream to get the data
> > > > > (if (FD_ISSET (gpg->stdout_fd, &rdset) && gpg->ostream)).
> > > > > 
> > > > > So the end of file state cannot be detected and thus gpg->seen_eof1
> > > > > won't be set.
> > > > > 
> > > > > If that happens gpg_ctx_op_complete fails to detect when gpg has
> > > > > finished and the users of these functions run in an endless loop.
> > > > 
> > > > When can this condition ever happen?
> > > 
> > > When gpg_ctx_op_step is called with gpg->ostream being NULL.
> > > gpg_verify and gpg_import_keys don't set them (it actually happened to
> > > me when trying to verify a signature).
> > 
> > a few things:
> > 
> > 1) gpg_import_keys() is not yet in use, so this isn't a real concern.
> > 
> > 2) seen_eof1 is used differently in the case of gpg_verify(). Instead of
> > being used as a eof marker, it is used to denote that we have gotten a
> > trust metric for the data being verified. ie, we parsed a
> > TRUST_[NEVER,MARGINAL,FULLY,ULTIMATE] status line from gpg's --status-fd
> > 
> > apparently you have discovered a bug in gpg, although the
> > camel-gpg-context code is a bit dodgy in this case as well.
> > 
> > Jeff
-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]