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

Tracing Failures in ASN.1 Stubs and General Heimdal Dev


What's the best way to debug Heimdal's ASN.1 code? I'm getting a
GSS_S_DEFECTIVE_TOKEN routine error on the initial NegTokenInit returned
in Samba's SMB_COM_NEGOTIATE. I know through Luke H. that I should just
move on to the mechglue branch (got that BTW, thanks) but I think I'm
going to be working on Heimdal's GSS quite a bit so I'm using this as
an opportunity to learn the ropes.

What I've been doing is using indent -kr -i8 to view the stub source and
use a hexdump program I wrote called "hexd" to break down a binary blob
exported from Ethereal using File > Export > Selected Packet Bytes.

The faulty NegTokenInit looks like this:

  $ hexd /tmp/nti -r "2,2,2,0x0c,2,2,2,2,4,999"
  00000:  30 1c                                            |0.              |
  00000:  a0 0e                                            |..              |
  00000:  30 0c                                            |0.              |
  00000:  06 0a 2b 06 01 04 01 82 37 02 02 0a              |..+.....7...    |
  00000:  a3 0a                                            |..              |
  00000:  30 08                                            |0.              |
  00000:  a0 06                                            |..              |
  00000:  1b 04                                            |..              |
  00000:  4e 4f 4e 45                                      |NONE            |

Then I sprinkle a few printfs in the code and rebuild and install the
Heimdal libs like:

  $ make
  # make install-exec

Can someone recommend a better way to trace failures?

Also, I would like to contribute the attached hexdump.c function that
generates hexdumps like those depicted above. If Love could find a way
to include it in the Heimdal source somewhere I think people might find
such a thing useful when debugging.