33
33
#include "debug_priv.h"
34
34
#include "oval_fts.h"
35
35
#include "list.h"
36
+ #include "probe/probe.h"
36
37
38
+ int yamlfilecontent_probe_offline_mode_supported ()
39
+ {
40
+ return PROBE_OFFLINE_OWN ;
41
+ }
37
42
38
43
static int yaml_path_query (const char * filepath , const char * yaml_path_cstr , struct oscap_list * values , probe_ctx * ctx )
39
44
{
@@ -125,13 +130,14 @@ static int yaml_path_query(const char *filepath, const char *yaml_path_cstr, str
125
130
return ret ;
126
131
}
127
132
128
- static int process_yaml_file (const char * path , const char * filename , const char * yamlpath , probe_ctx * ctx )
133
+ static int process_yaml_file (const char * prefix , const char * path , const char * filename , const char * yamlpath , probe_ctx * ctx )
129
134
{
130
135
int ret = 0 ;
131
136
char * filepath = oscap_path_join (path , filename );
132
137
struct oscap_list * values = oscap_list_new ();
138
+ char * filepath_with_prefix = oscap_path_join (prefix , filepath );
133
139
134
- if (yaml_path_query (filepath , yamlpath , values , ctx )) {
140
+ if (yaml_path_query (filepath_with_prefix , yamlpath , values , ctx )) {
135
141
ret = -1 ;
136
142
goto cleanup ;
137
143
}
@@ -160,6 +166,7 @@ static int process_yaml_file(const char *path, const char *filename, const char
160
166
161
167
cleanup :
162
168
oscap_list_free (values , free );
169
+ free (filepath_with_prefix );
163
170
free (filepath );
164
171
return ret ;
165
172
}
@@ -176,16 +183,17 @@ int yamlfilecontent_probe_main(probe_ctx *ctx, void *arg)
176
183
char * yamlpath_str = SEXP_string_cstr (yamlpath_val );
177
184
178
185
probe_filebehaviors_canonicalize (& behaviors_ent );
186
+ const char * prefix = getenv ("OSCAP_PROBE_ROOT" );
179
187
OVAL_FTS * ofts = oval_fts_open_prefixed (
180
- NULL , path_ent , filename_ent , filepath_ent , behaviors_ent ,
188
+ prefix , path_ent , filename_ent , filepath_ent , behaviors_ent ,
181
189
probe_ctx_getresult (ctx ));
182
190
if (ofts != NULL ) {
183
191
OVAL_FTSENT * ofts_ent ;
184
192
while ((ofts_ent = oval_fts_read (ofts )) != NULL ) {
185
193
if (ofts_ent -> fts_info == FTS_F
186
194
|| ofts_ent -> fts_info == FTS_SL ) {
187
- process_yaml_file (
188
- ofts_ent -> path , ofts_ent -> file , yamlpath_str , ctx );
195
+ process_yaml_file (prefix , ofts_ent -> path , ofts_ent -> file ,
196
+ yamlpath_str , ctx );
189
197
}
190
198
oval_ftsent_free (ofts_ent );
191
199
}
0 commit comments