# # # add_file "contrib/get_passphrase_from_file.lua" # content [f78e93ea6cd7039dccb4d4446675ccf81d76bb41] # # patch "ChangeLog" # from [d089b155d8ec22c371049f10e1032d4223677a73] # to [28c34ad37e389db82fc367b02ef86369e1bbf426] # ============================================================ --- contrib/get_passphrase_from_file.lua f78e93ea6cd7039dccb4d4446675ccf81d76bb41 +++ contrib/get_passphrase_from_file.lua f78e93ea6cd7039dccb4d4446675ccf81d76bb41 @@ -0,0 +1,21 @@ +-- This hook reads the 'passphrases' file from the confdir. It expects the +-- file to be formatted as follows: +-- +-- address@hidden "passphrase here" +-- +-- One entry per line. The quotes are required. +-- +-- Note: Because the file contains passphrases it should only be readable by +-- select users. +function get_passphrase (keypair_id) + local permfile = io.open(get_confdir() .. "/passphrases", "r") + if (permfile == nil) then return false end + local line = permfile:read() + while (line ~= nil) do + local _, _, key, passphrase = string.find(line, "%s*([^%s]*)%s*\"(.*)\"%s*") + if keypair_id == key then return passphrase end + line = permfile:read() + end + io.close(permfile) + return false +end ============================================================ --- ChangeLog d089b155d8ec22c371049f10e1032d4223677a73 +++ ChangeLog 28c34ad37e389db82fc367b02ef86369e1bbf426 @@ -1,5 +1,10 @@ 2006-04-02 Matthew Nicholson + * contrib/get_passphrase_from_file.lua: Added. This hook reads + passphrases from 'confdir/passphrases'. + +2006-04-02 Matthew Nicholson + * contrib/ChangeLog.sh: Updated to reflect monotone name changes. 2006-04-02 Matthew Nicholson