Lines Matching full:spec
69 struct spec *curr_spec, *spec_arr = data->spec_arr;
271 struct spec *spec;
279 spec = &data->spec_arr[data->nspec];
280 spec->from_mmap = 1;
281 spec->regcomp = 1;
304 spec->lr.ctx_raw = str_buf;
306 if (strcmp(spec->lr.ctx_raw, "<<none>>") && rec->validating) {
307 if (selabel_validate(rec, &spec->lr) < 0) {
309 "%s: context %s is invalid\n", mmap_path, spec->lr.ctx_raw);
321 spec->regex_str = (char *)mmap_area->next_addr;
326 if (spec->regex_str[entry_len - 1] != '\0') {
339 spec->mode = mode;
347 spec->stem_id = -1;
349 spec->stem_id = stem_map[stem_id];
356 spec->hasMetaChars = meta_chars;
364 spec->prefix_len = prefix_len;
373 spec->regex = (pcre *)mmap_area->next_addr;
380 rc = pcre_fullinfo(spec->regex, NULL, PCRE_INFO_SIZE, &len);
391 spec->lsd.study_data = (void *)mmap_area->next_addr;
392 spec->lsd.flags |= PCRE_EXTRA_STUDY_DATA;
398 rc = pcre_fullinfo(spec->regex, &spec->lsd,
491 * Then do detailed validation of the input and fill the spec array
555 * The do detailed validation of the input and fill the spec array
597 struct spec *spec;
602 spec = &data->spec_arr[i];
603 free(spec->lr.ctx_trans);
604 free(spec->lr.ctx_raw);
605 if (spec->from_mmap)
607 free(spec->regex_str);
608 free(spec->type_str);
609 if (spec->regcomp) {
610 pcre_free(spec->regex);
611 pcre_free_study(spec->sd);
637 static struct spec *lookup_common(struct selabel_handle *rec,
643 struct spec *spec_arr = data->spec_arr;
647 struct spec *ret = NULL;
685 struct spec *spec = &spec_arr[i];
686 /* if the spec in question matches no stem or has the same
687 * stem as the file AND if the spec in question has no mode
690 if ((spec->stem_id == -1 || spec->stem_id == file_stem) &&
691 (!mode || !spec->mode || mode == spec->mode)) {
692 if (compile_regex(data, spec, NULL) < 0)
694 if (spec->stem_id == -1)
695 rc = pcre_exec(spec->regex,
696 get_pcre_extra(spec),
700 rc = pcre_exec(spec->regex,
701 get_pcre_extra(spec),
705 spec->matches++;
736 struct spec *spec;
738 spec = lookup_common(rec, key, type, false);
739 if (spec)
740 return &spec->lr;
756 struct spec **specs;
766 specs = calloc(n+1, sizeof(struct spec *));
806 static enum selabel_cmp_result incomp(struct spec *spec1, struct spec *spec2, const char *reason, int i, int j)
822 struct spec *spec_arr1 = data1->spec_arr, *spec_arr2 = data2->spec_arr;
829 struct spec *spec1 = &spec_arr1[i];
830 struct spec *spec2 = &spec_arr2[j];
901 struct spec *spec_arr = data->spec_arr;