func: int main() int msglen , ret ; u_char * dp ; u_char * name = ( u_char * ) malloc ( 100 * sizeof ( u_char ) ) ; u_char * msg = ( u_char * ) malloc ( 1000 * sizeof ( u_char ) ) ; msglen = createSig ( msg ); int createSig (u_char *buf) u_char * p ; char * temp , * temp1 ; u_char * comp_dn , * comp_dn2 ; char exp_dn [ 200 ] , exp_dn2 [ 200 ] ; u_char * * dnptrs , * * lastdnptr , * * dnptrs2 ; dnptrs = ( unsigned char * * ) malloc ( 2 * sizeof ( unsigned char * ) ); dnptrs2 = ( unsigned char * * ) malloc ( 2 * sizeof ( unsigned char * ) ); comp_dn = ( unsigned char * ) malloc ( 200 * sizeof ( unsigned char ) ); comp_dn2 = ( unsigned char * ) malloc ( 200 * sizeof ( unsigned char ) ); temp1 = ( char * ) malloc ( 400 * sizeof ( char ) ); temp = temp1; p = buf; strcpy ( temp , "HEADER JUNK:" ); while ( * temp != '\0' )  * p ++ = * temp ++; strcpy ( exp_dn , "lcs.mit.edu" ); * dnptrs ++ = ( u_char * ) exp_dn; * dnptrs -- = NULL; lastdnptr = NULL; comp_size = dn_comp ( ( const char * ) exp_dn , comp_dn , 200 , dnptrs , lastdnptr ); for(i=0; i<comp_size; i++) * p ++ = * comp_dn ++; p += 2; p += 2; p += 4; p += 2; p += 2; p += 2; p += 4; p += 4; p += 4; p += 2; strcpy ( exp_dn2 , "sls.lcs.mit.edu" ); * dnptrs2 ++ = ( u_char * ) exp_dn2; * dnptrs2 -- = NULL; lastdnptr = NULL; comp_size = dn_comp ( ( const char * ) exp_dn2 , comp_dn2 , 200 , dnptrs2 , lastdnptr ); for(i=0; i<comp_size; i++) * p ++ = * comp_dn2 ++; for(i=0; i<11; i++) p += 4; return ( p - buf ) ; dp = msg + sizeof ( HEADER ); ret = rrextract ( msg , msglen , dp , name , 100 ); static rrextract(u_char *msg, int msglen, u_char *rrp, u_char *dname, int namelen) u_char * eom , * cp , * cp1 , * rdatap ; cp = rrp; eom = msg + msglen; if ( ( n = dn_expand ( msg , eom , cp , ( char * ) dname , namelen ) ) < 0 )  cp += n; cp += 2; cp += 2; cp += 4; cp += 2; switch ( type )  u_long origTTL , exptime , signtime , timetilexp , now ; cp1 = cp; cp1 += 2; cp1 += 2; cp1 += 4; cp1 += 4; cp1 += 4; cp1 += 2; now = time ( NULL ); if ( signtime > now )  if ( exptime <= now )  cp = cp1 - 18; cp1 = ( u_char * ) data; memcpy ( cp1 , cp , 18 ); cp1 += 18; n = dn_expand ( msg , eom , cp + 18 , ( char * ) cp1 , ( sizeof data ) - 18 ); printf ( "dn_expand returned:  %d, expanded name = %s\n" , n , ( char * ) cp1 ); if ( n < 0 )  printf ( "ERROR: n = %d < 0!\n" , n ); cp += n; cp1 += strlen ( ( char * ) cp1 ) + 1; n = dlen - ( NS_SIG_SIGNER + n ); printf ( "dlen - NS_SIG_SIGNER - n = %d\n" , n ); printf ( "n=%d\n" , n ); printf ( "(sizeof data) - (cp1 - (u_char *)data) = %d\n" , ( sizeof data ) - ( cp1 - ( u_char * ) data ) ); printf ( "(n > (int) (sizeof data) - (cp1 - (u_char *)data)) = %d\n" , ( n > ( int ) ( sizeof data ) - ( cp1 - ( u_char * ) data ) ) ); if ( n > ( int ) ( sizeof data ) - ( cp1 - ( u_char * ) data ) )  if ( n < NS_MD5RSA_MIN_SIZE || n > NS_MD5RSA_MAX_SIZE )  if ( n != NS_DSA_SIG_SIZE )  printf ( "memcpying n=%u bytes \n" , ( unsigned int ) n ); memcpy ( cp1 , cp , n ); cp += n; cp1 += n; n = cp1 - ( u_char * ) data; return ( ( cp - rrp ) + dlen ) ; if ( cp > eom )  if ( ( u_int ) ( cp - rdatap ) != dlen )  printf ( "encoded rdata length is %u, but actual length was %u" , dlen , ( u_int ) ( cp - rdatap ) ); if ( n > MAXDATA )  printf ( "update type %d: %d bytes is too much data" , type , n ); return ( cp - rrp ) ; 