Changeset 830 for branches/ithildin-1.1


Ignore:
Timestamp:
01/25/09 23:08:01 (3 years ago)
Author:
wd
Message:

Make ACL username buffer bigger, fix a dumb bug with xinfo privs and
reloads.

Location:
branches/ithildin-1.1/modules/ircd
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/ithildin-1.1/modules/ircd/addons/acl.c

    r772 r830  
    3838acl_t *create_acl(int stage, int acc, char *host, const char *type, int rule) { 
    3939    acl_t *ap, *ap2; 
    40     char *at, hostcopy[USERLEN + HOSTLEN + 2]; 
     40    char *at, hostcopy[ACL_USERLEN + ACL_HOSTLEN + 2]; 
    4141    struct acl_list *list; 
    4242     
     
    5959    ap->stage = stage; 
    6060    ap->access = acc; 
    61     strlcpy(hostcopy, host, USERLEN + HOSTLEN + 2); 
     61    strlcpy(hostcopy, host, ACL_USERLEN + ACL_HOSTLEN + 2); 
    6262    at = strchr(hostcopy, '@'); 
    6363    if (at == NULL) 
    64         strlcpy(ap->host, hostcopy, HOSTLEN + 1); 
     64        strlcpy(ap->host, hostcopy, ACL_HOSTLEN + 1); 
    6565    else { 
    6666        *at = '\0'; 
    67         strlcpy(ap->user, hostcopy, USERLEN + 1); 
    68         strlcpy(ap->host, at + 1, HOSTLEN + 1); 
     67        strlcpy(ap->user, hostcopy, ACL_USERLEN + 1); 
     68        strlcpy(ap->host, at + 1, ACL_HOSTLEN + 1); 
    6969    } 
    7070    ap->type = strdup(type); 
     
    156156        int rule, char *pass, char *info) { 
    157157    struct acl_list *list; 
    158     char *at, hostcopy[USERLEN + HOSTLEN + 2], user[USERLEN + 1]; 
    159     char host[HOSTLEN + 1]; 
     158    char *at, hostcopy[ACL_USERLEN + ACL_HOSTLEN + 2], user[ACL_USERLEN + 1]; 
     159    char host[ACL_HOSTLEN + 1]; 
    160160    acl_t *ap; 
    161161 
    162162     
    163163    /* extract user@host data */ 
    164     strlcpy(hostcopy, hostmask, USERLEN + HOSTLEN + 2); 
     164    strlcpy(hostcopy, hostmask, ACL_USERLEN + ACL_HOSTLEN + 2); 
    165165    at = strchr(hostcopy, '@'); 
    166166    if (at == NULL) { 
    167167        *user = '\0'; 
    168         strlcpy(host, hostcopy, HOSTLEN + 1); 
     168        strlcpy(host, hostcopy, ACL_HOSTLEN + 1); 
    169169    } else { 
    170170        *at = '\0'; 
    171         strlcpy(user, hostcopy, USERLEN + 1); 
    172         strlcpy(host, at + 1, HOSTLEN + 1); 
     171        strlcpy(user, hostcopy, ACL_USERLEN + 1); 
     172        strlcpy(host, at + 1, ACL_HOSTLEN + 1); 
    173173    } 
    174174 
     
    348348    connection_t  *cp = (connection_t  *)data; 
    349349    uint32_t hash, iphash; 
    350     char ip[HOSTLEN + 1]; 
    351  
    352     get_socket_address(isock_raddr(cp->sock), ip, HOSTLEN + 1, NULL); 
     350    char ip[ACL_HOSTLEN + 1]; 
     351 
     352    get_socket_address(isock_raddr(cp->sock), ip, ACL_HOSTLEN + 1, NULL); 
    353353 
    354354    hash = get_acl_hash(cp->host); 
     
    392392    connection_t  *cp = (connection_t  *)data; 
    393393    uint32_t hash, iphash; 
    394     char ip[HOSTLEN + 1]; 
     394    char ip[ACL_HOSTLEN + 1]; 
    395395    void *ret = NULL; 
    396396 
    397     get_socket_address(isock_raddr(cp->sock), ip, HOSTLEN + 1, NULL); 
     397    get_socket_address(isock_raddr(cp->sock), ip, ACL_HOSTLEN + 1, NULL); 
    398398 
    399399    hash = get_acl_hash(cp->host); 
  • branches/ithildin-1.1/modules/ircd/addons/acl.h

    r731 r830  
    2424    uint32_t hash;                  /* hash of the acl */ 
    2525 
     26#define ACL_USERLEN (USERLEN * 2) 
     27#define ACL_HOSTLEN HOSTLEN 
     28 
    2629    class_t *cls;                   /* the class clients in the ACL are 
    2730                                       placed in (optional) */ 
    28     char    user[USERLEN + 1];      /* username to match against (optional) */ 
    29     char    host[HOSTLEN + 1];      /* hostname/mask to match against */ 
     31    char    user[ACL_USERLEN + 1];      /* username to match against (optional) */ 
     32    char    host[ACL_HOSTLEN + 1];      /* hostname/mask to match against */ 
    3033    char    *reason;                /* ban reason */ 
    3134    char    *info;                  /* "info" line to match against (stage 3 
  • branches/ithildin-1.1/modules/ircd/commands/acl.c

    r731 r830  
    4949    int oarg = 1; 
    5050    const char *type = acl_acl_type; 
    51     char mask[USERLEN + HOSTLEN + 2]; 
     51    char mask[ACL_USERLEN + ACL_HOSTLEN + 2]; 
    5252    int stage = -1; 
    5353    int acc = -1; 
     
    7777        stage = ACL_STAGE_REGISTER; 
    7878        acc = ACL_DENY; 
    79         strlcpy(mask, argv[oarg++], USERLEN + HOSTLEN + 2); 
     79        strlcpy(mask, argv[oarg++], ACL_USERLEN + ACL_HOSTLEN + 2); 
    8080        if (argc > oarg) 
    8181            strlcpy(reason, argv[oarg], XINFO_LEN); 
     
    9292        stage = ACL_STAGE_REGISTER; 
    9393        acc = ACL_DENY; 
    94         strlcpy(mask, argv[oarg++], USERLEN + HOSTLEN + 2); 
     94        strlcpy(mask, argv[oarg++], ACL_USERLEN + ACL_HOSTLEN + 2); 
    9595    } else if (!strcasecmp(argv[0], "ZLINE")) { 
    9696        if (argc <= oarg || (strchr(argv[oarg], '!') != NULL || 
     
    105105        stage = ACL_STAGE_CONNECT; 
    106106        acc = ACL_DENY; 
    107         strlcpy(mask, argv[oarg++], USERLEN + HOSTLEN + 2); 
     107        strlcpy(mask, argv[oarg++], ACL_USERLEN + ACL_HOSTLEN + 2); 
    108108        if (argc > oarg) 
    109109            strlcpy(reason, argv[oarg], XINFO_LEN); 
     
    120120        stage = ACL_STAGE_CONNECT; 
    121121        acc = ACL_DENY; 
    122         strlcpy(mask, argv[oarg++], USERLEN + HOSTLEN + 2); 
     122        strlcpy(mask, argv[oarg++], ACL_USERLEN + ACL_HOSTLEN + 2); 
    123123    } else { 
    124124        /* treat it like it was a real ACL command. */ 
     
    162162                oarg++; 
    163163                if (argc > oarg) 
    164                     strlcpy(mask, argv[oarg++], USERLEN + HOSTLEN + 2); 
     164                    strlcpy(mask, argv[oarg++], ACL_USERLEN + ACL_HOSTLEN + 2); 
    165165                else { 
    166166                    sendto_one(cli, "NOTICE", 
  • branches/ithildin-1.1/modules/ircd/commands/akill.c

    r734 r830  
    4545SERVER_COMMAND(akill, 0, 0, 0) { 
    4646    acl_t *ap = NULL; 
    47     char mask[USERLEN + HOSTLEN + 2]; 
     47    char mask[ACL_USERLEN + ACL_HOSTLEN + 2]; 
    4848#define ACL_ADD 0 
    4949#define ACL_DEL 1 
     
    9393            reason = argv[6]; 
    9494        } 
    95         snprintf(mask, USERLEN + HOSTLEN + 2, "%s@%s", user, host); 
     95        snprintf(mask, ACL_USERLEN + ACL_HOSTLEN + 2, "%s@%s", user, host); 
    9696 
    9797        /* propogate out.  If we're getting data from a 'SHORTAKILL' server 
     
    111111        } 
    112112 
    113         snprintf(mask, USERLEN + HOSTLEN + 2, "%s@%s", argv[2], argv[1]); 
     113        snprintf(mask, ACL_USERLEN + ACL_HOSTLEN + 2, "%s@%s", argv[2], argv[1]); 
    114114        op = ACL_DEL; 
    115115        sendto_serv_butone(sptr, NULL, srv, NULL, "RAKILL", "%s %s", argv[1], 
     
    125125        stage = ACL_STAGE_CONNECT; 
    126126        type = acl_szline_type; 
    127         strlcpy(mask, argv[1], HOSTLEN + 1); 
     127        strlcpy(mask, argv[1], ACL_HOSTLEN + 1); 
    128128        if (argc > 2) 
    129129            reason = argv[2]; 
     
    143143        stage = ACL_STAGE_CONNECT; 
    144144        type = acl_szline_type; 
    145         strlcpy(mask, argv[1], HOSTLEN + 1); 
     145        strlcpy(mask, argv[1], ACL_HOSTLEN + 1); 
    146146 
    147147        sendto_serv_butone(sptr, NULL, srv, NULL, "UNSZLINE", "%s", argv[1]); 
  • branches/ithildin-1.1/modules/ircd/support.c

    r777 r830  
    212212        if (xhp->func == func) { 
    213213            LIST_REMOVE(xhp, lp); 
     214            destroy_privilege(xhp->priv); 
    214215            free(xhp->desc); 
    215216            free(xhp); 
Note: See TracChangeset for help on using the changeset viewer.