static gboolean
list_filter (GtkListBoxRow *row,
             gpointer   user_data)
{
  GtkDialog *chooser = user_data;
  CcInputChooserPrivate *priv = GET_PRIVATE (chooser);
  LocaleInfo *info;
  gboolean is_extra;
  const gchar *source_name;

  if (row == priv->more_row)
    return !priv->showing_extra;

  is_extra = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "is-extra"));

  if (!priv->showing_extra && is_extra)
    return FALSE;

  if (!priv->filter_words)
    return TRUE;

  info = g_object_get_data (G_OBJECT (row), "locale-info");

  if (row == info->back_row)
    return TRUE;

  if (match_all (priv->filter_words, info->unaccented_name))
    return TRUE;

  if (match_all (priv->filter_words, info->untranslated_name))
    return TRUE;

  source_name = g_object_get_data (G_OBJECT (row), "unaccented-name");
  if (source_name)
    {
      if (match_all (priv->filter_words, source_name))
        return TRUE;
    }
  else
    {
      if (match_source_in_table (priv->filter_words, info->layout_rows_by_id))
        return TRUE;
      if (match_source_in_table (priv->filter_words, info->engine_rows_by_id))
        return TRUE;
    }

  return FALSE;
}
static gboolean
language_visible (GtkListBoxRow *row,
                  gpointer       user_data)
{
        CcLanguageChooser *chooser = user_data;
        CcLanguageChooserPrivate *priv = chooser->priv;
        gchar *locale_name = NULL;
        gchar *locale_current_name = NULL;
        gchar *locale_untranslated_name = NULL;
        LanguageWidget *widget;
        gboolean visible;
        GtkWidget *child;

        child = gtk_bin_get_child (GTK_BIN (row));
        if (child == priv->more_item)
                return !priv->showing_extra;

        widget = get_language_widget (child);

        if (!priv->showing_extra && widget->is_extra)
                return FALSE;

        if (!priv->filter_words)
                return TRUE;

        visible = FALSE;

        locale_name = cc_util_normalize_casefold_and_unaccent (widget->locale_name);
        visible = match_all (priv->filter_words, locale_name);
        if (visible)
                goto out;

        locale_current_name = cc_util_normalize_casefold_and_unaccent (widget->locale_current_name);
        visible = match_all (priv->filter_words, locale_current_name);
        if (visible)
                goto out;

        locale_untranslated_name = cc_util_normalize_casefold_and_unaccent (widget->locale_untranslated_name);
        visible = match_all (priv->filter_words, locale_untranslated_name);
        if (visible)
                goto out;

 out:
        g_free (locale_untranslated_name);
        g_free (locale_current_name);
        g_free (locale_name);
        return visible;
}
Esempio n. 3
0
File: bsr.c Progetto: AlD/bareos
/*********************************************************************
 *
 *      Match Bootstrap records
 *        returns  1 on match
 *        returns  0 no match and reposition is set if we should
 *                      reposition the tape
 *       returns -1 no additional matches possible
 */
int match_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, SESSION_LABEL *sessrec, JCR *jcr)
{
   int status;

   /*
    * The bsr->reposition flag is set any time a bsr is done.
    *   In this case, we can probably reposition the
    *   tape to the next available bsr position.
    */
   if (bsr) {
      bsr->reposition = false;
      status = match_all(bsr, rec, volrec, sessrec, true, jcr);
      /*
       * Note, bsr->reposition is set by match_all when
       *  a bsr is done. We turn it off if a match was
       *  found or if we cannot use positioning
       */
      if (status != 0 || !bsr->use_positioning) {
         bsr->reposition = false;
      }
   } else {
      status = 1;                       /* no bsr => match all */
   }
   return status;
}
static gboolean
language_visible (GtkListBoxRow *row,
                  gpointer   user_data)
{
        GtkDialog *chooser = user_data;
        CcLanguageChooserPrivate *priv = GET_PRIVATE (chooser);
        gchar *locale_name = NULL;
        gchar *locale_current_name = NULL;
        gchar *locale_untranslated_name = NULL;
        gboolean is_extra;
        gboolean visible;

        if (row == priv->more_item)
                return !priv->showing_extra;

        is_extra = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (row), "is-extra"));

        if (!priv->showing_extra && is_extra)
                return FALSE;

        if (!priv->filter_words)
                return TRUE;

        visible = FALSE;

        locale_name =
                cc_util_normalize_casefold_and_unaccent (g_object_get_data (G_OBJECT (row), "locale-name"));
        visible = match_all (priv->filter_words, locale_name);
        if (visible)
                goto out;

        locale_current_name =
                cc_util_normalize_casefold_and_unaccent (g_object_get_data (G_OBJECT (row), "locale-current-name"));
        visible = match_all (priv->filter_words, locale_current_name);
        if (visible)
                goto out;

        locale_untranslated_name =
                cc_util_normalize_casefold_and_unaccent (g_object_get_data (G_OBJECT (row), "locale-untranslated-name"));
        visible = match_all (priv->filter_words, locale_untranslated_name);

out:
        g_free (locale_untranslated_name);
        g_free (locale_current_name);
        g_free (locale_name);
        return visible;
}
Esempio n. 5
0
  bool NamespacesPolicy::Match(const X509_NAME* subject) {
    error_.resize(0);
    if(!file_) return false;
    std::string subject_str;
    std::string s;
    std::string policy_ca_subject;
    std::string policy_right;
    std::list<std::string> policy_patterns;
    bool right = false;
    bool failure = false;
    X509_NAME_to_string(subject_str, subject);
    bool permit = false;
    for(;;) {
      right = false;
      failure = false;
      get_one_rule(*file_, s);
      if(s.empty()) break;
      //logger.msg(INFO, "Get rule from namespaces file: %s", s.c_str());

      policy_ca_subject.resize(0);
      if(!get_issuer(s, policy_ca_subject, error_)) failure = true;
      //If the "SELF" token is contained.
      //According to the specification: 
      //The (quoted) issuerDirectoryName may be replaced by the single 
      //token “SELF”, in which case this policy applies to the issuer 
      //whose hash corresponds to the hash contained in the namespaces file name
      if(memicmp(policy_ca_subject.c_str(), selfissuer.c_str(), policy_ca_subject.length()) == 0) {
        policy_ca_subject.resize(0);
        policy_ca_subject = issuer_;
      }

      policy_right.resize(0);
      if(!get_right(s, policy_right, error_)) failure = true;
      else { right = (policy_right == "permit"); }

      policy_patterns.resize(0);
      if(!get_subject(s, policy_patterns, error_)) failure = true;

      if((!policy_ca_subject.empty()) && (!failure)) {
        //According to eugridpma's namespaces format specification: 
        //The policy can either permit or deny the issuer the right 
        //to issue subjects with specific names. A denial overrides 
        //any permissive statements in the same file.
        bool r = match_all(issuer_, subject_str, policy_ca_subject, policy_patterns);
        if(r && right) {
          //logger.msg(INFO, "The issuer: %s is permitted to sign the subject: %s", issuer_.c_str(), subject_str.c_str());
          permit = true;
        }
        else if(r && !right) { //Denial overrides
          //logger.msg(INFO, "The issuer: %s is explicitly denied to sign the subject: %s", issuer_.c_str(), subject_str.c_str());
          return false;
        }
        else {
          //logger.msg(INFO, "The subject: %s and issuer: %s in the verified certificate does not match any namespaces policies files", subject_str.c_str(), issuer_.c_str());
        }
      };
    };
    return permit;
  }
Esempio n. 6
0
int			get_max_len(char **av, char *t)
{
	int		len = 0;

	while (match_all(av, t, len))
	{
		len++;
	}
	return (len - 1);
}
Esempio n. 7
0
/* checks if a line matches all/some/one/none of a list of queries */
int match_all(char* p_line, t_query* p_root) {
    int RetVal = 0;
    
    if (p_root == NULL)
	return 0;

    RetVal += match(p_line, p_root);
    
    if (p_root->next)
	RetVal += match_all(p_line, p_root->next);
    return RetVal;
}
static gboolean
list_filter (GtkListBoxRow *row,
             gpointer user_data)
{
  GtkDialog *chooser = user_data;
  CcInputChooserPrivate *priv = GET_PRIVATE (chooser);
  LocaleInfo *info;
  gboolean is_extra;
  const gchar *source_name;
  GtkWidget *child;

  child = gtk_bin_get_child (GTK_BIN (row));

  if (child == priv->more_item)
    return !priv->showing_extra;

  is_extra = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (child), "is-extra"));

  if (!priv->showing_extra && is_extra)
    return FALSE;

  if (!priv->filter_words)
    return TRUE;

  info = g_object_get_data (G_OBJECT (child), "locale-info");

  if (match_all (priv->filter_words, info->unaccented_name))
    return TRUE;

  if (match_all (priv->filter_words, info->untranslated_name))
    return TRUE;

  source_name = g_object_get_data (G_OBJECT (child), "unaccented-name");
  if (source_name && match_all (priv->filter_words, source_name))
    return TRUE;

  return FALSE;
}
static gboolean
match_source_in_table (gchar      **words,
                       GHashTable  *table)
{
  GHashTableIter iter;
  gpointer row;
  const gchar *source_name;

  g_hash_table_iter_init (&iter, table);
  while (g_hash_table_iter_next (&iter, NULL, &row))
    {
      source_name = g_object_get_data (G_OBJECT (row), "unaccented-name");
      if (source_name && match_all (words, source_name))
        return TRUE;
    }
  return FALSE;
}
Esempio n. 10
0
File: bsr.c Progetto: AlD/bareos
/*
 * Match all the components of current record
 *   returns  1 on match
 *   returns  0 no match
 *   returns -1 no additional matches possible
 */
static int match_all(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec,
                     SESSION_LABEL *sessrec, bool done, JCR *jcr)
{
   Dmsg0(dbglevel, "Enter match_all\n");
   if (bsr->done) {
//    Dmsg0(dbglevel, "bsr->done set\n");
      goto no_match;
   }
   if (!match_volume(bsr, bsr->volume, volrec, 1)) {
      Dmsg2(dbglevel, "bsr fail bsr_vol=%s != rec read_vol=%s\n", bsr->volume->VolumeName,
            volrec->VolumeName);
      goto no_match;
   }
   Dmsg2(dbglevel, "OK bsr match bsr_vol=%s read_vol=%s\n", bsr->volume->VolumeName,
            volrec->VolumeName);

   if (!match_volfile(bsr, bsr->volfile, rec, 1)) {
      if (bsr->volfile) {
         Dmsg3(dbglevel, "Fail on file=%u. bsr=%u,%u\n",
               rec->File, bsr->volfile->sfile, bsr->volfile->efile);
      }
      goto no_match;
   }

   if (!match_voladdr(bsr, bsr->voladdr, rec, 1)) {
      if (bsr->voladdr) {
         Dmsg3(dbglevel, "Fail on Addr=%llu. bsr=%llu,%llu\n",
               get_record_address(rec), bsr->voladdr->saddr, bsr->voladdr->eaddr);
      }
      goto no_match;
   }

   if (!match_sesstime(bsr, bsr->sesstime, rec, 1)) {
      Dmsg2(dbglevel, "Fail on sesstime. bsr=%u rec=%u\n",
         bsr->sesstime->sesstime, rec->VolSessionTime);
      goto no_match;
   }

   /* NOTE!! This test MUST come after the sesstime test */
   if (!match_sessid(bsr, bsr->sessid, rec)) {
      Dmsg2(dbglevel, "Fail on sessid. bsr=%u rec=%u\n",
         bsr->sessid->sessid, rec->VolSessionId);
      goto no_match;
   }

   /* NOTE!! This test MUST come after sesstime and sessid tests */
   if (!match_findex(bsr, bsr->FileIndex, rec, 1)) {
      Dmsg3(dbglevel, "Fail on findex=%d. bsr=%d,%d\n",
         rec->FileIndex, bsr->FileIndex->findex, bsr->FileIndex->findex2);
      goto no_match;
   }
   Dmsg3(dbglevel, "match on findex=%d. bsr=%d,%d\n",
         rec->FileIndex, bsr->FileIndex->findex, bsr->FileIndex->findex2);

   if (!match_fileregex(bsr, rec, jcr)) {
     Dmsg1(dbglevel, "Fail on fileregex='%s'\n", bsr->fileregex);
     goto no_match;
   }

   /* This flag is set by match_fileregex (and perhaps other tests) */
   if (bsr->skip_file) {
      Dmsg1(dbglevel, "Skipping findex=%d\n", rec->FileIndex);
      goto no_match;
   }

   /*
    * If a count was specified and we have a FileIndex, assume
    *   it is a Bareos created bsr (or the equivalent). We
    *   then save the bsr where the match occurred so that
    *   after processing the record or records, we can update
    *   the found count. I.e. rec->bsr points to the bsr that
    *   satisfied the match.
    */
   if (bsr->count && bsr->FileIndex) {
      rec->bsr = bsr;
      Dmsg0(dbglevel, "Leave match_all 1\n");
      return 1;                       /* this is a complete match */
   }

   /*
    * The selections below are not used by Bareos's
    *   restore command, and don't work because of
    *   the rec->bsr = bsr optimization above.
    */
   if (!match_jobid(bsr, bsr->JobId, sessrec, 1)) {
      Dmsg0(dbglevel, "fail on JobId\n");
      goto no_match;

   }
   if (!match_job(bsr, bsr->job, sessrec, 1)) {
      Dmsg0(dbglevel, "fail on Job\n");
      goto no_match;
   }
   if (!match_client(bsr, bsr->client, sessrec, 1)) {
      Dmsg0(dbglevel, "fail on Client\n");
      goto no_match;
   }
   if (!match_job_type(bsr, bsr->JobType, sessrec, 1)) {
      Dmsg0(dbglevel, "fail on Job type\n");
      goto no_match;
   }
   if (!match_job_level(bsr, bsr->JobLevel, sessrec, 1)) {
      Dmsg0(dbglevel, "fail on Job level\n");
      goto no_match;
   }
   if (!match_stream(bsr, bsr->stream, rec, 1)) {
      Dmsg0(dbglevel, "fail on stream\n");
      goto no_match;
   }
   return 1;

no_match:
   if (bsr->next) {
      return match_all(bsr->next, rec, volrec, sessrec, bsr->done && done, jcr);
   }
   if (bsr->done && done) {
      Dmsg0(dbglevel, "Leave match all -1\n");
      return -1;
   }
   Dmsg0(dbglevel, "Leave match all 0\n");
   return 0;
}
Esempio n. 11
0
/** see if buffers contain the same packet */
static int
test_buffers(sldns_buffer* pkt, sldns_buffer* out)
{
	/* check binary same */
	if(sldns_buffer_limit(pkt) == sldns_buffer_limit(out) &&
		memcmp(sldns_buffer_begin(pkt), sldns_buffer_begin(out),
			sldns_buffer_limit(pkt)) == 0) {
		if(vbmp) printf("binary the same (length=%u)\n",
				(unsigned)sldns_buffer_limit(pkt));
		return 1;
	}

	if(vbmp) {
		size_t sz = 16;
		size_t count;
		size_t lim = sldns_buffer_limit(out);
		if(sldns_buffer_limit(pkt) < lim)
			lim = sldns_buffer_limit(pkt);
		for(count=0; count<lim; count+=sz) {
			size_t rem = sz;
			if(lim-count < sz) rem = lim-count;
			if(memcmp(sldns_buffer_at(pkt, count), 
				sldns_buffer_at(out, count), rem) == 0) {
				log_info("same %d %d", (int)count, (int)rem);
				log_hex("same: ", sldns_buffer_at(pkt, count),
					rem);
			} else {
				log_info("diff %d %d", (int)count, (int)rem);
				log_hex("difp: ", sldns_buffer_at(pkt, count),
					rem);
				log_hex("difo: ", sldns_buffer_at(out, count),
					rem);
			}
		}
	}

	/* check if it 'means the same' */
	if(vbmp) {
		char* s1, *s2;
		log_buf(0, "orig in hex", pkt);
		log_buf(0, "unbound out in hex", out);
		printf("\npacket from unbound (%d):\n", 
			(int)sldns_buffer_limit(out));
		s1 = sldns_wire2str_pkt(sldns_buffer_begin(out),
			sldns_buffer_limit(out));
		printf("%s\n", s1?s1:"null");
		free(s1);

		printf("\npacket original (%d):\n", 
			(int)sldns_buffer_limit(pkt));
		s2 = sldns_wire2str_pkt(sldns_buffer_begin(pkt),
			sldns_buffer_limit(pkt));
		printf("%s\n", s2?s2:"null");
		free(s2);
		printf("\n");
	}
	/* if it had two EDNS sections, skip comparison */
	if(1) {
		char* s = sldns_wire2str_pkt(sldns_buffer_begin(pkt),
			sldns_buffer_limit(pkt));
		char* e1 = strstr(s, "; EDNS:");
		if(e1 && strstr(e1+4, "; EDNS:")) {
			free(s);
			return 0;
		}
		free(s);
	}
	/* compare packets */
	unit_assert(match_all(sldns_buffer_begin(pkt), sldns_buffer_limit(pkt),
		sldns_buffer_begin(out), sldns_buffer_limit(out), 1,
		matches_nolocation));
	return 0;
}
/** see if buffers contain the same packet */
static int
test_buffers(ldns_buffer* pkt, ldns_buffer* out)
{
	ldns_pkt* p1=0, *p2=0;
	ldns_status s1, s2;
	/* check binary same */
	if(ldns_buffer_limit(pkt) == ldns_buffer_limit(out) &&
		memcmp(ldns_buffer_begin(pkt), ldns_buffer_begin(out),
			ldns_buffer_limit(pkt)) == 0) {
		if(vbmp) printf("binary the same (length=%u)\n",
				(unsigned)ldns_buffer_limit(pkt));
		return 1;
	}

	if(vbmp) {
		size_t sz = 16;
		size_t count;
		size_t lim = ldns_buffer_limit(out);
		if(ldns_buffer_limit(pkt) < lim)
			lim = ldns_buffer_limit(pkt);
		for(count=0; count<lim; count+=sz) {
			size_t rem = sz;
			if(lim-count < sz) rem = lim-count;
			if(memcmp(ldns_buffer_at(pkt, count), 
				ldns_buffer_at(out, count), rem) == 0) {
				log_info("same %d %d", (int)count, (int)rem);
				log_hex("same: ", ldns_buffer_at(pkt, count),
					rem);
			} else {
				log_info("diff %d %d", (int)count, (int)rem);
				log_hex("difp: ", ldns_buffer_at(pkt, count),
					rem);
				log_hex("difo: ", ldns_buffer_at(out, count),
					rem);
			}
		}
	}
	/* check if it 'means the same' */
	s1 = ldns_buffer2pkt_wire(&p1, pkt);
	s2 = ldns_buffer2pkt_wire(&p2, out);
	if(vbmp) {
		log_buf(0, "orig in hex", pkt);
		log_buf(0, "unbound out in hex", out);
		printf("\npacket from unbound (%d):\n", 
			(int)ldns_buffer_limit(out));
		ldns_pkt_print(stdout, p2);

		printf("\npacket original (%d):\n", 
			(int)ldns_buffer_limit(pkt));
		ldns_pkt_print(stdout, p1);
		printf("\n");
	}
	if(s1 != s2) {
		/* oops! */
		printf("input ldns parse: %s, output ldns parse: %s.\n",
			ldns_get_errorstr_by_id(s1), 
			ldns_get_errorstr_by_id(s2));
		unit_assert(0);
	}
	/* compare packets */
	unit_assert(match_all(p1, p2));
	ldns_pkt_free(p1);
	ldns_pkt_free(p2);
	return 0;
}
Esempio n. 13
0
int main(int argc, char* argv[]) {
    t_query* p_query_pos = NULL;
    t_query* p_query_neg = NULL;
    t_query* p_query_ignore = NULL;
    t_line* p_lines;
    t_line* p_act;
    char filename[SZ_FILENAME];
    char posname[SZ_FILENAME];
    char negname[SZ_FILENAME];
    char ignorename[SZ_FILENAME] = "ignore.std";
    int neg_match = 0;
    int missing_pos_match = 0;
	int i=0;

#ifdef WIN32
#ifdef _DEBUG
		printf("Command Line before parse:\n");
		for (i=0;i<argc;i++)
			printf("%s ",argv[i]);
		printf("\n");

#endif
#endif
    
	/* if whe have more than 3 parameters interpret and shift argument list */
    /* (add a loop later) */
	if (argc >= 3) {
	  if (strcmp("-v", argv[1]) == 0) {
	    verbose = 1;
	    argv[1] = argv[2];
	    argc--;
	  }
    }

	/* if less than 2 printout usage */
    if (argc < 2) {
	fprintf(stderr, "usage: %s <testname>\n", argv[0]);
	exit (-1);
    }
#ifdef WIN32
#ifdef _DEBUG
	if (verbose)
	{
		printf("Command Line after parse:\n");
		for (i=0;i<argc;i++)
			printf("%s ",argv[i]);
		printf("\n");
	}

#endif
#endif


	/* create filenames */
#ifdef WIN32
    sprintf(filename, "%s.txt", argv[1]);
#else
	sprintf(filename, "%s.out", argv[1]);
#endif
    sprintf(posname, "%s.std", argv[1]);
    sprintf(negname, "%s.neg", argv[1]);
    
	/* read queries and lines */
    p_query_pos = read_queries(posname);
    p_query_neg = read_queries(negname);
    p_query_ignore = read_queries(ignorename);
    p_lines = read_lines(filename);
    
	/* walk through all lines of testoutput */
    for (p_act = p_lines; p_act != NULL; p_act=p_act->next) {
	
	/* if a line is not defined as positive match, mark it for output */
	if (match_all(p_act->line, p_query_pos) < 1)
	    p_act->show = 1;
	
	/* ignore overrides lines not in pos. match */
	if (match_all(p_act->line, p_query_ignore)) {
	    p_act->show = 0;
	}

	/* if a line is defined as negative match, mark it for output */
	/* negatives overides ignore */
	if (match_all(p_act->line, p_query_neg)) {
	    p_act->show = 1;
	    neg_match++;
	}
    }

	/* are there unsatisfyed positive queries ? */
    missing_pos_match = unmatched(p_query_pos);
    
    if (neg_match || missing_pos_match) {
	printf("\n");
	printf("Test '%s' failed\n", argv[1]);
	if (verbose) {
	    if (neg_match)
		printf("- matched negative criteria: %d\n",neg_match);
	    if (missing_pos_match) {
		printf("- unmatched positive criteria: %d\n",missing_pos_match);
		print_unmatched(p_query_pos);
	    }
	}
	printf("\nOUTPUT:\n");
	for (p_act = p_lines; p_act != NULL; p_act=p_act->next) {
	    if (p_act->show)
		printf("%s\n", p_act->line);
	}
	printf("\n");
    }
    else {
	if (debug)
	    printf("Test '%s' was successfull\n", argv[1]);
    }

    return 0;
}
Esempio n. 14
0
/* finds entry in list, or returns NULL */
struct entry* 
find_match(struct entry* entries, ldns_pkt* query_pkt,
	enum transport_type transport)
{
	struct entry* p = entries;
	ldns_pkt* reply = NULL;
	for(p=entries; p; p=p->next) {
		verbose(3, "comparepkt: ");
		reply = p->reply_list->reply;
		if(p->match_opcode && ldns_pkt_get_opcode(query_pkt) != 
			ldns_pkt_get_opcode(reply)) {
			verbose(3, "bad opcode\n");
			continue;
		}
		if(p->match_qtype && get_qtype(query_pkt) != get_qtype(reply)) {
			verbose(3, "bad qtype\n");
			continue;
		}
		if(p->match_qname) {
			if(!get_owner(query_pkt) || !get_owner(reply) ||
				ldns_dname_compare(
				get_owner(query_pkt), get_owner(reply)) != 0) {
				verbose(3, "bad qname\n");
				continue;
			}
		}
		if(p->match_subdomain) {
			if(!get_owner(query_pkt) || !get_owner(reply) ||
				(ldns_dname_compare(get_owner(query_pkt), 
				get_owner(reply)) != 0 &&
				!ldns_dname_is_subdomain(
				get_owner(query_pkt), get_owner(reply))))
			{
				verbose(3, "bad subdomain\n");
				continue;
			}
		}
		if(p->match_serial && get_serial(query_pkt) != p->ixfr_soa_serial) {
				verbose(3, "bad serial\n");
				continue;
		}
		if(p->match_do && !ldns_pkt_edns_do(query_pkt)) {
			verbose(3, "no DO bit set\n");
			continue;
		}
		if(p->match_noedns && ldns_pkt_edns(query_pkt)) {
			verbose(3, "bad; EDNS OPT present\n");
			continue;
		}
		if(p->match_transport != transport_any && p->match_transport != transport) {
			verbose(3, "bad transport\n");
			continue;
		}
		if(p->match_all && !match_all(query_pkt, reply, p->match_ttl)) {
			verbose(3, "bad allmatch\n");
			continue;
		}
		verbose(3, "match!\n");
		return p;
	}
	return NULL;
}