pike.git / lib / modules / SSL.pmod / Connection.pike

version» Context lines:

pike.git/lib/modules/SSL.pmod/Connection.pike:1014:    return -1;    }    int err, len;    handshake_buffer += packet->fragment;       while (sizeof(handshake_buffer) >= 4)    {    sscanf(handshake_buffer, "%*c%3c", len);    if (sizeof(handshake_buffer) < (len + 4))    break; +  mixed exception = catch {    err = handle_handshake(handshake_buffer[0],    handshake_buffer[4..len + 3],    handshake_buffer[.. len + 3]); -  +  }; +  if( exception ) +  { +  if( objectp(exception) && ([object]exception)->ADT_struct ) +  { +  Error.Generic e = [object(Error.Generic)]exception; +  send_packet(Alert(ALERT_fatal, ALERT_decode_error, +  e->message())); +  return -1; +  } +  throw(exception); +  }    handshake_buffer = handshake_buffer[len + 4..];    if (err < 0)    return err;    if (err > 0) {    handshake_finished = 1;    }    }    break;    }    case PACKET_application_data:
pike.git/lib/modules/SSL.pmod/Connection.pike:1057:    if (!session->heartbeat_mode) {    // RFC 6520 2:    // If an endpoint that has indicated peer_not_allowed_to_send    // receives a HeartbeatRequest message, the endpoint SHOULD    // drop the message silently and MAY send an unexpected_message    // Alert message.    send_packet(Alert(ALERT_warning, ALERT_unexpected_message,    "Heart beat mode not enabled.\n"));    break;    } +  +  mixed exception = catch {    handle_heartbeat(packet->fragment); -  +  }; +  if( exception ) +  { +  if( objectp(exception) && ([object]exception)->ADT_struct ) +  { +  Error.Generic e = [object(Error.Generic)]exception; +  send_packet(Alert(ALERT_fatal, ALERT_decode_error, +  e->message())); +  return -1;    } -  +  throw(exception); +  } +  +  }    break;    default:    if (!handshake_finished)    {    send_packet(Alert(ALERT_fatal, ALERT_unexpected_message,    "Unexpected message during handshake!\n"));    return -1;    }    // RFC 4346 6:    // If a TLS implementation receives a record type it does not    // understand, it SHOULD just ignore it.    SSL3_DEBUG_MSG("SSL.connection: Ignoring packet of type %s\n",    fmt_constant(packet->content_type, "PACKET"));    break;    }    }    }    return closing & 2 ? 1 : res;   }