-static int tm_parsegroup(trustmigration *tm, unsigned int id, const char *oline) {
- char *line, *createdby, *contact, *comment, *name;
- unsigned int trustedfor, maxperident, mode, maxseen;
- unsigned long expires, lastseen, lastmaxusereset;
- char xbuf[1024];
- int pos;
-
-/* ticket35153,14,20,1,1,17,1879854575,1222639249,0,nterfacer,Qwhois&2120764,Non-Commercial Bouncer (Created by: doomie)
- name ,current
- ,trustedfor
- ,mode
- ,maxperident
- ,maxseen
- ,expires ,lastseen ,lastmaxusereset
- ,createdby,contact ,comment
-*/
- int r;
-
- strlcpy(xbuf, oline, sizeof(xbuf));
- name = xbuf;
-
- line = strchr(name, ',');
- if(!line)
- return 1;
- *line++ = '\0';
-
- r = sscanf(line, "%*u,%u,%u,%u,%u,%lu,%lu,%lu,%n",
- /*current, */ &trustedfor, &mode, &maxperident,
- &maxseen, &expires, &lastseen, &lastmaxusereset, &pos);
- if(r != 7)
- return 2;
-
- createdby = &line[pos];
- contact = strchr(createdby, ',');
- if(!contact)
- return 3;
- *contact++ = '\0';
-
- comment = strchr(contact, ',');
- if(!comment)
- return 4;
- *comment++ = '\0';
-
- tm->group(tm->tag, id, name, trustedfor, mode, maxperident, maxseen, (time_t)expires, (time_t)lastseen, (time_t)lastmaxusereset, createdby, contact, comment);
- return 0;
-}
-
-static int tm_parsehost(trustmigration *tm, unsigned int id, char *line) {
- unsigned int max;
- unsigned long lastseen;
- char *ip, xbuf[1024];
-
-/* 213.230.192.128/26,20,23,1222732944
- ip ,cur,max,lastseen */
-
- strlcpy(xbuf, line, sizeof(xbuf));
- ip = line = xbuf;
-
- line = strchr(line, ',');
- if(!line)
- return 5;
- *line++ = '\0';
-
- if(sscanf(line, "%*u,%u,%lu", /*current, */&max, &lastseen) != 2)
- return 6;
-
- tm->host(tm->tag, id, ip, max, lastseen);
- return 0;
-}
-