search for: receive_file

Displaying 20 results from an estimated 30 matches for "receive_file".

2014 Sep 23
1
Another possible bug in the preview version of virt-v2v for RHEL/CentOS 7.1
...libguestfs: trace: hivex_node_set_value = 0 libguestfs: trace: upload "/usr/share/virtio-win/drivers/amd64/Win2012R2/netkvm.cat" "/Windows/Drivers/VirtIO" guestfsd: main_loop: proc 365 (hivex_node_set_value) took 0.01 seconds guestfsd: main_loop: new request, len 0x44 guestfsd: receive_file: reading length word libguestfs: got daemon cancellation guestfsd: receive_file: got chunk: cancel = 0x1, len = 0, buf = (nil) guestfsd: receive_file: received cancellation from library guestfsd: error: /Windows/Drivers/VirtIO: Is a directory libguestfs: trace: upload = -1 (error) libguestfs: trace...
2016 Nov 09
1
[PATCH] upload: improve file write callback
...com> --- daemon/upload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/upload.c b/daemon/upload.c index f034627..8b4f600 100644 --- a/daemon/upload.c +++ b/daemon/upload.c @@ -84,7 +84,7 @@ upload (const char *filename, int flags, int64_t offset) } } - r = receive_file (write_cb, &data.fd); + r = receive_file (write_cb, &data); if (r == -1) { /* write error */ err = errno; r = cancel_receive (); -- 2.10.2
2016 Dec 14
0
[PATCH] daemon: expose file upload logic
...upload.c index 8b4f600..0f385b6 100644 --- a/daemon/upload.c +++ b/daemon/upload.c @@ -54,60 +54,68 @@ write_cb (void *data_vp, const void *buf, size_t len) return 0; } +int +upload_to_fd (int fd) +{ + int ret = 0, err = 0; + struct write_cb_data data = { .fd = fd, .written = 0 }; + + ret = receive_file (write_cb, &data); + if (ret == -1) { /* write error */ + err = errno; + ret = cancel_receive (); + errno = err; + reply_with_error ("write error"); + close (fd); + return -1; + } + if (ret == -2) { /* cancellation from library */ + /* This error is ignored b...
2017 Mar 12
0
[PATCH v4 1/7] daemon: expose file upload logic
...ad.c index 655baf29d..144bb246c 100644 --- a/daemon/upload.c +++ b/daemon/upload.c @@ -54,60 +54,68 @@ write_cb (void *data_vp, const void *buf, size_t len) return 0; } +int +upload_to_fd (int fd) +{ + int ret = 0, err = 0; + struct write_cb_data data = { .fd = fd, .written = 0 }; + + ret = receive_file (write_cb, &data); + if (ret == -1) { /* write error */ + err = errno; + ret = cancel_receive (); + errno = err; + reply_with_error ("write error"); + close (fd); + return -1; + } + if (ret == -2) { /* cancellation from library */ + /* This error is ignored b...
2017 Apr 06
0
[PATCH v6 1/7] daemon: expose file upload logic
...ad.c index 655baf29d..144bb246c 100644 --- a/daemon/upload.c +++ b/daemon/upload.c @@ -54,60 +54,68 @@ write_cb (void *data_vp, const void *buf, size_t len) return 0; } +int +upload_to_fd (int fd) +{ + int ret = 0, err = 0; + struct write_cb_data data = { .fd = fd, .written = 0 }; + + ret = receive_file (write_cb, &data); + if (ret == -1) { /* write error */ + err = errno; + ret = cancel_receive (); + errno = err; + reply_with_error ("write error"); + close (fd); + return -1; + } + if (ret == -2) { /* cancellation from library */ + /* This error is ignored b...
2017 Apr 23
0
[PATCH v7 1/7] daemon: expose file upload logic
...9d..1b109e634 100644 --- a/daemon/upload.c +++ b/daemon/upload.c @@ -54,19 +54,50 @@ write_cb (void *data_vp, const void *buf, size_t len) return 0; } +int +upload_to_fd (int fd, const char *filename) +{ + int r = 0, err = 0; + struct write_cb_data data = { .fd = fd, .written = 0 }; + + r = receive_file (write_cb, &data); + if (r == -1) { /* write error */ + err = errno; + r = cancel_receive (); + errno = err; + reply_with_error ("write error: %s", filename); + close (fd); + return -1; + } + if (r == -2) { /* cancellation from library */ + /* This error is i...
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 Nov 02
0
[PATCH 2/6] New API: yara_load
...r. + */ +static int +upload_rules_file (char *rules_path) +{ + int ret = 0; + CLEANUP_CLOSE int fd = 0; + struct write_callback_data data = { .written = 0 }; + + data.fd = mkstemp (rules_path); + if (data.fd == -1) { + reply_with_perror ("mkstemp"); + return -1; + } + + ret = receive_file (write_callback, &data.fd); + if (ret == -1) { + /* Write error. */ + cancel_receive (); + reply_with_error ("write error: %s", rules_path); + return -1; + } + if (ret == -2) { + /* Cancellation from library */ + reply_with_error ("file upload cancelled"...
2016 Nov 21
2
Re: [PATCH v2 2/6] New API: yara_load
...t; +{ > + int ret = 0; > + CLEANUP_CLOSE int fd = 0; > + struct write_callback_data data = { .written = 0 }; > + > + data.fd = mkstemp (rules_path); > + if (data.fd == -1) { > + reply_with_perror ("mkstemp"); > + return -1; > + } > + > + ret = receive_file (write_callback, &data); > + if (ret == -1) { > + /* Write error. */ > + cancel_receive (); > + reply_with_error ("write error: %s", rules_path); > + return -1; > + } > + if (ret == -2) { > + /* Cancellation from library */ > + reply_wit...
2016 Nov 09
0
[PATCH v2 2/6] New API: yara_load
...r. + */ +static int +upload_rules_file (char *rules_path) +{ + int ret = 0; + CLEANUP_CLOSE int fd = 0; + struct write_callback_data data = { .written = 0 }; + + data.fd = mkstemp (rules_path); + if (data.fd == -1) { + reply_with_perror ("mkstemp"); + return -1; + } + + ret = receive_file (write_callback, &data); + if (ret == -1) { + /* Write error. */ + cancel_receive (); + reply_with_error ("write error: %s", rules_path); + return -1; + } + if (ret == -2) { + /* Cancellation from library */ + reply_with_error ("file upload cancelled");...
2015 Jul 02
0
[PATCH] Fix various -Wformat problems.
...r.direction); goto cont; } if (hdr.status != GUESTFS_STATUS_OK) { - reply_with_error ("unexpected message status (%d)", hdr.status); + reply_with_error ("unexpected message status (%d)", (int) hdr.status); goto cont; } @@ -444,8 +445,9 @@ receive_file (receive_cb cb, void *opaque) if (verbose) fprintf (stderr, - "guestfsd: receive_file: got chunk: cancel = 0x%x, len = %d, buf = %p\n", - chunk.cancel, chunk.data.data_len, chunk.data.data_val); + "guestfsd: receive_file: got ch...
2015 Jul 02
0
[PATCH v2] Fix various -Wformat problems.
...r.direction); goto cont; } if (hdr.status != GUESTFS_STATUS_OK) { - reply_with_error ("unexpected message status (%d)", hdr.status); + reply_with_error ("unexpected message status (%d)", (int) hdr.status); goto cont; } @@ -444,8 +445,9 @@ receive_file (receive_cb cb, void *opaque) if (verbose) fprintf (stderr, - "guestfsd: receive_file: got chunk: cancel = 0x%x, len = %d, buf = %p\n", - chunk.cancel, chunk.data.data_len, chunk.data.data_val); + "guestfsd: receive_file: got ch...
2016 Nov 22
0
Re: [PATCH v2 2/6] New API: yara_load
...LEANUP_CLOSE int fd = 0; >> + struct write_callback_data data = { .written = 0 }; >> + >> + data.fd = mkstemp (rules_path); >> + if (data.fd == -1) { >> + reply_with_perror ("mkstemp"); >> + return -1; >> + } >> + >> + ret = receive_file (write_callback, &data); >> + if (ret == -1) { >> + /* Write error. */ >> + cancel_receive (); >> + reply_with_error ("write error: %s", rules_path); >> + return -1; >> + } >> + if (ret == -2) { >> + /* Cancellation fro...
2016 Nov 02
8
[PATCH 0/6] Feature: Yara file scanning
Yara is a rule based scanning engine aimed to help malware analysts in finding and classifying interesting samples. https://github.com/VirusTotal/yara This series adds Yara support to Libguestfs allowing to upload sets of rules and scanning files against them. Currently provided APIs: - yara_load: loads a set of rules - yara_destroy: free resources allocated by loaded rules - yara_scan:
2009 Nov 20
1
fix new failures from latest-from-gnulib syntax-check
...if (xwrite (sock, lenbuf, 4) == -1) { fprintf (stderr, "xwrite failed\n"); - exit (1); + exit (EXIT_FAILURE); } if (xwrite (sock, buf, len) == -1) { fprintf (stderr, "xwrite failed\n"); - exit (1); + exit (EXIT_FAILURE); } } @@ -311,7 +311,7 @@ receive_file (receive_cb cb, void *opaque) for (;;) { /* Read the length word. */ if (xread (sock, lenbuf, 4) == -1) - exit (1); + exit (EXIT_FAILURE); xdrmem_create (&xdr, lenbuf, 4, XDR_DECODE); xdr_uint32_t (&xdr, &len); @@ -323,7 +323,7 @@ receive_file (receive_...
2016 Nov 09
9
[PATCH v2 0/6] Feature: Yara file scanning
v2: - Fix yara dependency in packagelist - Use pkg-config where available - Improve longdesc of yara_load API - Fix libyara initialization and finalization - Import CLEANUP_FCLOSE - Add custom CLEANUP_DESTROY_YARA_COMPILER - Add rules compilation error callback - Other small fixes according to comments Matteo Cafasso (6): appliance: add yara dependency New API: yara_load New API:
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 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
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
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 +-