Changeset 759 for branches


Ignore:
Timestamp:
07/08/06 22:01:57 (6 years ago)
Author:
wd
Message:

Add scons branch

Location:
branches/ithildin-scons
Files:
144 added
2 edited
6 copied

Legend:

Unmodified
Added
Removed
  • branches/ithildin-scons/include/ithildin/hash.h

    r726 r759  
    3434 
    3535    /* these are useful for debugging the state of the hash system */ 
    36 #ifdef DEBUG_CODE 
     36#ifdef DEBUG 
    3737    int     max_per_bucket; /* most entries in a single bucket */ 
    3838    uint32_t empty_buckets; /* number of empty buckets */ 
  • branches/ithildin-scons/modules/ircd/addons/hostcrypt.c

    r579 r759  
    372372    char addr[IPADDR_SIZE]; 
    373373    size_t alen; 
    374  
    375 #ifdef INET6 
    376     if (inet_pton(PF_INET6, cli->ip, addr) == 1) 
    377         alen = IPADDR_SIZE; 
    378     else 
    379 #endif 
    380         if (inet_pton(PF_INET, cli->ip, addr) == 1) 
     374    char *s; 
     375    bool ip = false; 
     376    int family = PF_INET;  
     377#ifdef INET6 
     378    struct in6_addr i6a; 
     379#endif 
     380    struct in_addr ia; 
     381 
     382    /* See if it is an IP address.. */ 
     383#ifdef INET6 
     384    if ((s = strchr(cli->orighost, ':')) != NULL && 
     385            inet_pton(PF_INET6, cli->orighost, &i6a) == 1) { 
     386        ip = true; 
     387        family = PF_INET6; 
     388    } else 
     389#endif 
     390    if ((s = strrchr(cli->orighost, '.')) != NULL && 
     391            inet_pton(PF_INET, cli->orighost, &ia) == 1) 
     392    ip = true; 
     393 
     394    if (ip) { 
     395        inet_pton(family, cli->orighost, addr); 
     396#ifdef INET6 
     397        if (family == PF_INET6) 
     398            alen = IPADDR_SIZE; 
     399        else 
     400#endif 
    381401            alen = 4; 
     402 
     403        md5_data(addr, alen, md5buf); 
     404        memset(addr + (alen / 2), 0, alen / 2); 
     405        md5_data(addr, alen, md5buf + 32); 
     406    } else { 
     407        alen = strlen(cli->orighost); 
     408        md5_data(cli->orighost, alen, md5buf); 
     409         
     410        /* extract only the interesting part of the hostname (domain.tld). 
     411         * For hostnames which are merely domain.tld to begin with, we 
     412         * provide the first set of md5 data as additional "seed" for them. */ 
     413        s = strrchr(cli->orighost, '.'); 
     414        if (s == NULL) 
     415            /* singleton string like 'localhost' */ 
     416            sprintf(buf, "%32s.%s", md5buf, cli->orighost); 
    382417        else { 
    383             inet_pton(PF_INET, "0.0.0.0", addr); 
    384             alen = 4; 
     418            while (*s != '.' && s > cli->orighost) 
     419                s--; /* walk backwards to find the . or beginning of string */ 
     420            if (s == cli->orighost) 
     421                /* host is in pure domain.tld form */ 
     422                sprintf(buf, "%32s.%s", md5buf, cli->orighost); 
     423            else 
     424                /* s is the second to last . in the string now */ 
     425                sprintf(buf, "%s", s + 1); 
    385426        } 
    386  
    387     md5_data(addr, alen, md5buf); 
    388     memset(addr + (alen / 2), 0, alen / 2); 
    389     md5_data(addr, alen, md5buf + 32); 
     427        /* buf now contains the host we wish to md5 on */ 
     428        alen = strlen(buf); 
     429        md5_data(buf, alen, md5buf + 32); 
     430    } 
    390431     
    391432    /* okay, md5buf is now a 64 byte long base16 encoded string.  decode it 
  • branches/ithildin-scons/source/hash.c

    r726 r759  
    6262    htp->keyoffset = offset; 
    6363    htp->keylen = len; 
    64 #ifdef DEBUG_CODE 
     64#ifdef DEBUG 
    6565    htp->max_per_bucket = 1; 
    6666    htp->empty_buckets = real_elems; 
     
    109109    table->size = elems; 
    110110    table->entries = 0; 
    111 #ifdef DEBUG_CODE 
     111#ifdef DEBUG 
    112112    table->max_per_bucket = 1; 
    113113    table->empty_buckets = elems; 
     
    275275 
    276276    hep->hv = hash; 
    277 #ifdef DEBUG_CODE 
     277#ifdef DEBUG 
    278278    if (SLIST_EMPTY(&table->table[hash])) 
    279279        table->empty_buckets--; /* this bucket isn't empty now */ 
     
    358358    free(hep); 
    359359 
    360 #ifdef DEBUG_CODE 
     360#ifdef DEBUG 
    361361    if (SLIST_EMPTY(&table->table[hash])) 
    362362        table->empty_buckets++; /* this bucket is empty again. */ 
  • branches/ithildin-scons/tools/build.py

    r652 r759  
    99 
    1010if not os.path.exists("tools/build.py"): 
    11     print "Please run build.sh from the top of the source directory." 
     11    print "Please run build.py from the top of the source directory." 
    1212    sys.exit(1) 
    1313 
     
    2424 
    2525def runcmd(cmd): 
     26    # split cmd if need be 
     27    cmdlist = str(cmd).split(" ") 
     28 
     29    # find the command in question... 
     30    path = os.getenv("PATH").split(os.path.pathsep) 
     31 
     32    realcmd = None 
     33    for p in path: 
     34        if os.path.exists("%s/%s" % (p, cmdlist[0])): 
     35            realcmd = "%s/%s" % (p, cmdlist[0]) 
     36            break 
     37 
     38    if not realcmd: 
     39        return False 
     40 
     41    cmdlist[0] = realcmd 
     42    cmd = str.join(" ", cmdlist) 
    2643    print cmd 
    27     print os.popen(cmd).read() 
     44    (infd, outfd) = os.popen4(cmd) 
     45     
     46    line = "..." 
     47    while line: 
     48        line = outfd.readline() 
     49        print line, 
     50    return True 
    2851 
    2952if "prebuild" in run: 
     
    3255    runcmd("autoheader") 
    3356    runcmd("automake --add-missing") 
     57 
     58if "build" in run: 
     59    if not runcmd("gmake"): 
     60        runcmd("make") 
Note: See TracChangeset for help on using the changeset viewer.