Bug in gpgme 1.1 - gpgme_engine_check_version()

Stéphane Corthésy stephane at sente.ch
Sun Oct 30 13:00:02 CET 2005


Hi,

The call to gpgme_engine_check_version() will not return correct  
results if, just before, you call gpgme_set_engine_info() with an  
executable path not pointing to gpg: gpgme_engine_check_version()  
returns 0 (if /usr/local/bin/gpg is OK), whereas it should return a  
GPG_ERR_INV_ENGINE error, according to documentation. Here's a test  
case.

Stéphane

/*
    gcc -o test test.c `gpgme-config --cflags --libs`
*/
#include <gpgme.h>
#include <stdio.h>
#include <locale.h>

int main(int argc, char **argv){
     gpgme_error_t   anError;

     setlocale (LC_ALL, "");
     printf("Checking version\n");
     gpgme_check_version (NULL);

     gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
     gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES,  
NULL));

     printf("Checking default configuration\n");
     anError = gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP);
     if(anError != GPG_ERR_NO_ERROR)
         return anError;

     printf("Changing executable path\n");
     anError = gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP, "/dummy/ 
path", NULL);
     if(anError != GPG_ERR_NO_ERROR)
         return anError;

     printf("Checking new configuration: ");
     anError = gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP);
     printf("%d\n", anError); /* anError  should be  
GPG_ERR_INV_ENGINE */

     return 0;
}




More information about the Gnupg-devel mailing list