MCPcopy Create free account
hub / github.com/assaultcube/AC / marksuperseded

Function marksuperseded

source/src/crypto.cpp:1357–1378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1355#endif
1356
1357void marksuperseded(cert *chain) // checks all
1358{
1359 for(cert *c = chain; c; c = c->next)
1360 {
1361 if(c->isvalid) for(cert *r = c->next; r; r = r->next)
1362 {
1363 if(r->isvalid && c->isvalid)
1364 {
1365 if((c->type == r->type && c->name && r->name && !strcmp(c->name, r->name)) || (c->pubkey && r->pubkey && !memcmp(c->pubkey, r->pubkey, 32)))
1366 { // same name and type or same pubkey
1367 cert *x = c->signeddate < r->signeddate ? c : r; // older one has to go
1368 x->superseded = true;
1369 x->isvalid = false;
1370 }
1371 }
1372 }
1373 }
1374 for(cert *c = chain; c; c = c->next)
1375 { // check, if certs lost their parent during the cleanup above
1376 if(c->isvalid && c->parent && (!c->parent->isvalid || !c->parent->rank)) c->rank = 0;
1377 }
1378}
1379
1380void rebuildcerttree() // determines the rank of all certs; ages them; removes all kinds of illegal certs
1381{

Callers 1

rebuildcerttreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected