if(oid) kfree(oid); 
kfree(oid); 
decode_negTokenInit(unsigned char *security_blob, int length,		    enum securityEnum *secType){	struct asn1_ctx ctx;	unsigned char *end;	unsigned char *sequence_end;	unsigned long *oid = NULL;	unsigned int cls, con, tag, oidlen, rc;	int use_ntlmssp = FALSE;	*secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default */	/* cifs_dump_mem(" Received SecBlob ", security_blob, length); */	asn1_open(&ctx, security_blob, length);	if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {		cFYI(1, ("Error decoding negTokenInit header "));		return 0;	} else if ((cls != ASN1_APL) || (con != ASN1_CON)		   || (tag != ASN1_EOC)) {		cFYI(1, ("cls = %d con = %d tag = %d", cls, con, tag));		return 0;	} else {		/*      remember to free obj->oid */		rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag);		if (rc) {			if ((tag == ASN1_OJI) && (cls == ASN1_PRI)) {				rc = asn1_oid_decode(&ctx, end, &oid, &oidlen);				if (rc) {					rc = compare_oid(oid, oidlen,							 SPNEGO_OID,							 SPNEGO_OID_LEN);					kfree(oid);				}			} else				rc = 0;		}		if (!rc) {			cFYI(1, ("Error decoding negTokenInit header"));			return 0;		}		if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {			cFYI(1, ("Error decoding negTokenInit "));			return 0;		} else if ((cls != ASN1_CTX) || (con != ASN1_CON)			   || (tag != ASN1_EOC)) {			cFYI(1,("cls = %d con = %d tag = %d end = %p (%d) exit 0",			      cls, con, tag, end, *end));			return 0;		}		if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {			cFYI(1, ("Error decoding negTokenInit "));			return 0;		} else if ((cls != ASN1_UNI) || (con != ASN1_CON)			   || (tag != ASN1_SEQ)) {			cFYI(1,("cls = %d con = %d tag = %d end = %p (%d) exit 1",			      cls, con, tag, end, *end));			return 0;		}		if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {			cFYI(1, ("Error decoding 2nd part of negTokenInit "));			return 0;		} else if ((cls != ASN1_CTX) || (con != ASN1_CON)			   || (tag != ASN1_EOC)) {			cFYI(1,			     ("cls = %d con = %d tag = %d end = %p (%d) exit 0",			      cls, con, tag, end, *end));			return 0;		}		if (asn1_header_decode		    (&ctx, &sequence_end, &cls, &con, &tag) == 0) {			cFYI(1, ("Error decoding 2nd part of negTokenInit "));			return 0;		} else if ((cls != ASN1_UNI) || (con != ASN1_CON)			   || (tag != ASN1_SEQ)) {			cFYI(1,			     ("cls = %d con = %d tag = %d end = %p (%d) exit 1",			      cls, con, tag, end, *end));			return 0;		}		while (!asn1_eoc_decode(&ctx, sequence_end)) {			rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag);			if (!rc) {				cFYI(1,				     ("Error 1 decoding negTokenInit header exit 2"));				return 0;			}			if ((tag == ASN1_OJI) && (con == ASN1_PRI)) {				rc = asn1_oid_decode(&ctx, end, &oid, &oidlen);				if(rc) {							cFYI(1,					  ("OID len = %d oid = 0x%lx 0x%lx 0x%lx 0x%lx",					   oidlen, *oid, *(oid + 1), *(oid + 2),					   *(oid + 3)));					rc = compare_oid(oid, oidlen, NTLMSSP_OID,						 NTLMSSP_OID_LEN);					if(oid)						kfree(oid);					if (rc)						use_ntlmssp = TRUE;				}			} else {				cFYI(1,("This should be an oid what is going on? "));			}		}		if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {			cFYI(1,			     ("Error decoding last part of negTokenInit exit 3"));			return 0;		} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {	/* tag = 3 indicating mechListMIC */			cFYI(1,			     ("Exit 4 cls = %d con = %d tag = %d end = %p (%d)",			      cls, con, tag, end, *end));			return 0;		}		if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {			cFYI(1,			     ("Error decoding last part of negTokenInit exit 5"));			return 0;		} else if ((cls != ASN1_UNI) || (con != ASN1_CON)			   || (tag != ASN1_SEQ)) {			cFYI(1,			     ("Exit 6 cls = %d con = %d tag = %d end = %p (%d)",			      cls, con, tag, end, *end));		}		if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {			cFYI(1,			     ("Error decoding last part of negTokenInit exit 7"));			return 0;		} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {			cFYI(1,			     ("Exit 8 cls = %d con = %d tag = %d end = %p (%d)",			      cls, con, tag, end, *end));			return 0;		}		if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {			cFYI(1,			     ("Error decoding last part of negTokenInit exit 9"));			return 0;		} else if ((cls != ASN1_UNI) || (con != ASN1_PRI)			   || (tag != ASN1_GENSTR)) {			cFYI(1,			     ("Exit 10 cls = %d con = %d tag = %d end = %p (%d)",			      cls, con, tag, end, *end));			return 0;		}		cFYI(1, ("Need to call asn1_octets_decode() function for this %s", ctx.pointer));	/* is this UTF-8 or ASCII? */	}	/* if (use_kerberos) 	   *secType = Kerberos 	   else */	if (use_ntlmssp) {		*secType = NTLMSSP;	}	return 1;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/f99d49adf527fa6f7a9c42257fa76bca6b8df1e3/asn1.c/clean/fs/cifs/asn1.c