X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ffides.cc;h=9040d5f33bcc6c2e7f13ea7ae7c2c57fe62e90b8;hb=f36a11f15b1d75cf3d786cab06fefe0d50812c83;hp=006b503613c6beb31fe298ee850f97c4cd83b92f;hpb=811b273f857703f489875376f188f1fc21b7e850;p=fides diff --git a/src/fides.cc b/src/fides.cc index 006b503..9040d5f 100644 --- a/src/fides.cc +++ b/src/fides.cc @@ -1,39 +1,24 @@ -/* fides.c - Light-weight, decentralised trust and authorisation management +/* fides.cc - Light-weight, decentralised trust and authorisation management Copyright (C) 2008-2009 Guus Sliepen - Fides is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of - the License, or (at your option) any later version. - - Fides is distributed in the hope that it will be useful, + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this program; if not, see . + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ -#include -#include -#include -#include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "fides.h" @@ -94,7 +79,7 @@ static void version(ostream &out = cout) { } static int init() { - fides fides; + Fides::Manager fides; if(fides.is_firstrun()) { cout << "New keys generated in " << fides.get_homedir() << '\n'; } else { @@ -107,8 +92,8 @@ static int is_trusted(int argc, char *const argv[]) { if(argc < 1) return EX_USAGE; - fides fides; - fides::publickey *key = fides.find_key(fides::hexdecode(argv[0])); + Fides::Manager fides; + Fides::PublicKey *key = fides.find_key(Fides::hexdecode(argv[0])); if(!key) { cerr << "Unknown key!\n"; return 1; @@ -120,8 +105,8 @@ static int is_distrusted(int argc, char *const argv[]) { if(argc < 1) return EX_USAGE; - fides fides; - fides::publickey *key = fides.find_key(fides::hexdecode(argv[0])); + Fides::Manager fides; + Fides::PublicKey *key = fides.find_key(Fides::hexdecode(argv[0])); if(!key) { cerr << "Unknown key!\n"; return 1; @@ -133,8 +118,8 @@ static int trust(int argc, char *const argv[]) { if(argc < 1) return EX_USAGE; - fides fides; - fides::publickey *key = fides.find_key(fides::hexdecode(argv[0])); + Fides::Manager fides; + Fides::PublicKey *key = fides.find_key(Fides::hexdecode(argv[0])); if(key) fides.trust(key); else { @@ -148,8 +133,8 @@ static int dctrust(int argc, char *const argv[]) { if(argc < 1) return EX_USAGE; - fides fides; - fides::publickey *key = fides.find_key(fides::hexdecode(argv[0])); + Fides::Manager fides; + Fides::PublicKey *key = fides.find_key(Fides::hexdecode(argv[0])); if(key) fides.dctrust(key); else { @@ -163,8 +148,8 @@ static int distrust(int argc, char *const argv[]) { if(argc < 1) return EX_USAGE; - fides fides; - fides::publickey *key = fides.find_key(fides::hexdecode(argv[0])); + Fides::Manager fides; + Fides::PublicKey *key = fides.find_key(Fides::hexdecode(argv[0])); if(key) fides.distrust(key); else { @@ -178,7 +163,7 @@ static int sign(int argc, char *const argv[]) { if(argc < 1) return EX_USAGE; - fides fides; + Fides::Manager fides; fides.sign(argv[0]); return 0; } @@ -187,7 +172,7 @@ static int allow(int argc, char *const argv[]) { if(argc < 1) return EX_USAGE; - fides fides; + Fides::Manager fides; fides.allow(argv[0]); return 0; } @@ -196,7 +181,7 @@ static int dontcare(int argc, char *const argv[]) { if(argc < 1) return EX_USAGE; - fides fides; + Fides::Manager fides; fides.dontcare(argv[0]); return 0; } @@ -205,13 +190,13 @@ static int deny(int argc, char *const argv[]) { if(argc < 1) return EX_USAGE; - fides fides; + Fides::Manager fides; fides.deny(argv[0]); return 0; } static int import(int argc, char *const argv[]) { - fides fides; + Fides::Manager fides; if(argc) { ifstream in(argv[0]); @@ -222,7 +207,7 @@ static int import(int argc, char *const argv[]) { } static int exprt(int argc, char *const argv[]) { - fides fides; + Fides::Manager fides; if(argc) { ofstream out(argv[0]); @@ -237,8 +222,8 @@ static int find(int argc, char *const argv[]) { return EX_USAGE; // Find certificates matching statement - fides fides; - const vector &certs = fides.find_certificates(argv[0]); + Fides::Manager fides; + const vector &certs = fides.find_certificates(argv[0]); for(size_t i = 0; i < certs.size(); ++i) cout << i << ' ' << certs[i]->to_string() << '\n'; return 0; @@ -248,7 +233,7 @@ static int is_allowed(int argc, char *const argv[]) { if(argc < 1) return EX_USAGE; - fides fides; + Fides::Manager fides; return fides.is_allowed(argv[0]) ? 0 : 1; } @@ -256,7 +241,7 @@ static int is_denied(int argc, char *const argv[]) { if(argc < 1) return EX_USAGE; - fides fides; + Fides::Manager fides; return fides.is_denied(argv[0]) ? 0 : 1; } @@ -264,7 +249,7 @@ static int test(int argc, char *const argv[]) { if(argc < 1) return EX_USAGE; - fides fides; + Fides::Manager fides; int self, trusted, all; fides.auth_stats(argv[0], self, trusted, all); cout << "Self: " << self << ", trusted: " << trusted << ", all: " << all << '\n'; @@ -272,7 +257,7 @@ static int test(int argc, char *const argv[]) { } static int fsck() { - fides fides; + Fides::Manager fides; if(fides.fsck()) { cout << "Everything OK\n"; return 0;