Revision 7cae0102
Added by Marc Dequènes about 15 years ago
- ID 7cae0102718dcd9e194e04ea551c5759700b331d
lib/cyborghood/mail.rb | ||
---|---|---|
refs = []
|
||
end
|
||
unless command_txt
|
||
order = Order.new(false, "Mail does not contain a proper text part for commands.")
|
||
order = Order.new(false, N_("Mail does not contain a proper text part for commands."))
|
||
order.user = self.user
|
||
return order
|
||
end
|
||
... | ... | |
|
||
def parse_signed
|
||
sigs_check = verify_pgp_signature()
|
||
return Order.new(false, "mail not formatted correctly (signed part)") if sigs_check.nil? or sigs_check.size != 1
|
||
return Order.new(false, N_("Mail not formatted correctly (signed part).")) if sigs_check.nil? or sigs_check.size != 1
|
||
|
||
sig_check = sigs_check.first
|
||
return Order.new(false, "Mail content tampered or badly signed: " + sig_check.to_s) unless sig_check.status == 0
|
||
return Order.new(false, N_("Mail content tampered or badly signed: ") + sig_check.to_s) unless sig_check.status == 0
|
||
|
||
logger.info "Mail content was properly signed by key #{sig_check.fingerprint}"
|
||
user = Person.find_by_fingerprint(sig_check.fingerprint)
|
||
if user.nil?
|
||
order = Order.new(false, "Mail is from an unknown person.")
|
||
order = Order.new(false, N_("Mail is from an unknown person."))
|
||
order.warn_sender = true
|
||
return order
|
||
end
|
||
... | ... | |
logger.debug "Signature drift time: #{drift}"
|
||
unless drift.abs < MAX_DRIFT_TIME
|
||
if drift > 0
|
||
order = Order.new(false, "The signature was made too long ago (check your system clock)." +
|
||
" Rejected message to avoid replay attacks.")
|
||
order = Order.new(false, N_("The signature was made too long ago (check your system clock). Rejected message to avoid replay attacks."))
|
||
order.user = self.user
|
||
else
|
||
# mark message to prevent later replay of the message
|
||
mark_processed(sig_check.timestamp)
|
||
order = Order.new(false, "The signature was made in the future (check your system clock)." +
|
||
" Rejected message to avoid replay attacks.")
|
||
order = Order.new(false, N_("The signature was made in the future (check your system clock). Rejected message to avoid replay attacks."))
|
||
order.user = self.user
|
||
end
|
||
return order
|
||
... | ... | |
end
|
||
end
|
||
|
||
Order.new(false, "Mail not formatted correctly (encrypted part).")
|
||
Order.new(false, N_("Mail not formatted correctly (encrypted part)."))
|
||
end
|
||
|
||
def mark_dir
|
Also available in: Unified diff
[evol] added gettext support using user prefered langage