]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Remove trusts2 from paulbranch.
authorChris Porter <redacted>
Sun, 19 Feb 2012 03:59:50 +0000 (03:59 +0000)
committerChris Porter <redacted>
Sun, 19 Feb 2012 03:59:50 +0000 (03:59 +0000)
--HG--
branch : paul

53 files changed:
core/hooks.h
glines2/Makefile.in [deleted file]
glines2/gline.c [deleted file]
glines2/gline.h [deleted file]
glines2/gline_alloc.c [deleted file]
glines2/gline_commands.c [deleted file]
glines2/gline_handler.c [deleted file]
glines2/gline_hash.c [deleted file]
trusts2/Makefile.in [deleted file]
trusts2/trusts.c [deleted file]
trusts2/trusts.h [deleted file]
trusts2/trusts_alloc.c [deleted file]
trusts2/trusts_blocks.c [deleted file]
trusts2/trusts_commands.c [deleted file]
trusts2/trusts_db.c [deleted file]
trusts2/trusts_groups.c [deleted file]
trusts2/trusts_handlers.c [deleted file]
trusts2/trusts_hash.c [deleted file]
trusts2/trusts_hosts.c [deleted file]
trusts2/trusts_ident.c [deleted file]
trusts2_newsearch/Makefile.in [deleted file]
trusts2_newsearch/formats.c [deleted file]
trusts2_newsearch/trusts_newsearch.c [deleted file]
trusts2_newsearch/trusts_newsearch.h [deleted file]
trusts2_newsearch/trusts_searchcommands.c [deleted file]
trusts2_newsearch/tsns-currenton.c [deleted file]
trusts2_newsearch/tsns-enforceident.c [deleted file]
trusts2_newsearch/tsns-istrusted.c [deleted file]
trusts2_newsearch/tsns-maxclones.c [deleted file]
trusts2_newsearch/tsns-ownerid.c [deleted file]
trusts2_newsearch/tsns-tbid.c [deleted file]
trusts2_newsearch/tsns-tgcreated.c [deleted file]
trusts2_newsearch/tsns-tgexpire.c [deleted file]
trusts2_newsearch/tsns-tgid.c [deleted file]
trusts2_newsearch/tsns-tglastused.c [deleted file]
trusts2_newsearch/tsns-tgmaxperident.c [deleted file]
trusts2_newsearch/tsns-tgmaxperip.c [deleted file]
trusts2_newsearch/tsns-tgmaxusage.c [deleted file]
trusts2_newsearch/tsns-tgmodified.c [deleted file]
trusts2_newsearch/tsns-tgstartdate.c [deleted file]
trusts2_newsearch/tsns-thcreated.c [deleted file]
trusts2_newsearch/tsns-thexpire.c [deleted file]
trusts2_newsearch/tsns-thid.c [deleted file]
trusts2_newsearch/tsns-thlastused.c [deleted file]
trusts2_newsearch/tsns-thmaxusage.c [deleted file]
trusts2_newsearch/tsns-thmodified.c [deleted file]
trusts2_newsearch/tsns-thstartdate.c [deleted file]
trusts2_newsearch/tsns-trusted.c [deleted file]
trusts2_search/Makefile.in [deleted file]
trusts2_search/formats.c [deleted file]
trusts2_search/newsearch_ast.c [deleted file]
trusts2_search/trusts_search.c [deleted file]
trusts2_search/trusts_search.h [deleted file]

index 90e2972c70f4a3ee36f22da82f5d380beb598821..a3c219c5887092a9e7b32f53c4dfa91075c6c32a 100644 (file)
 #define HOOK_TRUSTS_MODIFYGROUP    910 /* Argument is trustgroup* */
 #define HOOK_TRUSTS_LOSTHOST       911 /* Argument is trusthost* */
 
-#define HOOK_TRUSTS_DBLOADED       1000
-
-#define HOOK_TRUSTS_DBLOADED       1000
-
 #define PRIORITY_DEFAULT           0
 
 #define PRIORITY_MAX               LONG_MIN
diff --git a/glines2/Makefile.in b/glines2/Makefile.in
deleted file mode 100644 (file)
index 68de83c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-@include@ @includel@../build.mk@includel@
-
-CFLAGS+=$(INCPGSQL) ${INCPCRE}
-LDFLAGS+=$(LIBPGSQL) ${LIBPCRE}
-
-.PHONY: all
-all: gline.so
-
-gline.so: gline_hash.o gline_alloc.o gline_handler.o gline.o
diff --git a/glines2/gline.c b/glines2/gline.c
deleted file mode 100644 (file)
index f0c19de..0000000
+++ /dev/null
@@ -1,357 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <time.h>
-#include <assert.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include "../control/control.h"
-#include "../nick/nick.h"
-#include "../localuser/localuserchannel.h"
-#include "../core/hooks.h"
-#include "../server/server.h"
-#include "../parser/parser.h"
-#include "../core/schedule.h"
-#include "../lib/array.h"
-#include "../lib/base64.h"
-#include "../lib/irc_string.h"
-#include "../lib/splitline.h"
-#include "../core/nsmalloc.h"
-
-#include "gline.h"
-
-gline* glinelist = 0, *glinelistnonnode = 0;
-
-int glinecount = 0;
-int badchancount = 0;
-int rnglinecount = 0;
-int gl_nodeext = -1;
-
-/* 
-  <prefix> GL <target> [!][+|-|>|<]<mask> [<expiration>] [<lastmod>]
-    [<lifetime>] [:<reason>]
-
- */
-
-void _init() {
-  gl_nodeext = registernodeext("gline");
-
-  if ( gl_nodeext == -1 ) {
-    Error("gline", ERR_FATAL, "Could not register a required node extension (gline)");
-    return;
-  }
-
-  registerserverhandler("GL", &handleglinemsg, 6);
-
-  /* send reburst command to get glines from before we registered handler */
-  irc_send("%s RB G", mynumeric->content);
-}
-
-void _fini() {
-  gline *gl, *ngl;
-
-  deregisterserverhandler("GL", &handleglinemsg);
-
-  for (gl=glinelist;gl;gl=ngl) { 
-    ngl=gl->next;
-    freegline(gl);    
-  }
-  glinelist = NULL;
-  if (gl_nodeext != -1) 
-    releasenodeext(gl_nodeext);
-
-  nsfreeall(POOL_GLINE);
-}
-
-int gline_setnick(nick *np, int duration, char *reason ) {
-
-}
-
-int gline_setnode(patricia_node_t *node ) {
-
-}
-
-int gline_setmask(char *mask, int duration, char *reason ) {
-
-}
-
-gline* gline_add(long creatornum, sstring *creator, char *mask, char *reason, time_t expires, time_t lastmod, time_t lifetime) {
-  gline* gl;
-  char glineiddata[1024];
-
-  if ( !(gl=gline_processmask(mask))) { /* sets up nick,user,host,node and flags */
-    /* couldn't process gline mask */
-    Error("gline", ERR_WARNING, "Tried to add malformed G-Line %s!", mask);
-    return 0;
-  }
-
-  gl->creator = creator;
-  gl->numeric = creatornum;
-
-  /* it's not unreasonable to assume gline is active, if we're adding a deactivated gline, we can remove this later */
-  gl->flags = GLINE_ACTIVE;
-
-
-  /* set up gline id */
-  snprintf(glineiddata, sizeof(glineiddata), "gline %s %s", mask, reason);
-  gl->glineid = crc32(glineiddata);  
-
-  gl->reason = getsstring(reason, 255); /*TODO@@@ */ 
-  gl->expires = expires;
-  gl->lastmod = lastmod;
-  gl->lifetime = lifetime; 
-
-  /* Storage of glines */
-  /* ipbased glines are stored at node->ext[gl_nodeext]   
-   * other glines are stored in seperate linked list (for now) */
-  if (gl->flags & GLINE_IPMASK) {
-    gl->nextbynode = gl->node->exts[gl_nodeext];
-    gl->node->exts[gl_nodeext] = gl; 
-  } else {
-    gl->nextbynonnode = glinelistnonnode;
-    glinelistnonnode = gl;
-  }  
-
-  gl->next = glinelist;
-  glinelist = gl;
-
-  return gl;
-}
-
-/* returns 1 on success, 0 on a bad mask */
-gline* gline_processmask(char *mask) {
-  /* populate gl-> user,host,node,nick and set appropriate flags */
-  int len;
-  int foundat=-1,foundbang=-1;
-  int foundwild=0;
-  int i;
-  struct irc_in_addr sin;
-  unsigned char bits;
-  gline *gl = NULL;
-
-  if (!(gl = newgline())) {
-    Error("gline", ERR_ERROR, "Failed to allocate new gline");
-    return 0;
-  }
-
-  len=strlen(mask);
-
-  switch (*mask ) {
-    case '#':
-    case '&':
-      gl->flags |= GLINE_BADCHAN;
-      gl->user = getsstring(mask, CHANNELLEN);
-      return gl;
-    case '$':
-      switch (mask[1]) {
-        case 'R':
-          gl->flags |= GLINE_REALNAME;
-          break;
-        default: 
-          Error("gline", ERR_WARNING, "Tried to add malformed G-Line %s!", mask);
-          return 0;
-      }
-      gl->user = getsstring(mask,REALLEN);
-      return gl;
-    default:
-      /* Default case of some host/ip/cidr mask */
-      for (i=(len-1);i>=0;i--) {
-        if (mask[i]=='@') {
-          /* host */
-          if ((len-i)-1 > HOSTLEN) {
-            /* host too long */
-            return 0;
-          } else if (i==(len-1)) {
-            /* no host supplied aka gline ends @ */
-            return 0;
-          } else if (i==(len-2) && mask[i+1]=='*') {
-            /* Special case: "@*" */
-            gl->flags |= GLINE_HOSTANY;
-            gl->host=NULL;
-          } else {
-            if (ipmask_parse(&mask[i+1], &sin, &bits) == 0) {
-              /* we have some host string */
-              gl->host=getsstring(&mask[i+1],HOSTLEN);
-              if (foundwild) {
-                gl->flags |= GLINE_HOSTMASK;
-              } else {
-                gl->flags |= GLINE_HOSTEXACT;
-              } 
-            } else {
-              /* we have a / so cidr gline */
-              Error("gline", ERR_WARNING, "CIDR: %s", &mask[i+1]);
-              gl->node = refnode(iptree, &sin, bits);
-              gl->flags |= GLINE_IPMASK;
-            }
-          }
-          foundat=i;
-          break;
-        } else if (mask[i]=='?' || mask[i]=='*') {
-          if (!foundwild)  /* Mark last wildcard in string */
-            foundwild=i;
-        }
-      }
-  }
-  /*TODO set hostexact/hostmask */
-  if (foundat<0) {
-    /* If there wasn't an @, this ban matches any host */
-    gl->host=NULL;
-    gl->flags |= GLINE_HOSTANY;
-  }
-
-  foundwild=0;
-
-  for (i=0;i<foundat;i++) {
-    if (mask[i]=='!') {
-      if (i==0) {
-        /* Invalid mask: nick is empty */
-        gl->flags |= GLINE_NICKNULL;
-        gl->nick=NULL;
-      } else if (i==1 && mask[0]=='*') {
-        /* matches any nick */
-        gl->flags |= GLINE_NICKANY;
-        gl->nick=NULL;
-      } else {
-        if (i>NICKLEN) {
-          /* too long: just take the first NICKLEN chars */
-          gl->nick=getsstring(mask,NICKLEN);
-        } else {
-          gl->nick=getsstring(mask,i);
-        }
-        if (foundwild)
-          gl->flags |= GLINE_NICKMASK;
-        else
-          gl->flags |= GLINE_NICKEXACT;
-      }
-      foundbang=i;
-      break;
-    } else if (mask[i]=='?' || mask[i]=='*') {
-      if (i<NICKLEN) {
-        foundwild=1;
-      }
-    }
-  }
-
-  if (foundbang<0) {
-    /* We didn't find a !, what we do now depends on what happened
-     * with the @ */
-    if (foundat<0) {
-      /* A gline with no ! or @ is treated as a nick ban only */
-      /* Note that we've special-cased "*" at the top, so we can only
-       * hit the MASK or EXACT case here. */
-      if (len>NICKLEN)
-        gl->nick=getsstring(mask,NICKLEN);
-      else
-        gl->nick=getsstring(mask,len);
-
-      if (foundwild)
-        gl->flags |= GLINE_NICKMASK;
-      else
-        gl->flags |= GLINE_NICKEXACT;
-
-      gl->flags |= (GLINE_USERANY | GLINE_HOSTANY);
-      gl->host=NULL;
-      gl->user=NULL;
-    } else {
-      /* A gline with @ only is treated as user@host */
-      gl->nick=NULL;
-      gl->flags |= GLINE_NICKANY;
-    }
-  }
-
-  if (foundat>=0) {
-    /* We found an @, so everything between foundbang+1 and foundat-1 is supposed to be ident */
-    /* This is true even if there was no !.. */
-    if (foundat==(foundbang+1)) {
-      /* empty ident matches nothing */ /*@@@TODO: * for glines? */
-      gl->flags |= (/*GLINE_INVALID |*/ GLINE_USERNULL);
-      gl->user=NULL;
-    } else if (foundat - foundbang - 1 > USERLEN) {
-      /* It's too long.. */
-      return 0;
-    } else if ((foundat - foundbang - 1 == 1) && mask[foundbang+1]=='*') {
-      gl->user=NULL;
-      gl->flags |= GLINE_USERANY;
-    } else {
-      gl->user=getsstring(&mask[foundbang+1],(foundat-foundbang-1));
-      if (strchr(gl->user->content,'*') || strchr(gl->user->content,'?'))
-        gl->flags |= GLINE_USERMASK;
-      else
-        gl->flags |= GLINE_USEREXACT;
-    }
-    /* Username part can't contain an @ */
-    if (gl->user && strchr(gl->user->content,'@')) {
-      //gl->flags |= CHANBAN_INVALID;
-    }
-  }
-
-  assert(gl->flags & (GLINE_USEREXACT | GLINE_USERMASK | GLINE_USERANY | GLINE_USERNULL));
-  assert(gl->flags & (GLINE_NICKEXACT | GLINE_NICKMASK | GLINE_NICKANY | GLINE_NICKNULL));
-  assert(gl->flags & (GLINE_HOSTEXACT | GLINE_HOSTMASK | GLINE_HOSTANY | GLINE_HOSTNULL | GLINE_IPMASK));
-
-  return gl;
-}
-
-gline *gline_find( char *mask) {
-  gline *gl;
-  gline *globalgline;
-
-  if( !(globalgline=gline_processmask(mask))) {
-    /* gline mask couldn't be processed */
-    return 0;
-  }
-
-  if (globalgline->flags & GLINE_IPMASK) {
-    gl = globalgline->node->exts[gl_nodeext];
-    while (gl) {
-      if ( gline_match( globalgline, gl) ) {
-        freegline(globalgline);
-        return gl;
-      }
-      gl = gl->nextbynode;
-    }
-  } else {
-    gl = glinelist;
-    while (gl) { 
-      if ( gline_match( globalgline, gl ) ) {
-        freegline(globalgline);
-        return gl;
-      }
-      gl = gl->nextbynonnode;
-    }
-  }
-  freegline(globalgline);
-  return 0;
-}
-
-/* returns non-zero on match */
-int gline_match ( gline *gla, gline *glb) {
-  if ((!gla->nick && glb->nick) || (gla->nick && !glb->nick))
-    return 0;
-
-  if (gla->nick && ircd_strcmp(gla->nick->content,glb->nick->content))
-    return 0;
-
-  if ((!gla->user && glb->user) || (gla->user && !glb->user))
-    return 0;
-
-  if (gla->user && ircd_strcmp(gla->user->content,glb->user->content))
-    return 0;
-
-  if ((!gla->host && glb->host) || (gla->host && !glb->host))
-    return 0;
-
-  if (gla->host && ircd_strcmp(gla->host->content,glb->host->content))
-    return 0;
-  
-  /* TODO @@@ match bits flags */
-  return 1;
-}
-
-void gline_send(gline *gl) {
-
-}
diff --git a/glines2/gline.h b/glines2/gline.h
deleted file mode 100644 (file)
index 601a746..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-#ifndef _GLINE_H
-#define _GLINE_H
-
-#include <time.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include "../lib/sstring.h"
-#include "../lib/flags.h"
-#include "../nick/nick.h"
-#include "../channel/channel.h"
-#include "../parser/parser.h"
-#include "../localuser/localuserchannel.h"
-
-#define MAX_USERS_RN 1
-
-#define PASTWATCH       157680000       /* number of seconds in 5 years */
-
-/*
- * If the expiration value, interpreted as an absolute timestamp, is
- * more recent than 5 years in the past, we interpret it as an
- * absolute timestamp; otherwise, we assume it's relative and convert
- * it to an absolute timestamp.  Either way, the output of this macro
- * is an absolute timestamp--not guaranteed to be a *valid* timestamp,
- * but you can't have everything in a macro ;)
- */
-#define abs_expire(exp)                                                 \
-  ((exp) >= getnettime() - PASTWATCH ? (exp) : (exp) + getnettime())
-
-#define gline_max(a,b) (((a)<(b)) ? (b) : (a))
-
-extern int gl_nodeext;
-
-typedef struct gline {
-  struct gline*    next;
-  struct gline*    nextbynode;
-  struct gline*    nextbynonnode;
-
-  long             glineid;
-  long             numeric;
-  sstring*         nick;
-  sstring*         user;
-  sstring*         host;
-  sstring*         reason;
-  sstring*         creator;
-
-  patricia_node_t* node;
-  time_t           expires;
-  time_t           lastmod;
-  time_t           lifetime;
-  unsigned int     flags;
-} gline;
-
-#define GLINE_NICKEXACT   0x00001  /* Gline includes an exact nick (no wildcards) */
-#define GLINE_NICKMASK    0x00002  /* Gline includes a nick mask with wildcards */
-#define GLINE_NICKANY     0x00004  /* Gline is *!.. */
-#define GLINE_NICKNULL    0x00008  /* Gline has no nick */
-#define GLINE_USEREXACT   0x00010  /* Gline includes an exact user (no wildcards) */
-#define GLINE_USERMASK    0x00020  /* Gline includes a user mask with wildcards */
-#define GLINE_USERANY     0x00040  /* Gline is ..!*@.. */
-#define GLINE_USERNULL    0x00080  /* Gline has no user */
-#define GLINE_HOSTEXACT   0x00100  /* Gline includes an exact host */
-#define GLINE_HOSTMASK    0x00200  /* Gline includes a host mask */
-#define GLINE_HOSTANY     0x00400  /* Gline is ..@* */
-#define GLINE_HOSTNULL    0x00800  /* Gline has no host */
-#define GLINE_BADCHAN     0x01000
-#define GLINE_REALNAME    0x02000
-#define GLINE_IPMASK      0x04000
-#define GLINE_FORCED      0x08000
-#define GLINE_ACTIVATE    0x10000
-#define GLINE_DEACTIVATE  0x20000
-#define GLINE_ACTIVE      0x40000
-#define GLINE_HOST        0x80000
-
-#define GlineIsBadChan(x)  ((x)->flags & GLINE_BADCHAN)
-#define GlineIsRealName(x) ((x)->flags & GLINE_REALNAME)
-#define GlineIsIpMask(x)   ((x)->flags & GLINE_IPMASK)
-#define GlineIsForced(x)   ((x)->flags & GLINE_FORCED)
-
-#define GlineNick(x)    ((x)->nick)
-#define GlineUser(x)    ((x)->user)
-#define GlineHost(x)    ((x)->host)
-#define GlineReason(x)  ((x)->reason)
-#define GlineCreator(x) ((x)->creator)
-#define GlineExpires(x) ((x)->expires)
-#define GlineLastMod(x) ((x)->lastmod)
-
-#define GLIST_COUNT    0x01 /* -c */
-#define GLIST_EXACT    0x02 /* -x */
-#define GLIST_FIND     0x04 /* -f */
-#define GLIST_REASON   0x10 /* -r */
-#define GLIST_OWNER    0x20 /* -o */
-#define GLIST_REALNAME 0x40 /* -R */
-
-extern gline* glinelist;
-extern gline* glinelistnonnode;
-extern gline* badchanlist;
-extern int glinecount;
-extern int badchancount;
-extern int rnglinecount;
-extern int hostglinecount;
-extern int ipglinecount;
-
-int gline_glist(void* source, int cargc, char** cargv);
-int gline_glgrep(void* source, int cargc, char** cargv);
-int gline_glstats(void* source, int cargc, char** cargv);
-int gline_ungline(void* source, int cargc, char** cargv);
-int gline_rawglinefile(void* source, int cargc, char** cargv);
-int gline_glinefile(void* source, int cargc, char** cargv);
-int gline_unglinefile(void* source, int cargc, char** cargv);
-int gline_saveglines(void* source, int cargc, char** cargv);
-int handleglinemsg(void* source, int cargc, char** cargv);
-int gline_gline(void* source, int cargc, char** cargv);
-int gline_rngline(void* source, int cargc, char** cargv);
-int gline_block(void* source, int cargc, char** cargv);
-
-gline *newgline();
-void freegline (gline *gl);
-
-gline* gline_processmask(char *mask);
-int gline_match ( gline *gla, gline *glb);
-
-gline* gline_add(long creatornum, sstring *creator, char *mask, char *reason, time_t expires, time_t lastmod, time_t lifetime);
-
-/*
-int gline_add(char* mask, char* reason, char* creator, time_t expires, time_t lastmod, unsigned int flags, int propagate);
-gline* make_gline(char* nick, char* user, char* host, char* reason, char* creator, time_t expires, time_t lastmod, unsigned int flags);
-gline* gline_find(char* mask);
-void gline_free(gline* g);
-int check_if_ipmask(const char* mask);
-void canon_userhost(char* mask, char** nick, char** user, char** host, char* def_user);
-*/
-
-#endif
diff --git a/glines2/gline_alloc.c b/glines2/gline_alloc.c
deleted file mode 100644 (file)
index 26d51d9..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-#include <stdlib.h>
-#include <assert.h>
-#include "../core/nsmalloc.h"
-#include <stdio.h>
-#include <string.h>
-
-#include "gline.h"
-
-#define ALLOCUNIT  100
-
-gline *gline_freelist;
-
-gline *newgline() {
-  gline *gl;
-  int i;
-
-  if( gline_freelist ==NULL ) {
-    gline_freelist=(gline *)nsmalloc(POOL_GLINE,ALLOCUNIT*sizeof(gline));
-
-    for (i=0;i<(ALLOCUNIT-1);i++) {
-      gline_freelist[i].next=(gline *)&(gline_freelist[i+1]);
-    }
-    gline_freelist[ALLOCUNIT-1].next=NULL;
-  }
-
-  gl=gline_freelist;
-  gline_freelist=(gline *)gl->next;
-
-  gl->next=NULL;
-  gl->nextbynode=NULL;
-  gl->nextbynonnode=NULL;
-  
-  gl->glineid=0;
-  gl->numeric=0;
-
-  gl->nick=NULL;
-  gl->user=NULL;
-  gl->host=NULL;
-  gl->reason=NULL;
-  gl->creator=NULL;
-
-  gl->node=NULL;
-
-  gl->expires=0;
-  gl->lastmod=0;
-  gl->lifetime=0;
-
-  gl->flags=0;
-
-  return gl;
-}
-
-void removeglinefromlists( gline *gl) {
-  gline *gl2;
-
-  if (gl->flags & GLINE_IPMASK) {
-    if ( gl == gl->node->exts[gl_nodeext]) {
-      gl->node->exts[gl_nodeext] = gl->nextbynode;
-    } else {
-      gl2 = gl->node->exts[gl_nodeext];
-      while (gl2) {
-        if ( gl2->nextbynode == gl) {
-          gl2->nextbynode = gl->nextbynode; 
-          break;
-        }
-        gl2 = gl2->nextbynode;
-      }
-    }
-  } else {
-    if ( gl == glinelistnonnode) {
-      glinelistnonnode = gl->nextbynonnode;
-    } else {
-      gl2 = glinelistnonnode;
-      while (gl2) {
-        if ( gl2->nextbynonnode == gl) {
-          gl2->nextbynonnode = gl->nextbynonnode;
-          break;
-        }
-        gl2 = gl2->nextbynonnode;
-      }
-    }
-  }
-
-  if ( gl == glinelist) {
-    glinelist = gl->next;
-  } else {
-    gl2 = glinelist;
-    while (gl2) {
-      if ( gl2->next == gl) {
-        gl2->next = gl->next;
-        break;
-      }
-      gl2 = gl2->next;
-    }
-  }
-}
-
-void freegline (gline *gl) {
-  gl->next=(gline *)gline_freelist;
-
-  if (gl->nick)
-    freesstring(gl->nick);
-  if (gl->user)
-    freesstring(gl->user);
-  if (gl->host)
-    freesstring(gl->host);
-  if (gl->reason)
-    freesstring(gl->reason);
-  if (gl->creator)
-    freesstring(gl->creator);
-
-  if (gl->node) { 
-    derefnode(iptree, gl->node);
-  }
-  gline_freelist=gl;
-}
-
-void removegline( gline *gl) { 
-  removeglinefromlists(gl);
-  freegline(gl);
-}
-
-
diff --git a/glines2/gline_commands.c b/glines2/gline_commands.c
deleted file mode 100644 (file)
index ac35407..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <time.h>
-#include <assert.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include "../control/control.h"
-#include "../nick/nick.h"
-#include "../localuser/localuserchannel.h"
-#include "../core/hooks.h"
-#include "../server/server.h"
-#include "../parser/parser.h"
-#include "../core/schedule.h"
-#include "../lib/array.h"
-#include "../lib/base64.h"
-#include "../lib/irc_string.h"
-#include "../lib/splitline.h"
-
-#include "gline.h"
-
-void _init() {
-  registercontrolhelpcmd("glstats",NO_OPER,0,&gline_glstats,"Usage: glstats.");
-}
-
-void _fini() {
-  deregistercontrolcmd("glstats", gline_glstats);
-}
-
-int gline_glstats(void* source, int cargc, char** cargv) {
-  nick* sender = (nick*)source;
-  gline* g;
-  gline* sg;
-  time_t curtime = time(0);
-  int glinecount = 0, hostglinecount = 0, ipglinecount = 0, badchancount = 0, rnglinecount = 0;
-  int deactivecount =0, activecount = 0;
-
-  for (g = glinelist; g; g = sg) {
-    sg = g->next;
-
-    if (g->lifetime <= curtime)
-      continue;
-    if (g->flags & GLINE_ACTIVE) {
-      activecount++;
-    } else {
-      deactivecount++;
-    }
-
-    if(g->flags & GLINE_IPMASK)
-      ipglinecount++;
-    else if (g->flags & (GLINE_HOSTMASK | GLINE_HOSTEXACT))
-      hostglinecount++;
-    else if (g->flags & GLINE_REALNAME)
-      rnglinecount++;
-    else if (g->flags & GLINE_BADCHAN)
-      badchancount++;
-    glinecount++;
-  }
-
-  controlreply(sender, "Total G-Lines set: %d", glinecount);
-  controlreply(sender, "Hostmask G-Lines:  %d", hostglinecount);
-  controlreply(sender, "IPMask G-Lines:    %d", ipglinecount);
-  controlreply(sender, "Channel G-Lines:   %d", badchancount);
-  controlreply(sender, "Realname G-Lines:  %d", rnglinecount);
-
-  controlreply(sender, "Active G-Lines:    %d", activecount);
-  controlreply(sender, "De-Active G-Lines: %d", deactivecount);
-
-  /* TODO show top 10 creators here */
-  /* TODO show unique creators count */
-  /* TODO show glines per create %8.1f", ccount?((float)gcount/(float)ccount):0 */
-  return CMD_OK;
-}
-
diff --git a/glines2/gline_handler.c b/glines2/gline_handler.c
deleted file mode 100644 (file)
index 732f037..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-#include <string.h>
-
-#include "../control/control.h"
-#include "../nick/nick.h"
-#include "../localuser/localuserchannel.h"
-#include "../core/hooks.h"
-#include "../server/server.h"
-#include "../parser/parser.h"
-#include "../core/schedule.h"
-#include "../lib/array.h"
-#include "../lib/base64.h"
-#include "../lib/irc_string.h"
-#include "../lib/splitline.h"
-#include "gline.h"
-
-/*
-  <prefix> GL <target> [!][+|-|>|<]<mask> [<expiration>] [<lastmod>]
-        [<lifetime>] [:<reason>]
-*/
-
-int handleglinemsg(void* source, int cargc, char** cargv) {
-  char* sender = (char*)source;
-  char* target;
-  char* mask;
-  char* reason;
-  sstring *creator;
-  time_t lifetime = 0, expires = 0, lastmod = 0;
-  unsigned int flags = 0;
-  int numlen; 
-  long creatornum;
-  gline *agline;
-
-  nick* np;
-
-  int i;
-  for (i = 0; i <cargc; i++) {
-    Error("debuggline", ERR_WARNING, "Token %d is - %s", i, cargv[i]);
-  }
-
-  /* valid GL tokens have X params */
-  switch ( cargc ) {
-    case 2:
-      /* local modification which we reject later */
-      break;
-    case 5:
-      /* 1.3.x GL Token */
-      break;
-    case 6:
-      /* 1.4.0 and above GL token */
-      break;
-    default: 
-      Error("gline", ERR_WARNING, "Invalid number of arguments in GL token (%d)", cargc);
-      return CMD_ERROR;
-  }
-
-  /* gline creator can be either a nick or a server */
-  numlen = strlen(source);
-  switch (numlen) {
-    case 2:
-      creatornum = numerictolong(sender, 2);
-      if (creatornum < 0) {
-        Error("gline", ERR_WARNING, "Failed to resolve numeric to server (%s) when adding G-Line!", sender);
-        creator = getsstring("unknown", HOSTLEN);
-      } else 
-        creator = getsstring(serverlist[(int)creatornum].name->content, HOSTLEN);
-      break;
-    case 5:
-      creatornum = numerictolong(sender, 5);
-      if (!(np = getnickbynumeric(creatornum))) {
-        Error("gline", ERR_WARNING, "Failed to resolve numeric to nick when adding G-Line!", sender);
-        creator = getsstring("unknown", HOSTLEN);
-      } else
-        creator = getsstring( np->nick, NICKLEN);
-      break;
-    default:
-      Error("gline", ERR_WARNING, "Invalid numeric '%s' in G-Line message.", sender);
-  }
-
-  /* 1st param is target */
-  target = cargv[0];
-
-  /* 2nd param is mask */
-  mask = cargv[1];
-
-  if (*mask == '!') {
-    Error("gline", ERR_DEBUG, " forced flag ");
-    mask++;
-  }
-
-  switch (*mask) {
-    case '+':
-      flags |= GLINE_ACTIVATE;
-      mask++;
-      break;
-    case '-':
-      flags |= GLINE_DEACTIVATE;
-      mask++;
-      break;
-    case '>':
-    case '<':
-      Error("gline", ERR_WARNING, "Received local modification from %s - do they realise we're a service?", sender);
-      return CMD_ERROR;
-  } 
-
-  /* anything other than a global G-Line is irrelevant */
-  if (strcmp(target, "*")) {
-    Error("gline", ERR_WARNING, "Received local g-line from %s - do they realise we're a service?", sender);
-    return CMD_ERROR;
-  }
-
-  if (flags & GLINE_ACTIVATE) {
-    /* activate gline */
-    expires = abs_expire(atoi(cargv[2]));
-    switch (cargc) {
-      case 4:
-        /* asuka U:d, no lastmod */
-        reason = cargv[3];
-        break;
-      case 5:
-        /*asuka lastmod */
-        lastmod = atoi(cargv[3]);
-        lifetime = gline_max(lastmod,expires); /* set lifetime = lastmod */ 
-        reason = cargv[4];
-        break;
-      case 6:
-        /* snircd */
-        lastmod = atoi(cargv[3]);
-        lifetime = atoi(cargv[4]); 
-        reason = cargv[5];
-        break;
-      default:
-         Error("gline", ERR_WARNING, "Gline Activate with invalid number (%d) of arguments", cargc);
-         return CMD_ERROR;
-    }
-
-    Error("debuggline", ERR_WARNING, "GL Received: Creator %s, Mask %s, Reason %s, Expire %lu, Lastmod %lu, Lifetime %lu", creator->content, mask, reason, expires, lastmod, lifetime);   
-    if ( (agline=gline_find(mask)) ) {
-      if (agline->flags & GLINE_ACTIVE ) { 
-        Error("debuggline", ERR_WARNING, "Duplicate Gline recieved for %s - old lastmod %lu, expire %lu, lifetime %lu, reason %s, creator %s", mask, agline->lastmod, agline->expires, agline->lifetime, agline->reason->content, agline->creator->content  );
-      } else {
-        /* we're reactivating a gline - check lastmod then assume the new gline is authoritive */
-        if ( lastmod > agline->lastmod ) {
-          agline->lastmod = lastmod;
-          agline->expires = expires;
-          agline->lifetime = lifetime;
-          agline->creator = creator;
-          freesstring(agline->reason);
-          agline->reason = getsstring(reason, 255); 
-          agline->flags |= GLINE_ACTIVE;
-        } else {
-          Error("debuggline", ERR_WARNING, "received a gline with a lower lastmod");
-          /* @@@TODO resend our gline ? */
-        } 
-      }
-      /* TODO */
-      return CMD_ERROR;
-    } else {
-      gline_add( creatornum, creator, mask, reason, expires, lastmod, lifetime); 
-    } 
-  } else if (flags & GLINE_DEACTIVATE) {
-    /* deactivate gline */
-    if ((agline = gline_find(mask))) {
-      switch (cargc) {
-        case 2:
-          /* asuka U:d, no last mod */
-          removegline(agline);
-          break;
-        case 5:
-          /* asuka last mod */
-          lastmod = atoi(cargv[3]);
-          gline_deactivate(agline, lastmod, 0);
-          break;
-        case 6:
-          /* snircd */
-          lastmod = atoi(cargv[3]);
-          gline_deactivate(agline, lastmod, 0);
-          break;
-        default:
-          Error("gline", ERR_WARNING, "Gline Deactivate with invalid number (%d) of arguments", cargc);
-          return CMD_ERROR;
-      }
-      return CMD_OK;
-    } else {
-       Error("gline", ERR_WARNING, "Gline addition - adding deactivated gline - mask not found (%s)", mask);
-       expires = abs_expire(atoi(cargv[2]));
-       switch (cargc) {
-         case 4:
-           /* asuka U:d, no lastmod */
-           reason = cargv[3];
-           break;
-         case 5:
-           /*asuka lastmod */
-           lastmod = atoi(cargv[3]);
-           lifetime = gline_max(lastmod,expires); /* set lifetime = lastmod */
-           reason = cargv[4];
-           break;
-         case 6:
-           /* snircd */
-           lastmod = atoi(cargv[3]);
-           lifetime = atoi(cargv[4]);
-           reason = cargv[5];
-           break;
-         default:
-           Error("gline", ERR_WARNING, "Gline DeActivate with invalid number (%d) of arguments", cargc);
-           return CMD_ERROR;
-      }
-
-      agline = gline_add( creatornum, creator, mask, reason, expires, lastmod, lifetime);
-      gline_deactivate(agline, lastmod, 0);       
-      return CMD_ERROR;
-    }
-  } else {
-    /* modification - only snircd 1.4.x */
-    if ((agline = gline_find(mask))) {
-      expires = abs_expire(atoi(cargv[2]));
-      lastmod = atoi(cargv[3]);
-      lifetime = atoi(cargv[4]);
-      reason = cargv[5];
-
-      if ( lastmod > agline->lastmod ) {
-        agline->lastmod = lastmod;
-        agline->expires = expires;
-        agline->lifetime = lifetime;
-        agline->creator = creator;
-        freesstring(agline->reason);
-        agline->reason = getsstring(reason, 255);
-      } else {
-        Error("debuggline", ERR_WARNING, "received a gline modification with a lower lastmod");
-        /* @@@TODO resend our gline ? */
-      }
-      return CMD_OK;
-    } else {
-      Error("gline", ERR_WARNING, "Received modification for gline that does not exist for mask %s", mask);
-      return CMD_ERROR;
-    }
-  }
-
-  Error("debuggline", ERR_WARNING, "Creator %s", creator->content);
-  return CMD_OK;
-}
-
-
-int gline_deactivate(gline *agline, time_t lastmod, int propagate) {
-  agline->flags &= ~GLINE_ACTIVE;
-  agline->lastmod = lastmod;
-}
diff --git a/glines2/gline_hash.c b/glines2/gline_hash.c
deleted file mode 100644 (file)
index 8197a6b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "gline.h"
-
-//gline *glinetable[
diff --git a/trusts2/Makefile.in b/trusts2/Makefile.in
deleted file mode 100644 (file)
index 5961e3a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-@include@ @includel@../build.mk@includel@
-
-CFLAGS+=$(INCDBAPI)
-LDFLAGS+=$(LIBDBAPI)
-
-.PHONY: all
-
-all: trusts.so trusts_commands.so
-
-trusts.so: trusts_ident.o trusts_hosts.o trusts_groups.o trusts_alloc.o trusts.o trusts_handlers.o trusts_blocks.o trusts_hash.o trusts_db.o
-trusts_commands.so: trusts_commands.o
diff --git a/trusts2/trusts.c b/trusts2/trusts.c
deleted file mode 100644 (file)
index 186fc25..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-#include "trusts.h"
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include "../core/nsmalloc.h"
-#include "../lib/version.h"
-
-MODULE_VERSION("");
-
-int tgh_ext = -1;
-int tgb_ext = -1;
-int tgn_ext = -1;
-
-unsigned long trusts_lasttrustgroupid;
-unsigned long trusts_lasttrusthostid;
-unsigned long trusts_lasttrustblockid;
-int trusts_loaded = 0;
-int removeusers = 0;
-
-static void trusts_status(int hooknum, void *arg);
-void trustsfinishinit(int hooknum, void *arg);
-
-void _init(void) {
-  trusts_hash_init();
-
-  tgh_ext = registernodeext("trusthost");
-  if ( tgh_ext == -1 ) {
-    Error("trusts", ERR_FATAL, "Could not register a required node extension (trusthost)");
-    return;
-  }
-
-  tgb_ext = registernodeext("trustblock");
-  if ( tgb_ext == -1 ) {
-    Error("trusts", ERR_FATAL, "Could not register a required node extension (trustblock)");
-    return;
-  }
-
-  tgn_ext = registernickext("trustnick");
-  if ( tgn_ext == -1 ) {
-    Error("trusts", ERR_FATAL, "Could not register a required nick extension (trustnick)");
-    return;
-  }
-
-  registerhook(HOOK_TRUSTS_DBLOADED, trustsfinishinit);
-
-  if ( !trusts_load_db()) {
-    return;
-  }
-  if (trusts_loaded) 
-    trustsfinishinit(HOOK_TRUSTS_DBLOADED, NULL);
-}
-
-void trustsfinishinit(int hooknum, void *arg) {
-  registerhook(HOOK_NICK_NEWNICK, &trusts_hook_newuser);
-  registerhook(HOOK_NICK_LOSTNICK, &trusts_hook_lostuser);
-
-  registerhook(HOOK_CORE_STATSREQUEST, trusts_status);
-}
-
-void _fini(void) {
-  trusthost_t *thptr;
-  trustgroupidentcount_t *t;
-
-  int i;
-
-  deregisterhook(HOOK_TRUSTS_DBLOADED, trustsfinishinit);
-
-  if ( trusts_loaded ) {
-    deregisterhook(HOOK_NICK_NEWNICK, &trusts_hook_newuser);
-    deregisterhook(HOOK_NICK_LOSTNICK, &trusts_hook_lostuser);
-
-    deregisterhook(HOOK_CORE_STATSREQUEST, trusts_status);
-  }
-
-  for ( i = 0; i < TRUSTS_HASH_IDENTSIZE ; i++ ) {
-    for ( t = trustgroupidentcounttable[i]; t; t = t-> next ) {
-      if (t->ident) {
-        freesstring(t->ident);
-      }
-    }
-  }
-
-  patricia_node_t *node;
-  PATRICIA_WALK_CLEAR(iptree->head,node) {
-    if (node && node->exts[tgb_ext]) {
-      trustblock_free(node->exts[tgb_ext]);
-      node->exts[tgb_ext] = NULL;      
-    }
-  } PATRICIA_WALK_CLEAR_END;
-
-  if (tgh_ext != -1)
-    releasenodeext(tgh_ext);
-  if (tgb_ext != -1)
-    releasenodeext(tgb_ext);
-  if (tgn_ext != -1)
-    releasenickext(tgn_ext);
-
-  /* @@@ CLOSE DB */
-
-  trusts_hash_fini();
-
-  nsfreeall(POOL_TRUSTS);
-}
-
-void increment_trust_ipnode(patricia_node_t *node) {
-  patricia_node_t *parent;
-  trusthost_t *tgh = NULL;
-  time_t curtime = getnettime();
-  parent = node;
-  while (parent) {
-    if(parent->exts && parent->exts[tgh_ext]) {
-      /* update the trusted hosts themselves */
-      tgh = (trusthost_t *)parent->exts[tgh_ext];
-      tgh->lastused = curtime;
-      if (tgh->node->usercount > tgh->maxused) { tgh->maxused = tgh->node->usercount; }
-
-      /* update the trustgroup itself */
-      tgh->trustgroup->currenton++;
-      tgh->trustgroup->lastused = curtime;
-      if (tgh->trustgroup->currenton > tgh->trustgroup->maxusage) { tgh->trustgroup->maxusage = tgh->trustgroup->currenton; }
-    }
-    parent = parent->parent;
-  }
-}
-
-void decrement_trust_ipnode(patricia_node_t *node) {
-  patricia_node_t *parent;
-  trusthost_t *tgh = NULL;
-  time_t curtime = getnettime();
-
-  parent = node;
-  while (parent) {
-    if(parent->exts && parent->exts[tgh_ext]) {
-      tgh = (trusthost_t *)parent->exts[tgh_ext];
-      tgh->trustgroup->currenton--;
-      tgh->lastused = curtime;
-
-      tgh->trustgroup->lastused = curtime;
-    }
-    parent = parent->parent;
-  }
-}
-
-static void trusts_status(int hooknum, void *arg) {
-  if((long)arg > 10) {
-    char message[100];
-    int tgcount = 0, thcount = 0; 
-    trustgroup_t *tg; trusthost_t* thptr; int i;
-
-    for ( i = 0; i < TRUSTS_HASH_GROUPSIZE ; i++ ) {
-      for ( tg = trustgroupidtable[i]; tg; tg = tg -> nextbyid ) {
-        tgcount++;
-      }
-    }
-
-    for ( i = 0; i < TRUSTS_HASH_HOSTSIZE ; i++ ) {
-      for ( thptr = trusthostidtable[i]; thptr; thptr = thptr-> nextbyid ) {
-        thcount++;
-      }
-    }
-    snprintf(message, sizeof(message), "Trusts  :%7d groups, %7d hosts", tgcount, thcount);
-    triggerhook(HOOK_CORE_STATSREPLY, message);
-  }
-}
-
-int trusts_ignore_np(nick *np) {
-  if(SIsService(&serverlist[homeserver(np->numeric)])) {
-    /* ANY user created by a server (nterface,fakeusers,Q) are ignored in relation to trusts */
-    /* NOTE: we might need to review this if we ever used newserv to handle client/user connections in some way */
-    return 1;
-  }
-  return 0;
-}
diff --git a/trusts2/trusts.h b/trusts2/trusts.h
deleted file mode 100644 (file)
index 8707ebb..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
-
- * trust.h:
- *  Top level data structures and function prototypes for the
- *  trusts service module
- */
-
-#ifndef __TRUST_H
-#define __TRUST_H
-
-#include <string.h>
-
-#include "../lib/irc_ipv6.h"
-#include "../core/schedule.h"
-#include "../lib/irc_string.h"
-#include "../localuser/localuserchannel.h"
-#include "../control/control.h"
-#include "../patricia/patricia.h"
-#include "../dbapi/dbapi.h"
-#include "../patricianick/patricianick.h"
-#include "../nick/nick.h"
-
-#define TRUSTS_HASH_GROUPSIZE 500
-#define TRUSTS_HASH_HOSTSIZE 1000
-#define TRUSTS_HASH_IDENTSIZE 50
-
-#define TRUSTS_MAXGROUPNAMELEN 20
-
-/* node extensions */
-extern int tgh_ext;
-extern int tgb_ext;
-
-/* nick extensions */
-extern int tgn_ext;
-
-extern int removeusers;
-extern int trusts_loaded;
-
-typedef struct trusthost_s {
-        /* Details */
-        unsigned long id;
-        patricia_node_t* node;
-        time_t startdate;
-        time_t lastused;
-        time_t expire;
-        unsigned long maxused;
-
-        /* Trust group */
-        struct trustgroup_s* trustgroup;
-
-        time_t created;
-        time_t modified;
-
-        /* Hash table */
-        struct trusthost_s* nextbyid;
-        struct trusthost_s* nextbygroupid;
-} trusthost_t;
-
-typedef struct trustgroup_s {
-        /* Details */
-        unsigned long id;
-        unsigned long maxusage, currenton;
-        unsigned long maxclones, maxperident;
-        unsigned short maxperip;
-        int enforceident;
-        time_t startdate,lastused, expire;
-        unsigned long ownerid;
-        int type;
-
-        time_t created;
-        time_t modified;
-
-        /* Hash table */
-        struct trustgroup_s* nextbyid;
-} trustgroup_t;
-
-typedef struct trustgroupidentcount_s {
-        /* Ident */
-        sstring *ident;
-
-        /* Trust group */
-        struct trustgroup_s* trustgroup;
-
-        /* Counter */
-        unsigned long currenton;
-
-        /* Hash table */
-        struct trustgroupidentcount_s* next;
-} trustgroupidentcount_t;
-
-typedef struct trustblock_s {
-  unsigned long id;
-  patricia_node_t* node;
-  unsigned long ownerid;
-  time_t expire;
-  time_t startdate;
-  sstring* reason_private;
-  sstring* reason_public;
-  struct trustblock_s* next;
-} trustblock_t;
-
-/* trusts hash tables */
-extern trustgroup_t *trustgroupidtable[TRUSTS_HASH_GROUPSIZE];
-extern trustgroup_t *trustgroupnametable[TRUSTS_HASH_GROUPSIZE];
-extern trusthost_t *trusthostidtable[TRUSTS_HASH_HOSTSIZE];
-extern trusthost_t *trusthostgroupidtable[TRUSTS_HASH_HOSTSIZE];
-extern trustgroupidentcount_t *trustgroupidentcounttable[TRUSTS_HASH_IDENTSIZE];
-
-#define trusts_gettrustgroupidhash(x) ((x)%TRUSTS_HASH_GROUPSIZE)
-#define trusts_gettrustgroupnamehash(x) ((crc32i(x))%TRUSTS_HASH_GROUPSIZE)
-#define trusts_gettrusthostidhash(x) ((x)%TRUSTS_HASH_HOSTSIZE)
-#define trusts_gettrusthostgroupidhash(x) ((x)%TRUSTS_HASH_HOSTSIZE)
-#define trusts_gettrustgroupidenthash(x) ((crc32i(x))%TRUSTS_HASH_IDENTSIZE)
-
-/* trusts_hash.c */
-void trusts_hash_init();
-void trusts_hash_fini();
-
-void trusts_addtrusthosttohash(trusthost_t *newhost);
-void trusts_removetrusthostfromhash(trusthost_t *t);
-
-void trusts_addtrustgrouptohash(trustgroup_t *newgroup);
-void trusts_removetrustgroupfromhash(trustgroup_t *t);
-
-void trusts_addtrustgroupidenttohash(trustgroupidentcount_t *newident);
-void trusts_removetrustgroupidentfromhash(trustgroupidentcount_t *t);
-
-trustgroup_t* findtrustgroupbyid(int id);
-trustgroup_t* findtrustgroupbyownerid(int ownerid);
-
-trustgroupidentcount_t* findtrustgroupcountbyident(char *ident, trustgroup_t *t);
-
-trustgroupidentcount_t *getnewtrustgroupidentcount(trustgroup_t *tg, char *ident);
-
-extern unsigned long trusts_lasttrustgroupid, trusts_lasttrusthostid, trusts_lasttrustblockid;
-
-/* trusts alloc */
-trustgroup_t *newtrustgroup();
-void freetrustgroup (trustgroup_t *trustgroup);
-trusthost_t *newtrusthost();
-void freetrusthost (trusthost_t *trusthost);
-trustgroupidentcount_t *newtrustgroupidentcount();
-void freetrustgroupidentcount (trustgroupidentcount_t *trustgroupidentcount);
-trustblock_t *newtrustblock();
-void freetrustblock (trustblock_t *trustblock);
-
-/* trusts db */
-int trusts_load_db(void);
-void trusts_create_tables(void);
-void trusts_cleanup_db(void);
-void trusts_loadtrustgroups(DBConn *dbconn, void *arg);
-void trusts_loadtrustgroupsmax(DBConn *dbconn, void *arg);
-void trusts_loadtrusthosts(DBConn *dbconn, void *arg);
-void trusts_loadtrusthostsmax(DBConn *dbconn, void *arg);
-void trusts_loadtrustblocks(DBConn *dbconn, void *arg);
-void trustsdb_addtrustgroup(trustgroup_t *t);
-void trustsdb_updatetrustgroup(trustgroup_t *t);
-void trustsdb_deletetrustgroup(trustgroup_t *t);
-void trustsdb_addtrusthost(trusthost_t *th);
-void trustsdb_updatetrusthost(trusthost_t *th);
-void trustsdb_deletetrusthost(trusthost_t *th);
-void trustsdb_addtrustblock(trustblock_t *tb);
-void trustsdb_updatetrustblock(trustblock_t *tb);
-void trustsdb_deletetrustblock(trustblock_t *tb);
-void trustsdb_logmessage(trustgroup_t *tg, unsigned long userid, int type, char *message);
-
-/* trusts handlers */
-void trusts_hook_newuser(int hook, void *arg);
-void trusts_hook_lostuser(int hook, void *arg);
-
-/* trusts groups */
-
-trustgroup_t *createtrustgroupfromdb(unsigned long id, unsigned long maxusage, unsigned long maxclones, unsigned long maxperident, unsigned short maxperip, int enforceident, time_t startdate, time_t lastused, time_t expire, unsigned long ownerid, int type, time_t created, time_t modified);
-trustgroup_t *createtrustgroup(unsigned long id, unsigned long maxclones, unsigned long maxperident, unsigned short maxperip, int enforceident, time_t expire, unsigned long ownerid, int type);
-void trustgroup_expire (trustgroup_t *tg);
-void trustgroup_free(trustgroup_t* t);
-
-/* trusts hosts */
-trusthost_t *createtrusthostfromdb(unsigned long id, patricia_node_t* node, time_t startdate, time_t lastused, time_t expire, unsigned long maxused, trustgroup_t* trustgroup, time_t created, time_t modified);
-trusthost_t *createtrusthost(unsigned long id, patricia_node_t* node, time_t expire, trustgroup_t *trustgroup);
-void trusthost_free(trusthost_t* t);
-void trusthost_addcounters(trusthost_t* tgh);
-trusthost_t* trusthostadd(patricia_node_t *node, trustgroup_t* tg, time_t expire);
-void trusthost_expire ( trusthost_t *th);
-
-/* trusts blocks */
-trustblock_t *createtrustblock(unsigned long id, patricia_node_t* node, unsigned long ownerid, time_t expire, char *reason_private, char *reason_public);
-trustblock_t *createtrustblockfromdb(unsigned long id, patricia_node_t* node, unsigned long ownerid, time_t expire, time_t startdate, char *reason_private, char *reason_public);
-void trustblock_free(trustblock_t* t);
-void trustblock_expire( trustblock_t *tb);
-
-/* trusts idents */
-void increment_ident_count(nick *np, trustgroup_t *tg);
-void decrement_ident_count(nick *np, trustgroup_t *tg);
-
-/* trusts */
-void decrement_trust_ipnode(patricia_node_t *node);
-void increment_trust_ipnode(patricia_node_t *node);
-int trusts_ignore_np(nick *np);
-
-/* trusts cmds */
-void trusts_cmdinit();
-void trusts_cmdfini();
-
-int trust_groupadd(void *source, int cargc, char **cargv);
-int trust_groupmodify(void *source, int cargc, char **cargv);
-int trust_groupdel(void *source, int cargc, char **cargv);
-int trust_denyadd(void *source, int cargc, char **cargv);
-int trust_denycomment(void *source, int cargc, char **cargv);
-int trust_denydel(void *source, int cargc, char **cargv);
-int trust_del(void *source, int cargc, char **cargv);
-int trust_add(void *source, int cargc, char **cargv);
-int trust_comment(void *source, int cargc, char **cargv);
-
-int trust_stats(void *source, int cargc, char **cargv);
-int trust_dump(void *source, int cargc, char **cargv);
-int trust_dotrustlog(void *source, int cargc, char **cargv);
-
-#endif
-
diff --git a/trusts2/trusts_alloc.c b/trusts2/trusts_alloc.c
deleted file mode 100644 (file)
index 4f1fb7c..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-#include <stdlib.h>
-#include <assert.h>
-#include "../core/nsmalloc.h"
-#include "trusts.h"
-
-#define ALLOCUNIT  100
-
-trustgroup_t *trustgroup_freelist;
-trustgroupidentcount_t *trustgroupidentcount_freelist;
-trusthost_t *trusthost_freelist;
-trustblock_t *trustblock_freelist;
-
-trustgroup_t *newtrustgroup() {
-  trustgroup_t *trustgroup;
-  int i;
-
-  if( trustgroup_freelist ==NULL ) {
-    trustgroup_freelist=(trustgroup_t *)nsmalloc(POOL_TRUSTS,ALLOCUNIT*sizeof(trustgroup_t));
-
-    for (i=0;i<(ALLOCUNIT-1);i++) {
-      trustgroup_freelist[i].nextbyid=(trustgroup_t *)&(trustgroup_freelist[i+1]);
-    }
-    trustgroup_freelist[ALLOCUNIT-1].nextbyid=NULL;
-  }
-
-  trustgroup=trustgroup_freelist;
-  trustgroup_freelist=(trustgroup_t *)trustgroup->nextbyid;
-
-  return trustgroup;
-}
-
-void freetrustgroup (trustgroup_t *trustgroup) {
-  trustgroup->nextbyid=(trustgroup_t *)trustgroup_freelist;
-  trustgroup_freelist=trustgroup;
-}
-
-trusthost_t *newtrusthost() {
-  trusthost_t *trusthost;
-  int i;
-
-  if( trusthost_freelist ==NULL ) {
-    trusthost_freelist=(trusthost_t *)nsmalloc(POOL_TRUSTS,ALLOCUNIT*sizeof(trusthost_t));
-
-    for (i=0;i<(ALLOCUNIT-1);i++) {
-      trusthost_freelist[i].nextbyid=(trusthost_t *)&(trusthost_freelist[i+1]);
-    }
-    trusthost_freelist[ALLOCUNIT-1].nextbyid=NULL;
-  }
-
-  trusthost=trusthost_freelist;
-  trusthost_freelist=(trusthost_t *)trusthost->nextbyid;
-
-  return trusthost;
-}
-
-void freetrusthost (trusthost_t *trusthost) {
-  trusthost->nextbyid=(trusthost_t *)trusthost_freelist;
-  trusthost_freelist=trusthost;
-}
-
-
-trustgroupidentcount_t *newtrustgroupidentcount() {
-  trustgroupidentcount_t *trustgroupidentcount;
-  int i;
-
-  if( trustgroupidentcount_freelist ==NULL ) {
-    trustgroupidentcount_freelist=(trustgroupidentcount_t *)nsmalloc(POOL_TRUSTS,ALLOCUNIT*sizeof(trustgroupidentcount_t));
-
-    for (i=0;i<(ALLOCUNIT-1);i++) {
-      trustgroupidentcount_freelist[i].next=(trustgroupidentcount_t *)&(trustgroupidentcount_freelist[i+1]);
-    }
-    trustgroupidentcount_freelist[ALLOCUNIT-1].next=NULL;
-  }
-
-  trustgroupidentcount=trustgroupidentcount_freelist;
-  trustgroupidentcount_freelist=(trustgroupidentcount_t *)trustgroupidentcount->next;
-
-  return trustgroupidentcount;
-}
-
-void freetrustgroupidentcount (trustgroupidentcount_t *trustgroupidentcount) {
-  trustgroupidentcount->next=(trustgroupidentcount_t *)trustgroupidentcount_freelist;
-  trustgroupidentcount_freelist=trustgroupidentcount;
-}
-
-trustblock_t *newtrustblock() {
-  trustblock_t *trustblock;
-  int i;
-
-  if( trustblock_freelist ==NULL ) {
-    trustblock_freelist=(trustblock_t *)nsmalloc(POOL_TRUSTS,ALLOCUNIT*sizeof(trustblock_t));
-
-    for (i=0;i<(ALLOCUNIT-1);i++) {
-      trustblock_freelist[i].next=(trustblock_t *)&(trustblock_freelist[i+1]);
-    }
-    trustblock_freelist[ALLOCUNIT-1].next=NULL;
-  }
-
-  trustblock=trustblock_freelist;
-  trustblock_freelist=(trustblock_t *)trustblock->next;
-
-  return trustblock;
-}
-
-void freetrustblock (trustblock_t *trustblock) {
-  trustblock->next=(trustblock_t *)trustblock_freelist;
-  trustblock_freelist=trustblock;
-}
-
diff --git a/trusts2/trusts_blocks.c b/trusts2/trusts_blocks.c
deleted file mode 100644 (file)
index c2046b2..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-#include "trusts.h"
-
-static trustblock_t *trustblocklist = NULL;
-
-trustblock_t *createtrustblock(unsigned long id, patricia_node_t* node, unsigned long ownerid, time_t expire, char *reason_private, char *reason_public) {
-  trustblock_t *tb = newtrustblock();
-  memset(tb, 0, sizeof(trustblock_t));
-
-  tb->startdate = getnettime();
-
-  tb->id = id;
-  tb->node = node;
-  tb->ownerid = ownerid;
-  tb->expire = expire;
-  tb->reason_private = getsstring(reason_private,512);
-  tb->reason_public = getsstring(reason_public,512);
-
-  tb->next=trustblocklist;
-  trustblocklist = tb; 
-  return tb;
-}
-
-trustblock_t *createtrustblockfromdb(unsigned long id, patricia_node_t* node, unsigned long ownerid, time_t expire, time_t startdate, char *reason_private, char *reason_public) {
-  trustblock_t *tb = createtrustblock(id,node,ownerid, expire, reason_private, reason_public);
-
-  tb->startdate = startdate;
-  return tb;
-}
-
-void trustblock_free(trustblock_t* t)
-{
-  trustblock_t *st, *pst=NULL;
-  for (st = trustblocklist; st; st=st->next) {
-    if (st == t ) {
-      break;
-    }
-    pst = st;
-  }
-  if (st) {
-    if (pst) {
-      pst->next = st->next;
-    } 
-
-    derefnode(iptree,st->node);
-    if (st->reason_public ) {
-      freesstring(st->reason_public);
-    }
-    if (st->reason_private) {
-      freesstring(st->reason_private);
-    }
-    freetrustblock(st);
-  }
-}
-
-void trustblock_expire( trustblock_t *tb) {
-    controlwall(NO_OPER, NL_TRUSTS, "trustblock on %s/%d expired",IPtostr(tb->node->prefix->sin),irc_bitlen(&(tb->node->prefix->sin),tb->node->prefix->bitlen));
-    trustsdb_deletetrustblock(tb->node->exts[tgb_ext]);
-    trustblock_free(tb->node->exts[tgb_ext]);
-    tb->node->exts[tgb_ext] = NULL;
-}
-
-void trustblock_freeall() {
-  trustblock_t *tb, *ptb=NULL;
-  tb=trustblocklist;
-  while(tb) {
-    ptb=tb;
-    tb=tb->next;
-
-    derefnode(iptree,ptb->node);
-    if (ptb->reason_public ) {
-      freesstring(ptb->reason_public);
-    }
-    if (ptb->reason_private) {
-      freesstring(ptb->reason_private);
-    }
-    ptb->node->exts[tgb_ext] = NULL;
-  }
-}
diff --git a/trusts2/trusts_commands.c b/trusts2/trusts_commands.c
deleted file mode 100644 (file)
index ac5d649..0000000
+++ /dev/null
@@ -1,928 +0,0 @@
-#include "../core/schedule.h"
-#include "../lib/irc_string.h"
-#include "../localuser/localuserchannel.h"
-#include "../control/control.h"
-#include "trusts.h"
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include "../lib/version.h"
-
-MODULE_VERSION("");
-
-static int commandsregistered;
-
-void _init(void) {
-  registerhook(HOOK_TRUSTS_DBLOADED, trusts_cmdinit);
-
-  /* Now that the database is in a separate module it might be loaded already. */
-  if (trusts_loaded)
-    trusts_cmdinit(HOOK_TRUSTS_DBLOADED, NULL);
-
-}
-
-void _fini(void) {
-  deregisterhook(HOOK_TRUSTS_DBLOADED, trusts_cmdinit);
-  trusts_cmdfini(0, NULL);
-}
-
-void trusts_cmdinit(int hooknum, void *arg) {
-  if(commandsregistered)
-    return;
-  registercontrolcmd("trustgroupadd",10,7,trust_groupadd);
-  registercontrolcmd("trustgroupmodify",10,4,trust_groupmodify);
-  registercontrolcmd("trustgroupdel",10,2,trust_groupdel);
-
-  registercontrolcmd("trustcomment",10,2,trust_comment);
-
-  registercontrolcmd("trustadd",10,3,trust_add);
-  registercontrolcmd("trustdel",10,2,trust_del);
-
-  registercontrolcmd("trustdenyadd",10,2,trust_denyadd);
-  registercontrolcmd("trustdenycomment",10,2,trust_denycomment);
-  registercontrolcmd("trustdenydel",10,2,trust_denydel);
-
-  registercontrolcmd("truststats",10,2,trust_stats);
-  registercontrolcmd("trustdump",10,2,trust_dump);
-
-  registercontrolcmd("trustlog", 10,2, trust_dotrustlog);
-
-  commandsregistered = 1;
-  removeusers = 0;
-}
-
-void trusts_cmdfini() {
-  if(!commandsregistered)
-    return;
-
-  deregistercontrolcmd("trustgroupadd",trust_groupadd);
-  deregistercontrolcmd("trustgroupmodify",trust_groupmodify);
-  deregistercontrolcmd("trustgroupdel",trust_groupdel);
-
-  deregistercontrolcmd("trustcomment",trust_comment);
-
-  deregistercontrolcmd("trustadd",trust_add);
-  deregistercontrolcmd("trustdel",trust_del);
-
-  deregistercontrolcmd("trustdenyadd",trust_denyadd);
-  deregistercontrolcmd("trustdenycomment",trust_denycomment);
-  deregistercontrolcmd("trustdenydel",trust_denydel);
-
-  deregistercontrolcmd("truststats",trust_stats);
-  deregistercontrolcmd("trustdump",trust_dump);
-
-  deregistercontrolcmd("trustlog", trust_dotrustlog);
-
-  commandsregistered = 0;
-  removeusers = 0;
-}
-
-/*TODO*/
-/* tgh - should this have a 'maxclones limit'? */
-
-int trust_groupadd(void *source, int cargc, char **cargv) {
-  nick *sender=(nick *)source;
-  int expiry;
-  unsigned long maxclones;
-  unsigned short maxperip;
-  unsigned long  maxperident;
-  int enforceident;
-  int type;
-  unsigned long ownerid;
-  trustgroup_t *t;
-
-  if (cargc < 7) {
-    controlreply(sender,"Usage: trustgroupadd howmany howlong maxperident maxperip enforceident type ownerid");
-    return CMD_ERROR;
-  }
-
-  maxclones = strtoul(cargv[0],NULL,10);
-  if ( maxclones > 10000 ) { 
-    /* we allow 0 for unlimited trusts, and only warn on this */
-    controlreply(sender, "WARNING: large maximum number of clients - %lu", maxclones);
-  }
-  expiry = durationtolong(cargv[1]);
-  if (expiry > (365 * 86400) ) {
-    controlreply(sender,"ERROR: Invalid duration given - temporary trusts must be less than 1 year");
-    return CMD_ERROR;
-  }
-  ownerid  = strtoul(cargv[6],NULL,10);
-  maxperip = strtoul(cargv[3],NULL,10);
-  if (maxperip > 500) {
-    controlreply(sender, "ERROR: MaxPerIP value should be less then 500 (if set)");
-    return CMD_ERROR;
-  }
-  maxperident = strtoul(cargv[2],NULL,10);
-  if (maxperident > 50) {
-    controlreply(sender, "ERROR: MaxPerIdent value should be less then 50 (if set)");
-    return CMD_ERROR;
-  }
-  if (((cargv[4][0]!='0') && (cargv[4][0]!='1')) || (cargv[4][1]!='\0')) {
-    controlreply(sender,"ERROR: enforceident is a boolean setting, that means it can only be 0 or 1");
-    return CMD_ERROR;
-  }
-  enforceident = cargv[4][0] == '1';
-
-  if ( findtrustgroupbyownerid(ownerid) ) {
-    controlreply(sender, "ERROR: Q User ID %d already has a trustgroup", ownerid);
-    return CMD_ERROR;
-  }
-  if (ownerid > 2147483646 ) {
-    controlreply(sender, "ERROR: Invalid Q User ID: %d", ownerid);
-    return CMD_ERROR;
-  }
-
-  type = strtoul(cargv[5],NULL,10);
-
-  /* check rules */
-  switch (type ) {
-    case 0:
-      break;
-    default:
-      controlreply(sender, "Invalid Type (%d)", type);
-      return CMD_ERROR;
-  }
-
-  t = createtrustgroup( ++trusts_lasttrustgroupid, maxclones, maxperident, maxperip,  enforceident, getnettime() + expiry, ownerid, type);
-
-  if(!t) {
-    controlreply(sender,"ERROR: An error occured adding trustgroup");
-    return CMD_ERROR;
-  }
-
-  trustsdb_addtrustgroup(t);
-
-  controlreply(sender,"Adding trustgroup with ID %lu", t->id);
-  controlreply(sender,"Connections: %d, Enforceident %d, Per ident: %d, Per IP %d",maxclones,enforceident,maxperident,maxperip);
-  controlreply(sender,"Expires: %d, User ID: %d", expiry, ownerid);
-  controlwall(NO_OPER, NL_TRUSTS, "NewTrust: ID: %lu, Connections: %d, Enforceident %d, Per ident: %d, Per IP %d, Owner %d", t->id,maxclones,enforceident,maxperident,maxperip, ownerid);
-  return CMD_OK;
-}
-
-int trust_del(void *source, int cargc, char **cargv) {
-  nick *sender=(nick *)source;
-  struct irc_in_addr sin;
-  unsigned char bits;
-  patricia_node_t *node;
-  trustgroup_t *tg;
-
-  if (cargc<1) {
-    controlreply(sender,"Syntax: trustdel IP[/mask]");
-    return CMD_OK;
-  }
-
-  if (ipmask_parse(cargv[0], &sin, &bits) == 0) {
-    controlreply(sender, "ERROR: Invalid mask.");
-    return CMD_ERROR;
-  }
-
-  if (!is_normalized_ipmask(&sin,bits)) {
-    controlreply(sender, "ERROR: non-normalized mask.");
-    return CMD_ERROR;
-  }
-
-  node = refnode(iptree, &sin, bits);
-  if(!node->exts[tgh_ext]) {
-    controlreply(sender,"ERROR: That CIDR was not trusted.");
-    return CMD_ERROR;
-  } else {
-    /*TODO: only allow a host to be removed if <X users? subnets? bah */
-    tg = ((trusthost_t *)node->exts[tgh_ext])->trustgroup;
-    controlreply(sender,"%s removed from trustgroup #%lu",cargv[0],tg->id);
-    controlwall(NO_OPER, NL_TRUSTS, "%s removed from trustgroup #%lu",cargv[0],tg->id);
-    trustsdb_deletetrusthost(node->exts[tgh_ext]);
-    trusthost_free(node->exts[tgh_ext]);
-    node->exts[tgh_ext] = NULL;
-  }
-  return CMD_OK;
-}
-
-int trust_add(void *source, int cargc, char **cargv) {
-  nick *sender=(nick *)source;
-  trustgroup_t *tg;
-  struct irc_in_addr sin;
-  unsigned char bits;
-  patricia_node_t *node, *inode, *parent;
-  int expiry = 0;
-  trusthost_t *th;
-
-  if (cargc<2) {
-    controlreply(sender,"Syntax: trustadd <#groupid> IP[/mask] <duration>");
-    return CMD_OK;
-  }
-
-  if(cargv[0][0]== '#'){
-    /* find group by id */
-    tg=findtrustgroupbyid(strtol(&cargv[0][1],NULL,10));
-  } else {
-    /* find group by id */
-    tg=findtrustgroupbyid(strtol(cargv[0],NULL,10));
-  }
-
-  if(tg == NULL) {
-    controlreply(sender,"ERROR: A trustgroup with that ID does not exist.");
-    return CMD_ERROR;
-  }
-
-  if (tg->id==0) {
-    controlreply(sender,"INTERNAL ERROR: Trustgroup has ID 0");
-    return CMD_ERROR;
-  }
-
-  if (ipmask_parse(cargv[1], &sin, &bits) == 0) {
-    controlreply(sender, "ERROR: Invalid mask.");
-    return CMD_ERROR;
-  }
-
-  if (!is_normalized_ipmask(&sin,bits)) {
-    controlreply(sender, "ERROR: non-normalized mask.");
-    return CMD_ERROR;
-  }
-
-  if ( irc_in_addr_is_ipv4(&sin) ) {
-    if (bits>128 || bits<112) {
-      controlreply(sender,"ERROR: Not a valid netmask (needs to be between 16 and 32)");
-      return CMD_ERROR;
-    }
-  } else {
-    if ( bits<64) {
-      controlreply(sender,"ERROR: Not a valid ipv6 netmask ");
-      return CMD_ERROR;
-    }
-  }
-
-  if (cargc == 3) {
-    expiry = getnettime() + durationtolong(cargv[2]);
-    if (expiry<1) {
-      controlreply(sender,"ERROR: Invalid duration given");
-      return CMD_ERROR;
-    }
-  }
-
-  node  = refnode(iptree, &sin, bits);
-  if(node->exts[tgh_ext]) {
-    /* this mask is already trusted */
-    controlreply(sender,"ERROR: This mask is already trusted by trustgroup %lu.", ((trusthost_t *)node->exts[tgh_ext])->trustgroup->id);
-    return CMD_ERROR;
-  }
-  if ( node->exts[tgb_ext] ) {
-    controlreply(sender,"ERROR: A trustblock exists on this subnet, as follows: ID: %lu, public reason: %s", ((trustblock_t *)node->exts[tgb_ext])->id, (((trustblock_t *)node->exts[tgb_ext])->reason_public ? ((trustblock_t *)node->exts[tgb_ext])->reason_public->content : "<none>"));
-    return CMD_ERROR;
-  }
-
-  /* check child status */
-  PATRICIA_WALK(node, inode)
-  {
-    th = inode->exts[tgh_ext];
-    if (th) {
-      /* we have a child trustgroup */
-      /* Criteria 1: we can't add two hosts into the same group */
-      if (th->trustgroup == tg) {
-        controlreply(sender,"ERROR: A child subnet is already in this trustgroup, remove that subnet first (%s/%d)", IPtostr(inode->prefix->sin),irc_bitlen(&(inode->prefix->sin),inode->prefix->bitlen));
-        return CMD_ERROR;
-      } 
-      /* Criteria 2: we can't trust a subnet containing a trustblock (unless you have +d flag, then warn) */
-      if ( inode->exts[tgb_ext] ) { 
-        controlreply(sender,"ERROR: A trustblock exists on a child subnet, as follows: ID: %lu, public reason: %s", ((trustblock_t *)inode->exts[tgb_ext])->id, (((trustblock_t *)inode->exts[tgb_ext])->reason_public ? ((trustblock_t *)inode->exts[tgb_ext])->reason_public->content : "<none>")); 
-        return CMD_ERROR;
-      }
-    }
-  }
-  PATRICIA_WALK_END;
-
-  /* check parents too */
-  parent = node->parent;
-  while (parent) {
-    if( parent->exts[tgh_ext]) {
-      th = parent->exts[tgh_ext];
-      /* we have a parent trustgroup */
-      /* Criteria 1: we can't add two hosts into the same group */
-      if (th->trustgroup == tg) {
-        controlreply(sender,"ERROR: A parent subnet is already in this trustgroup (%s/%d)", IPtostr(parent->prefix->sin),irc_bitlen(&(parent->prefix->sin),parent->prefix->bitlen));
-        return CMD_ERROR;
-      }
-      /* even if we find 1 parent, we continue to the top */
-      /* Criteria 2: we can't trust a subnet containing a trustblock (unless you have +d flag, then warn) */
-      if ( parent->exts[tgb_ext] ) {
-        controlreply(sender,"ERROR: A trustblock exists on a parent subnet, as follows: ID: %lu, public reason: %s", ((trustblock_t *)parent->exts[tgb_ext])->id, (((trustblock_t *)parent->exts[tgb_ext])->reason_public ? ((trustblock_t *)parent->exts[tgb_ext])->reason_public->content : "<none>")); 
-        return CMD_ERROR;
-      }
-    }
-    parent = parent->parent;
-  }
-
-  th = trusthostadd(node, tg, expiry );
-  if ( !th ) {
-    controlreply(sender,"ERROR: Unable to add trusted host");
-    return CMD_ERROR;
-  }
-  trustsdb_addtrusthost(th);
-  controlreply(sender,"Added %s to trustgroup #%lu",cargv[1],tg->id);
-  controlwall(NO_OPER, NL_TRUSTS, "Added %s to trustgroup #%lu",cargv[1],tg->id);
-  return CMD_OK;
-}
-
-int trust_dump(void *source, int cargc, char **cargv) {
-  nick *sender=(nick *)source;
-
-  char tmps3[512];
-  trustgroup_t *g;
-  unsigned long startid=0;
-  long num=0, count=0, lines=0;
-
-  if (cargc<2) {
-    controlreply(sender, "Syntax: trustdump <start #id> <number>");
-    controlreply(sender, "Dumps <number> trustgroups starting from <start #id>.");
-    controlreply(sender, "This allows to dump very large numbers of groups,");
-    controlreply(sender, "so use with care.");
-    return CMD_ERROR;
-  }
-  strncpy(tmps3,cargv[0],20);
-  tmps3[20]='\0';
-  num = atoi(cargv[1]);
-
-  if (tmps3[0] != '#') {
-    controlreply(sender, "First parameter has to be a trust ID (prefixed with #).");
-    return CMD_ERROR;
-  }
-
-  startid=strtoul(&tmps3[1], NULL, 10);
-  if (num < 1) {
-    controlreply(sender, "Cannot return fewer than 1 group.");
-    return CMD_ERROR;
-  }
-  if (num >= 500) {
-    controlreply(sender, "Will not list more than 500 groups in one go.");
-    return CMD_ERROR;
-  }
-
-  if (startid > trusts_lasttrustgroupid) {
-    controlreply(sender, "Start ID cannot exceed maximum group ID (#%ld).", trusts_lasttrustgroupid);
-    return CMD_ERROR;
-  }
-
-  do {
-    g=findtrustgroupbyid(startid);
-    startid++;
-  } while ((g == NULL) && (startid <= (trusts_lasttrustgroupid+1)));
-  if (g == NULL) {
-    controlreply(sender, "Failed to find nearest start group.");
-    return CMD_ERROR;
-  }
-
-  while (startid <= (trusts_lasttrustgroupid+1)) {
-    if (g == NULL) {
-      g=findtrustgroupbyid(startid);
-      startid++;
-      continue;
-    }
-    controlreply(sender, "G,#%lu,%lu,%lu,%d,%lu,%lu,%lu,%lu",
-      g->id, g->currenton, g->maxclones, g->enforceident, g->maxperident,
-      g->maxusage, g->expire, g->lastused);
-    lines++;
-
-    trusthost_t* thptr;
-
-    int hash = trusts_gettrusthostgroupidhash(g->id);
-    for (thptr = trusthostgroupidtable[hash]; thptr; thptr = thptr->nextbygroupid ) {
-      if ( thptr->trustgroup->id == g->id ) {
-        /* TODO: expire here - trusthost_free(thptr);*/
-        controlreply(sender, "H,#%lu,%s/%d,%lu,%lu,%lu", g->id,
-                              IPtostr(((patricia_node_t *)thptr->node)->prefix->sin),
-                              irc_bitlen(&(((patricia_node_t *)thptr->node)->prefix->sin),((patricia_node_t *)thptr->node)->prefix->bitlen),
-                              0 /*a->currentlyon*/,
-                              0 /*a->maxused*/,
-                              0 /* a->lastused*/);
-        lines++;
-      }
-    }
-
-    count++;
-    if (count >= num) {
-      break;
-    }
-    g=findtrustgroupbyid(startid);
-    startid++;
-  }
-  controlreply(sender, "End of list, %ld groups and %ld lines returned.", count, lines);
-  return CMD_OK;
-}
-
-int trust_denyadd(void *source, int cargc, char **cargv) {
-  nick *sender=(nick *)source;
-  struct irc_in_addr sin;
-  unsigned char bits;
-  trustblock_t *tb;
-  patricia_node_t *node;
-  int expiry;
-
-  if (cargc<2) {
-    controlreply(sender,"Syntax: trustdenyadd IP[/mask] <expiry> <public reason>");
-    return CMD_OK;
-  }
-
-  if (ipmask_parse(cargv[0], &sin, &bits) == 0) {
-    controlreply(sender, "ERROR: Invalid mask.");
-    return CMD_ERROR;
-  }
-
-  if (!is_normalized_ipmask(&sin,bits)) {
-    controlreply(sender, "ERROR: non-normalized mask.");
-    return CMD_ERROR;
-  }
-
-  if ( irc_in_addr_is_ipv4(&sin) ) {
-    if (bits>128 || bits<112) {
-      controlreply(sender,"ERROR: Not a valid netmask (needs to be between 8 and 32)");
-      return CMD_ERROR;
-    }
-  } else {
-    if ( bits<64) {
-      controlreply(sender,"ERROR: Not a valid ipv6 netmask ");
-      return CMD_ERROR;
-    }
-  }
-
-  expiry = getnettime() + durationtolong(cargv[1]);
-  if (expiry<1) {
-    controlreply(sender,"ERROR: Invalid duration given");
-    return CMD_ERROR;
-  }
-
-  node  = refnode(iptree, &sin, bits);
-  if(node->exts[tgb_ext]) {
-    /* this mask is already blocked */
-    controlreply(sender,"ERROR: This mask is already blocked", ((trustblock_t *)node->exts[tgb_ext])->id);
-    return CMD_ERROR;
-  }
-
-  tb = createtrustblock( ++trusts_lasttrustblockid, node, 0 /*TODO*/, expiry, NULL,cargv[2]); 
-  if (!tb) {
-    controlreply(sender,"ERROR: An error occured adding the trustblock");
-  }
-  node->exts[tgb_ext] = tb;
-  trustsdb_addtrustblock(tb);
-  controlreply(sender,"Added %s to trustblock list",cargv[0]);
-  controlwall(NO_OPER, NL_TRUSTS, "Added %s to trustblock list",cargv[0]);
-  return CMD_OK;
-}
-
-int trust_denycomment(void *source, int cargc, char **cargv) {
-  nick *sender=(nick *)source;
-  struct irc_in_addr sin;
-  unsigned char bits;
-  patricia_node_t *node;
-  trustblock_t *tb;
-
-  if (cargc<2) {
-    controlreply(sender,"Syntax: trustdenycomment IP[/mask] <private reason>");
-    return CMD_OK;
-  }
-
-  if (ipmask_parse(cargv[0], &sin, &bits) == 0) {
-    controlreply(sender, "ERROR: Invalid mask.");
-    return CMD_ERROR;
-  }
-
-  if (!is_normalized_ipmask(&sin,bits)) {
-    controlreply(sender, "ERROR: non-normalized mask.");
-    return CMD_ERROR;
-  }
-
-  if ( irc_in_addr_is_ipv4(&sin) ) {
-    if (bits>128 || bits<112) {
-      controlreply(sender,"ERROR: Not a valid netmask (needs to be between 8 and 32)");
-      return CMD_ERROR;
-    }
-  } else {
-    if ( bits<64) {
-      controlreply(sender,"ERROR: Not a valid ipv6 netmask ");
-      return CMD_ERROR;
-    }
-  }
-
-  node  = refnode(iptree, &sin, bits);
-  if(!node->exts[tgb_ext]) {
-    /* this mask is already blocked */
-    controlreply(sender,"ERROR: This mask is not blocked. Use trustdenyadd to add a new block");
-    return CMD_ERROR;
-  }
-  derefnode(iptree,node); 
-  tb = node->exts[tgb_ext];
-  
-  tb->reason_private = getsstring(cargv[1],512);
-  trustsdb_updatetrustblock(tb);
-  controlreply(sender,"Private Comment added to trustblock %s",cargv[0]);
-  controlwall(NO_OPER, NL_TRUSTS, "Private Comment added to trustblock %s",cargv[0]);
-  return CMD_OK;
-}
-
-int trust_denydel(void *source, int cargc, char **cargv) {
-  nick *sender=(nick *)source;
-  struct irc_in_addr sin;
-  unsigned char bits;
-  patricia_node_t *node;
-
-  if (cargc<1) {
-    controlreply(sender,"Syntax: trustdenydel IP[/mask]");
-    return CMD_OK;
-  }
-
-  if (ipmask_parse(cargv[0], &sin, &bits) == 0) {
-    controlreply(sender, "ERROR: Invalid mask.");
-    return CMD_ERROR;
-  }
-
-  if (!is_normalized_ipmask(&sin,bits)) {
-    controlreply(sender, "ERROR: non-normalized mask.");
-    return CMD_ERROR;
-  }
-  
-  node = refnode(iptree, &sin, bits);
-  if(!node->exts[tgb_ext]) {
-    controlreply(sender,"ERROR: That CIDR was not blocked.");
-    return CMD_ERROR;
-  } else {
-    controlreply(sender,"trustblock removed on %s",cargv[0]);
-    controlwall(NO_OPER, NL_TRUSTS, "trustblock removed on %s", cargv[0]);
-    trustsdb_deletetrustblock( node->exts[tgb_ext]);
-    trustblock_free( node->exts[tgb_ext] );
-    node->exts[tgb_ext] = NULL;
-  }
-  controlreply(sender,"Not Implemented");
-  return CMD_OK;
-}
-
-int trust_groupmodify(void *source, int cargc, char **cargv) {
-  nick *sender=(nick *)source;
-  unsigned long oldvalue, newvalue;
-  char *mod;
-  int expiry;
-  trustgroup_t *tg;
-
-  if (cargc<3 || cargc==4) {
-    controlreply(sender,"Syntax: trustgroupmodify <#groupid> <what> [+|-|=]number");
-    controlreply(sender,"        +20 means add 20, =20 replaces current value, -20 means subtract");
-    controlreply(sender,"        what: maxclones, maxperident, maxperip, expire, enforceident, ownerid");
-    return CMD_OK;
-  }
-
-  if(cargv[0][0]== '#'){
-    /* find group by id */
-    tg=findtrustgroupbyid(strtol(&cargv[0][1],NULL,10));
-  } else {
-    /* find group by id */
-    tg=findtrustgroupbyid(strtol(cargv[0],NULL,10));
-  }
-
-  if(tg == NULL) {
-    controlreply(sender,"ERROR: A trustgroup with that ID does not exist.");
-    return CMD_ERROR;
-  }
-
-  if (tg->id==0) {
-    controlreply(sender,"INTERNAL ERROR: Trustgroup has ID 0");
-    return CMD_ERROR;
-  }
-
-  switch ( cargv[2][0] ) {
-    case '+':
-    case '-':
-    case '=':
-      mod = cargv[2];
-      break;
-    default:
-      controlreply(sender,"ERROR: invalid modifier specified (values values are +,-,=)");
-      return CMD_ERROR;
-  }
-  newvalue = strtoul(&cargv[2][1],NULL,10);
-  
-  if (ircd_strcmp(cargv[1], "maxclones")==0) {
-    oldvalue = tg->maxclones;
-    switch (*mod) {
-      case '+':
-        newvalue = oldvalue + newvalue; 
-        break;
-      case '-':
-        if (newvalue > oldvalue) {
-          controlreply(sender, "ERROR: maxclones cannot be less than 0");
-          return CMD_ERROR; 
-        }
-        newvalue = oldvalue - newvalue;
-        if (newvalue == 0) {
-          controlreply(sender, "ERROR: maxclones limit would be 0 - unlimited maxclones can only be set with '='");
-          return CMD_ERROR;
-        }
-        break;
-    }
-
-    if (newvalue > 1000000) {
-      controlreply(sender, "ERROR: large maximum number of clients - %lu", newvalue);
-      return CMD_ERROR;
-    }
-    if (newvalue > 10000) {
-      controlreply(sender, "WARNING: large maximum number of clients - %lu", newvalue);
-    }
-
-    tg->maxclones = newvalue;
-  } else if (ircd_strcmp(cargv[1], "maxperident")==0) {
-    oldvalue = tg->maxperident;
-    switch (*mod) {
-      case '+':
-        newvalue = oldvalue + newvalue;
-        break;
-      case '-':
-        if (newvalue > oldvalue) {
-          controlreply(sender, "ERROR: maxperident cannot be less than 0");
-          return CMD_ERROR;
-        }
-        newvalue = oldvalue - newvalue;
-        if (newvalue == 0) {
-          controlreply(sender, "ERROR: maxperident limit would be 0 - unlimited maxclones can only be set with '='");
-          return CMD_ERROR;
-        }
-        break;
-    }
-
-    if (newvalue > 50) {
-      controlreply(sender, "ERROR: MaxPerIdent value should be less then 50 (if set)");
-      return CMD_ERROR;
-    }
-    tg->maxperident=newvalue;  
-  } else if (ircd_strcmp(cargv[1], "maxperip")==0) {
-    oldvalue = tg->maxperip;
-    switch (*mod) {
-      case '+':
-        newvalue = oldvalue + newvalue;
-        break;
-      case '-':
-        if (newvalue > oldvalue) {
-          controlreply(sender, "ERROR: maxperip cannot be less than 0");
-          return CMD_ERROR;
-        }
-        newvalue = oldvalue - newvalue;
-        if (newvalue == 0) {
-          controlreply(sender, "ERROR: maxperip limit would be 0 - unlimited maxclones can only be set with '='");
-          return CMD_ERROR;
-        }
-        break;
-    }
-
-    if (newvalue > 500) {
-      controlreply(sender, "ERROR: MaxPerIP value should be less then 500 (if set)");
-      return CMD_ERROR;
-    }
-    tg->maxperip = newvalue;
-  } else if (ircd_strcmp(cargv[1], "expire")==0) {
-    oldvalue = tg->expire;
-    expiry = durationtolong(&cargv[2][1]);
-
-    if (expiry > (365 * 86400) ) {
-      controlreply(sender,"ERROR: Invalid duration given - temporary trusts can not be longer then 1 year");
-      return CMD_ERROR;
-    }
-
-    switch (*mod) {
-      case '+':
-        newvalue = oldvalue + expiry;
-        break;
-      case '-':
-        newvalue = oldvalue - expiry;
-        if (newvalue < getnettime() ) {
-          controlreply(sender, "ERROR: Can't set expiry before current nettime - use trustgroupdel to delete trust groups");
-          return CMD_ERROR;
-        }
-        break;
-      case '=':
-        if ( expiry > 0) { 
-          newvalue = getnettime() + expiry;
-        }
-        break; 
-    }
-    tg->expire = newvalue;
-  } else if (ircd_strcmp(cargv[1], "enforceident")==0) {
-    oldvalue = tg->enforceident;
-    if ( (newvalue != 0 && newvalue != 1) || *mod != '=' ) {
-      controlreply(sender,"ERROR: enforceident is a boolean setting, that means it can only be 0 or 1, and can only be set by '='");
-      return CMD_ERROR; 
-    }
-    tg->enforceident = newvalue;
-  } else if (ircd_strcmp(cargv[1], "ownerid")==0) {
-    oldvalue = tg->ownerid; 
-    if ( *mod != '=' ) {
-      controlreply(sender,"ERROR: Q user ID can only be set by '='");
-      return CMD_ERROR;
-    }
-    if ( findtrustgroupbyownerid(newvalue) ) {
-      controlreply(sender, "ERROR: Q User ID %d already has a trustgroup", newvalue);
-      return CMD_ERROR;
-    }
-
-    if (newvalue > 2147483646 ) {
-      controlreply(sender, "ERROR: Invalid Q User ID: %d", newvalue);
-      return CMD_ERROR;
-    }
-
-    tg->ownerid = newvalue;
-  }
-  controlreply(sender, "Modification: %s changed to %lu from %lu for trustgroup %lu", cargv[1], newvalue, oldvalue, tg->id);
-  controlwall(NO_OPER, NL_TRUSTS, "Modification: %s changed to %lu from %lu for trustgroup %lu", cargv[1], newvalue, oldvalue, tg->id);
-
-  trustsdb_updatetrustgroup(tg);
-  return CMD_OK;
-}
-
-int trust_groupdel(void *source, int cargc, char **cargv) {
-  nick *sender=(nick *)source;
-  trusthost_t *thptr, *nthptr;
-  trustgroup_t *tg;
-  patricia_node_t *node;
-
-  if (cargc<1) {
-    controlreply(sender,"Syntax: trustgroupdel <#id|id>");
-    return CMD_OK;
-  }
-
-  if(cargv[0][0]== '#'){
-    /* find group by id */
-    tg=findtrustgroupbyid(strtol(&cargv[0][1],NULL,10));
-  } else {
-    /* find group by id */
-    tg=findtrustgroupbyid(strtol(cargv[0],NULL,10));
-  }
-
-  if(tg == NULL) {
-    controlreply(sender,"ERROR: A trustgroup with that ID does not exist.");
-    return CMD_ERROR;
-  }
-
-  if (tg->id==0) {
-    controlreply(sender,"INTERNAL ERROR: Trustgroup has ID 0");
-    return CMD_ERROR;
-  }
-
-  /* we have a trustgroup to remove */
-  int hash = trusts_gettrusthostgroupidhash(tg->id);
-  for (thptr = trusthostgroupidtable[hash]; thptr; thptr = nthptr ) {
-    nthptr = thptr->nextbygroupid;  
-    if(thptr->trustgroup == tg) {
-      node = thptr->node;
-      controlwall(NO_OPER, NL_TRUSTS, "%s/%d removed from trustgroup #%lu",IPtostr(thptr->node->prefix->sin),irc_bitlen(&(thptr->node->prefix->sin),thptr->node->prefix->bitlen),tg->id);
-      controlreply(sender,"%s/%d removed from trustgroup #%lu",IPtostr(thptr->node->prefix->sin),irc_bitlen(&(thptr->node->prefix->sin),thptr->node->prefix->bitlen),tg->id);
-      trustsdb_deletetrusthost(thptr);
-      trusthost_free(thptr);
-      node->exts[tgh_ext] = NULL;
-    }
-  }
-  controlwall(NO_OPER, NL_TRUSTS, "removed trustgroup #%lu",tg->id);
-  controlreply(sender,"removed trustgroup #%lu",tg->id);
-  trustsdb_deletetrustgroup(tg);
-  trustgroup_free(tg);
-  return CMD_OK;
-
-}
-
-int trust_stats(void *source, int cargc, char **cargv) {
-  nick *sender=(nick *)source;
-  trustgroup_t *tg; trusthost_t* thptr; int i;
-  unsigned long thcount=0, ucount=0, mcount=0, tgcount=0;
-  unsigned long hentries=0;
-  unsigned long netcount4[33];
-  unsigned long netucount4[33];
-  unsigned long netmcount4[33];
-  unsigned long netcount6[129];
-  unsigned long netucount6[129];
-  unsigned long netmcount6[129];
-
-  int maxthmask4 = 32;
-  int maxthmask6 = 128;
-
-  for (i=0; i<33; i++) {
-    netcount4[i]=0;
-    netucount4[i]=0;
-    netmcount4[i]=0;
-  }
-
-  for (i=0; i<129; i++) {
-    netcount6[i]=0;
-    netucount6[i]=0;
-    netmcount6[i]=0;
-  }
-
-  for ( i = 0; i < TRUSTS_HASH_GROUPSIZE ; i++ ) {
-    for ( tg = trustgroupidtable[i]; tg; tg = tg -> nextbyid ) {
-      /*check active*/
-      tgcount++;
-    }
-  }
-
-  for ( i = 0; i < TRUSTS_HASH_HOSTSIZE ; i++ ) {
-    for ( thptr = trusthostidtable[i]; thptr; thptr = thptr-> nextbyid ) {
-      /*check active*/
-      hentries++;
-      thcount++;
-      ucount+=thptr->node->usercount;
-      mcount+=thptr->maxused;
-      if(irc_in_addr_is_ipv4(&((patricia_node_t *)thptr->node)->prefix->sin)) {
-        netcount4[((patricia_node_t *)thptr->node)->prefix->bitlen-96]++;
-        netucount4[((patricia_node_t *)thptr->node)->prefix->bitlen-96]+=thptr->node->usercount;
-        netmcount4[((patricia_node_t *)thptr->node)->prefix->bitlen-96]+=thptr->maxused;
-        if( (((patricia_node_t *)thptr->node)->prefix->bitlen-96) < maxthmask4 ) {
-          maxthmask4 = (((patricia_node_t *)thptr->node)->prefix->bitlen-96);
-        }
-      } else {
-        controlreply(sender, "%s", IPtostr(((patricia_node_t *)thptr->node)->prefix->sin)); 
-        netcount6[((patricia_node_t *)thptr->node)->prefix->bitlen]++;
-        netucount6[((patricia_node_t *)thptr->node)->prefix->bitlen]+=thptr->node->usercount;
-        netmcount6[((patricia_node_t *)thptr->node)->prefix->bitlen]+=thptr->maxused;
-        if( ((patricia_node_t *)thptr->node)->prefix->bitlen < maxthmask6 ) {
-          maxthmask6 = ((patricia_node_t *)thptr->node)->prefix->bitlen;
-        }
-      }
-    }
-  }
-  controlreply(sender, "Online trust users:   %lu", ucount);
-  controlreply(sender, "Maximum online users: %lu", mcount);
-  controlreply(sender, "Trust groups:         %lu", tgcount);
-  controlreply(sender, "Maximum group ID:     #%lu", trusts_lasttrustgroupid);
-  controlreply(sender, "Trusted hosts/nets:   %lu", thcount);
-  controlreply(sender, "Largest subnet (v4):  /%d", maxthmask4);
-  controlreply(sender, "Largest subnet (v6):  /%d", maxthmask6);
-  controlreply(sender, "IPv4 Subnets:");
-  for (i=0; i<32; i++) {
-    if (netcount4[i]==0) continue;
-    controlreply(sender, "|-*/%d (Netcount: %lu Cur: %lu Max: %lu)", i, netcount4[i], netucount4[i], netmcount4[i]);
-  }
-  controlreply(sender, "`-*/32 (Netcount: %lu Cur: %lu Max: %lu)", netcount4[32], netucount4[32], netmcount4[32]);
-  controlreply(sender, "IPv6 Subnets:");
-  for (i=0; i<128; i++) {
-    if (netcount6[i]==0) continue;
-    controlreply(sender, "|-*/%d (Netcount: %lu Cur: %lu Max: %lu)", i, netcount6[i], netucount6[i], netmcount6[i]);
-  }
-  controlreply(sender, "`-*/128 (Netcount: %lu Cur: %lu Max: %lu)", netcount6[128], netucount6[128], netmcount6[128]);
-
-  return CMD_OK;
-}
-
-
-int trust_comment(void *source, int cargc, char **cargv) {
-  nick *sender=(nick *)source;
-  trustgroup_t *tg;
-
-  if (cargc<2) {
-    controlreply(sender,"Syntax: trustcomment <#groupid> <comment>");
-    return CMD_OK;
-  }
-
-  if(cargv[0][0]== '#'){
-    /* find group by id */
-    tg=findtrustgroupbyid(strtol(&cargv[0][1],NULL,10));
-  } else {
-    /* find group by id */
-    tg=findtrustgroupbyid(strtol(cargv[0],NULL,10));
-  }
-
-  if(tg == NULL) {
-    controlreply(sender,"A trustgroup with that ID does not exist.");
-    return CMD_ERROR;
-  }
-
-  if (tg->id==0) {
-    controlreply(sender,"Internal error: Trustgroup has ID 0");
-    return CMD_ERROR;
-  }
-
-  trustsdb_logmessage(tg, 0, 1, cargv[1]);
-
-  controlreply(sender, "Comment: %s for trustgroup %lu", cargv[1], tg->id);
-  controlwall(NO_OPER, NL_TRUSTS, "Comment: %s for trustgroup %lu", cargv[1], tg->id);
-
-  return CMD_OK;
-}
-
-int trust_dotrustlog(void *source, int cargc, char **cargv) {
-  nick *np=source;
-  unsigned long interval;
-  int trustid; 
-
-  if (cargc < 1) {
-    controlreply(np,"Syntax: trustlog <#groupid> [duration]");
-    return CMD_ERROR;
-  }
-
-  if(cargv[0][0]== '#'){
-    trustid = strtol(&cargv[0][1],NULL,10);
-  } else {
-    trustid = strtol(cargv[0],NULL,10);
-  }
-
-  if (cargc > 1)
-    interval=getnettime() - durationtolong(cargv[1]);
-  else
-    interval=0;
-
-  trustsdb_retrievetrustlog(np, trustid, interval);
-  return CMD_OK;
-}
diff --git a/trusts2/trusts_db.c b/trusts2/trusts_db.c
deleted file mode 100644 (file)
index 118e5cc..0000000
+++ /dev/null
@@ -1,442 +0,0 @@
-#include "../nick/nick.h"
-#include "../core/error.h"
-#include "../lib/irc_string.h"
-#include "../core/schedule.h"
-#include <stdlib.h>
-
-#include "trusts.h"
-
-int trustdb_loaded = 0;
-
-static void trusts_dbtriggerdbloaded(void *arg);
-
-int trusts_load_db(void) {
-  if(!dbconnected()) {
-    Error("trusts", ERR_STOP, "Could not connect to database.");
-    return 0;
-  }
-
-  if(trustdb_loaded)
-    trusts_cleanup_db();
-
-  trustdb_loaded = 1;
-
-  trusts_create_tables();
-
-  dbasyncquery(trusts_loadtrustgroups, NULL,
-    "SELECT trustid,maxusage,maxclones,maxperident,maxperip,enforceident,startdate,lastused,expires,owneruserid,type,created,modified FROM trusts.groups WHERE enddate = 0");
-  dbasyncquery(trusts_loadtrustgroupsmax, NULL,
-    "SELECT max(trustid) from trusts.groups");
-
-  dbasyncquery(trusts_loadtrusthosts, NULL,
-    "SELECT * FROM trusts.hosts WHERE enddate = 0");
-  dbasyncquery(trusts_loadtrusthostsmax, NULL,
-    "SELECT max(hostid) FROM trusts.hosts");
-
-  dbasyncquery(trusts_loadtrustblocks, NULL,
-    "SELECT * FROM trusts.blocks");
-
-  return 1;
-}
-
-void trusts_create_tables(void) {
-  dbattach("trusts");
-  dbcreatequery(
-    "CREATE TABLE trusts.groups ("
-    "trustid      INT4 NOT NULL PRIMARY KEY,"
-    "startdate    INT4 NOT NULL,"
-    "enddate      INT4 NOT NULL,"
-    "owneruserid  INT4,"
-    "maxusage     INT4 NOT NULL,"
-    "enforceident INT2 NOT NULL,"
-    "type         INT2,"
-    "maxclones    INT4 NOT NULL,"
-    "maxperident  INT4,"
-    "maxperip     INT4,"
-    "expires      INT4,"
-    "lastused     INT4,"
-    "modified     INT4,"
-    "created      INT4"
-    ") WITHOUT OIDS;"
-    );
-
-  dbcreatequery(
-    "CREATE TABLE trusts.hosts ("
-    "hostid     INT4 NOT NULL PRIMARY KEY,"
-    "trustid    INT4 NOT NULL,"
-    "startdate  INT4 NOT NULL,"
-    "enddate    INT4,"
-    "host       VARCHAR NOT NULL,"
-    "maxusage   INT4 NOT NULL,"
-    "lastused   INT4,"
-    "expires    INT4 NOT NULL,"
-    "modified   INT4,"
-    "created    INT4"
-    ") WITHOUT OIDS;"
-    );
-
-  dbcreatequery(
-    "CREATE TABLE trusts.blocks ("
-    "blockid        INT4 NOT NULL PRIMARY KEY,"
-    "block          VARCHAR NOT NULL,"
-    "owner          INT4,"
-    "expires        INT4,"
-    "startdate      INT4,"
-    "reason_private VARCHAR,"
-    "reason_public  VARCHAR"
-    ") WITHOUT OIDS;"
-    );
-
-  dbcreatequery(
-    "CREATE TABLE trusts.log ("
-    "logid          SERIAL NOT NULL PRIMARY KEY,"
-    "trustid        INT4 NOT NULL,"
-    "timestamp      INT4 NOT NULL,"
-    "userid         INT4 NOT NULL,"
-    "type           INT2,"
-    "message        VARCHAR"
-    ") WITHOUT OIDS;"
-  );
-}
-
-void trusts_cleanup_db(void) {
-  dbdetach("trusts");
-}
-
-void trusts_loadtrustgroups(DBConn *dbconn, void *arg) {
-  DBResult *pgres = dbgetresult(dbconn);
-  int rows=0;
-  trustgroup_t *t;
-
-  if(!dbquerysuccessful(pgres)) {
-    Error("trusts", ERR_ERROR, "Error loading trustgroup list.");
-    dbclear(pgres);
-    return;
-  }
-
-  trusts_lasttrustgroupid = 1; 
-
-  while(dbfetchrow(pgres)) {
-
-    t = createtrustgroupfromdb( 
-                     /*id*/          strtoul(dbgetvalue(pgres,0),NULL,10),
-                     /*maxusage*/    strtoul(dbgetvalue(pgres,1),NULL,10),
-                     /*maxclones*/   strtoul(dbgetvalue(pgres,2),NULL,10),
-                     /*maxperident*/ strtoul(dbgetvalue(pgres,3),NULL,10),
-                     /*maxperip*/    strtoul(dbgetvalue(pgres,4),NULL,10),
-        /*TODOTYPE*/ /*enforceident*/strtoul(dbgetvalue(pgres,5),NULL,10),
-                     /*startdate*/   strtoul(dbgetvalue(pgres,6),NULL,10),
-                     /*lastused*/    strtoul(dbgetvalue(pgres,7),NULL,10),
-                     /*expire*/      strtoul(dbgetvalue(pgres,8),NULL,10),
-                     /*ownerid*/     strtoul(dbgetvalue(pgres,9),NULL,10),
-                     /*type*/        strtoul(dbgetvalue(pgres,10),NULL,10),
-                     /*created*/     strtoul(dbgetvalue(pgres,11),NULL,10),
-                     /*modified*/    strtoul(dbgetvalue(pgres,12),NULL,10)
-                     );
-    if (!t) {
-      Error("trusts", ERR_ERROR, "Error loading trustblock.");
-      return;
-    }
-
-    if(t->id > trusts_lasttrustgroupid)
-      trusts_lasttrustgroupid = t->id;
-
-    rows++;
-  }
-
-  Error("trusts",ERR_INFO,"Loaded %d trusts (highest ID was %lu)",rows,trusts_lasttrustgroupid); 
-
-  dbclear(pgres);
-}
-
-void trusts_loadtrustgroupsmax(DBConn *dbconn, void *arg) {
-  DBResult *pgres = dbgetresult(dbconn);
-  unsigned long trustmax = 0;
-
-  if(!dbquerysuccessful(pgres)) {
-    Error("trusts", ERR_ERROR, "Error loading trustgroup max.");
-    dbclear(pgres);
-    return;
-  }
-
-  while(dbfetchrow(pgres)) {
-    trustmax = strtoul(dbgetvalue(pgres,0),NULL,10);
-  }
-
-  if ( trustmax < trusts_lasttrustgroupid ) {
-    Error("trusts",ERR_INFO,"trust max failed - %lu, %lu", trustmax, trusts_lasttrustgroupid);
-  }
-  trusts_lasttrustgroupid = trustmax;
-
-  Error("trusts",ERR_INFO,"Loaded Trust Max %lu", trusts_lasttrustgroupid);
-
-  dbclear(pgres);
-}
-
-void trusts_loadtrusthosts(DBConn *dbconn, void *arg) {
-  DBResult *pgres = dbgetresult(dbconn);
-  int rows=0;
-  trusthost_t *t;
-  trustgroup_t *tg;
-  patricia_node_t *node;
-  struct irc_in_addr sin;
-  unsigned char bits;
-
-  if(!dbquerysuccessful(pgres)) {
-    Error("trusts", ERR_ERROR, "Error loading trusthost list.");
-    dbclear(pgres);
-    return;
-  }
-
-  trusts_lasttrusthostid = 1;
-
-  while(dbfetchrow(pgres)) {
-    /*node*/
-    if( ipmask_parse(dbgetvalue(pgres,4), &sin, &bits) == 0) {
-      Error("trusts", ERR_ERROR, "Failed to parse trusthost: %s", dbgetvalue(pgres,4));
-      continue;
-    }
-
-    node  = refnode(iptree, &sin, bits);
-
-    /*tg*/
-    int tgid = strtoul(dbgetvalue(pgres,1),NULL,10);
-    tg=findtrustgroupbyid(tgid);
-    if (!tg) { 
-      Error("trusts", ERR_ERROR, "Error loading trusthosts - invalid group: %d.", tgid);
-
-      /* update last hostid - although we probably should fail here more loudly */
-      if(t->id > trusts_lasttrusthostid)
-        trusts_lasttrusthostid = t->id;
-
-      continue;
-    }
-
-    t = createtrusthostfromdb( 
-                    /*id*/        strtoul(dbgetvalue(pgres,0),NULL,10),
-                    /*node*/      node,
-                    /*startdate*/ strtoul(dbgetvalue(pgres,2),NULL,10),
-                    /*lastused*/  strtoul(dbgetvalue(pgres,6),NULL,10),
-                    /*expire*/    strtoul(dbgetvalue(pgres,7),NULL,10),
-                    /*maxusage*/  strtoul(dbgetvalue(pgres,5),NULL,10),
-                    /*trustgroup*/ tg,
-                    /*created*/   strtoul(dbgetvalue(pgres,9),NULL,10),
-                    /*modified*/ strtoul(dbgetvalue(pgres,8),NULL,10)
-                  );
-    if (!t) {
-      Error("trusts", ERR_ERROR, "Error loading trusthost.");
-      return;
-    }
-    node = 0;
-    if(t->id > trusts_lasttrusthostid)
-      trusts_lasttrusthostid = t->id;
-
-    trusthost_addcounters(t);
-    rows++;
-  }
-
-  Error("trusts",ERR_INFO,"Loaded %d trusthosts (highest ID was %lu)",rows,trusts_lasttrusthostid);
-
-  dbclear(pgres);
-}
-
-void trusts_loadtrusthostsmax(DBConn *dbconn, void *arg) {
-  DBResult *pgres = dbgetresult(dbconn);
-  unsigned long trustmax = 0;
-
-  if(!dbquerysuccessful(pgres)) {
-    Error("trusts", ERR_ERROR, "Error loading trusthost max.");
-    dbclear(pgres);
-    return;
-  }
-
-  while(dbfetchrow(pgres)) {
-    trustmax = strtoul(dbgetvalue(pgres,0),NULL,10);
-  }
-
-  if ( trustmax < trusts_lasttrusthostid ) {
-    Error("trusts", ERR_FATAL, "trusthost max failed - %lu, %lu", trustmax, trusts_lasttrusthostid);
-  }
-  trusts_lasttrusthostid = trustmax;
-
-  Error("trusts",ERR_INFO,"Loaded Trust Host Max %lu", trusts_lasttrusthostid);
-
-  dbclear(pgres);
-}
-
-void trusts_loadtrustblocks(DBConn *dbconn, void *arg) {
-  DBResult *pgres = dbgetresult(dbconn);
-  int rows=0;
-  trustblock_t *t;
-  struct irc_in_addr sin;
-  unsigned char bits;
-  patricia_node_t *node;
-
-  if(!dbquerysuccessful(pgres)) {
-    Error("trusts", ERR_ERROR, "Error loading trustblock list.");
-    dbclear(pgres);
-    return;
-  }
-
-  trusts_lasttrustblockid = 1;
-
-  while(dbfetchrow(pgres)) {
-    /*node*/
-    if( ipmask_parse(dbgetvalue(pgres,1), &sin, &bits) == 0) {
-      Error("trusts", ERR_ERROR, "Failed to parse trustblock: %s", dbgetvalue(pgres,1));
-      continue;
-    } 
-    node  = refnode(iptree, &sin, bits);
-
-    t = createtrustblockfromdb(
-      /* id */      strtoul(dbgetvalue(pgres,0),NULL,10),
-      /* node */    node,
-      /* ownerid */ strtoul(dbgetvalue(pgres,2),NULL,10),
-      /* expire */  strtoul(dbgetvalue(pgres,3),NULL,10), 
-      /* startdate*/ strtoul(dbgetvalue(pgres,4),NULL,10),
-      /* reason_private */ dbgetvalue(pgres,5),
-      /* reason_public */ dbgetvalue(pgres,6)
-     );
-    if (!t) {
-      Error("trusts", ERR_ERROR, "Error loading trustblock.");
-      return;
-    }
-
-    node->exts[tgb_ext] = t;
-
-    if(t->id > trusts_lasttrustblockid)
-      trusts_lasttrustblockid = t->id;
-
-    rows++;
-  }
-
-  Error("trusts",ERR_INFO,"Loaded %d trustblocks (highest ID was %lu)",rows,trusts_lasttrustblockid);
-
-  dbclear(pgres);
-  
-  trusts_loaded = 1;
-  scheduleoneshot(time(NULL), trusts_dbtriggerdbloaded, NULL);
-}
-
-static void trusts_dbtriggerdbloaded(void *arg) {
-  triggerhook(HOOK_TRUSTS_DBLOADED, NULL);
-}
-
-/* trust group */
-void trustsdb_addtrustgroup(trustgroup_t *t) {
-  dbquery("INSERT INTO trusts.groups (trustid,startdate,enddate,owneruserid,maxusage,enforceident,type,maxclones,maxperident,maxperip,expires,lastused,modified,created ) VALUES (%lu,%lu,0,%lu,%lu,%d,%d,%lu,%lu,%d,%lu,%lu,%lu,%lu )", t->id,t->startdate,t->ownerid,t->maxusage,t->enforceident,t->type,t->maxclones,t->maxperident,t->maxperip, t->expire, t->lastused, t->modified, t->created ); 
-}
-
-void trustsdb_updatetrustgroup(trustgroup_t *t) {
-  dbquery("UPDATE trusts.groups SET startdate=%lu,owneruserid=%lu,maxusage=%lu,enforceident=%d,type=%d,maxclones=%lu, maxperident=%lu,maxperip=%d,expires=%lu,lastused=%lu,modified=%lu,created=%lu WHERE trustid = %lu", t->startdate, t->ownerid,t->maxusage,t->enforceident,t->type,t->maxclones,t->maxperident,t->maxperip, t->expire, t->lastused, t->modified, t->created, t->id);
-}
-
-void trustsdb_deletetrustgroup(trustgroup_t *t) {
-  dbquery("UPDATE trusts.groups SET enddate = %jd WHERE trustid = %lu", (intmax_t)getnettime(), t->id);
-}
-
-/* trust host */
-void trustsdb_addtrusthost(trusthost_t *th) {
-  dbquery("INSERT INTO trusts.hosts (hostid,trustid,startdate,enddate,host,maxusage,lastused,expires,modified,created) VALUES (%lu,%lu,%lu,0,'%s/%d',%lu,%lu,%lu,%lu,%lu)", th->id, th->trustgroup->id, th->startdate, IPtostr(th->node->prefix->sin),irc_bitlen(&(th->node->prefix->sin),th->node->prefix->bitlen), th->maxused, th->lastused, th->expire, th->modified, th->created);
-}
-
-void trustsdb_updatetrusthost(trusthost_t *th) {
-  dbquery("UPDATE trusts.hosts SET hostid=%lu,trustid=%lu,startdate=%lu,host='%s/%d',maxusage=%lu,lastused=%lu,expires=%lu,modified=%lu,created=%lu", th->id, th->trustgroup->id, th->startdate, IPtostr(th->node->prefix->sin), irc_bitlen(&(th->node->prefix->sin),th->node->prefix->bitlen), th->maxused, th->lastused, th->expire, th->modified, th->created);
-}
-
-void trustsdb_deletetrusthost(trusthost_t *th) {
-  dbquery("UPDATE trusts.hosts SET enddate = %jd WHERE hostid = %lu", (intmax_t)getnettime(), th->id);
-}
-
-/* trust block */
-void trustsdb_addtrustblock(trustblock_t *tb) {
-  dbquery("INSERT INTO trusts.blocks ( blockid,block,owner,expires,startdate,reason_private,reason_public) VALUES (%lu,'%s/%d',%lu,%lu,%lu,'%s','%s')",tb->id, IPtostr(tb->node->prefix->sin), irc_bitlen(&(tb->node->prefix->sin),tb->node->prefix->bitlen), tb->ownerid, tb->expire, tb->startdate, tb->reason_private ? tb->reason_private->content : "", tb->reason_public ? tb->reason_public->content : "");
-}
-
-void trustsdb_updatetrustblock(trustblock_t *tb) {
-  char escprivate[2*512+1];
-  char escpublic[2*512+1];
-
-  dbescapestring(escprivate,tb->reason_private ? tb->reason_private->content : "", strlen(tb->reason_private ? tb->reason_private->content : ""));
-  dbescapestring(escpublic,tb->reason_public ? tb->reason_public->content : "", strlen(tb->reason_public ? tb->reason_public->content : ""));
-
-  dbquery("UPDATE trusts.blocks SET block='%s/%d',owner=%lu,expires=%lu,startdate=%lu,reason_private='%s',reason_public='%s' WHERE blockid=%lu", IPtostr(tb->node->prefix->sin), irc_bitlen(&(tb->node->prefix->sin),tb->node->prefix->bitlen), tb->ownerid, tb->expire, tb->startdate, escprivate, escpublic, tb->id);
-}
-
-void trustsdb_deletetrustblock(trustblock_t *tb) {
-  dbquery("DELETE from trusts.blocks WHERE blockid = %lu", tb->id);
-}
-
-/* trust log */
-/* logid, trustid, timestamp, userid, type, message */
-/* @@@ TODO */
-
-void trustsdb_logmessage(trustgroup_t *tg, unsigned long userid, int type, char *message) {
-  /* maximum length of a trustlog message is ircd max length */
-  char escmessage[2*512+1];
-  
-  dbescapestring(escmessage,message, strlen(message)); 
-  dbquery("INSERT INTO trusts.log (trustid, timestamp, userid, type, message) VALUES ( %lu, %lu, %lu, %d, '%s')", tg->id, getnettime(), userid, type, escmessage);
-}
-
-void trust_dotrustlog_real(DBConn *dbconn, void *arg) {
-  nick *np=getnickbynumeric((unsigned long)arg);
-  DBResult *pgres;
-  unsigned long logid, trustid, userid, type;
-  time_t timestamp;
-  char *message;
-  char timebuf[30];
-  int header=0;
-
-  if(!dbconn)
-    return;
-
-  pgres=dbgetresult(dbconn);
-
-  if (!dbquerysuccessful(pgres)) {
-    Error("trusts", ERR_ERROR, "Error loading trusts log data.");
-    dbclear(pgres);
-    return;
-  }
-
- if (dbnumfields(pgres) != 6) {
-    Error("trusts", ERR_ERROR, "trusts log data format error.");
-    dbclear(pgres);
-    return;
-  }
-
-  if (!np) {
-    dbclear(pgres);
-    return;
-  }
-
-  while(dbfetchrow(pgres)) {
-    logid=strtoul(dbgetvalue(pgres, 0), NULL, 10);
-    trustid=strtoul(dbgetvalue(pgres, 1), NULL, 10);
-    timestamp=strtoul(dbgetvalue(pgres, 2), NULL, 10);
-    userid=strtoul(dbgetvalue(pgres, 3), NULL, 10);
-    type=strtoul(dbgetvalue(pgres, 4), NULL, 10);
-    message=dbgetvalue(pgres, 5);
-
-    if (!header) {
-      header=1;
-      controlreply(np, "Display trustlog for trust %lu", trustid); 
-      controlreply(np, "ID  Time           OperID  Type Message"); 
-    }
-    strftime(timebuf, 30, "%d/%m/%y %H:%M", localtime(&timestamp));
-    controlreply(np, "%-3lu %s %-7lu %-2lu   %s", logid, timebuf, userid, type, message);  
-  }
-
-  if (!header) {
-    controlreply(np, "No trust log entries found."); 
-  } else {
-    controlreply(np, "End Of List.");
-  }
-  dbclear(pgres);
-}
-
-
-void trustsdb_retrievetrustlog(nick *np, unsigned int trustid, time_t starttime) {
-  dbasyncquery(trust_dotrustlog_real, (void *)np->numeric, "SELECT * FROM trusts.log WHERE trustid=%u AND timestamp>%lu order by timestamp desc limit 1000", trustid, starttime);
-  Error("trusts", ERR_ERROR, "SELECT * FROM trusts.log WHERE trustid=%u AND timestamp>%lu order by timestamp desc limit 1000", trustid, starttime);
-}
diff --git a/trusts2/trusts_groups.c b/trusts2/trusts_groups.c
deleted file mode 100644 (file)
index 2d1af41..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#include "trusts.h"
-
-trustgroup_t *createtrustgroupfromdb(unsigned long id,
- unsigned long maxusage, unsigned long maxclones, unsigned long maxperident, unsigned short maxperip, int enforceident, time_t startdate, time_t lastused, time_t expire, unsigned long ownerid, int type, time_t created, time_t modified){
-  trustgroup_t *tg = createtrustgroup(id, maxclones, maxperident, maxperip, enforceident, expire, ownerid,type);
-  tg->maxusage = maxusage;
-  // currenton
-  tg->startdate = startdate;
-  tg->lastused = lastused;
-  tg->created = created;
-  tg->modified = modified;
-  return tg;
-}
-trustgroup_t *createtrustgroup(unsigned long id, unsigned long maxclones, unsigned long maxperident, unsigned short maxperip, int enforceident, time_t expire, unsigned long ownerid, int type) {
-  trustgroup_t *tg = newtrustgroup();
-
-  time_t timenow = getnettime();
-
-  tg->id = id;
-  tg->maxusage = 0;
-  tg->currenton = 0;
-  tg->maxclones = maxclones;
-  tg->maxperident = maxperident;
-  tg->maxperip = maxperip;
-  tg->enforceident = enforceident;
-  tg->startdate = timenow;
-  tg->lastused = 0;
-  tg->expire = expire;
-  tg->ownerid = ownerid;
-  tg->type = type;
-  tg->created = timenow;
-  tg->modified = timenow;
-  trusts_addtrustgrouptohash(tg);
-  return tg;
-}
-
-void trustgroup_free(trustgroup_t* t)
-{
-  trusts_removetrustgroupfromhash(t);
-  freetrustgroup(t);
-}
-
-void trustgroup_expire (trustgroup_t *tg) {
-  trusthost_t *thptr, *nthptr;
-  /* set expire to 0 so we can call trusthost_expire without it bouncing back */
-  tg->expire = 0;
-
-  /* first expiry any trust hosts */
-  int hash = trusts_gettrusthostgroupidhash(tg->id);
-  thptr = trusthostgroupidtable[hash];
-  while (thptr) {
-    nthptr = thptr;
-    thptr=thptr->nextbygroupid;
-    if(nthptr->trustgroup == tg) {
-      trusthost_expire(nthptr);
-    }
-  }
-
-  /* secondly expire trust group */
-  controlwall(NO_OPER, NL_TRUSTS, "expired trustgroup #%lu",tg->id); 
-  trustsdb_deletetrustgroup(tg);
-  trustgroup_free(tg);
-}
diff --git a/trusts2/trusts_handlers.c b/trusts2/trusts_handlers.c
deleted file mode 100644 (file)
index f2f9cfb..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-#include "trusts.h"
-
-void trusts_hook_newuser(int hook, void *arg) {
-  /*TODO: add subnet clone warnings somewhere */
-  nick *np = (nick *)arg;
-  trusthost_t *tgh = NULL;
-  trustgroup_t *tg = NULL;
-  patricia_node_t *parent;
-
-  if (trusts_ignore_np(np)) {
-    return;
-  }
-
-  if(np->ipnode->exts[tgh_ext]) {
-    /* we have a new user on a trust group host */
-    tgh = (trusthost_t *)np->ipnode->exts[tgh_ext];
-    /* check if it has expired */ 
-    if(tgh->expire && (tgh->expire <= getnettime())) {
-      trusthost_expire(tgh);
-      tgh = NULL;
-    } else {
-      tg = tgh->trustgroup;
-      if(tg->expire && (tg->expire <= getnettime())) {
-        /* expire trust group */
-        trustgroup_expire(tg);
-        tgh = NULL;
-      }
-    } 
-  }
-
-  if (!tgh) {
-    /* recurse to see if a parent node is trusted */
-    parent = np->ipnode->parent;
-    while (parent) {
-      if(parent->exts)
-        if( parent->exts[tgh_ext]) {
-          /* falls under parent trust */
-          tgh = (trusthost_t *)parent->exts[tgh_ext];
-          if(tgh->expire && (tgh->expire <= getnettime())) {
-            trusthost_expire(tgh);
-            tgh = NULL;
-          } else {
-            tg = tgh->trustgroup;
-            if(tg->expire && (tg->expire <= getnettime())) {
-              /* expire trust group */
-              trustgroup_expire(tg);
-              tgh = NULL;
-            } else {
-              break; 
-            }
-          }
-        }
-      parent = parent->parent;
-    }
-  }
-
-  if(tgh) {
-    /* we have a trusthost - check it */
-    tg = tgh->trustgroup;
-    if(((((int)(np->ipnode->usercount))) > tg->maxperip) && tg->maxperip ) {
-      /* user exceed ip trust limit - disconnect */
-      controlwall(NO_OPER, NL_TRUSTS, "TG %lu: Exceeding IP limit (%d / %d) for %s!%s@%s (%s)", tg->id, (((int)(np->ipnode->usercount))), tg->maxperip, np->nick, np->ident, np->host->name->content, removeusers == 1 ? "disconnected": "ignored");
-      //killuser(NULL, np, "USER: Exceeding IP Limit.");
-    }
-    if( tg->maxclones >0 ) {
-      if( (tg->currenton + 1) > tg->maxclones) {
-        /* user exceeds trust group limit - disconnect */
-        //killuser(NULL, np, "USER: Exceeding Trustgroup Limit.");
-        controlwall(NO_OPER, NL_TRUSTS, "TG %lu: Exceeding trustgroup limit (%d / %d) for %s!%s@%s (%s)",tg->id, (tg->currenton + 1), tg->maxclones, np->nick, np->ident, np->host->name->content, removeusers == 1 ? "disconnected": "ignored");
-      }
-    }
-    if ( np->ident[0] == '~')  {
-      /* non-ident user */
-      if (tg->enforceident ) {
-        controlwall(NO_OPER, NL_TRUSTS, "TG %lu: Ident Required for %s!%s@%s (%s)", tg->id, np->nick, np->ident, np->host->name->content, removeusers == 1 ? "disconnected": "ignored");
-        //killuser(NULL, np, "USER: Ident Required From Your Host.");
-        /*TODO: add short gline here - ~*@%s - "IDENTD required from your host", "MissingIDENT" */
-      }
-    } else {
-      /* ident user */
-      /*TODO: need to tidy out ident currenton */
-      increment_ident_count(np, tg);
-    }
-    /* Trust Checks Passed: OK - increment counters */
-    increment_trust_ipnode(np->ipnode);
-
-    /* set nick extension for user for future use */
-    np->exts[tgn_ext] = tgh; 
-
-    return;
-  }
-  /* non trusted user - OK */
-}
-
-
-void trusts_hook_lostuser(int hook, void *arg) {
-  nick *np = (nick *)arg;
-  trusthost_t *tgh = NULL;
-  trustgroup_t *tg = NULL;
-  patricia_node_t *parent;
-
-  if(!np) {
-    Error("nodecount", ERR_ERROR, "np was NULL");
-  }
-  if(!np->ipnode) {
-    Error("nodecount", ERR_ERROR, "np->ipnode was NULL");
-  }
-  if(!np->ipnode->exts) {
-    Error("nodecount", ERR_ERROR, "np->ipnode->exts was NULL");
-  }
-
-  if (trusts_ignore_np(np)) {
-    return;
-  }
-
-  decrement_trust_ipnode(np->ipnode);
-
-  if(np->ipnode->exts[tgh_ext]) {
-    tgh = (trusthost_t *)np->ipnode->exts[tgh_ext];
-  } else {
-    parent = np->ipnode->parent;
-    while (parent) {
-      if(parent->exts)
-        if( parent->exts[tgh_ext]) {
-          /* falls under parent trust */
-          tgh = (trusthost_t *)parent->exts[tgh_ext];
-          break;
-        }
-      parent = parent->parent;
-    }
-  }
-  if(tgh) {
-    tg = tgh->trustgroup;
-    if ( np->ident[0] != '~')  {
-      decrement_ident_count(np, tg);
-    }
-  }
-
-  /* clear nick extension */
-  np->exts[tgn_ext] = NULL;
-}
-
diff --git a/trusts2/trusts_hash.c b/trusts2/trusts_hash.c
deleted file mode 100644 (file)
index ae7d3d0..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-#include "trusts.h"
-
-trustgroup_t *trustgroupidtable[TRUSTS_HASH_GROUPSIZE];
-trustgroup_t *trustgroupnametable[TRUSTS_HASH_GROUPSIZE];
-trusthost_t *trusthostidtable[TRUSTS_HASH_HOSTSIZE];
-trusthost_t *trusthostgroupidtable[TRUSTS_HASH_HOSTSIZE];
-trustgroupidentcount_t *trustgroupidentcounttable[TRUSTS_HASH_IDENTSIZE];
-
-void trusts_hash_init() {
-  memset(trustgroupidtable,0,sizeof(trustgroupidtable));
-  memset(trustgroupnametable,0,sizeof(trustgroupnametable));
-  memset(trusthostidtable,0,sizeof(trusthostidtable));
-  memset(trusthostgroupidtable,0,sizeof(trusthostgroupidtable));
-}
-
-void trusts_hash_fini() {
-}
-
-void trusts_addtrusthosttohash(trusthost_t *newhost)
-{
-  unsigned int hash;
-  hash = trusts_gettrusthostidhash(newhost->id);
-  newhost->nextbyid = trusthostidtable[hash];
-  trusthostidtable[hash] = newhost;
-
-  hash = trusts_gettrusthostgroupidhash(newhost->trustgroup->id);
-  newhost->nextbygroupid = trusthostgroupidtable[hash];
-  trusthostgroupidtable[hash] = newhost;
-}
-
-void trusts_removetrusthostfromhash(trusthost_t *t)
-{
-  trusthost_t **tgh;
-  int found = 0;
-  for(tgh=&(trusthostidtable[trusts_gettrusthostidhash(t->id)]);*tgh;tgh=(trusthost_t **)&((*tgh)->nextbyid)) {
-    if((*tgh)==t) {
-      (*tgh)=(trusthost_t *)t->nextbyid;
-      found = 1;
-      break;
-    }
-  }
-  if(!found)
-    Error("trusts",ERR_ERROR,"Unable to remove trusthost id %lu from hashtable", t->id);
-  found = 0;
-  for(tgh=&(trusthostgroupidtable[trusts_gettrusthostgroupidhash(t->trustgroup->id)]);*tgh;tgh=(trusthost_t **)&((*tgh)->nextbygroupid)) {
-    if((*tgh)==t) {
-      (*tgh)=(trusthost_t *)t->nextbygroupid;
-      found = 1;
-      break;
-    }
-  }
-  if(!found)
-    Error("trusts",ERR_ERROR,"Unable to remove trusthost groupid %lu from hashtable", t->trustgroup->id);
-}
-
-void trusts_addtrustgrouptohash(trustgroup_t *newgroup)
-{
-  unsigned int hash;
-  hash = trusts_gettrustgroupidhash(newgroup->id);
-  newgroup->nextbyid = trustgroupidtable[hash];
-  trustgroupidtable[hash] = newgroup;
-}
-
-trustgroup_t* findtrustgroupbyid(int id) {
-  trustgroup_t* tl;
-  for(tl=trustgroupidtable[trusts_gettrustgroupidhash(id)]; tl; tl = (trustgroup_t *)tl->nextbyid) { 
-    if(tl->id == id) {
-      return tl;
-    }
-  }
-  return NULL;
-}
-
-trustgroup_t* findtrustgroupbyownerid(int ownerid) {
-  trustgroup_t* tg;
-  int i;
-
-  for ( i = 0; i < TRUSTS_HASH_GROUPSIZE ; i++ ) {
-    for ( tg = trustgroupidtable[i]; tg; tg = tg -> nextbyid ) {
-      if(tg->ownerid == ownerid) {
-        return tg;
-      }
-    }
-  }
-  return NULL;
-}
-
-
-void trusts_removetrustgroupfromhash(trustgroup_t *t)
-{
-  trustgroup_t **tg;
-  int found = 0;
-  for(tg=&(trustgroupidtable[trusts_gettrustgroupidhash(t->id)]);*tg;tg=(trustgroup_t **)&((*tg)->nextbyid)) {
-    if((*tg)==t) {
-      (*tg)=(trustgroup_t *)t->nextbyid;
-      found = 1;
-      break;
-    }
-  }
-  if (!found)
-    Error("trusts",ERR_ERROR,"Unable to remove trustgroup ID %lu from hashtable",t->id);
-}
-
-void trusts_addtrustgroupidenttohash(trustgroupidentcount_t *newident)
-{
-  unsigned int hash;
-  hash = trusts_gettrustgroupidenthash(newident->ident->content);
-  newident->next = trustgroupidentcounttable[hash];
-  trustgroupidentcounttable[hash] = newident;
-}
-
-void trusts_removetrustgroupidentfromhash(trustgroupidentcount_t *t)
-{
-  trustgroupidentcount_t **thi;
-  for(thi=&(trustgroupidentcounttable[trusts_gettrustgroupidenthash(t->ident->content)]);*thi;thi=(trustgroupidentcount_t **)&((*thi)->next)) {
-    if((*thi)==t) {
-      (*thi)=(trustgroupidentcount_t *)t->next;
-      return; 
-    }
-  }
-  Error("trusts",ERR_ERROR,"Unable to remove trustgroup ident %s from group %lu from hashtable",t->ident->content, t->trustgroup->id);
-}
-
-trustgroupidentcount_t* findtrustgroupcountbyident(char *ident, trustgroup_t *t) {
-  trustgroupidentcount_t* tgi;
-
-  for(tgi=trustgroupidentcounttable[trusts_gettrustgroupidenthash(ident)]; tgi; tgi = (trustgroupidentcount_t *)tgi->next) {
-    if(tgi->trustgroup == t) {
-      if(strcmp(tgi->ident->content,ident)==0) {
-        return tgi;
-      }
-    }
-  }
-  return NULL;
-}
-
diff --git a/trusts2/trusts_hosts.c b/trusts2/trusts_hosts.c
deleted file mode 100644 (file)
index bbdc6b6..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-#include "trusts.h"
-
-trusthost_t *createtrusthostfromdb(unsigned long id, patricia_node_t* node, time_t startdate, time_t lastused, time_t expire, unsigned long maxused, trustgroup_t* trustgroup, time_t created, time_t modified){
-  trusthost_t *th = createtrusthost(id,node,expire,trustgroup);
-
-  th->startdate=startdate;
-  th->lastused = lastused;
-  th->maxused = maxused;
-  th->created = created;
-  th->modified = modified;
-  return th;
-}
-
-trusthost_t *createtrusthost(unsigned long id, patricia_node_t* node, time_t expire, trustgroup_t *trustgroup) {
-  trusthost_t *th = newtrusthost();
-  memset(th, 0, sizeof(trusthost_t));
-
-  time_t timenow = getnettime();
-
-  th->id = id;
-  th->node = node;
-  th->expire = expire;
-  th->trustgroup = trustgroup;
-  th->created = timenow;
-  th->modified = timenow;
-  th->lastused = 0;
-  trusts_addtrusthosttohash(th);
-  return th;
-}
-
-void trusthost_free(trusthost_t* t)
-{
-  trusts_removetrusthostfromhash(t);
-
-  derefnode(iptree,t->node);
-  freetrusthost(t);
-}
-
-trusthost_t* trusthostadd(patricia_node_t *node, trustgroup_t* tg, time_t expire) {
-  trusthost_t* tgh = createtrusthost(++trusts_lasttrusthostid, node, expire, tg);
-  patricia_node_t *inode;
-  nick *np;
-  patricianick_t *pnp;
-  int i;
-  time_t timenow;
-
-  if(!tgh) {
-    Error("trusts", ERR_FATAL, "trusthostadd failed to createtrusthost");
-    return NULL;
-  }
-
-  timenow = getnettime();
-  if(node->usercount >0){
-    tgh->lastused = timenow;
-    tg->currenton += node->usercount;
-    tg->lastused = timenow;
-  }
-  tgh->expire = expire;
-
-  PATRICIA_WALK(node, inode)
-  {
-    pnp = inode->exts[pnode_ext];
-    if (pnp ) {
-      for (i = 0; i < PATRICIANICK_HASHSIZE; i++) {
-        for (np = pnp->identhash[i]; np; np=np->exts[pnick_ext]) {
-          if (trusts_ignore_np(np)) {
-            continue;
-          }
-          increment_ident_count(np, tg);
-        }
-      }
-    }
-  }
-  PATRICIA_WALK_END;
-
-  node->exts[tgh_ext] = tgh;
-
-  return tgh;
-}
-
-void trusthost_addcounters(trusthost_t* tgh) {
-  patricia_node_t *inode;
-  nick *np;
-  patricianick_t *pnp;
-  int i;
-
-  trustgroup_t* tg = tgh->trustgroup;
-  if(tgh->node->usercount >0){
-    tg->currenton += tgh->node->usercount;
-  }
-
-  PATRICIA_WALK(tgh->node, inode)
-  {
-    pnp = inode->exts[pnode_ext];
-    if (pnp ) {
-      for (i = 0; i < PATRICIANICK_HASHSIZE; i++) {
-        for (np = pnp->identhash[i]; np; np=np->exts[pnick_ext]) {
-          if (trusts_ignore_np(np)) {
-            continue;
-          }
-          increment_ident_count(np, tg);
-          np->exts[tgn_ext] = tgh;
-        }
-      }
-    }
-  }
-  PATRICIA_WALK_END;
-
-  tgh->node->exts[tgh_ext] = tgh;
-}
-
-
-void trusthost_expire( trusthost_t *th) {
-  trustgroup_t *tg = th->trustgroup;
-
-  if(tg->expire && (tg->expire <= getnettime())) {
-    /* check if trustgroup also expires */
-    trustgroup_expire(tg);
-  } else {
-    controlwall(NO_OPER, NL_TRUSTS, "%s/%d expired from trustgroup #%lu",IPtostr(th->node->prefix->sin),irc_bitlen(&(th->node->prefix->sin),th->node->prefix->bitlen),tg->id);
-    trustsdb_deletetrusthost(th->node->exts[tgh_ext]);
-    trusthost_free(th->node->exts[tgh_ext]);
-    th->node->exts[tgh_ext] = NULL;
-  }
-}
diff --git a/trusts2/trusts_ident.c b/trusts2/trusts_ident.c
deleted file mode 100644 (file)
index 7c0c042..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "trusts.h"
-
-trustgroupidentcount_t *getnewtrustgroupidentcount(trustgroup_t *tg, char *ident) {
-  trustgroupidentcount_t *tgic = newtrustgroupidentcount();
-  tgic->ident = getsstring(ident,USERLEN);
-  tgic->currenton = 1; 
-  tgic->trustgroup = tg;
-
-  trusts_addtrustgroupidenttohash(tgic);
-  return tgic;
-}
-
-void increment_ident_count(nick *np, trustgroup_t *tg) {
-  trustgroupidentcount_t* identcnt;
-  identcnt = findtrustgroupcountbyident(np->ident,tg);
-  if(identcnt) {
-    /* ident exists */
-    if( tg->maxperident && (identcnt->currenton+1) > tg->maxperident) {
-      controlwall(NO_OPER, NL_TRUSTS, "TG %lu: Exceeded Ident Limit (%d/%d) for %s!%s@%s (%s)",tg->id, identcnt->currenton+1, tg->maxperident, np->nick, np->ident, np->host->name->content, removeusers == 1 ? "disconnected": "ignored");
-      //killuser(NULL, np, "USER: Exceeding User Ident Limit.");
-    }
-    identcnt->currenton++;
-  } else {
-    /* we have a new user to add */
-    getnewtrustgroupidentcount( tg, np->ident );
-  }
-}
-
-void decrement_ident_count(nick *np, trustgroup_t *tg) {
-  trustgroupidentcount_t* identcnt;
-  identcnt = findtrustgroupcountbyident(np->ident,tg);
-  if(identcnt) {
-    identcnt->currenton--;
-    if(identcnt->currenton == 0) {
-      trusts_removetrustgroupidentfromhash(identcnt);
-      if (identcnt->ident) {
-        freesstring(identcnt->ident);
-      }
-      freetrustgroupidentcount(identcnt);
-    }
-  }
-}
-
diff --git a/trusts2_newsearch/Makefile.in b/trusts2_newsearch/Makefile.in
deleted file mode 100644 (file)
index 09cd216..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-@include@ @includel@../build.mk@includel@
-
-CFLAGS+=$(INCDBAPI)
-LDFLAGS+=$(LIBDBAPI)
-
-
-.PHONY: all
-
-all: trusts_newsearch.so
-
-trusts_newsearch.so: formats.o tsns-ownerid.o tsns-tgmaxperident.o tsns-thcreated.o tsns-thmodified.o trusts_newsearch.o tsns-tgcreated.o tsns-tgmaxperip.o tsns-thexpire.o tsns-thstartdate.o tsns-currenton.o tsns-tgexpire.o tsns-tgmaxusage.o tsns-thid.o tsns-trusted.o tsns-enforceident.o tsns-tgid.o tsns-tgmodified.o tsns-thlastused.o tsns-maxclones.o tsns-tglastused.o tsns-tgstartdate.o tsns-thmaxusage.o tsns-tbid.o tsns-istrusted.o trusts_searchcommands.o
-
diff --git a/trusts2_newsearch/formats.c b/trusts2_newsearch/formats.c
deleted file mode 100644 (file)
index 9504ad4..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <stdio.h>
-
-#include "../newsearch/newsearch.h"
-#include "../control/control.h"
-#include "../lib/stringbuf.h"
-#include "../trusts2/trusts.h"
-
-void printtrust_group(searchCtx *ctx, nick *sender, patricia_node_t *node) {
-  trusthost_t *tgh = node->exts[tgh_ext];
-  trustgroup_t *tg;
-
-  if (tgh) {
-    tg = tgh->trustgroup;
-    ctx->reply(sender,"%s/%d | [%lu] | %lu/%lu", IPtostr(node->prefix->sin), irc_bitlen(&(node->prefix->sin),(node->prefix->bitlen)), tg->id, tg->currenton, tg->maxusage); 
-  } else { 
-    ctx->reply(sender,"%s/%d | <none>", IPtostr(node->prefix->sin), irc_bitlen(&(node->prefix->sin),(node->prefix->bitlen)));
-  }
-}
-
-void printtrust_block(searchCtx *ctx, nick *sender, patricia_node_t *node) {
-  trustblock_t *tb = node->exts[tgb_ext];
-
-  if (tb) {
-    ctx->reply(sender,"%s/%d | [%lu] | %s", IPtostr(node->prefix->sin), irc_bitlen(&(node->prefix->sin),(node->prefix->bitlen)), tb->id, tb->reason_public ? tb->reason_public->content : "");
-  } else {
-    ctx->reply(sender,"%s/%d | <none>", IPtostr(node->prefix->sin), irc_bitlen(&(node->prefix->sin),(node->prefix->bitlen)));
-  } 
-}
-
-void printtrust_blockprivate(searchCtx *ctx, nick *sender, patricia_node_t *node) {
-  trustblock_t *tb = node->exts[tgb_ext];
-
-  if (tb) {
-    ctx->reply(sender,"%s/%d | [%lu] | %s", IPtostr(node->prefix->sin), irc_bitlen(&(node->prefix->sin),(node->prefix->bitlen)), tb->id, tb->reason_private ? tb->reason_private->content : "");
-  } else {
-    ctx->reply(sender,"%s/%d | <none>", IPtostr(node->prefix->sin), irc_bitlen(&(node->prefix->sin),(node->prefix->bitlen)));
-  }
-}
diff --git a/trusts2_newsearch/trusts_newsearch.c b/trusts2_newsearch/trusts_newsearch.c
deleted file mode 100644 (file)
index 06c7b25..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-
-#include "trusts_newsearch.h"
-#include "../trusts2/trusts.h"
-#include "../lib/version.h"
-
-MODULE_VERSION("");
-
-
-void _init(void) {
-  regdisp(reg_nodesearch, "tg", printtrust_group, 0, "");
-  regdisp(reg_nodesearch, "tb", printtrust_block, 0, "");
-  regdisp(reg_nodesearch, "tbprivate", printtrust_blockprivate, 0, "");
-
-  /* TRUSTGROUP */
-  registersearchterm(reg_tgsearch, "tgid", tsns_tgid_parse, 0, "Trustgroup ID");
-  registersearchterm(reg_tgsearch, "tgstartdate", tsns_tgstartdate_parse, 0, "Trustgroup start date timestamp - represents date trust is due to go active or date trust was added");
-  registersearchterm(reg_tgsearch, "tglastused", tsns_tglastused_parse, 0, "trust group last used timestamp");
-  registersearchterm(reg_tgsearch, "tgexpire", tsns_tgexpire_parse, 0, "trust group expiry timestamp");
-  registersearchterm(reg_tgsearch, "tgownerid", tsns_tgownerid_parse, 0, "Q auth id of trust group owner");
-  registersearchterm(reg_tgsearch, "tgmaxperip", tsns_tgmaxperip_parse, 0, "trust group max per IP value");
-  registersearchterm(reg_tgsearch, "tgmaxusage", tsns_tgmaxusage_parse, 0, "trust group max usage ever");
-  registersearchterm(reg_tgsearch, "tgcurrenton", tsns_tgcurrenton_parse, 0, "trust group current usage");
-  registersearchterm(reg_tgsearch, "tgmaxclones", tsns_tgmaxclones_parse, 0, "trust group maximum user limit");
-  registersearchterm(reg_tgsearch, "tgmaxperident", tsns_tgmaxperident_parse, 0, "trust group max per ident value");
-  registersearchterm(reg_tgsearch, "tgenforceident", tsns_tgenforceident_parse, 0, "trust group enforce ident (0/1)");
-  registersearchterm(reg_tgsearch, "tgcreated", tsns_tgcreated_parse, 0, "trust group creation timestamp (note: we also store a startdate timestamp)");
-  registersearchterm(reg_tgsearch, "tgmodified", tsns_tgmodified_parse, 0, "trust group last modified timestamp");
-
-  registersearchterm(reg_thsearch, "thid", tsns_thid_parse, 0, "trust host ID");
-  registersearchterm(reg_thsearch, "thstartdate", tsns_thstartdate_parse, 0, "trust host start date timestamp - represents date host is due to go active or date host was added");
-  registersearchterm(reg_thsearch, "thlastused", tsns_thlastused_parse, 0, "trust host last used timestamp");
-  registersearchterm(reg_thsearch, "thexpire", tsns_thexpire_parse, 0, "trust host expiry timestamp");
-  registersearchterm(reg_thsearch, "thmaxusage", tsns_thmaxusage_parse, 0, "trust host max usage ever");
-  registersearchterm(reg_thsearch, "thcreated", tsns_thcreated_parse, 0, "trust host creation timestamp (note: we also store a startdate timestamp)");
-  registersearchterm(reg_thsearch, "thmodified", tsns_thmodified_parse, 0, "trust host last modified timestamp");
-
-  registersearchterm(reg_nodesearch, "trusted", tsns_trusted_parse, 0, "IP node is trusted");
-  registersearchterm(reg_nodesearch, "tgid", tsns_tgid_parse, 0, "Trust group ID");
-  registersearchterm(reg_nodesearch, "tgexpire", tsns_tgexpire_parse, 0, "trust group expiry timestamp");
-  registersearchterm(reg_nodesearch, "tgstartdate", tsns_tgstartdate_parse, 0, "Trustgroup start date timestamp - represents date trust is due to go active or date trust was added");
-  registersearchterm(reg_nodesearch, "tglastused", tsns_tglastused_parse, 0, "trust group last used timestamp");
-  registersearchterm(reg_nodesearch, "tgownerid", tsns_tgownerid_parse, 0, "Q auth id of trust group owner");
-  registersearchterm(reg_nodesearch, "tgmaxperip", tsns_tgmaxperip_parse, 0, "trust group max per IP value");
-  registersearchterm(reg_nodesearch, "tgmaxusage", tsns_tgmaxusage_parse, 0, "trust group max usage ever");
-  registersearchterm(reg_nodesearch, "tgmaxclones", tsns_tgmaxclones_parse, 0, "trust group maximum user limit");
-  registersearchterm(reg_nodesearch, "tgmaxperident", tsns_tgmaxperident_parse, 0, "trust group max per ident value");
-  registersearchterm(reg_nodesearch, "tgenforceident", tsns_tgenforceident_parse, 0, "trust group enforce ident (0/1)");
-  registersearchterm(reg_nodesearch, "tgcreated", tsns_tgcreated_parse, 0, "trust group creation timestamp (note: we also store a startdate timestamp)");
-  registersearchterm(reg_nodesearch, "tgmodified", tsns_tgmodified_parse, 0, "trust group last modified timestamp");
-
-  registersearchterm(reg_nodesearch, "thid", tsns_thid_parse, 0, "Trust Host ID");
-  registersearchterm(reg_nodesearch, "thstartdate", tsns_thstartdate_parse, 0, "trust host start date timestamp - represents date host is due to go active or date host was added");
-  registersearchterm(reg_nodesearch, "thlastused", tsns_thlastused_parse, 0, "trust host last used timestamp");
-  registersearchterm(reg_nodesearch, "thexpire", tsns_thexpire_parse, 0, "trust host expiry timestamp");
-  registersearchterm(reg_nodesearch, "thmaxusage", tsns_thmaxusage_parse, 0, "trust host max usage ever");
-  registersearchterm(reg_nodesearch, "thcreated", tsns_thcreated_parse, 0, "trust host creation timestamp (note: we also store a startdate timestamp)");
-  registersearchterm(reg_nodesearch, "thmodified", tsns_thmodified_parse, 0, "trust host last modified timestamp");
-
-  registersearchterm(reg_nodesearch, "tbid", tsns_tbid_parse, 0, "Trust Block ID");
-
-  registersearchterm(reg_nicksearch, "istrusted", tsns_istrusted_parse, 0, "user is on a trusted host");
-
-  registercontrolhelpcmd("trustlist",10,1,tsns_dotrustlist, "Usage: trustlist <tgid>");
-  registercontrolhelpcmd("trustdenylist",10,1,tsns_dotrustdenylist, "Usage: trustdenylist <tgid>");
-
-}
-
-void _fini(void) {
-  unregdisp(reg_nodesearch, "tg", printtrust_group);
-  unregdisp(reg_nodesearch, "tb", printtrust_block);
-  unregdisp(reg_nodesearch, "tbprivate", printtrust_blockprivate);
-
-  deregistersearchterm(reg_tgsearch, "tgid", tsns_tgid_parse);
-  deregistersearchterm(reg_tgsearch, "tgstartdate", tsns_tgstartdate_parse);
-  deregistersearchterm(reg_tgsearch, "tglastused", tsns_tglastused_parse);
-  deregistersearchterm(reg_tgsearch, "tgexpire", tsns_tgexpire_parse);
-  deregistersearchterm(reg_tgsearch, "tgownerid", tsns_tgownerid_parse);
-  deregistersearchterm(reg_tgsearch, "tgmaxperip", tsns_tgmaxperip_parse);
-  deregistersearchterm(reg_tgsearch, "tgmaxusage", tsns_tgmaxusage_parse);
-  deregistersearchterm(reg_tgsearch, "tgcurrenton", tsns_tgcurrenton_parse);
-  deregistersearchterm(reg_tgsearch, "tgmaxclones", tsns_tgmaxclones_parse);
-  deregistersearchterm(reg_tgsearch, "tgmaxperident", tsns_tgmaxperident_parse);
-  deregistersearchterm(reg_tgsearch, "tgenforceident", tsns_tgenforceident_parse);
-  deregistersearchterm(reg_tgsearch, "tgcreated", tsns_tgcreated_parse);
-  deregistersearchterm(reg_tgsearch, "tgmodified", tsns_tgmodified_parse);
-
-  deregistersearchterm(reg_thsearch, "thid", tsns_thid_parse);
-  deregistersearchterm(reg_thsearch, "thstartdate", tsns_thstartdate_parse);
-  deregistersearchterm(reg_thsearch, "thlastused", tsns_thlastused_parse);
-  deregistersearchterm(reg_thsearch, "thexpire", tsns_thexpire_parse);
-  deregistersearchterm(reg_thsearch, "thmaxusage", tsns_thmaxusage_parse);
-  deregistersearchterm(reg_thsearch, "thcreated", tsns_thcreated_parse);
-  deregistersearchterm(reg_thsearch, "thmodified", tsns_thmodified_parse);
-
-  deregistersearchterm(reg_nodesearch, "trusted", tsns_trusted_parse);
-  deregistersearchterm(reg_nodesearch, "tgid", tsns_tgid_parse);
-  deregistersearchterm(reg_nodesearch, "tgexpire", tsns_tgexpire_parse);
-  deregistersearchterm(reg_nodesearch, "tgstartdate", tsns_tgstartdate_parse);
-  deregistersearchterm(reg_nodesearch, "tglastused", tsns_tglastused_parse);
-  deregistersearchterm(reg_nodesearch, "tgownerid", tsns_tgownerid_parse);
-  deregistersearchterm(reg_nodesearch, "tgmaxperip", tsns_tgmaxperip_parse);
-  deregistersearchterm(reg_nodesearch, "tgmaxusage", tsns_tgmaxusage_parse);
-  deregistersearchterm(reg_nodesearch, "tgmaxclones", tsns_tgmaxclones_parse);
-  deregistersearchterm(reg_nodesearch, "tgmaxperident", tsns_tgmaxperident_parse);
-  deregistersearchterm(reg_nodesearch, "tgenforceident", tsns_tgenforceident_parse);
-  deregistersearchterm(reg_nodesearch, "tgcreated", tsns_tgcreated_parse);
-  deregistersearchterm(reg_nodesearch, "tgmodified", tsns_tgmodified_parse);
-
-  deregistersearchterm(reg_nodesearch, "thid", tsns_thid_parse);
-  deregistersearchterm(reg_nodesearch, "thstartdate", tsns_thstartdate_parse);
-  deregistersearchterm(reg_nodesearch, "thlastused", tsns_thlastused_parse);
-  deregistersearchterm(reg_nodesearch, "thexpire", tsns_thexpire_parse);
-  deregistersearchterm(reg_nodesearch, "thmaxusage", tsns_thmaxusage_parse);
-  deregistersearchterm(reg_nodesearch, "thcreated", tsns_thcreated_parse);
-  deregistersearchterm(reg_nodesearch, "thmodified", tsns_thmodified_parse);
-
-  deregistersearchterm(reg_nodesearch, "tbid", tsns_tbid_parse);
-
-  deregistersearchterm(reg_nicksearch, "istrusted", tsns_istrusted_parse);
-
-  deregistercontrolcmd("trustlist",tsns_dotrustlist);
-  deregistercontrolcmd("trustdenylist",tsns_dotrustdenylist);
-}
-
diff --git a/trusts2_newsearch/trusts_newsearch.h b/trusts2_newsearch/trusts_newsearch.h
deleted file mode 100644 (file)
index 852c835..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef __TRUSTS_NEWSEARCH_H_
-#define __TRUSTS_NEWSEARCH_H
-
-#include "../patriciasearch/patriciasearch.h"
-#include "../trusts2/trusts.h"
-#include "../trusts_search/trusts_search.h"
-
-void printtrust_group(searchCtx *ctx, nick *sender, patricia_node_t *node);
-void printtrust_block(searchCtx *ctx, nick *sender, patricia_node_t *node);
-void printtrust_blockprivate(searchCtx *ctx, nick *sender, patricia_node_t *node);
-
-struct searchNode *tsns_trusted_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_tgid_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_tgexpire_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_tgmaxperip_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_tgownerid_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_tgstartdate_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_tglastused_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_tgmaxusage_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_tgcurrenton_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_tgmaxclones_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_tgmaxperident_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_tgenforceident_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_tgcreated_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_tgmodified_parse(searchCtx *ctx, int argc, char **argv);
-
-struct searchNode *tsns_thcreated_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_thexpire_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_thid_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_thlastused_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_thmaxusage_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_thmodified_parse(searchCtx *ctx, int argc, char **argv);
-struct searchNode *tsns_thstartdate_parse(searchCtx *ctx, int argc, char **argv);
-
-struct searchNode *tsns_tbid_parse(searchCtx *ctx, int argc, char **argv);
-
-struct searchNode *tsns_istrusted_parse(searchCtx *ctx, int argc, char **argv);
-
-int tsns_dotrustlist(void *source, int cargc, char **cargv);
-int tsns_dotrustdenylist(void *source, int cargc, char **cargv);
-
-#endif
diff --git a/trusts2_newsearch/trusts_searchcommands.c b/trusts2_newsearch/trusts_searchcommands.c
deleted file mode 100644 (file)
index fc3656a..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "trusts_newsearch.h"
-#include "../newsearch/newsearch.h"
-
-static void tsnsmessagewrapper(nick *np, char *format, ...) {
-  char buf[1024];
-  va_list ap;
-
-  va_start(ap, format);
-  vsnprintf(buf, sizeof(buf), format, ap);
-  va_end(ap);
-
-  controlreply(np, "%s", buf);
-}
-
-static void tsnswallwrapper(int level, char *format, ...) {
-  char buf[1024];
-  va_list ap;
-
-  va_start(ap, format);
-  vsnprintf(buf, sizeof(buf), format, ap);
-  va_end(ap);
-
-  controlwall(NO_OPER, level, "%s", buf);
-}
-
-int tsns_dotrustlist(void *source, int cargc, char **cargv) {
-  searchASTExpr tree;
-  searchASTExpr nodes[2];
-  
-  if(cargc < 1) {
-    controlreply(source,"Syntax: trustlist <#groupid>");
-    return CMD_ERROR;
-  }
-
-  if(cargv[0][0]== '#'){
-    tree = NSASTNode(eq_parse, NSASTNode(tsns_tgid_parse), NSASTLiteral(&cargv[0][1]));
-  } else {
-    tree = NSASTNode(eq_parse, NSASTNode(tsns_tgid_parse), NSASTLiteral(cargv[0]));
-  }
-
-//  nodes[0] = NSASTNode(tsns_tgid_parse);
-//  nodes[1] = cargv[0];
-//  tree =
-//      NSASTManualNode(eq_parse, 2, nodes 
-//    );
-  return ast_tgsearch(&tree, tsnsmessagewrapper , source, tsnswallwrapper, printtgfull, NULL, NULL, 1);
-}
-
-int tsns_dotrustdenylist(void *source, int cargc, char **cargv) {
-  searchASTExpr tree;
-
-  tree = NSASTNode(gt_parse, NSASTNode(tsns_tbid_parse), NSASTLiteral("0"));
-
-  if(cargc == 1){ /* just assume -private */
-    return ast_nodesearch(&tree, tsnsmessagewrapper , source, tsnswallwrapper, printtrust_blockprivate, NULL, NULL, 500);
-  } else {
-    return ast_nodesearch(&tree, tsnsmessagewrapper , source, tsnswallwrapper, printtrust_block, NULL, NULL, 500);
-  }
-}
diff --git a/trusts2_newsearch/tsns-currenton.c b/trusts2_newsearch/tsns-currenton.c
deleted file mode 100644 (file)
index e75d397..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tgcurrenton_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tgcurrenton_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tgcurrenton_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tgcurrenton_exe;
-  thenode->free = tsns_tgcurrenton_free;
-
-  return thenode;
-}
-
-void *tsns_tgcurrenton_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trustgroup_t *tg;
-
-  tg = (trustgroup_t *)theinput;
-  return (void *)(tg->currenton);
-}
-
-void tsns_tgcurrenton_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-enforceident.c b/trusts2_newsearch/tsns-enforceident.c
deleted file mode 100644 (file)
index a382f7f..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tgenforceident_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tgenforceident_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tgenforceident_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_BOOL;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tgenforceident_exe;
-  thenode->free = tsns_tgenforceident_free;
-
-  return thenode;
-}
-
-void *tsns_tgenforceident_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trustgroup_t *tg;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      if (((trusthost_t *)node->exts[tgh_ext])->trustgroup->enforceident)
-        return (void *)1;
-  } else if (ctx->searchcmd == reg_tgsearch) {
-    tg = (trustgroup_t *)theinput;
-    if (tg->enforceident)
-      return (void *)1;
-  } else {
-    return NULL;
-  }
-
-  return (void *)0;
-}
-
-void tsns_tgenforceident_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-istrusted.c b/trusts2_newsearch/tsns-istrusted.c
deleted file mode 100644 (file)
index d9b51c6..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_istrusted_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_istrusted_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_istrusted_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_BOOL;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_istrusted_exe;
-  thenode->free = tsns_istrusted_free;
-
-  return thenode;
-}
-
-void *tsns_istrusted_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  nick *np = theinput;
-
-  trusthost_t *tgh = np->exts[tgn_ext];
-
-  if (!tgh)
-    return (void *)0;
-
-  return (void *)1;
-}
-
-void tsns_istrusted_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-maxclones.c b/trusts2_newsearch/tsns-maxclones.c
deleted file mode 100644 (file)
index 66dc9d4..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tgmaxclones_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tgmaxclones_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tgmaxclones_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tgmaxclones_exe;
-  thenode->free = tsns_tgmaxclones_free;
-
-  return thenode;
-}
-
-void *tsns_tgmaxclones_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trustgroup_t *tg;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-  
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->trustgroup->maxclones);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_tgsearch) {
-    tg = (trustgroup_t *)theinput;
-    return (void *)(tg->maxclones);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_tgmaxclones_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-ownerid.c b/trusts2_newsearch/tsns-ownerid.c
deleted file mode 100644 (file)
index af3c7fd..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tgownerid_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tgownerid_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tgownerid_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tgownerid_exe;
-  thenode->free = tsns_tgownerid_free;
-
-  return thenode;
-}
-
-void *tsns_tgownerid_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trustgroup_t *tg;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->trustgroup->ownerid);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_tgsearch) {
-    tg = (trustgroup_t *)theinput;
-    return (void *)(tg->ownerid);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_tgownerid_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-tbid.c b/trusts2_newsearch/tsns-tbid.c
deleted file mode 100644 (file)
index b5d1bee..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tbid_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tbid_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tbid_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tbid_exe;
-  thenode->free = tsns_tbid_free;
-
-  return thenode;
-}
-
-void *tsns_tbid_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  patricia_node_t *node;
-
-  node = (patricia_node_t *)theinput;
-  if (node->exts[tgb_ext] != NULL)
-    return (void *)(((trustblock_t *)node->exts[tgb_ext])->id);
-  else
-    return (void *)0; /* will cast to a FALSE */
-}
-
-void tsns_tbid_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-tgcreated.c b/trusts2_newsearch/tsns-tgcreated.c
deleted file mode 100644 (file)
index 1cd3af5..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tgcreated_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tgcreated_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tgcreated_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tgcreated_exe;
-  thenode->free = tsns_tgcreated_free;
-
-  return thenode;
-}
-
-void *tsns_tgcreated_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trustgroup_t *tg;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->trustgroup->created);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_tgsearch) {
-    tg = (trustgroup_t *)theinput;
-    return (void *)(tg->created);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_tgcreated_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-tgexpire.c b/trusts2_newsearch/tsns-tgexpire.c
deleted file mode 100644 (file)
index ecbb7d0..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tgexpire_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tgexpire_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tgexpire_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tgexpire_exe;
-  thenode->free = tsns_tgexpire_free;
-
-  return thenode;
-}
-
-void *tsns_tgexpire_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trustgroup_t *tg;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->trustgroup->expire);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_tgsearch) {
-    tg = (trustgroup_t *)theinput;
-    return (void *)(tg->expire);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_tgexpire_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-tgid.c b/trusts2_newsearch/tsns-tgid.c
deleted file mode 100644 (file)
index ad11ccb..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tgid_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tgid_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tgid_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tgid_exe;
-  thenode->free = tsns_tgid_free;
-
-  return thenode;
-}
-
-void *tsns_tgid_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  patricia_node_t *node;
-  trustgroup_t *tg;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-      node = (patricia_node_t *)theinput;
-      if (node->exts[tgh_ext] != NULL)
-        return (void *)(((trusthost_t *)node->exts[tgh_ext])->trustgroup->id);
-      else
-        return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_tgsearch) {
-      tg = (trustgroup_t *)theinput;
-      return (void *)(tg->id); 
-  } else {
-      return NULL;
-  } 
-
-}
-
-void tsns_tgid_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-tglastused.c b/trusts2_newsearch/tsns-tglastused.c
deleted file mode 100644 (file)
index a31586e..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tglastused_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tglastused_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tglastused_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tglastused_exe;
-  thenode->free = tsns_tglastused_free;
-
-  return thenode;
-}
-
-void *tsns_tglastused_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trustgroup_t *tg;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->trustgroup->lastused);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_tgsearch) {
-    tg = (trustgroup_t *)theinput;
-    return (void *)(tg->lastused);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_tglastused_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-tgmaxperident.c b/trusts2_newsearch/tsns-tgmaxperident.c
deleted file mode 100644 (file)
index 3682024..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tgmaxperident_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tgmaxperident_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tgmaxperident_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tgmaxperident_exe;
-  thenode->free = tsns_tgmaxperident_free;
-
-  return thenode;
-}
-
-void *tsns_tgmaxperident_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trustgroup_t *tg;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-  
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->trustgroup->maxperident);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_tgsearch) {
-    tg = (trustgroup_t *)theinput;
-    return (void *)(tg->maxperident);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_tgmaxperident_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-tgmaxperip.c b/trusts2_newsearch/tsns-tgmaxperip.c
deleted file mode 100644 (file)
index 5418f3c..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tgmaxperip_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tgmaxperip_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tgmaxperip_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tgmaxperip_exe;
-  thenode->free = tsns_tgmaxperip_free;
-
-  return thenode;
-}
-
-void *tsns_tgmaxperip_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trustgroup_t *tg;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-  
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->trustgroup->maxperip);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_tgsearch) {
-    tg = (trustgroup_t *)theinput;
-    return (void *)(tg->maxperip);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_tgmaxperip_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-tgmaxusage.c b/trusts2_newsearch/tsns-tgmaxusage.c
deleted file mode 100644 (file)
index f3f5319..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tgmaxusage_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tgmaxusage_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tgmaxusage_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tgmaxusage_exe;
-  thenode->free = tsns_tgmaxusage_free;
-
-  return thenode;
-}
-
-void *tsns_tgmaxusage_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trustgroup_t *tg;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->trustgroup->maxusage);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_tgsearch) {
-    tg = (trustgroup_t *)theinput;
-    return (void *)(tg->maxusage);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_tgmaxusage_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-tgmodified.c b/trusts2_newsearch/tsns-tgmodified.c
deleted file mode 100644 (file)
index 8a0bc69..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tgmodified_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tgmodified_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tgmodified_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tgmodified_exe;
-  thenode->free = tsns_tgmodified_free;
-
-  return thenode;
-}
-
-void *tsns_tgmodified_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trustgroup_t *tg;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->trustgroup->modified);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_tgsearch) {
-    tg = (trustgroup_t *)theinput;
-    return (void *)(tg->modified);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_tgmodified_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-tgstartdate.c b/trusts2_newsearch/tsns-tgstartdate.c
deleted file mode 100644 (file)
index 97a43d3..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_tgstartdate_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_tgstartdate_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_tgstartdate_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_tgstartdate_exe;
-  thenode->free = tsns_tgstartdate_free;
-
-  return thenode;
-}
-
-void *tsns_tgstartdate_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trustgroup_t *tg;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->trustgroup->startdate);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_tgsearch) {
-    tg = (trustgroup_t *)theinput;
-    return (void *)(tg->startdate);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_tgstartdate_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-thcreated.c b/trusts2_newsearch/tsns-thcreated.c
deleted file mode 100644 (file)
index 38fc626..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_thcreated_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_thcreated_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_thcreated_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_thcreated_exe;
-  thenode->free = tsns_thcreated_free;
-
-  return thenode;
-}
-
-void *tsns_thcreated_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trusthost_t *th;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->created);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_thsearch) {
-    th = (trusthost_t *)theinput;
-    return (void *)(th->created);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_thcreated_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-thexpire.c b/trusts2_newsearch/tsns-thexpire.c
deleted file mode 100644 (file)
index b6234d3..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_thexpire_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_thexpire_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_thexpire_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_thexpire_exe;
-  thenode->free = tsns_thexpire_free;
-
-  return thenode;
-}
-
-void *tsns_thexpire_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trusthost_t *th;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->expire);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_thsearch) {
-    th = (trusthost_t *)theinput;
-    return (void *)(th->expire);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_thexpire_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-thid.c b/trusts2_newsearch/tsns-thid.c
deleted file mode 100644 (file)
index 80e1713..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_thid_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_thid_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_thid_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_thid_exe;
-  thenode->free = tsns_thid_free;
-
-  return thenode;
-}
-
-void *tsns_thid_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  patricia_node_t *node;
-  trusthost_t *th;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-      node = (patricia_node_t *)theinput;
-      if (node->exts[tgh_ext] != NULL)
-        return (void *)(((trusthost_t *)node->exts[tgh_ext])->id);
-      else
-        return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_thsearch) {
-      th = (trusthost_t *)theinput;
-      return (void *)(th->id); 
-  } else {
-      return NULL;
-  } 
-
-}
-
-void tsns_thid_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-thlastused.c b/trusts2_newsearch/tsns-thlastused.c
deleted file mode 100644 (file)
index 8b6cb6e..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_thlastused_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_thlastused_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_thlastused_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_thlastused_exe;
-  thenode->free = tsns_thlastused_free;
-
-  return thenode;
-}
-
-void *tsns_thlastused_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trusthost_t *th;
-  patricia_node_t *node; 
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    node = (patricia_node_t *)theinput;
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->lastused);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_thsearch) {
-    th = (trusthost_t *)theinput;
-    return (void *)(th->lastused);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_thlastused_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-thmaxusage.c b/trusts2_newsearch/tsns-thmaxusage.c
deleted file mode 100644 (file)
index cc53a6f..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_thmaxusage_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_thmaxusage_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_thmaxusage_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_thmaxusage_exe;
-  thenode->free = tsns_thmaxusage_free;
-
-  return thenode;
-}
-
-void *tsns_thmaxusage_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trusthost_t *th;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->maxused);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_thsearch) {
-    th = (trusthost_t *)theinput;
-    return (void *)(th->maxused);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_thmaxusage_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-thmodified.c b/trusts2_newsearch/tsns-thmodified.c
deleted file mode 100644 (file)
index 8d8ce63..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_thmodified_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_thmodified_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_thmodified_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_thmodified_exe;
-  thenode->free = tsns_thmodified_free;
-
-  return thenode;
-}
-
-void *tsns_thmodified_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trusthost_t *th;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->modified);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_thsearch) {
-    th = (trusthost_t *)theinput;
-    return (void *)(th->modified);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_thmodified_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-thstartdate.c b/trusts2_newsearch/tsns-thstartdate.c
deleted file mode 100644 (file)
index ad36fad..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_thstartdate_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_thstartdate_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_thstartdate_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_INT;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_thstartdate_exe;
-  thenode->free = tsns_thstartdate_free;
-
-  return thenode;
-}
-
-void *tsns_thstartdate_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  trusthost_t *th;
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (ctx->searchcmd == reg_nodesearch) {
-    if (node->exts[tgh_ext] != NULL) 
-      return (void *)(((trusthost_t *)node->exts[tgh_ext])->startdate);
-    else
-      return (void *)0; /* will cast to a FALSE */
-  } else if (ctx->searchcmd == reg_thsearch) {
-    th = (trusthost_t *)theinput;
-    return (void *)(th->startdate);
-  } else {
-    return NULL;
-  }
-}
-
-void tsns_thstartdate_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
diff --git a/trusts2_newsearch/tsns-trusted.c b/trusts2_newsearch/tsns-trusted.c
deleted file mode 100644 (file)
index 7975938..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "trusts_newsearch.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *tsns_trusted_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
-void tsns_trusted_free(searchCtx *ctx, struct searchNode *thenode);
-
-struct searchNode *tsns_trusted_parse(searchCtx *ctx, int argc, char **argv) {
-  struct searchNode *thenode;
-
-  if (!(thenode=(struct searchNode *)malloc(sizeof (struct searchNode)))) {
-    parseError = "malloc: could not allocate memory for this search.";
-    return NULL;
-  }
-
-  thenode->returntype = RETURNTYPE_BOOL;
-  thenode->localdata = NULL;
-  thenode->exe = tsns_trusted_exe;
-  thenode->free = tsns_trusted_free;
-
-  return thenode;
-}
-
-void *tsns_trusted_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput) {
-  patricia_node_t *node = (patricia_node_t *)theinput;
-
-  if (node->exts[tgh_ext] == NULL)
-    return (void *)0;
-
-  return (void *)1;
-}
-
-void tsns_trusted_free(searchCtx *ctx, struct searchNode *thenode) {
-  free(thenode);
-}
-
diff --git a/trusts2_search/Makefile.in b/trusts2_search/Makefile.in
deleted file mode 100644 (file)
index 34e8a43..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-@include@ @includel@../build.mk@includel@
-
-CFLAGS+=$(INCPGSQL) $(INCPCRE)
-LDFLAGS+=$(LIBPGSQL) $(LIBPCRE)
-
-.PHONY: all
-all: trusts_search.so
-
-trusts_search.so: formats.o trusts_search.o newsearch_ast.o
-
diff --git a/trusts2_search/formats.c b/trusts2_search/formats.c
deleted file mode 100644 (file)
index bc0009a..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#include <stdio.h>
-
-#include "../newsearch/newsearch.h"
-#include "../control/control.h"
-#include "../lib/stringbuf.h"
-#include "../trusts2/trusts.h"
-
-char *trusts_timetostr(time_t t) {
-  static char buf[100];
-  if ( t == 0 ) {
-    return "<none>";
-  }
-
-  strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", localtime(&t));
-
-  return buf;
-}
-
-void printtg(searchCtx *ctx, nick *sender, trustgroup_t *tg) {
-  ctx->reply(sender,"%lu", tg->id);
-}
-
-void printth(searchCtx *ctx, nick *sender, trusthost_t *th) {
-  ctx->reply(sender,"%lu: %s", th->id, IPtostr(((patricia_node_t *)th->node)->prefix->sin));
-}
-
-void printtgfull(searchCtx *ctx, nick *sender, trustgroup_t *g) {
-  trusthost_t* thptr;
-  trusthost_t *tgh = NULL;
-  patricia_node_t *parent;
-
-  ctx->reply(sender,"Trustgroup ID   : %lu", g->id);
-  ctx->reply(sender,"Max Connections : %lu, Max Per Ident: %lu, Max Per IP: %lu", g->maxclones, g->maxperident, g->maxperip);
-  ctx->reply(sender,"Curent Usage    : %lu/%lu", g->currenton,g->maxusage);
-  ctx->reply(sender,"Enforce Ident   : %d", g->enforceident);
-  ctx->reply(sender,"Start Date      : %s", trusts_timetostr(g->startdate));
-  ctx->reply(sender,"Last Used       : %s", trusts_timetostr(g->lastused));
-  ctx->reply(sender,"Expiry          : %s", trusts_timetostr(g->expire));
-
-  ctx->reply(sender,"Owner           : %lu", g->ownerid);
-  ctx->reply(sender,"Type            : %d", g->type);
-
-  ctx->reply(sender,"Trust Hosts:");
-  ctx->reply(sender,"ID      Host             Current    Max   Last seen           Expiry");
-  int hash = trusts_gettrusthostgroupidhash(g->id);
-  for (thptr = trusthostgroupidtable[hash]; thptr; thptr = thptr->nextbygroupid ) {
-    if(thptr->trustgroup == g)
-      ctx->reply(sender, "%-5lu %15s/%d   %-10lu %-5lu %s %s",
-                         thptr->id,
-                         IPtostr(((patricia_node_t *)thptr->node)->prefix->sin),
-                         irc_bitlen(&(((patricia_node_t *)thptr->node)->prefix->sin),((patricia_node_t *)thptr->node)->prefix->bitlen),
-                         thptr->node->usercount,
-                         thptr->maxused,
-                         trusts_timetostr(thptr->lastused),
-                         trusts_timetostr(thptr->expire));
-
-    parent = ((patricia_node_t *)thptr->node)->parent;
-    while (parent) {
-      if(parent->exts)
-        if( parent->exts[tgh_ext]) {
-          tgh = (trusthost_t *)parent->exts[tgh_ext];
-          ctx->reply(sender, "- Parent Trust Group: %lu", tgh->trustgroup->id);
-        }
-      parent = parent->parent;
-    }
-  }
-}
diff --git a/trusts2_search/newsearch_ast.c b/trusts2_search/newsearch_ast.c
deleted file mode 100644 (file)
index 93afaf4..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "../lib/sstring.h"
-#include "../lib/strlfunc.h"
-#include "../lib/stringbuf.h"
-#include <stdarg.h>
-#include <string.h>
-#include "trusts_search.h"
-
-int ast_tgsearch(searchASTExpr *tree, replyFunc reply, void *sender, wallFunc wall, ChanDisplayFunc display, HeaderFunc header, void *headerarg, int limit) {
-  searchCtx ctx;
-  searchASTCache cache;
-  searchNode *search;
-  char buf[1024];
-
-  newsearch_ctxinit(&ctx, search_astparse, reply, wall, &cache, reg_tgsearch, sender, display, limit);
-
-  memset(&cache, 0, sizeof(cache));
-  cache.tree = tree;
-
-  buf[0] = '\0';
-  reply(sender, "Parsing: %s", ast_printtree(buf, sizeof(buf), tree, reg_tgsearch));
-  search = ctx.parser(&ctx, (char *)tree);
-  if(!search) {
-    reply(sender, "Parse error: %s", parseError);
-    return CMD_ERROR;
-  }
-
-  reply(sender, "Executing...");
-  if(header)
-    header(sender, headerarg);
-  tgsearch_exe(search, &ctx);
-
-  (search->free)(&ctx, search);
-
-  return CMD_OK;
-}
-
diff --git a/trusts2_search/trusts_search.c b/trusts2_search/trusts_search.c
deleted file mode 100644 (file)
index 40551a3..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-
-#include "../control/control.h"
-#include "../irc/irc_config.h"
-#include "../lib/irc_string.h"
-#include "../parser/parser.h"
-#include "../lib/splitline.h"
-#include "../lib/version.h"
-#include "../lib/stringbuf.h"
-#include "../lib/strlfunc.h"
-#include "../trusts2/trusts.h"
-#include "trusts_search.h"
-#include "../lib/version.h"
-
-MODULE_VERSION("");
-
-typedef void (*TGDisplayFunc)(struct searchCtx *, nick *, trustgroup_t *);
-typedef void (*THDisplayFunc)(struct searchCtx *, nick *, trusthost_t *);
-
-int do_tgsearch(void *source, int cargc, char **cargv);
-int do_tgsearch_real(replyFunc reply, wallFunc wall, void *source, int cargc, char **cargv);
-void tgsearch_exe(struct searchNode *search, searchCtx *ctx);
-int do_thsearch(void *source, int cargc, char **cargv);
-int do_thsearch_real(replyFunc reply, wallFunc wall, void *source, int cargc, char **cargv);
-void thsearch_exe(struct searchNode *search, searchCtx *ctx, nick *sender, THDisplayFunc display, int limit, patricia_node_t *subset);
-
-searchCmd *reg_tgsearch;
-searchCmd *reg_thsearch;
-
-TGDisplayFunc defaulttgfn = printtg;
-THDisplayFunc defaultthfn = printth;
-
-void _init() {
-  reg_tgsearch = (searchCmd *)registersearchcommand("tgsearch",NO_OPER,do_tgsearch, printtg);
-  reg_thsearch = (searchCmd *)registersearchcommand("thsearch",NO_OPER,do_thsearch, printth);
-
-  regdisp(reg_tgsearch, "all", printtgfull, 0, "show trustgroup details, including hosts, excludes trust comments");
-  regdisp(reg_tgsearch, "default", printtg, 0, "displays trust group id");
-  regdisp(reg_thsearch, "default", printth, 0, "displays trust host id");
-}
-
-void _fini() {
-  unregdisp( reg_tgsearch, "all", printtgfull);
-  unregdisp(reg_tgsearch, "default", printtg);
-  unregdisp(reg_thsearch, "default", printth);
-
-  deregistersearchcommand( reg_tgsearch );
-  deregistersearchcommand( reg_thsearch );
-}
-
-static void controlwallwrapper(int level, char *format, ...) {
-  char buf[1024];
-  va_list ap;
-
-  va_start(ap, format);
-  vsnprintf(buf, sizeof(buf), format, ap);
-  controlwall(NO_OPER, level, "%s", buf);
-  va_end(ap);
-}
-
-int do_tgsearch_real(replyFunc reply, wallFunc wall, void *source, int cargc, char **cargv) {
-  nick *sender = senderNSExtern = source;
-  int limit=500;
-  int arg=0;
-  TGDisplayFunc display=defaulttgfn;
-  int ret;
-  patricia_node_t *subset = iptree->head;
-  parsertree *tree;
-
-  if (cargc<1) {
-    reply( sender, "Usage: [flags] <criteria>");
-    reply( sender, "For help, see help nicksearch");
-    return CMD_OK;
-  }
-
-  ret = parseopts(cargc, cargv, &arg, &limit, (void *)&subset, (void **)&display, reg_tgsearch->outputtree, reply, sender);
-  if(ret != CMD_OK)
-    return ret;
-
-  if (arg>=cargc) {
-    reply(sender,"No search terms - aborting.");
-    return CMD_ERROR;
-  }
-
-  if (arg<(cargc-1)) {
-    rejoinline(cargv[arg],cargc-arg);
-  }
-
-  tree = parse_string(reg_tgsearch, cargv[arg]);
-  if(!tree) {
-    displaystrerror(reply, sender, cargv[arg]);
-    return CMD_ERROR;
-  }
-
-  ast_tgsearch(tree->root, reply, sender, wall, display, NULL, NULL, limit);
-
-  parse_free(tree);
-
-  return CMD_OK;
-}
-
-int do_tgsearch(void *source, int cargc, char **cargv) {
-  return do_tgsearch_real(controlreply, controlwallwrapper, source, cargc, cargv);
-}
-
-void tgsearch_exe(struct searchNode *search, searchCtx *ctx) {
-  int matches = 0;
-  trustgroup_t *tg;
-  int i;
-  nick *np, *sender = ctx->sender;
-  senderNSExtern = sender;
-  TGDisplayFunc display = ctx->displayfn;
-  int limit = ctx->limit;
-
-  /* Get a marker value to mark "seen" channels for unique count */
-  //nmarker=nextnodemarker();
-
-  /* The top-level node needs to return a BOOL */
-  search=coerceNode(ctx, search, RETURNTYPE_BOOL);
-
-  for ( i = 0; i < TRUSTS_HASH_GROUPSIZE ; i++ ) {
-    for ( tg = trustgroupidtable[i]; tg; tg = tg -> nextbyid ) {
-      if ((search->exe)(ctx, search, tg)) {
-      if (matches<limit)
-        display(ctx, sender, tg);
-
-      if (matches==limit)
-        ctx->reply(sender, "--- More than %d matches, skipping the rest",limit);
-      matches++;
-    }
-  }
-  }
-  ctx->reply(sender,"--- End of list: %d matches",
-                matches);
-}
-
-int do_thsearch_real(replyFunc reply, wallFunc wall, void *source, int cargc, char **cargv) {
-  nick *sender = senderNSExtern = source;
-  struct searchNode *search;
-  int limit=500;
-  int arg=0;
-  THDisplayFunc display=defaultthfn;
-  searchCtx ctx;
-  int ret;
-  patricia_node_t *subset = iptree->head;
-
-  if (cargc<1)
-    return CMD_USAGE;
-
-  ret = parseopts(cargc, cargv, &arg, &limit, (void *)&subset, (void **)&display, reg_tgsearch->outputtree, reply, sender);
-  if(ret != CMD_OK)
-    return ret;
-
-  if (arg>=cargc) {
-    reply(sender,"No search terms - aborting.");
-    return CMD_ERROR;
-  }
-
-  if (arg<(cargc-1)) {
-    rejoinline(cargv[arg],cargc-arg);
-  }
-
-  newsearch_ctxinit(&ctx, search_parse, reply, wall, NULL, reg_thsearch, sender, display, limit);
-
-  if (!(search = ctx.parser(&ctx, cargv[arg]))) {
-    reply(sender,"Parse error: %s",parseError);
-    return CMD_ERROR;
-  }
-
-  thsearch_exe(search, &ctx, sender, display, limit, subset);
-
-  (search->free)(&ctx, search);
-
-  return CMD_OK;
-}
-
-int do_thsearch(void *source, int cargc, char **cargv) {
-  return do_thsearch_real(controlreply, controlwallwrapper, source, cargc, cargv);
-}
-
-void thsearch_exe(struct searchNode *search, searchCtx *ctx, nick *sender, THDisplayFunc display, int limit, patricia_node_t *subset) {
-  int matches = 0;
-  trusthost_t *tgh;
-  int i;
-
-  /* Get a marker value to mark "seen" channels for unique count */
-  //nmarker=nextnodemarker();
-
-  /* The top-level node needs to return a BOOL */
-  search=coerceNode(ctx, search, RETURNTYPE_BOOL);
-
-  for ( i = 0; i < TRUSTS_HASH_HOSTSIZE ; i++ ) {
-    for ( tgh = trusthostidtable[i]; tgh; tgh = tgh -> nextbyid ) {
-      if ((search->exe)(ctx, search, tgh)) {
-      if (matches<limit)
-        display(ctx, sender, tgh);
-
-      if (matches==limit)
-        ctx->reply(sender, "--- More than %d matches, skipping the rest",limit);
-      matches++;
-    }
-  }
-  }
-  ctx->reply(sender,"--- End of list: %d matches",
-                matches);
-}
-
diff --git a/trusts2_search/trusts_search.h b/trusts2_search/trusts_search.h
deleted file mode 100644 (file)
index 7de96b2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-
-#include "../newsearch/newsearch.h"
-#include "../control/control.h"
-#include "../irc/irc_config.h"
-#include "../lib/irc_string.h"
-#include "../parser/parser.h"
-#include "../lib/splitline.h"
-#include "../lib/version.h"
-#include "../lib/stringbuf.h"
-#include "../lib/strlfunc.h"
-#include "../trusts2/trusts.h"
-#include "../newsearch/parser.h"
-
-extern searchCmd *reg_tgsearch;
-extern searchCmd *reg_thsearch;
-
-void printtg(searchCtx *ctx, nick *sender, trustgroup_t *tg);
-void printth(searchCtx *ctx, nick *sender, trusthost_t *tgh);
-void printtgfull(searchCtx *ctx, nick *sender, trustgroup_t *g);