Displaying 20 results from an estimated 29 matches for "upload_to_fd".
2016 Dec 14
2
[PATCH] daemon: expose file upload logic
Exposing file upload logic as suggested in previous patch:
https://www.redhat.com/archives/libguestfs/2016-November/msg00109.html
Matteo Cafasso (1):
daemon: expose upload logic
daemon/daemon.h | 3 +++
daemon/upload.c | 70 ++++++++++++++++++++++++++++++++-------------------------
2 files changed, 42 insertions(+), 31 deletions(-)
--
2.10.2
2016 Dec 14
0
[PATCH] daemon: expose file upload logic
...b68 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -256,6 +256,9 @@ extern int64_t ntfs_minimum_size (const char *device);
extern int swap_set_uuid (const char *device, const char *uuid);
extern int swap_set_label (const char *device, const char *label);
+/*-- in upload.c --*/
+extern int upload_to_fd (int fd);
+
/* ordinary daemon functions use these to indicate errors
* NB: you don't need to prefix the string with the current command,
* it is added automatically by the client-side RPC stubs.
diff --git a/daemon/upload.c b/daemon/upload.c
index 8b4f600..0f385b6 100644
--- a/daemon/uplo...
2017 Mar 12
0
[PATCH v4 1/7] daemon: expose file upload logic
...8dd 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -258,6 +258,9 @@ extern int64_t ntfs_minimum_size (const char *device);
extern int swap_set_uuid (const char *device, const char *uuid);
extern int swap_set_label (const char *device, const char *label);
+/*-- in upload.c --*/
+extern int upload_to_fd (int fd);
+
/* ordinary daemon functions use these to indicate errors
* NB: you don't need to prefix the string with the current command,
* it is added automatically by the client-side RPC stubs.
diff --git a/daemon/upload.c b/daemon/upload.c
index 655baf29d..144bb246c 100644
--- a/daemon/...
2017 Apr 06
0
[PATCH v6 1/7] daemon: expose file upload logic
...dd9 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -259,6 +259,9 @@ extern int64_t ntfs_minimum_size (const char *device);
extern int swap_set_uuid (const char *device, const char *uuid);
extern int swap_set_label (const char *device, const char *label);
+/*-- in upload.c --*/
+extern int upload_to_fd (int fd);
+
/* ordinary daemon functions use these to indicate errors
* NB: you don't need to prefix the string with the current command,
* it is added automatically by the client-side RPC stubs.
diff --git a/daemon/upload.c b/daemon/upload.c
index 655baf29d..144bb246c 100644
--- a/daemon/...
2017 Apr 23
0
[PATCH v7 1/7] daemon: expose file upload logic
...46e 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -261,6 +261,9 @@ extern int64_t ntfs_minimum_size (const char *device);
extern int swap_set_uuid (const char *device, const char *uuid);
extern int swap_set_label (const char *device, const char *label);
+/*-- in upload.c --*/
+extern int upload_to_fd (int fd, const char *filename);
+
/* ordinary daemon functions use these to indicate errors
* NB: you don't need to prefix the string with the current command,
* it is added automatically by the client-side RPC stubs.
diff --git a/daemon/upload.c b/daemon/upload.c
index 655baf29d..1b109e63...
2017 Apr 06
14
[PATCH v6 0/7] Feature: Yara file scanning
v6:
- use new test functions
- fix yara_detection struct field names
- revert yara_load function to initial version
With Pino we were exploring the idea of allowing Users to load multiple
rule files with subsequent calls to yara_load API.
https://www.redhat.com/archives/libguestfs/2016-November/msg00119.html
It turns out impractical due to YARA API limitations. It is possible
to load multiple
2016 Nov 21
2
Re: [PATCH v2 2/6] New API: yara_load
...upload cancelled");
> + return -1;
> + }
> +
> + return 0;
> +}
This function does not always unlink the temporary file on error, and
it is never close either -- my suggestion would be to reuse and expose
parts of the "upload" function in daemon/upload.c:
int upload_to_fd (int fd)
With the above, upload_rules_file could not be needed anymore, and the
logic to open a temporary fd could be moved directly at the beginning
of do_yara_load.
> +/* Compile source code rules and load them.
> + * Return ERROR_SUCCESS on success, Yara error code type on error.
> +...
2017 Mar 12
8
[PATCH v4 0/7] Feature: Yara file scanning
Rebase patches on top of 1.37.1.
No changes since last series.
Matteo Cafasso (7):
daemon: expose file upload logic
appliance: add yara dependency
New API: yara_load
New API: yara_destroy
New API: internal_yara_scan
New API: yara_scan
yara_scan: added API tests
appliance/packagelist.in | 4 +
configure.ac | 1 +
daemon/Makefile.am
2017 Feb 19
9
[PATCH v3 0/7] Feature: Yara file scanning
Rebase patches on top of 1.35.25.
No changes since last series.
Matteo Cafasso (7):
daemon: expose file upload logic
appliance: add yara dependency
New API: yara_load
New API: yara_destroy
New API: internal_yara_scan
New API: yara_scan
yara_scan: added API tests
appliance/packagelist.in | 4 +
configure.ac | 1 +
daemon/Makefile.am
2016 Nov 22
0
Re: [PATCH v2 2/6] New API: yara_load
...rn -1;
>> + }
>> +
>> + return 0;
>> +}
> This function does not always unlink the temporary file on error, and
> it is never close either -- my suggestion would be to reuse and expose
> parts of the "upload" function in daemon/upload.c:
>
> int upload_to_fd (int fd)
>
> With the above, upload_rules_file could not be needed anymore, and the
> logic to open a temporary fd could be moved directly at the beginning
> of do_yara_load.
Just one question: shall the changes in upload.c be in a separate commit
"expose XYZ"? What is the pr...
2017 Apr 25
8
[PATCH v9 0/7] Feature: Yara file scanning
v9:
- fixes according to comments
Matteo Cafasso (7):
daemon: expose file upload logic
appliance: add yara dependency
New API: yara_load
New API: yara_destroy
New API: internal_yara_scan
New API: yara_scan
yara_scan: added API tests
appliance/packagelist.in | 4 +
configure.ac | 1 +
daemon/Makefile.am | 4 +-
2017 Apr 04
13
[PATCH v5 0/7] Feature: Yara file scanning
v5:
- rebase on top of 1.37.9
- add missing actions_yara.* files
Matteo Cafasso (7):
daemon: expose file upload logic
appliance: add yara dependency
New API: yara_load
New API: yara_destroy
New API: internal_yara_scan
New API: yara_scan
yara_scan: added API tests
appliance/packagelist.in | 4 +
configure.ac | 1 +
daemon/Makefile.am
2017 Apr 24
10
[PATCH v8 0/8] Feature: Yara file scanning
v8:
- Ignore returned value in daemon/upload.c
- Report serialization errors in lib/yara.c
Matteo Cafasso (8):
daemon: ignore unused return value in upload function
daemon: expose file upload logic
appliance: add yara dependency
New API: yara_load
New API: yara_destroy
New API: internal_yara_scan
New API: yara_scan
yara_scan: added API tests
appliance/packagelist.in
2017 Apr 23
11
[PATCH v7 0/7] Feature: Yara file scanning
v7:
- Fixes according to comments
- Rebase on top of 1.37.12
Matteo Cafasso (7):
daemon: expose file upload logic
appliance: add yara dependency
New API: yara_load
New API: yara_destroy
New API: internal_yara_scan
New API: yara_scan
yara_scan: added API tests
appliance/packagelist.in | 4 +
configure.ac | 1 +
daemon/Makefile.am
2020 Jan 09
0
[PATCH v2 4/4] daemon: drop usage of C augeas library
...-static inline int
-augeas_is_version (int major, int minor, int patch)
-{
- aug_read_version (); /* Lazy version reading. */
- return augeas_version >= ((major << 16) | (minor << 8) | patch);
-}
-
/* hivex.c */
extern void hivex_finalize (void);
@@ -373,21 +356,4 @@ extern int upload_to_fd (int fd, const char *filename);
} \
while (0)
-/* Calls reply_with_error, but includes the Augeas error details. */
-#define AUGEAS_ERROR(fs,...) \
- do {...
2020 Mar 09
0
[PATCH v3 3/3] daemon: drop usage of C augeas library
...-static inline int
-augeas_is_version (int major, int minor, int patch)
-{
- aug_read_version (); /* Lazy version reading. */
- return augeas_version >= ((major << 16) | (minor << 8) | patch);
-}
-
/* hivex.c */
extern void hivex_finalize (void);
@@ -374,21 +357,4 @@ extern int upload_to_fd (int fd, const char *filename);
} \
while (0)
-/* Calls reply_with_error, but includes the Augeas error details. */
-#define AUGEAS_ERROR(fs,...) \
- do {...
2017 Mar 12
0
[PATCH v4 3/7] New API: yara_load
...s, consult optargs_bitmask.
+ */
+int
+do_yara_load (const char *namespace)
+{
+ int ret = 0;
+ 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) {
+ unlink (tmpfile);
+ return -1;
+ }
+
+ /* Initialize yara only once. */
+ if (!initialized) {
+ ret = yr_initialize ();
+ if (ret != ERROR_SUCCESS) {
+ reply_with_error ("failed initializing yara");
+ unlink (tmpfile);
+ return -1...
2017 Apr 06
0
[PATCH v6 3/7] New API: yara_load
...optional arguments, consult optargs_bitmask.
+ */
+int
+do_yara_load (void)
+{
+ int ret = 0;
+ 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) {
+ unlink (tmpfile);
+ return -1;
+ }
+
+ /* Initialize yara only once. */
+ if (!initialized) {
+ ret = yr_initialize ();
+ if (ret != ERROR_SUCCESS) {
+ reply_with_error ("failed initializing yara");
+ unlink (tmpfile);
+ return -1...
2017 Apr 24
0
[PATCH v8 4/8] New API: yara_load
...kes optional arguments, consult optargs_bitmask.
+ */
+int
+do_yara_load (void)
+{
+ int r = 0;
+ CLEANUP_CLOSE int fd = -1;
+ char tmpfile[] = "/tmp/yaraXXXXXX";
+
+ fd = mkstemp (tmpfile);
+ if (fd == -1) {
+ reply_with_perror ("mkstemp");
+ return -1;
+ }
+
+ r = upload_to_fd (fd, tmpfile);
+ if (r == -1) {
+ unlink (tmpfile);
+ return -1;
+ }
+
+ /* Initialize yara only once. */
+ if (!initialized) {
+ r = yr_initialize ();
+ if (r != ERROR_SUCCESS) {
+ reply_with_error ("failed initializing yara");
+ unlink (tmpfile);
+ return...
2017 Apr 04
0
[PATCH v5 3/7] New API: yara_load
...s, consult optargs_bitmask.
+ */
+int
+do_yara_load (const char *namespace)
+{
+ int ret = 0;
+ 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) {
+ unlink (tmpfile);
+ return -1;
+ }
+
+ /* Initialize yara only once. */
+ if (!initialized) {
+ ret = yr_initialize ();
+ if (ret != ERROR_SUCCESS) {
+ reply_with_error ("failed initializing yara");
+ unlink (tmpfile);
+ return -1...