Changeset 1275
- Timestamp:
- 09/18/08 21:05:33 (2 months ago)
- Files:
-
- 1.8.3/branches/devel/CHANGES.183 (modified) (2 diffs)
- 1.8.3/branches/devel/hdrs/access.h (modified) (1 diff)
- 1.8.3/branches/devel/src/access.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
1.8.3/branches/devel/CHANGES.183
r1263 r1275 37 37 similiar problems triggered by tests, by passing the --valgrind option 38 38 to test scripts. 39 * baseconv() now supports up to base64.39 * Significantly reduce memory usage in @sitelock rules. 40 40 41 41 Commands: … … 63 63 * ljust() and rjust() take fill strings now, not just single 64 64 characters. Suggested by Nyssa, patch by Talvo. 65 * baseconv() now supports up to base64. 65 66 66 67 Fixes: 1.8.3/branches/devel/hdrs/access.h
r1066 r1275 7 7 */ 8 8 struct access { 9 char host[BUFFER_LEN]; /**< The host pattern */10 char comment[BUFFER_LEN]; /**< A comment about the rule */9 char *host; /**< The host pattern */ 10 char *comment; /**< A comment about the rule */ 11 11 dbref who; /**< Who created this rule if sitelock used */ 12 12 uint32_t can; /**< Bitflags of what the host can do */ 1.8.3/branches/devel/src/access.c
r1213 r1275 119 119 extern const unsigned char *tables; 120 120 121 static void 122 sitelock_free(struct access *ap) 123 { 124 mush_free(ap->host, "sitelock.rule.host"); 125 if (ap->comment) 126 mush_free(ap->comment, "sitelock.rule.comment"); 127 if (ap->re) 128 free(ap); 129 mush_free(ap, "sitelock.rule"); 130 } 131 121 132 static struct access * 122 133 sitelock_alloc(const char *host, dbref who, … … 141 152 tmp->can = can; 142 153 tmp->cant = cant; 143 mush_strncpy(tmp->host, host, BUFFER_LEN);144 if (comment )145 mush_strncpy(tmp->comment, comment, BUFFER_LEN);154 tmp->host = mush_strdup(host, "sitelock.rule.host"); 155 if (comment && *comment) 156 tmp->comment = mush_strdup(comment, "sitelock.rule.comment"); 146 157 else 147 tmp->comment [0] = '\0';158 tmp->comment = NULL; 148 159 tmp->next = NULL; 149 160 … … 152 163 tmp->re = pcre_compile(host, 0, errptr, &erroffset, tables); 153 164 if (!tmp->re) { 154 mush_free(tmp, "sitelock.rule");165 sitelock_free(tmp); 155 166 return NULL; 156 167 } … … 307 318 break; 308 319 } 309 if (ap->comment && *ap->comment)320 if (ap->comment) 310 321 fprintf(fp, "# %s\n", ap->comment); 311 322 else 312 fp rintf(fp, "\n");323 fputc('\n', fp); 313 324 } 314 325 fclose(fp); … … 607 618 : deletethis == rulenum) { 608 619 n++; 609 if (ap->re) 610 free(ap->re); 611 mush_free(ap, "sitelock.rule"); 620 sitelock_free(ap); 612 621 if (prev) 613 622 prev->next = next; … … 633 642 while (ap) { 634 643 next = ap->next; 635 if (ap->re) 636 free(ap->re); 637 mush_free(ap, "sitelock.rule"); 644 sitelock_free(ap); 638 645 ap = next; 639 646 } … … 676 683 "%3d SITE: %-20s DBREF: %-6s FLAGS:%s", rulenum, 677 684 ap->host, unparse_dbref(ap->who), flaglist); 678 notify_format(player, " COMMENT: %s", ap->comment );685 notify_format(player, " COMMENT: %s", ap->comment ? comment : ""); 679 686 } else { 680 687 notify(player,
