Text   |  XML   |  ReML   |   Visible Warnings:

Ignored Return Value  at packet-ldap.c:4223

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

dissect_ldap_tcp

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ldap.c)expand/collapse
Show more  
 4206  dissect_ldap_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 4207  {
 4208          guint32 sasl_len;
 4209          guint32 ldap_len;
 4210          int offset;
 4211          gboolean ind;
 4212          conversation_t *conversation;
 4213          ldap_conv_info_t *ldap_info = NULL;
 4214   
 4215          /*
 4216           * Do we have a conversation for this connection?
 4217           */
 4218          conversation = find_conversation(pinfo->fd->num,  
 4219                                  &pinfo->src, &pinfo->dst,
 4220                                  pinfo->ptype, pinfo->srcport,
 4221                                  pinfo->destport, 0);
 4222          if(conversation){
 4223                  ldap_info = conversation_get_proto_data(conversation, proto_ldap);
 4224          }
 4225   
 4226          ldm_tree = NULL;
 4227   
 4228          /* This is a bit tricky. We have to find out whether SASL is used 
 4229           * so that we know how big a header we are supposed to pass 
 4230           * to tcp_dissect_pdus()
 4231           * We must also cope with the case when a client connects to LDAP 
 4232           * and performs a few unauthenticated searches of LDAP before 
 4233           * it performs the bind on the same tcp connection.
 4234           */
 4235          /* check for a SASL header, i.e. assume it is SASL if 
 4236           * 1, first four bytes (SASL length) is an integer 
 4237           *    with a value that must be <LDAP_SASL_MAX_BUF and >2
 4238           *    (>2 to fight false positives, 0x00000000 is a common
 4239           *        "random" tcp payload)
 4240           * (SASL ldap PDUs might be >64k in size, which is why 
 4241           * LDAP_SASL_MAX_BUF is used - defined in packet-ldap.h)
 4242           *
 4243           * 2, we must have a conversation and the auth type must
 4244           *    be LDAP_AUTH_SASL 
 4245           */
 4246          sasl_len=tvb_get_ntohl(tvb, 0);
 4247   
 4248          if( sasl_len<2 ){
 4249                  goto this_was_not_sasl;
 4250          }
 4251   
 4252          if( sasl_len>LDAP_SASL_MAX_BUF ){
 4253                  goto this_was_not_sasl;
 4254          }
 4255                   
 4256          if((!ldap_info) || (ldap_info->auth_type!=LDAP_AUTH_SASL) ){
 4257                  goto this_was_not_sasl;
 4258          }
 4259   
 4260          tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_sasl_ldap_pdu_len, dissect_sasl_ldap_pdu);
 4261          return;
 4262   
 4263  this_was_not_sasl:
 4264          /* check if it is a normal BER encoded LDAP packet
 4265           * i.e. first byte is 0x30 followed by a length that is
 4266           * <64k
 4267           * (no ldap PDUs are ever >64kb? )
 4268           */
 4269          if(tvb_get_guint8(tvb, 0)!=0x30){
 4270                  goto this_was_not_normal_ldap;
 4271          }
 4272   
 4273          /* check that length makes sense */
 4274          offset=get_ber_length(tvb, 1, &ldap_len, &ind);
 4275   
 4276          /* dont check ind since indefinite length is never used for ldap (famous last words)*/
 4277          if(ldap_len<2){
 4278                  goto this_was_not_normal_ldap;
 4279          }
 4280   
 4281          tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_normal_ldap_pdu_len, dissect_normal_ldap_pdu);
 4282   
 4283          goto end;
 4284   
 4285  this_was_not_normal_ldap:
 4286   
 4287          /* perhaps it was SSL? */
 4288          if(ldap_info &&  
 4289             ldap_info->start_tls_frame &&  
 4290             ( pinfo->fd->num >= ldap_info->start_tls_frame)) {
 4291   
 4292            /* we have started TLS and so this may be an SSL layer */
 4293            guint32 old_start_tls_frame;
 4294   
 4295            /* temporarily dissect this port as SSL */
 4296            dissector_delete("tcp.port", tcp_port, ldap_handle);  
 4297            ssl_dissector_add(tcp_port, "ldap", TRUE);
 4298       
 4299            old_start_tls_frame = ldap_info->start_tls_frame;
 4300            ldap_info->start_tls_frame = 0; /* make sure we don't call SSL again */
 4301            pinfo->can_desegment++; /* ignore this LDAP layer so SSL can use the TCP resegment */
 4302   
 4303            offset = call_dissector(ssl_handle, tvb, pinfo, tree);
 4304   
 4305            ldap_info->start_tls_frame = old_start_tls_frame;
 4306            ssl_dissector_delete(tcp_port, "ldap", TRUE);
 4307   
 4308            /* restore ldap as the dissector for this port */
 4309            dissector_add("tcp.port", tcp_port, ldap_handle);
 4310   
 4311            /* we are done */
 4312            return;
 4313          }
 4314   end:
 4315          return;
 4316  }
Show more  




Change Warning 5420.35642 : Ignored Return Value

Priority:
State:
Finding:
Owner:
Note: