[Open-scap] XCCDF_POLICY bindings

Joshua Adams jadams at tresys.com
Thu May 27 18:40:35 UTC 2010


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