[Open-scap] XCCDF_POLICY bindings

Maros Barabas mbarabas at redhat.com
Wed Jun 9 11:46:35 UTC 2010


Hi Josh,

     However I can't resolve this issue now, I have added a function and API 
to XCCDF Policy layer so you can use it in Python without callback but without 
other checking engines then OVAL. 

Temporal workaround: You have to evaluate OVAL definition file first and get OVAL 
result system. Then call new xccdf_policy_evaluate_oval function with policy 
and result system as arguments without registering callback. After 
implementing new variable system I will remake this to have one-loop checking 
algorithm with full XCCDF support.

Regards,
Maros Barabas

On Thursday, May 27, 2010 08:40:35 pm you wrote:
> Unfortunately I'm still having issues with this.  While I can now use
> xccdf_policy_model_register_callback, it segfaults when calling
> xccdf_policy_model_evaluate.  I was able to trace it down to the fact that
> the values being received by register_callback for both the function
> pointer and usr pointer were 0.  It seems that swig is dropping these
> values and causing the segfault when I try to evaluate the policy model.
> 
> Thanks for the help,
> 
> Josh Adams
> 
> 
> -----Original Message-----
> From: Maros Barabas [mailto:mbarabas at redhat.com]
> Sent: Tue 5/25/2010 11:13 AM
> To: open-scap-list at redhat.com
> Cc: Joshua Adams
> Subject: Re: [Open-scap] XCCDF_POLICY bindings
> 
> Hi Joshua,
> 
>      thanks for finding bug, I have added typemap for (void *) arguments.
> 
> The correct use should be:
> 
> def callback(model, href, id, usr):
>    # model = struct xccdf_policy_model
>    # href = string
>    # id = string
>    # usr = None or whatever user passed to register function
>    pass
> 
> ben = oscap_import_source_new_file("absolute-path-to-file", "UTF-8")
> benchmark = xccdf_benchmark_import(ben)
> policy_model = xccdf_policy_model_new(benchmark)
> 
> reg = xccdf_policy_model_register_callback(policy_model,
> "http://oval.mitre.org/XMLSchema/oval-definitions-5", callback, None)
> 
> Try the last release, should work now.
> 
> On Monday 24 May 2010 08:48:19 pm Joshua Adams wrote:
> > I've run into a bit of an issue with the XCCDF_POLICY Python bindings. 
> > I'm trying to use xccdf_policy_register_callback, which takes a function
> > pointer as one of its arguments.  Ideally I'd want to define the
> > callback function in Python and I've been trying to get this to work,
> > but my knowledge of SWIG is rather limited.  I'm assuming this would
> > need some sort of typemap in the interface file, but I haven't had much
> > luck finding an example of this.
> > 
> > Any help would be appreciated,
> > 
> > Josh Adams
> > 
> > _______________________________________________
> > Open-scap-list mailing list
> > Open-scap-list at redhat.com
> > https://www.redhat.com/mailman/listinfo/open-scap-list




More information about the Open-scap-list mailing list