On Thu, Apr 06, 2017 at 11:41:03PM +0300, Matteo Cafasso wrote:
+#include <yara.h> + +#define CLEANUP_DESTROY_YARA_COMPILER \ + __attribute__((cleanup(cleanup_destroy_yara_compiler)))
While we should probably get rid of HAVE_ATTRIBUTE_CLEANUP, while we still have it you need to use it here and provide the alternative for people who don't HAVE_ATTRIBUTE_CLEANUP.
+/* Has one FileIn parameter. + * Takes optional arguments, consult optargs_bitmask. + */ +int +do_yara_load (void) +{ + int ret = 0;
You're not returning 'ret', so call it something else, eg. 'r'.
+ CLEANUP_CLOSE int fd = -1; + char tmpfile[] = "/tmp/yaraXXXXXX"; + + fd = mkstemp (tmpfile); + if (fd == -1) { + reply_with_perror ("mkstemp"); + return -1; + } + + ret = upload_to_fd (fd); + if (ret < 0) {
upload_to_fd returns 0 or -1, so only check for r == -1.
+static void +compile_error_callback(int level, const char *name, int line, + const char *message, void *data)
Space before the opening parenthesis.
+let daemon_functions = [ + { defaults with + name = "yara_load"; added = (1, 37, 9); + style = RErr, [FileIn "filename"], []; + progress = true; cancellable = true; + optional = Some "libyara"; + shortdesc = "load yara rules within libguestfs"; + longdesc = "\ +Load a set of Yara rules from F<filename> within libguestfs appliance.
This is still confusingly worded, but after examining the code I think I understand what you're trying to say. Just replace this first sentence with: "Upload a set of Yara rules from local file F<filename>.
+Yara rules allow to categorize files based on textual or binary patterns +within their content. +See C<yara_scan> to see how to scan files with the loaded rules.
This should be: C<guestfs_yara_scan>. The generator will replace C<guestfs_ with the correct link. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v