preferences bug (patch.. sort of)

Brian Warner warner at
Tue Nov 17 23:54:58 CET 1998

Thanks to some help from Brian Moore, I found the problem with the preferences
getting dropped. The code that created the preference record in the trustdb
wasn't looping where it should have and was only putting a single preference
of each type into the prefrec.

The function that needs patching is upd_pref_record() in g10/trustdb.c . Early
in that function, parse_sig_subpkt2() is called which updates a certain value
"n" (by reference) with the number of preferences found. In the following
clause, a loop needs to be inserted such that the prefs_sig[] array gets added
to "n" times, not just once. s is a pointer to an "n"-long list of integers,
and all of them need to be pushed onto prefs_sig[].

The patch itself is left as an exercise for the reader. For the non-US-resident
reader in particular. (grumble grumble ITAR grumble grumble)

After patching, you'll need to update your trustdb for the fix to take
effect. I don't know if you can just run 'gpgm --update-trustdb' or if you
need to export the trust, delete trustdb.gpg, then reimport the trust. I
suspect the latter.

BTW, "gpgm --list-trustdb" was very helpful for tracking this down. To anyone
else hacking this code: look through the options in g10/g10.c . There are a
gazillion undocumented debugging commands in there, all extremely useful.

 -Brian (Warner)

More information about the Gnupg-devel mailing list