Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id CF576431FD0 for ; Fri, 3 Jun 2011 16:03:52 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2vyAQG6Z9YGc for ; Fri, 3 Jun 2011 16:03:52 -0700 (PDT) Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108]) by olra.theworths.org (Postfix) with ESMTP id 574B5431FB6 for ; Fri, 3 Jun 2011 16:03:52 -0700 (PDT) Received: from pip.fifthhorseman.net (dsl254-070-154.nyc1.dsl.speakeasy.net [216.254.70.154]) by che.mayfirst.org (Postfix) with ESMTPSA id B255CF970; Fri, 3 Jun 2011 19:03:49 -0400 (EDT) Received: by pip.fifthhorseman.net (Postfix, from userid 1000) id C5E9511878; Fri, 3 Jun 2011 19:03:43 -0400 (EDT) From: Daniel Kahn Gillmor To: notmuch@notmuchmail.org Subject: [PATCH] Always return the empty string if decryption tries to demand a password Date: Fri, 3 Jun 2011 19:03:08 -0400 Message-Id: <1307142188-6551-1-git-send-email-dkg@fifthhorseman.net> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <87lixr1w87.fsf@yoom.home.cworth.org> References: <87lixr1w87.fsf@yoom.home.cworth.org> Cc: Daniel Kahn Gillmor X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 23:03:53 -0000 The notmuch binary is not in the business of doing interactive prompting with the user. If credentials are needed for decryption, they should be supplied to the decrypting processes some other way (e.g. gpg-agent). Previously, we returned a NULL function pointer for the request_passwd() function, which may have cause segmentation faults with some versions of gmime. --- notmuch-gmime-session.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/notmuch-gmime-session.c b/notmuch-gmime-session.c index d83d9b3..33f2817 100644 --- a/notmuch-gmime-session.c +++ b/notmuch-gmime-session.c @@ -39,11 +39,26 @@ notmuch_gmime_session_get_type (void) return type; } +/* + notmuch never prompts the user for a password. It always returns + an empty string (could it return a NULL pointer instead?) + + If credentials are needed for crypto, they should be supplied via + other mechanisms (e.g. gpg-agent, etc) + */ +static char *never_request_passwd (unused (GMimeSession *session), unused (const char *prompt), + unused (gboolean secret), unused (const char *item), + unused (GError **err)) { + fprintf (stderr, "Credentials needed for crypto; Please use gpg-agent.\n"); + return g_strdup (""); +} + + static void notmuch_gmime_session_class_init (NotmuchGmimeSessionClass *klass) { GMimeSessionClass *session_class = GMIME_SESSION_CLASS (klass); parent_class = g_type_class_ref (GMIME_TYPE_SESSION); - session_class->request_passwd = NULL; + session_class->request_passwd = never_request_passwd; } /* END CRUFTY BOILERPLATE */ -- 1.7.4.4