projects
/
fides
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Some more const.
[fides]
/
lib
/
fides.cc
diff --git
a/lib/fides.cc
b/lib/fides.cc
index
46dcd7f
..
e035e84
100644
(file)
--- a/
lib/fides.cc
+++ b/
lib/fides.cc
@@
-267,7
+267,7
@@
fides::certificate *fides::certificate_from_string(const string &data) {
if(e == string::npos)
throw exception("Invalid certificate");
string fingerprint = hexdecode(data.substr(0, e));
if(e == string::npos)
throw exception("Invalid certificate");
string fingerprint = hexdecode(data.substr(0, e));
- publickey *signer = find_key(fingerprint);
+
const
publickey *signer = find_key(fingerprint);
if(!signer)
throw exception("Unknown public key");
b = e + 1;
if(!signer)
throw exception("Unknown public key");
b = e + 1;
@@
-359,9
+359,9
@@
fides::fides(const string &dir): homedir(dir) {
fides::~fides() {
cerr << "Fides exitting\n";
fides::~fides() {
cerr << "Fides exitting\n";
- for(map<string, certificate *>::iterator i = certs.begin(); i != certs.end(); ++i)
+ for(map<string, certificate *>::
const_
iterator i = certs.begin(); i != certs.end(); ++i)
delete i->second;
delete i->second;
- for(map<string, publickey *>::iterator i = keys.begin(); i != keys.end(); ++i)
+ for(map<string, publickey *>::
const_
iterator i = keys.begin(); i != keys.end(); ++i)
if(i->second != &mykey)
delete i->second;
}
if(i->second != &mykey)
delete i->second;
}
@@
-397,8
+397,8
@@
fides::publickey *fides::find_key(const string &fingerprint) const {
return 0;
}
return 0;
}
-vector<fides::certificate *> fides::find_certificates(const publickey *signer, const string ®ex) const {
- vector<certificate *> found;
+vector<
const
fides::certificate *> fides::find_certificates(const publickey *signer, const string ®ex) const {
+ vector<c
onst c
ertificate *> found;
map<string, certificate *>::const_iterator i;
regexp regexp(regex);
for(i = certs.begin(); i != certs.end(); ++i) {
map<string, certificate *>::const_iterator i;
regexp regexp(regex);
for(i = certs.begin(); i != certs.end(); ++i) {
@@
-413,8
+413,8
@@
vector<fides::certificate *> fides::find_certificates(const publickey *signer, c
return found;
}
return found;
}
-vector<fides::certificate *> fides::find_certificates(const string ®ex) const {
- vector<certificate *> found;
+vector<
const
fides::certificate *> fides::find_certificates(const string ®ex) const {
+ vector<c
onst c
ertificate *> found;
map<string, certificate *>::const_iterator i;
regexp regexp(regex);
for(i = certs.begin(); i != certs.end(); ++i)
map<string, certificate *>::const_iterator i;
regexp regexp(regex);
for(i = certs.begin(); i != certs.end(); ++i)
@@
-423,8
+423,8
@@
vector<fides::certificate *> fides::find_certificates(const string ®ex) const
return found;
}
return found;
}
-vector<fides::certificate *> fides::find_certificates(const publickey *signer) const {
- vector<certificate *> found;
+vector<
const
fides::certificate *> fides::find_certificates(const publickey *signer) const {
+ vector<c
onst c
ertificate *> found;
map<string, certificate *>::const_iterator i;
for(i = certs.begin(); i != certs.end(); ++i)
if(i->second->signer == signer)
map<string, certificate *>::const_iterator i;
for(i = certs.begin(); i != certs.end(); ++i)
if(i->second->signer == signer)
@@
-484,7
+484,7
@@
void fides::dctrust(const publickey *key) {
void fides::update_trust() {
// clear trust on all keys
void fides::update_trust() {
// clear trust on all keys
- for(map<string, publickey *>::iterator i = keys.begin(); i != keys.end(); ++i)
+ for(map<string, publickey *>::
const_
iterator i = keys.begin(); i != keys.end(); ++i)
i->second->trust = 0;
// Start by checking all trust certificates from ourself.
i->second->trust = 0;
// Start by checking all trust certificates from ourself.
@@
-520,7
+520,7
@@
void fides::update_trust() {
// find all non-zero trust certificates of this key
// find all non-zero trust certificates of this key
- vector<certificate *> matches = find_certificates(*i, "^t[+-] ");
+ vector<c
onst c
ertificate *> matches = find_certificates(*i, "^t[+-] ");
// update trust value of those keys
// update trust value of those keys
@@
-584,7
+584,7
@@
void fides::merge(certificate *cert) {
// TODO: move these regexps to the class?
regexp authexp("^a[+0-] ");
regexp trustexp("^t[+0-] ");
// TODO: move these regexps to the class?
regexp authexp("^a[+0-] ");
regexp trustexp("^t[+0-] ");
- vector<certificate *> others;
+ vector<c
onst c
ertificate *> others;
// Is this an authorisation cert?
if(authexp.match(cert->statement)) {
// Is this an authorisation cert?
if(authexp.match(cert->statement)) {
@@
-671,7
+671,7
@@
void fides::merge(certificate *cert) {
void fides::auth_stats(const string &statement, int &self, int &trusted, int &all) const {
self = trusted = all = 0;
void fides::auth_stats(const string &statement, int &self, int &trusted, int &all) const {
self = trusted = all = 0;
- vector<certificate *> matches = find_certificates(string("^a[+0-] ") + statement + '$');
+ vector<c
onst c
ertificate *> matches = find_certificates(string("^a[+0-] ") + statement + '$');
for(size_t i = 0; i < matches.size(); ++i) {
char code = matches[i]->statement[1];
int diff = 0;
for(size_t i = 0; i < matches.size(); ++i) {
char code = matches[i]->statement[1];
int diff = 0;