Skip to content

Commit f865cb4

Browse files
committed
OVAL/environmentvariable58_probe: Support offline mode (docker/podman)
1 parent efe36b8 commit f865cb4

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/OVAL/probes/independent/environmentvariable58_probe.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include <sys/types.h>
5252
#include <dirent.h>
5353

54+
#include <probe/probe.h>
5455
#include "_seap.h"
5556
#include "probe-api.h"
5657
#include "probe/entcmp.h"
@@ -192,6 +193,11 @@ static int read_environment(SEXP_t *pid_ent, SEXP_t *name_ent, probe_ctx *ctx)
192193
return err;
193194
}
194195

196+
int environmentvariable58_probe_offline_mode_supported(void)
197+
{
198+
return PROBE_OFFLINE_OWN;
199+
}
200+
195201
int environmentvariable58_probe_main(probe_ctx *ctx, void *arg)
196202
{
197203
SEXP_t *probe_in, *name_ent, *pid_ent;
@@ -229,9 +235,16 @@ int environmentvariable58_probe_main(probe_ctx *ctx, void *arg)
229235
SEXP_free(nref);
230236
SEXP_free(nval);
231237
pid_ent = new_pid_ent;
238+
} else {
239+
if (ctx->offline_mode != PROBE_OFFLINE_NONE) {
240+
err = PROBE_EINVAL;
241+
goto cleanup;
242+
}
232243
}
233244

234245
err = read_environment(pid_ent, name_ent, ctx);
246+
247+
cleanup:
235248
SEXP_free(name_ent);
236249
SEXP_free(pid_ent);
237250

src/OVAL/probes/independent/environmentvariable58_probe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "probe-api.h"
2727

28+
int environmentvariable58_probe_offline_mode_supported(void);
2829
int environmentvariable58_probe_main(probe_ctx *ctx, void *arg);
2930

3031
#endif /* OPENSCAP_ENVIRONMENTVARIABLE58_PROBE_H */

src/OVAL/probes/probe-table.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ static const probe_table_entry_t probe_table[] = {
213213
{OVAL_INDEPENDENT_ENVIRONMENT_VARIABLE, NULL, environmentvariable_probe_main, NULL, NULL},
214214
#endif
215215
#ifdef OPENSCAP_PROBE_INDEPENDENT_ENVIRONMENTVARIABLE58
216-
{OVAL_INDEPENDENT_ENVIRONMENT_VARIABLE58, NULL, environmentvariable58_probe_main, NULL, NULL},
216+
{OVAL_INDEPENDENT_ENVIRONMENT_VARIABLE58, NULL, environmentvariable58_probe_main, NULL, environmentvariable58_probe_offline_mode_supported},
217217
#endif
218218
#ifdef OPENSCAP_PROBE_INDEPENDENT_FAMILY
219219
{OVAL_INDEPENDENT_FAMILY, NULL, family_probe_main, NULL, family_probe_offline_mode_supported},

0 commit comments

Comments
 (0)