Update of /cvsroot/srvx/services/src
In directory sc8-pr-cvs1:/tmp/cvs-serv29793/src
Modified Files:
opserv.c
Log Message:
allow searching for a specific trust in ?stats trusted
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.349
retrieving revision 1.350
diff -C2 -r1.349 -r1.350
*** opserv.c 8 Nov 2003 20:11:49 -0000 1.349
--- opserv.c 2 Jan 2004 21:52:05 -0000 1.350
***************
*** 159,162 ****
--- 159,163 ----
#define OSMSG_TRUSTED_LIST "List of trusted hosts:"
#define OSMSG_HOST_IS_TRUSTED "%s (%s; set %s ago by %s; expires %s: %s)"
+ #define OSMSG_HOST_NOT_TRUSTED "%s does not have a special trust."
#define OSMSG_UPTIME_STATS "Uptime: %s (%u lines processed, CPU time %.2fu/%.2fs)"
#define OSMSG_UNKNOWN_STATS "Unknown statistics type $b%s$b"
***************
*** 1432,1435 ****
--- 1433,1458 ----
struct trusted_host *th;
char length[INTERVALLEN], issued[INTERVALLEN], limit[32];
+
+ if (argc > 1) {
+ th = dict_find(opserv_trusted_hosts, argv[1], NULL);
+ if (th) {
+ if (th->issued)
+ intervalString(issued, now - th->issued);
+ if (th->expires)
+ intervalString(length, th->expires - now);
+ if (th->limit)
+ sprintf(limit, "limit %lu", th->limit);
+ reply(OSMSG_HOST_IS_TRUSTED,
+ th->ipaddr,
+ (th->limit ? limit : "no limit"),
+ (th->issued ? issued : "some time"),
+ (th->issuer ? th->issuer : "<unknown>"),
+ (th->expires ? length : "never"),
+ (th->reason ? th->reason : "<unknown>"));
+ } else {
+ reply(OSMSG_HOST_NOT_TRUSTED, argv[1]);
+ }
+ return 1;
+ }
reply(OSMSG_TRUSTED_LIST);
|