@@ -77,7 +77,7 @@ struct cbargs {
77
77
};
78
78
79
79
#if defined(OS_FREEBSD )
80
- static int file_cb (const char * prefix , const char * p , const char * f , void * ptr , SEXP_t * gr_lastpath )
80
+ static int file_cb (const char * prefix , const char * p , const char * f , void * ptr , SEXP_t * gr_lastpath , struct oscap_list * blocked_paths )
81
81
{
82
82
char path_buffer [PATH_MAX ];
83
83
SEXP_t * item ;
@@ -110,6 +110,10 @@ static int file_cb(const char *prefix, const char *p, const char *f, void *ptr,
110
110
st_path = path_buffer ;
111
111
}
112
112
113
+ if (probe_path_is_blocked (st_path , blocked_paths )) {
114
+ return 0 ;
115
+ }
116
+
113
117
char * st_path_with_prefix = oscap_path_join (prefix , st_path );
114
118
115
119
/* update lastpath if needed */
@@ -205,7 +209,7 @@ static int file_cb(const char *prefix, const char *p, const char *f, void *ptr,
205
209
}
206
210
207
211
#else
208
- static int file_cb (const char * prefix , const char * p , const char * f , void * ptr , SEXP_t * gr_lastpath )
212
+ static int file_cb (const char * prefix , const char * p , const char * f , void * ptr , SEXP_t * gr_lastpath , struct oscap_list * blocked_paths )
209
213
{
210
214
char path_buffer [PATH_MAX ];
211
215
SEXP_t * item , xattr_name ;
@@ -231,6 +235,10 @@ static int file_cb(const char *prefix, const char *p, const char *f, void *ptr,
231
235
232
236
SEXP_init (& xattr_name );
233
237
238
+ if (probe_path_is_blocked (st_path , blocked_paths )) {
239
+ return 0 ;
240
+ }
241
+
234
242
char * st_path_with_prefix = oscap_path_join (prefix , st_path );
235
243
do {
236
244
/* estimate the size of the buffer */
@@ -441,7 +449,7 @@ int fileextendedattribute_probe_main(probe_ctx *ctx, void *mutex)
441
449
442
450
if ((ofts = oval_fts_open_prefixed (prefix , path , filename , filepath , behaviors , probe_ctx_getresult (ctx ))) != NULL ) {
443
451
while ((ofts_ent = oval_fts_read (ofts )) != NULL ) {
444
- file_cb (prefix , ofts_ent -> path , ofts_ent -> file , & cbargs , & gr_lastpath );
452
+ file_cb (prefix , ofts_ent -> path , ofts_ent -> file , & cbargs , & gr_lastpath , ctx -> blocked_paths );
445
453
oval_ftsent_free (ofts_ent );
446
454
}
447
455
oval_fts_close (ofts );
0 commit comments