- Timestamp:
- 05/12/06 01:42:19 (6 years ago)
- Location:
- branches/ithildin-1.1/modules/ircd/addons
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ithildin-1.1/modules/ircd/addons/acl.c
r725 r729 45 45 acl_t *ap, *ap2; 46 46 char *at, hostcopy[USERLEN + HOSTLEN + 2]; 47 struct acl_ tq*list;47 struct acl_list *list; 48 48 49 49 if ((ap = find_acl(stage, host, type, NULL, NULL)) != NULL) { … … 90 90 list = acl.stage3_list; 91 91 92 if ( TAILQ_EMPTY(list))93 TAILQ_INSERT_HEAD(list, ap, intlp);92 if (LIST_EMPTY(list)) 93 LIST_INSERT_HEAD(list, ap, intlp); 94 94 else { 95 TAILQ_FOREACH(ap2, list, intlp) {95 LIST_FOREACH(ap2, list, intlp) { 96 96 if (ap2->rule > ap->rule) { 97 TAILQ_INSERT_BEFORE(ap2, ap, intlp);97 LIST_INSERT_BEFORE(ap2, ap, intlp); 98 98 break; 99 } 100 } 101 if (ap2 == NULL) 102 TAILQ_INSERT_TAIL(list, ap, intlp); 99 } else if (LIST_NEXT(ap2, intlp) == NULL) 100 LIST_INSERT_AFTER(ap2, ap, intlp); 101 } 103 102 } 104 103 … … 155 154 acl_t *find_acl(int stage, char *hostmask, const char *type, char *pass, 156 155 char *info) { 157 struct acl_ tq*list;156 struct acl_list *list; 158 157 char *at, hostcopy[USERLEN + HOSTLEN + 2], user[USERLEN + 1]; 159 158 char host[HOSTLEN + 1]; … … 180 179 181 180 /* now try and find them in the bucket. */ 182 TAILQ_FOREACH(ap, list, intlp) {181 LIST_FOREACH(ap, list, intlp) { 183 182 if (!strcasecmp(ap->user, user) && !strcasecmp(ap->host, host) && 184 183 !strcasecmp(ap->type, type) && … … 202 201 /* and remove it from whatever list it's in */ 203 202 if (ap->stage == ACL_STAGE_CONNECT) 204 TAILQ_REMOVE(acl.stage1_list,ap, intlp);203 LIST_REMOVE(ap, intlp); 205 204 else if (ap->stage == ACL_STAGE_PREREG) 206 TAILQ_REMOVE(acl.stage2_list,ap, intlp);205 LIST_REMOVE(ap, intlp); 207 206 else 208 TAILQ_REMOVE(acl.stage3_list,ap, intlp);207 LIST_REMOVE(ap, intlp); 209 208 210 209 /* now free the memory */ … … 310 309 /* now match. skip over any entries that aren't the default hash or our 311 310 * hash. */ 312 TAILQ_FOREACH(ap, acl.stage1_list, intlp) {311 LIST_FOREACH(ap, acl.stage1_list, intlp) { 313 312 if (ap->hash != hash && ap->hash != ACL_DEFAULT_HASH) 314 313 continue; … … 349 348 * and the ip (using hostmatch and ipmatch). All together that is four 350 349 * calls. Also, our hash space is expanded. */ 351 TAILQ_FOREACH(ap, acl.stage2_list, intlp) {350 LIST_FOREACH(ap, acl.stage2_list, intlp) { 352 351 if (ap->hash != hash && ap->hash != iphash && 353 352 ap->hash != ACL_DEFAULT_HASH) … … 395 394 * aren't allowed because of a class being full we actually have to keep on 396 395 * looking to see if they fit in somewhere else. blechhh. */ 397 TAILQ_FOREACH(ap, acl.stage3_list, intlp) {396 LIST_FOREACH(ap, acl.stage3_list, intlp) { 398 397 if (ap->hash != hash && ap->hash != iphash && 399 398 ap->hash != ACL_DEFAULT_HASH) … … 442 441 } 443 442 444 if (ret == NULL && ! TAILQ_EMPTY(acl.stage3_list))443 if (ret == NULL && !LIST_EMPTY(acl.stage3_list)) 445 444 return "You are not authorised to use this server."; 446 445 return ret; … … 611 610 * for ACLs based on four parameters: mask, stage, access, and type. */ 612 611 acl_t *ap; 613 struct acl_ tq*list;612 struct acl_list *list; 614 613 char rpl[XINFO_LEN]; 615 614 char *mask = NULL, *type = NULL; … … 684 683 } 685 684 while (list != NULL) { 686 TAILQ_FOREACH(ap, list, intlp) {685 LIST_FOREACH(ap, list, intlp) { 687 686 if (acc != -1 && ap->access != acc) 688 687 continue; … … 733 732 734 733 LIST_ALLOC(acl.list); 735 TAILQ_ALLOC(acl.stage1_list);736 TAILQ_ALLOC(acl.stage2_list);737 TAILQ_ALLOC(acl.stage3_list);734 LIST_ALLOC(acl.stage1_list); 735 LIST_ALLOC(acl.stage2_list); 736 LIST_ALLOC(acl.stage3_list); 738 737 739 738 add_xinfo_handler(xinfo_acl_handler, "ACL", XINFO_HANDLER_OPER, NULL, … … 755 754 destroy_acl(LIST_FIRST(acl.list)); 756 755 LIST_FREE(acl.list); 757 TAILQ_FREE(acl.stage1_list);758 TAILQ_FREE(acl.stage2_list);759 TAILQ_FREE(acl.stage3_list);756 LIST_FREE(acl.stage1_list); 757 LIST_FREE(acl.stage2_list); 758 LIST_FREE(acl.stage3_list); 760 759 761 760 remove_xinfo_handler(xinfo_acl_handler); -
branches/ithildin-1.1/modules/ircd/addons/acl.h
r725 r729 47 47 NULL otherwise. */ 48 48 49 TAILQ_ENTRY(acl) intlp; /* list pointers. intlp is for internal */ 50 LIST_ENTRY(acl) lp; /* use. lp is part of 'the big list'. */ 49 LIST_ENTRY(acl) intlp; /* list pointers. intlp is for internal 50 (stage-segregated) lists */ 51 LIST_ENTRY(acl) lp; /* lp is for the 'big list'. */ 51 52 } acl_t; 52 53 53 TAILQ_HEAD(acl_tq, acl);54 LIST_HEAD(acl_list, acl); 54 55 55 56 extern struct acl_module_data { 56 struct acl_ tq*stage1_list;57 struct acl_ tq*stage2_list;58 struct acl_ tq*stage3_list;59 LIST_HEAD(, acl)*list;57 struct acl_list *stage1_list; 58 struct acl_list *stage2_list; 59 struct acl_list *stage3_list; 60 struct acl_list *list; 60 61 61 62 unsigned short default_rule;
Note: See TracChangeset
for help on using the changeset viewer.
