Ejemplo n.º 1
0
static void
edge_cases( struct resampled *effmass ,
	    const struct resampled *bootavg ,
	    const size_t j ,
	    const size_t NDATA )
{
  if( j == 0 ) {
    equate( &effmass[j] , bootavg[j+1] ) ;
    divide( &effmass[j] , bootavg[j] ) ;
    if( log_range( effmass[j] ) ) {
      zero_effmass( &effmass[j] , bootavg[j] ) ;
    } else {
      res_log( &effmass[j] ) ;
      mult_constant( &effmass[j] , -1.0 ) ;
    }
  } else if( j == NDATA - 1 ) {
    equate( &effmass[j] , bootavg[j] ) ;
    divide( &effmass[j] , bootavg[j-1] ) ;
    // just in case there is a sign flip
    if( log_range( effmass[j] ) ) {
      return zero_effmass( &effmass[j] , bootavg[j] ) ;
    } else {
      res_log( &effmass[j] ) ;
      mult_constant( &effmass[j] , -1.0 ) ;
    }
  }
  return ;
}
Ejemplo n.º 2
0
int
res_tsig_verifies(struct name_server *respondent,
                  u_char * answer, size_t answer_length)
{
    u_int16_t arcount;
    HEADER *header = (HEADER *) answer;

    if (!(respondent->ns_security_options & ZONE_USE_TSIG))
        return SR_TS_OK;
    else if (answer_length < sizeof(HEADER))
        return SR_TS_FAIL;
    else if (header->arcount == 0) 
        return SR_TS_FAIL;
    else {
        /* XXX Simply decrement the additional section count for now */
        arcount = ntohs(header->arcount);
        arcount--;
        header->arcount = htons(arcount);;
        res_log(NULL, LOG_INFO, "libsres: ""not checking tsig!");
    }
    return SR_TS_OK;
}