[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Status of Heimdal and Amavis



On Fri, Jan 31, 2003 at 12:29:29AM -0200, Henrique de Moraes Holschuh wrote:
> Any chance the source is doing extremely braindamaged things such as trying
> to guess the structure of the socket strucs ?  netsnmp tried to do that, and
> fucked up royally...
> 
> Differences in glibc might be causing the bug to show up...

Hmmm, the code looks OK to me, the relevant parts are:

for (i = 0; i < num_ports; i++){
  for (j = 0; j < addresses.len; ++j) {
    init_socket(&d[num], &addresses.val[j],ports[i].family, ports[i].type, ports[i].port);
    [...]
    krb5_print_address (&addresses.val[j], a_str, sizeof(a_str), &len);
    [...]
  }
}

static void
init_socket(struct descr *d, krb5_address *a, int family, int type, int
port)
{
[...]
    ret = krb5_addr2sockaddr (context, a, sa, &sa_size, port);
[...]
    if(bind(d->s, sa, sa_size) < 0){
[...]
}

I would guess (but only guess) that krb5_addr2sockaddr calls this routine:

static void
ipv4_h_addr2sockaddr(const char *addr,
                     struct sockaddr *sa,
                     krb5_socklen_t *sa_size,
                     int port)
{
    struct sockaddr_in tmp;

    memset (&tmp, 0, sizeof(tmp));
    tmp.sin_family = AF_INET;
    tmp.sin_port   = port;
    tmp.sin_addr   = *((const struct in_addr *)addr);
    memcpy(sa, &tmp, min(sizeof(tmp), *sa_size));
    *sa_size = sizeof(tmp);
}

Is this wrong?
-- 
Brian May <bam@debian.org>



Reply to: