Add a relative path to the "#line" directives we produce. Regenerate the

SNMP and SPNEGO dissectors to see if it helps Coverity locate the
original source files.

svn path=/trunk/; revision=36522
This commit is contained in:
Gerald Combs 2011-04-08 19:51:39 +00:00
parent de938dddce
commit a5b20fbdf6
5 changed files with 57 additions and 47 deletions

View File

@ -5,7 +5,7 @@
/* Input file: packet-snmp-template.c */
#line 1 "packet-snmp-template.c"
#line 1 "../../asn1/snmp/packet-snmp-template.c"
/* packet-snmp.c
* Routines for SNMP (simple network management protocol)
* Copyright (C) 1998 Didier Jorand
@ -227,7 +227,7 @@ static int hf_snmp_scalar_instance_index = -1;
/*--- Included file: packet-snmp-hf.c ---*/
#line 1 "packet-snmp-hf.c"
#line 1 "../../asn1/snmp/packet-snmp-hf.c"
static int hf_snmp_SMUX_PDUs_PDU = -1; /* SMUX_PDUs */
static int hf_snmp_version = -1; /* Version */
static int hf_snmp_community = -1; /* Community */
@ -295,7 +295,7 @@ static int hf_snmp_priority = -1; /* INTEGER_M1_2147483647 */
static int hf_snmp_operation = -1; /* T_operation */
/*--- End of included file: packet-snmp-hf.c ---*/
#line 221 "packet-snmp-template.c"
#line 221 "../../asn1/snmp/packet-snmp-template.c"
static int hf_smux_version = -1;
static int hf_smux_pdutype = -1;
@ -316,7 +316,7 @@ static gint ett_decoding_error = -1;
/*--- Included file: packet-snmp-ett.c ---*/
#line 1 "packet-snmp-ett.c"
#line 1 "../../asn1/snmp/packet-snmp-ett.c"
static gint ett_snmp_Message = -1;
static gint ett_snmp_Messagev2u = -1;
static gint ett_snmp_T_datav2u = -1;
@ -338,7 +338,7 @@ static gint ett_snmp_SimpleOpen_U = -1;
static gint ett_snmp_RReqPDU_U = -1;
/*--- End of included file: packet-snmp-ett.c ---*/
#line 240 "packet-snmp-template.c"
#line 240 "../../asn1/snmp/packet-snmp-template.c"
static const true_false_string auth_flags = {
"OK",
@ -1596,13 +1596,13 @@ check_ScopedPdu(tvbuff_t* tvb)
/*--- Included file: packet-snmp-fn.c ---*/
#line 1 "packet-snmp-fn.c"
#line 1 "../../asn1/snmp/packet-snmp-fn.c"
static int
dissect_snmp_EnterpriseOID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 64 "snmp.cnf"
#line 64 "../../asn1/snmp/snmp.cnf"
const gchar* name;
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &enterprise_oid);
@ -1855,7 +1855,7 @@ dissect_snmp_GenericTrap(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
static int
dissect_snmp_SpecificTrap(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 48 "snmp.cnf"
#line 48 "../../asn1/snmp/snmp.cnf"
guint specific_trap;
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
@ -1886,7 +1886,7 @@ static const ber_sequence_t Trap_PDU_U_sequence[] = {
static int
dissect_snmp_Trap_PDU_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 40 "snmp.cnf"
#line 40 "../../asn1/snmp/snmp.cnf"
generic_trap = 0;
enterprise_oid = NULL;
@ -2005,7 +2005,7 @@ static const ber_choice_t PDUs_choice[] = {
static int
dissect_snmp_PDUs(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 28 "snmp.cnf"
#line 28 "../../asn1/snmp/snmp.cnf"
gint pdu_type=-1;
col_clear(actx->pinfo->cinfo, COL_INFO);
@ -2091,7 +2091,7 @@ dissect_snmp_Messagev2u(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_snmp_SnmpEngineID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 99 "snmp.cnf"
#line 99 "../../asn1/snmp/snmp.cnf"
tvbuff_t* param_tvb = NULL;
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
@ -2110,7 +2110,7 @@ dissect_snmp_SnmpEngineID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
static int
dissect_snmp_T_msgAuthoritativeEngineID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 90 "snmp.cnf"
#line 90 "../../asn1/snmp/snmp.cnf"
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
&usm_p.engine_tvb);
@ -2158,7 +2158,7 @@ dissect_snmp_T_msgUserName(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
static int
dissect_snmp_T_msgAuthenticationParameters(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 112 "snmp.cnf"
#line 112 "../../asn1/snmp/snmp.cnf"
offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_index, &usm_p.auth_tvb);
if (usm_p.auth_tvb) {
usm_p.auth_item = actx->created_item;
@ -2212,7 +2212,7 @@ dissect_snmp_INTEGER_484_2147483647(gboolean implicit_tag _U_, tvbuff_t *tvb _U_
static int
dissect_snmp_T_msgFlags(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 227 "snmp.cnf"
#line 227 "../../asn1/snmp/snmp.cnf"
tvbuff_t *parameter_tvb = NULL;
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
@ -2267,7 +2267,7 @@ dissect_snmp_HeaderData(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_snmp_T_msgSecurityParameters(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 170 "snmp.cnf"
#line 170 "../../asn1/snmp/snmp.cnf"
switch(MsgSecurityModel){
case SNMP_SEC_USM: /* 3 */
@ -2309,7 +2309,7 @@ dissect_snmp_ScopedPDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_snmp_T_encryptedPDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 121 "snmp.cnf"
#line 121 "../../asn1/snmp/snmp.cnf"
tvbuff_t* crypt_tvb;
offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_snmp_encryptedPDU, &crypt_tvb);
@ -2399,7 +2399,7 @@ dissect_snmp_SNMPv3Message(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
SNMPv3Message_sequence, hf_index, ett_snmp_SNMPv3Message);
#line 185 "snmp.cnf"
#line 185 "../../asn1/snmp/snmp.cnf"
if( usm_p.authenticated
&& usm_p.user_assoc
@ -2716,7 +2716,7 @@ static void dissect_SMUX_PDUs_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pro
/*--- End of included file: packet-snmp-fn.c ---*/
#line 1496 "packet-snmp-template.c"
#line 1496 "../../asn1/snmp/packet-snmp-template.c"
guint
@ -3370,7 +3370,7 @@ void proto_register_snmp(void) {
/*--- Included file: packet-snmp-hfarr.c ---*/
#line 1 "packet-snmp-hfarr.c"
#line 1 "../../asn1/snmp/packet-snmp-hfarr.c"
{ &hf_snmp_SMUX_PDUs_PDU,
{ "SMUX-PDUs", "snmp.SMUX_PDUs",
FT_UINT32, BASE_DEC, VALS(snmp_SMUX_PDUs_vals), 0,
@ -3633,7 +3633,7 @@ void proto_register_snmp(void) {
NULL, HFILL }},
/*--- End of included file: packet-snmp-hfarr.c ---*/
#line 2148 "packet-snmp-template.c"
#line 2148 "../../asn1/snmp/packet-snmp-template.c"
};
/* List of subtrees */
@ -3651,7 +3651,7 @@ void proto_register_snmp(void) {
&ett_decoding_error,
/*--- Included file: packet-snmp-ettarr.c ---*/
#line 1 "packet-snmp-ettarr.c"
#line 1 "../../asn1/snmp/packet-snmp-ettarr.c"
&ett_snmp_Message,
&ett_snmp_Messagev2u,
&ett_snmp_T_datav2u,
@ -3673,7 +3673,7 @@ void proto_register_snmp(void) {
&ett_snmp_RReqPDU_U,
/*--- End of included file: packet-snmp-ettarr.c ---*/
#line 2164 "packet-snmp-template.c"
#line 2164 "../../asn1/snmp/packet-snmp-template.c"
};
module_t *snmp_module;

View File

@ -5,7 +5,7 @@
/* Input file: packet-snmp-template.h */
#line 1 "packet-snmp-template.h"
#line 1 "../../asn1/snmp/packet-snmp-template.h"
/* packet-snmp.h
* Routines for snmp packet dissection
*

View File

@ -5,7 +5,7 @@
/* Input file: packet-spnego-template.c */
#line 1 "packet-spnego-template.c"
#line 1 "../../asn1/spnego/packet-spnego-template.c"
/* packet-spnego.c
* Routines for the simple and protected GSS-API negotiation mechanism
* as described in RFC 2478.
@ -88,7 +88,7 @@ static int hf_spnego_krb5_cfx_seq = -1;
/*--- Included file: packet-spnego-hf.c ---*/
#line 1 "packet-spnego-hf.c"
#line 1 "../../asn1/spnego/packet-spnego-hf.c"
static int hf_spnego_negTokenInit = -1; /* NegTokenInit */
static int hf_spnego_negTokenTarg = -1; /* NegTokenTarg */
static int hf_spnego_MechTypeList_item = -1; /* MechType */
@ -113,7 +113,7 @@ static int hf_spnego_ContextFlags_confFlag = -1;
static int hf_spnego_ContextFlags_integFlag = -1;
/*--- End of included file: packet-spnego-hf.c ---*/
#line 82 "packet-spnego-template.c"
#line 82 "../../asn1/spnego/packet-spnego-template.c"
/* Global variables */
static const char *MechType_oid;
@ -129,7 +129,7 @@ static gint ett_spnego_krb5_cfx_flags = -1;
/*--- Included file: packet-spnego-ett.c ---*/
#line 1 "packet-spnego-ett.c"
#line 1 "../../asn1/spnego/packet-spnego-ett.c"
static gint ett_spnego_NegotiationToken = -1;
static gint ett_spnego_MechTypeList = -1;
static gint ett_spnego_PrincipalSeq = -1;
@ -139,7 +139,7 @@ static gint ett_spnego_NegTokenTarg = -1;
static gint ett_spnego_InitialContextToken_U = -1;
/*--- End of included file: packet-spnego-ett.c ---*/
#line 96 "packet-spnego-template.c"
#line 96 "../../asn1/spnego/packet-spnego-template.c"
/*
* Unfortunately, we have to have a forward declaration of this,
@ -152,12 +152,12 @@ static int dissect_spnego_PrincipalSeq(gboolean implicit_tag, tvbuff_t *tvb,
/*--- Included file: packet-spnego-fn.c ---*/
#line 1 "packet-spnego-fn.c"
#line 1 "../../asn1/spnego/packet-spnego-fn.c"
static int
dissect_spnego_MechType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 23 "spnego.cnf"
#line 23 "../../asn1/spnego/spnego.cnf"
gssapi_oid_value *value;
@ -195,7 +195,7 @@ static const ber_sequence_t MechTypeList_sequence_of[1] = {
static int
dissect_spnego_MechTypeList(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 91 "spnego.cnf"
#line 91 "../../asn1/spnego/spnego.cnf"
conversation_t *conversation;
@ -244,7 +244,7 @@ dissect_spnego_ContextFlags(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int
dissect_spnego_T_mechToken(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 112 "spnego.cnf"
#line 112 "../../asn1/spnego/spnego.cnf"
tvbuff_t *mechToken_tvb = NULL;
@ -269,7 +269,7 @@ dissect_spnego_T_mechToken(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
static int
dissect_spnego_T_NegTokenInit_mechListMIC(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 126 "spnego.cnf"
#line 126 "../../asn1/spnego/spnego.cnf"
gint8 class;
gboolean pc;
@ -350,7 +350,7 @@ dissect_spnego_T_negResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
static int
dissect_spnego_T_supportedMech(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 164 "spnego.cnf"
#line 164 "../../asn1/spnego/spnego.cnf"
conversation_t *conversation;
@ -379,7 +379,7 @@ dissect_spnego_T_supportedMech(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
static int
dissect_spnego_T_responseToken(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 187 "spnego.cnf"
#line 187 "../../asn1/spnego/spnego.cnf"
tvbuff_t *responseToken_tvb;
@ -413,7 +413,7 @@ dissect_spnego_T_responseToken(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
static int
dissect_spnego_T_mechListMIC(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 214 "spnego.cnf"
#line 214 "../../asn1/spnego/spnego.cnf"
tvbuff_t *mechListMIC_tvb;
@ -509,7 +509,7 @@ dissect_spnego_PrincipalSeq(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int
dissect_spnego_InnerContextToken(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 48 "spnego.cnf"
#line 48 "../../asn1/spnego/spnego.cnf"
gssapi_oid_value *next_level_value_lcl;
proto_item *item;
@ -584,7 +584,7 @@ dissect_spnego_InitialContextToken(gboolean implicit_tag _U_, tvbuff_t *tvb _U_,
/*--- End of included file: packet-spnego-fn.c ---*/
#line 107 "packet-spnego-template.c"
#line 107 "../../asn1/spnego/packet-spnego-template.c"
/*
* This is the SPNEGO KRB5 dissector. It is not true KRB5, but some ASN.1
* wrapped blob with an OID, USHORT token ID, and a Ticket, that is also
@ -1874,7 +1874,7 @@ void proto_register_spnego(void) {
/*--- Included file: packet-spnego-hfarr.c ---*/
#line 1 "packet-spnego-hfarr.c"
#line 1 "../../asn1/spnego/packet-spnego-hfarr.c"
{ &hf_spnego_negTokenInit,
{ "negTokenInit", "spnego.negTokenInit",
FT_NONE, BASE_NONE, NULL, 0,
@ -1961,7 +1961,7 @@ void proto_register_spnego(void) {
NULL, HFILL }},
/*--- End of included file: packet-spnego-hfarr.c ---*/
#line 1395 "packet-spnego-template.c"
#line 1395 "../../asn1/spnego/packet-spnego-template.c"
};
/* List of subtrees */
@ -1973,7 +1973,7 @@ void proto_register_spnego(void) {
/*--- Included file: packet-spnego-ettarr.c ---*/
#line 1 "packet-spnego-ettarr.c"
#line 1 "../../asn1/spnego/packet-spnego-ettarr.c"
&ett_spnego_NegotiationToken,
&ett_spnego_MechTypeList,
&ett_spnego_PrincipalSeq,
@ -1983,7 +1983,7 @@ void proto_register_spnego(void) {
&ett_spnego_InitialContextToken_U,
/*--- End of included file: packet-spnego-ettarr.c ---*/
#line 1405 "packet-spnego-template.c"
#line 1405 "../../asn1/spnego/packet-spnego-template.c"
};
/* Register protocol */

View File

@ -5,7 +5,7 @@
/* Input file: packet-spnego-template.h */
#line 1 "packet-spnego-template.h"
#line 1 "../../asn1/spnego/packet-spnego-template.h"
/* packet-spnego.h
* Routines for spnego packet dissection
*

View File

@ -557,6 +557,16 @@ def dependency_compute(items, dependency, map_fn = lambda t: t, ignore_fn = lamb
x[e] = True
return (item_ord, item_cyc)
# Given a filename, return a relative path from epan/dissectors
def rel_dissector_path(filename):
path_parts = os.path.abspath(filename).split(os.sep)
while (len(path_parts) > 3 and path_parts[0] != 'asn1'):
path_parts.pop(0)
path_parts.insert(0, '..')
path_parts.insert(0, '..')
return '/'.join(path_parts)
#--- EthCtx -------------------------------------------------------------------
class EthCtx:
def __init__(self, conform, output, indent = 0):
@ -2175,7 +2185,7 @@ class EthCnf:
self.fn[name][ctx]['used'] = True
out = self.fn[name][ctx]['text']
if (not self.suppress_line):
out = '#line %u "%s"\n%s\n' % (self.fn[name][ctx]['lineno'], os.path.basename(self.fn[name][ctx]['fn']), out);
out = '#line %u "%s"\n%s\n' % (self.fn[name][ctx]['lineno'], rel_dissector_path(self.fn[name][ctx]['fn']), out);
return out
def add_pdu(self, par, is_new, fn, lineno):
@ -2878,7 +2888,7 @@ class EthOut:
fout.write(self.fhdr(out_nm))
fout.write('/* Input file: ' + os.path.basename(in_nm) +' */\n')
fout.write('\n')
fout.write('#line %u "%s"\n' % (1, os.path.basename(in_nm)))
fout.write('#line %u "%s"\n' % (1, rel_dissector_path(in_nm)))
include = re.compile(r'^\s*#\s*include\s+[<"](?P<fname>[^>"]+)[>"]', re.IGNORECASE)
@ -2900,12 +2910,12 @@ class EthOut:
if (ifile):
fout.write('\n')
fout.write('/*--- Included file: ' + ifile + ' ---*/\n')
fout.write('#line %u "%s"\n' % (1, os.path.basename(ifile)))
fout.write('#line %u "%s"\n' % (1, rel_dissector_path(ifile)))
finc = file(ifile, "r")
fout.write(finc.read())
fout.write('\n')
fout.write('/*--- End of included file: ' + ifile + ' ---*/\n')
fout.write('#line %u "%s"\n' % (cont_linenum+1, os.path.basename(in_nm)) )
fout.write('#line %u "%s"\n' % (cont_linenum+1, rel_dissector_path(in_nm)) )
finc.close()
else:
fout.write(line)