Re: [netatalk-admins] Autoselect problem with asun mods


Subject: Re: [netatalk-admins] Autoselect problem with asun mods
From: Stefan Bethke (stefan@promo.de)
Date: Tue Jul 15 1997 - 04:18:47 EDT


At 0:11 Uhr +0200 15.07.1997, William R. Dickson wrote:
>- AppleTalk and TCP clients (AppleShare 3.7 and 3.7.1 on the local network)
> have problems. If they simply double-click on the server name in the
> Chooser, the system thinks for about 30 seconds before eventually
> establishing an AppleTalk connection instead of a TCP/IP connection.

Might it be that the liswt of IP addresses in GetStatus is botched?

The following snippet decodes the GetStatus data:

----------------

void ptocstr __P((const char *p, char *c));

void
ptocstr (p, c)
        const char *p;
        char *c;
{
        bcopy (p+1, c, (unsigned char)*p);
        c[(unsigned char)*p] = 0;
}

char *status_flagnames[16] = {
        "SupportsCopyFile",
        "SupportChgPwd",
        "DontAllowSavePwd",
        "SupportsServerMessages",

        "SupportsServerSignature",
        "SupportsTCP/IP",
        "(Flag 6)",
        "(Flag 7)",

        "(Flag 8)",
        "(Flag 9)",
        "(Flag 10)",
        "(Flag 11)",

        "(Flag 12)",
        "(Flag 13)",
        "(Flag 14)",
        "(Flag 15)",
};

void
dump_status(data0,len)
        char *data0;
        int len;
{
        unsigned char *data = (unsigned char *)data0;
        struct afp_status *as = (struct afp_status *)data;
        char s[256];
        int i, j;
        unsigned char *cp, *cp2;

        if (!(debug & DEBUG_INIT))
                return;
        ptocstr (data+sizeof(struct afp_status), s);
        fprintf (stderr, "FPGetSrvrStatus: length=%d\n\tname=\"%s\"\n",
len, s);

        if (as->as_machoff) {
                ptocstr (data+ntohs(as->as_machoff), s);
                fprintf (stderr, "\tmachine=\"%s\" (%d)\n", s,
ntohs(as->as_machoff));
        }

        fprintf (stderr, "\tflags:\n");
        for (i=0; i<16; i++)
                if (ntohs(as->as_flags) & (1 << i))
                        fprintf (stderr, "\t\t%s\n", status_flagnames[i]);

        if (as->as_versoff) {
                cp = data + ntohs(as->as_versoff);
                fprintf (stderr, "\tversions: (%d)\n", cp - data);
                for (i=*cp++; i--; ) {
                        ptocstr (cp, s);
                        fprintf (stderr, "\t\t\"%s\"\n", s);
                        cp += *cp + 1;
                }
        }

        if (as->as_uamsoff) {
                cp = data + ntohs(as->as_uamsoff);
                fprintf (stderr, "\tuams: (%d)\n", cp - data);
                for (i=*cp++; i--; ) {
                        ptocstr (cp, s);
                        fprintf (stderr, "\t\t\"%s\"\n", s);
                        cp += *cp + 1;
                }
        }

        if (as->as_iconoff)
                fprintf (stderr, "\ticon (%d)\n", ntohs (as->as_iconoff));

        cp2 = data + sizeof (*as);
        cp2 += ((unsigned char)data[sizeof(*as)] + 1) & ~1;

        if (ntohs(as->as_flags) & AFPSRVRINFO_SIGNATURE) {
                fprintf (stderr, "\tsignature: ");
                cp = data + ntohs(*(unsigned short *)cp2);
                for (i=0; i<16; i++, cp++)
                        fprintf (stderr, "%02x ", *cp);
                cp = data + ntohs(*(unsigned short *)cp2);
                for (i=0; i<16; i++, cp++)
                        fprintf (stderr, "%c", isprint (*cp) ? *cp : '.');
                fprintf (stderr, "(%d)\n", ntohs(*(unsigned short *)cp2));
        }

        if (ntohs(as->as_flags) & AFPSRVRINFO_DSI) {
                cp = data + ntohs(((unsigned short *)cp2)[1]);
                fprintf (stderr, "\taddresses: (%d)\n", cp - data);
                for (i=*cp++; i--; ) {
                        switch (cp[1]) {
                                case AFPADDR_IP:
                                case AFPADDR_IPPORT:
                                        j = ntohl(*(unsigned int *)(cp+2));
                                        fprintf (stderr, "\t\tIP:
%d.%d.%d.%d",
                                                (j >> 24) & 0xFF, (j >> 16)
& 0xFF,
                                                (j >> 8) & 0xFF, j & 0xFF);
                                        if (cp[1] == AFPADDR_IPPORT)
                                                fprintf (stderr, ":%d",
ntohs(*(unsigned short *)(cp+6)));
                                        fprintf (stderr, "\n");
                                        break;
                                case AFPADDR_DDP:
                                        fprintf (stderr, "\t\tAT: %d.%d:%d\n",
                                                ntohs(*(unsigned short
*)(cp+2)),
                                                cp[4], cp[5]);
                                        break;
                                default:
                                        fprintf (stderr, "\t\taddress type
%d with %d bytes\n", cp[1], cp[0]);
                        }
                        cp += cp[0];
                }
        }
}

-------------

Hope this helps,
Stefan

--
Stefan Bethke
Promo Datentechnik      |  Tel. +49-40-851744-0
+ Systemberatung GmbH   |  Fax. +49-40-851744-44
Eduardstrasse 46-48     |  e-mail: stefan@Promo.DE
D-20257 Hamburg         |  http://www.Promo.DE/



This archive was generated by hypermail 2b28 : Sat Dec 18 1999 - 16:25:41 EST