Lines Matching refs:rec
98 struct selabel_handle *rec, const char *path)
106 rc = process_line(rec, path, prefix, line_buf, ++lineno);
116 static int load_mmap(FILE *fp, size_t len, struct selabel_handle *rec,
119 struct saved_data *data = (struct saved_data *)rec->data;
334 if (strcmp(spec->lr.ctx_raw, "<<none>>") && rec->validating) {
335 if (selabel_validate(rec, &spec->lr) < 0) {
533 struct selabel_handle *rec,
554 load_mmap(fp, sb.st_size, rec, found_path) :
555 process_text_file(fp, prefix, rec, found_path);
710 static void closef(struct selabel_handle *rec);
713 static int init(struct selabel_handle *rec, const struct selinux_opt *opts, unsigned n)
715 struct saved_data *data = (struct saved_data *)rec->data;
736 rec->spec_file = (char **)calloc(path_nums, sizeof(char *));
737 if (rec->spec_file == NULL) {
740 rec->spec_file_nums = path_nums;
745 rec->spec_file[i] = strdup(opts[n].value);
746 if (rec->spec_file[i] == NULL) {
753 for (int path_index = 0; path_index < rec->spec_file_nums; path_index++) {
754 status = process_file(rec->spec_file[path_index], NULL, rec, prefix, rec->digest);
759 if (rec->validating) {
760 status = nodups_specs(data, rec->spec_file[path_index]);
767 digest_gen_hash(rec->digest);
773 closef(rec);
778 static int init(struct selabel_handle *rec, const struct selinux_opt *opts,
781 struct saved_data *data = (struct saved_data *)rec->data;
806 rec->digest, &data->dist_subs);
810 rec->digest, &data->subs);
816 status = selabel_subs_init(subs_file, rec->digest,
821 status = selabel_subs_init(subs_file, rec->digest,
832 rec->spec_file = strdup(path);
837 status = process_file(path, NULL, rec, prefix, rec->digest);
841 if (rec->validating) {
848 status = process_file(path, "homedirs", rec, prefix,
849 rec->digest);
853 status = process_file(path, "local", rec, prefix,
854 rec->digest);
859 digest_gen_hash(rec->digest);
865 closef(rec);
874 static void closef(struct selabel_handle *rec)
876 struct saved_data *data = (struct saved_data *)rec->data;
922 static struct spec **lookup_all(struct selabel_handle *rec,
928 struct saved_data *data = (struct saved_data *)rec->data;
1065 static struct spec *lookup_common(struct selabel_handle *rec,
1069 struct spec **matches = lookup_all(rec, key, type, partial, NULL);
1083 static bool get_digests_all_partial_matches(struct selabel_handle *rec,
1097 bool status = selabel_hash_all_partial_matches(rec, pathname,
1131 static bool hash_all_partial_matches(struct selabel_handle *rec, const char *key, uint8_t *digest)
1136 struct spec **matches = lookup_all(rec, key, 0, true, &total_matches);
1162 static struct selabel_lookup_rec *lookup(struct selabel_handle *rec,
1167 spec = lookup_common(rec, key, type, false);
1173 static bool partial_match(struct selabel_handle *rec, const char *key)
1175 return lookup_common(rec, key, 0, true) ? true : false;
1178 static struct selabel_lookup_rec *lookup_best_match(struct selabel_handle *rec,
1190 return lookup(rec, key, type);
1198 specs[0] = lookup_common(rec, key, type, false);
1209 specs[i] = lookup_common(rec, aliases[i-1], type, false);
1319 static void stats(struct selabel_handle *rec)
1321 struct saved_data *data = (struct saved_data *)rec->data;
1349 int selabel_file_init(struct selabel_handle *rec,
1360 rec->data = data;
1361 rec->func_close = &closef;
1362 rec->func_stats = &stats;
1363 rec->func_lookup = &lookup;
1364 rec->func_partial_match = &partial_match;
1365 rec->func_get_digests_all_partial_matches =
1367 rec->func_hash_all_partial_matches = &hash_all_partial_matches;
1368 rec->func_lookup_best_match = &lookup_best_match;
1369 rec->func_cmp = &cmp;
1371 return init(rec, opts, nopts);