More style tweaks: replace spaces with tabs.

This commit is contained in:
Matthias Vallentin 2012-12-21 18:04:19 -08:00
parent 382262e286
commit 8a569facd6

View file

@ -13,12 +13,12 @@ export {
valid: bool &log &optional; valid: bool &log &optional;
}; };
## Hands over an SSL record to the Notary module. This is an ownership ## Hands over an SSL record to the Notary module. This is an ownership
## transfer, i.e., the caller does not need to call Log::write on this record ## transfer, i.e., the caller does not need to call Log::write on this record
## anymore. ## anymore.
global push: function(info: SSL::Info); global push: function(info: SSL::Info);
## The notary domain to query. ## The notary domain to query.
const domain = "notary.icsi.berkeley.edu" &redef; const domain = "notary.icsi.berkeley.edu" &redef;
} }
@ -63,26 +63,26 @@ function clear_waitlist(digest: string)
} }
function flush(evict_all: bool) function flush(evict_all: bool)
{ {
local current: string; local current: string;
for ( unused_index in deque ) for ( unused_index in deque )
{ {
current = deque[tail]; current = deque[tail];
local info = records[current]; local info = records[current];
if ( ! evict_all && ! info?$notary ) if ( ! evict_all && ! info?$notary )
break; break;
Log::write(SSL::LOG, info); Log::write(SSL::LOG, info);
delete deque[tail]; delete deque[tail];
delete records[current]; delete records[current];
++tail; ++tail;
} }
} }
function lookup_cert_hash(uid: string, digest: string) function lookup_cert_hash(uid: string, digest: string)
{ j{
# Add the record ID to the list of waiting IDs for this digest. j# Add the record ID to the list of waiting IDs for this digest.
local waits_already = digest in waiting; jlocal waits_already = digest in waiting;
if ( ! waits_already ) jif ( ! waits_already )
waiting[digest] = vector(); waiting[digest] = vector();
waiting[digest][|waiting[digest]|] = uid; waiting[digest][|waiting[digest]|] = uid;
if ( waits_already ) if ( waits_already )
@ -135,14 +135,14 @@ function push(info: SSL::Info)
if ( ! info?$sha1_digest ) if ( ! info?$sha1_digest )
return; return;
local digest = info$sha1_digest; local digest = info$sha1_digest;
if ( info$sha1_digest in notary_cache ) if ( info$sha1_digest in notary_cache )
info$notary = notary_cache[digest]; info$notary = notary_cache[digest];
else else
lookup_cert_hash(info$uid, digest); lookup_cert_hash(info$uid, digest);
records[info$uid] = info; records[info$uid] = info;
deque[head] = info$uid; deque[head] = info$uid;
++head; ++head;
} }
event x509_certificate(c: connection, is_orig: bool, cert: X509, event x509_certificate(c: connection, is_orig: bool, cert: X509,
@ -151,12 +151,12 @@ event x509_certificate(c: connection, is_orig: bool, cert: X509,
if ( is_orig || chain_idx != 0 || ! c?$ssl ) if ( is_orig || chain_idx != 0 || ! c?$ssl )
return; return;
c$ssl$sha1_digest = sha1_hash(der_cert); c$ssl$sha1_digest = sha1_hash(der_cert);
} }
event bro_done() event bro_done()
{ {
if ( |deque| == 0 ) if ( |deque| == 0 )
return; return;
flush(T); flush(T);
} }