win32 gpgme passphrase callback FD issues

Tony Caduto tony.caduto at gmail.com
Sat Mar 19 19:06:51 CET 2016


Hi,
I have looked back in the list archives and did find some info about this
but no resolutions.

I am using FPC (free pascal) and have gpgme.dll working (currently using
older versions that don't require the pinentry support)

The problem I am having is with the passphrase call back.
Basically the win32 writefile function does not work, I did see in the docs
that a internal function
is available in newer versions called gpgme_io_writen
problem is I can't find a version that has that function exposed except the
very
newest which have that pinentry, I need to use this on a server and a
dialog popping up
to ask for the passphrase is not good.

I have tried this with verison 1.1.8 through 1.3.0 and they all fail.
What happens is it just goes into a loop calling back over and over that
the password was bad.
The only way I can get it to not hang is to close the file handle, then on
the next callback it fails because
the file handle is gone.

Does anyone know what is the newest version of gpgme.dll that still
supports the passphrase call back function?



Here is my FCP call back function:
(it gets called back and all params are populated but it just hangs after
returning 0.

function
gpgme_passphrase_cb(handle:pointer;uid_hint:pchar;passphrase_info:pchar;prev_was_bad:integer;fd:integer):Tgpgme_error;cdecl;
var
   password:pchar;
   ret:dword;
   filehandle:windows.HANDLE;
   newline:pchar = #10;
begin
     filehandle:=windows.HANDLE(fd);
     password:='coutweha';
     windows.WriteFile(filehandle,password,Length(password),ret,nil);
     windows.WriteFile(filehandle,newline,Length(newline),ret,nil);
     //windows.FlushFileBuffers(filehandle);   // Tried this to see if it
was not fully writing to handle.
     windows.CloseHandle(filehandle);    //Loops forever if you don't close
handle, errors out on second try because handle is closed.

     result.errorcode:=GPG_ERR_NO_ERROR;
     result.error:=GPG_ERR_NO_ERROR;;
     result.errorsource:=0;
end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20160319/52807fde/attachment.html>


More information about the Gnupg-users mailing list