]> git.proxmox.com Git - proxmox.git/log
proxmox.git
4 years agobump proxmox version to 0.3.8-1
Dietmar Maurer [Mon, 14 Sep 2020 11:41:14 +0000 (13:41 +0200)]
bump proxmox version to 0.3.8-1

4 years agoremove chrono dependency and related code
Dietmar Maurer [Mon, 14 Sep 2020 11:38:53 +0000 (13:38 +0200)]
remove chrono dependency and related code

4 years agocheck year in epoch_to_rfc3339, new helpers strftime_local and strftime_utc
Dietmar Maurer [Mon, 14 Sep 2020 10:42:23 +0000 (12:42 +0200)]
check year in epoch_to_rfc3339, new helpers strftime_local and strftime_utc

4 years agonew helpers epoch_i64 and epoch_f64
Dietmar Maurer [Mon, 14 Sep 2020 08:38:09 +0000 (10:38 +0200)]
new helpers epoch_i64 and epoch_f64

These helpers use rust std SystemTime. Removed the libc time() binding.

4 years agoproxmox/src/tools/serde.rs: fix epoch_as_rfc3339 doctest
Dietmar Maurer [Sun, 13 Sep 2020 14:20:56 +0000 (16:20 +0200)]
proxmox/src/tools/serde.rs: fix epoch_as_rfc3339 doctest

4 years agobump proxmox version to 0.3.7
Dietmar Maurer [Sun, 13 Sep 2020 14:15:59 +0000 (16:15 +0200)]
bump proxmox version to 0.3.7

4 years agofix epoch_as_rfc3339 serializer
Dietmar Maurer [Sun, 13 Sep 2020 14:13:19 +0000 (16:13 +0200)]
fix epoch_as_rfc3339 serializer

4 years agosrc/tools/serde.rs: implement epoch_as_rfc3339 serializer
Dietmar Maurer [Sun, 13 Sep 2020 09:52:46 +0000 (11:52 +0200)]
src/tools/serde.rs: implement epoch_as_rfc3339 serializer

4 years agosrc/tools/time.rs: rename rfc_3339 to rfc3339
Dietmar Maurer [Sun, 13 Sep 2020 09:42:15 +0000 (11:42 +0200)]
src/tools/time.rs: rename rfc_3339 to rfc3339

4 years agosrc/tools/email.rs: avoid chrono dependency
Dietmar Maurer [Sun, 13 Sep 2020 09:31:31 +0000 (11:31 +0200)]
src/tools/email.rs: avoid chrono dependency

4 years agosrc/tools/time.rs: add parse_rfc_3339
Dietmar Maurer [Sun, 13 Sep 2020 09:09:20 +0000 (11:09 +0200)]
src/tools/time.rs: add parse_rfc_3339

4 years agosrc/tools/time/tm_editor.rs: copied from proxmox backup
Dietmar Maurer [Sun, 13 Sep 2020 09:02:52 +0000 (11:02 +0200)]
src/tools/time/tm_editor.rs: copied from proxmox backup

4 years agoproxmox/src/tools/time.rs: add epoch_to_rfc_3339
Dietmar Maurer [Sun, 13 Sep 2020 08:51:27 +0000 (10:51 +0200)]
proxmox/src/tools/time.rs: add epoch_to_rfc_3339

4 years agoproxmox/src/tools/time.rs: fix previous commit
Dietmar Maurer [Sat, 12 Sep 2020 13:07:12 +0000 (15:07 +0200)]
proxmox/src/tools/time.rs: fix previous commit

4 years agobump proxmox version to 0.3.6-1
Dietmar Maurer [Sat, 12 Sep 2020 13:01:46 +0000 (15:01 +0200)]
bump proxmox version to 0.3.6-1

4 years agoproxmox/src/tools/time.rs: add strftime bindings
Dietmar Maurer [Sat, 12 Sep 2020 12:59:31 +0000 (14:59 +0200)]
proxmox/src/tools/time.rs: add strftime bindings

4 years agobump proxmox version to 0.3.5-1
Dietmar Maurer [Fri, 4 Sep 2020 04:36:55 +0000 (06:36 +0200)]
bump proxmox version to 0.3.5-1

4 years agotools/time: give tm struct as mut reference
Dominik Csapak [Thu, 3 Sep 2020 11:37:59 +0000 (13:37 +0200)]
tools/time: give tm struct as mut reference

mktime/timegm can modify the timestruct (to normalize the time, e.g.
convert the january 40 to february 9)

to use that feature, we have to give a mutable reference, else the
struct will be copied and the original left untouched

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agoand run rustfmt over another big chunk of code
Wolfgang Bumiller [Fri, 28 Aug 2020 06:59:25 +0000 (08:59 +0200)]
and run rustfmt over another big chunk of code

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agomore formatting fixups
Wolfgang Bumiller [Fri, 28 Aug 2020 06:56:54 +0000 (08:56 +0200)]
more formatting fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoformatting fixups
Wolfgang Bumiller [Fri, 28 Aug 2020 06:55:16 +0000 (08:55 +0200)]
formatting fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump proxmox to 0.3.4-1
Dietmar Maurer [Fri, 28 Aug 2020 04:25:36 +0000 (06:25 +0200)]
bump proxmox to 0.3.4-1

4 years agoemail: add small function to send multi-part emails using sendmail
Hannes Laimer [Thu, 27 Aug 2020 10:00:36 +0000 (12:00 +0200)]
email: add small function to send multi-part emails using sendmail

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
4 years agobump proxmox to 0.3.3-1
Wolfgang Bumiller [Mon, 10 Aug 2020 09:30:49 +0000 (11:30 +0200)]
bump proxmox to 0.3.3-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd serde forwarding convenience macros
Wolfgang Bumiller [Thu, 6 Aug 2020 09:16:04 +0000 (11:16 +0200)]
add serde forwarding convenience macros

* forward_deserialize_to_from_str
* forward_serialize_to_display

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoclippy: use matches for if let -> bool
Wolfgang Bumiller [Tue, 4 Aug 2020 14:24:13 +0000 (16:24 +0200)]
clippy: use matches for if let -> bool

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump proxmox dep to 0.3.2-1
Wolfgang Bumiller [Tue, 4 Aug 2020 09:12:11 +0000 (11:12 +0200)]
bump proxmox dep to 0.3.2-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools/mod.rs: sort modules
Wolfgang Bumiller [Tue, 4 Aug 2020 08:29:03 +0000 (10:29 +0200)]
tools/mod.rs: sort modules

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd lock_file and open_file_locked
Wolfgang Bumiller [Tue, 4 Aug 2020 07:31:14 +0000 (09:31 +0200)]
add lock_file and open_file_locked

to proxmox::tools::fs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd proxmox::sys::timer module (moved from proxmox-backup)
Wolfgang Bumiller [Tue, 4 Aug 2020 07:27:59 +0000 (09:27 +0200)]
add proxmox::sys::timer module (moved from proxmox-backup)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agomove uuid serde code to uuid.rs
Wolfgang Bumiller [Mon, 3 Aug 2020 09:10:59 +0000 (11:10 +0200)]
move uuid serde code to uuid.rs

And avoid the temporary string allocation where possible.

Implementing foreign traits in external modules is bad
practice. The `serde` module is for implementations which
deviate from the expected default.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 0.3.1-1
Dietmar Maurer [Sun, 2 Aug 2020 09:52:25 +0000 (11:52 +0200)]
bump version to 0.3.1-1

4 years agoUuid: implement Serlialize/Deserialize
Dietmar Maurer [Sun, 2 Aug 2020 09:49:36 +0000 (11:49 +0200)]
Uuid: implement Serlialize/Deserialize

4 years agobump proxmox version to 0.3.0-1
Wolfgang Bumiller [Wed, 29 Jul 2020 07:37:02 +0000 (09:37 +0200)]
bump proxmox version to 0.3.0-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd http_bail macro
Wolfgang Bumiller [Wed, 29 Jul 2020 07:28:59 +0000 (09:28 +0200)]
add http_bail macro

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agohttp_err macro: imply format!()
Wolfgang Bumiller [Wed, 29 Jul 2020 07:25:46 +0000 (09:25 +0200)]
http_err macro: imply format!()

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoswitch to using mod.rs
Wolfgang Bumiller [Tue, 28 Jul 2020 13:11:38 +0000 (15:11 +0200)]
switch to using mod.rs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agofix #2882: correctly parse optional fields from mountinfo
Stefan Reiter [Mon, 27 Jul 2020 15:28:40 +0000 (17:28 +0200)]
fix #2882: correctly parse optional fields from mountinfo

As per the linux kernel documentation[0], the "optional fields" (called
"tags" in our parser) are not comma-separated, but are a variable number
(0 or more) of space-separated fields, always followed by a dash to mark
the end.

Fix the /proc/<pid>/mountinfo parser to correctly parse these and add
test cases (l3 is the line that produced the original warning from the
bug report).

[0] https://www.kernel.org/doc/html/latest/filesystems/proc.html#proc-pid-mountinfo-information-about-mounts

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agobump proxmox version to 0.2.1-1
Thomas Lamprecht [Thu, 23 Jul 2020 10:04:12 +0000 (12:04 +0200)]
bump proxmox version to 0.2.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoproxmox/tools/byte_buffer: improve read_from example
Dominik Csapak [Fri, 17 Jul 2020 12:17:10 +0000 (14:17 +0200)]
proxmox/tools/byte_buffer: improve read_from example

'norun' was not a valid attribute, so cargo doc ignored it completely

instead, write a proper example that can be compiled

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox/tools/websocket: fix some clippy warnings
Dominik Csapak [Fri, 17 Jul 2020 12:17:09 +0000 (14:17 +0200)]
proxmox/tools/websocket: fix some clippy warnings

* reformat docs
* use &mut [u8] instead of Box<[u8]> (conversion can be done automatically)
* use:
    let foo = if condition { A } else { B };
  instead of matching on a boolean condition
* rename WaitingForData to Receiving so that not all
  variants of the enum end with Data

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox/tools/websocket: improve error handling
Dominik Csapak [Fri, 17 Jul 2020 12:17:08 +0000 (14:17 +0200)]
proxmox/tools/websocket: improve error handling

use io_err_other instead of io_format_err and change the Error type
of create_frame from io::Error to WebSocketError

it is not good to redefine the ErrorKinds of io::Error, since
the caller probably is not aware of that

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox/tools/websocket: introduce WebSocketError and use it
Dominik Csapak [Fri, 17 Jul 2020 12:17:07 +0000 (14:17 +0200)]
proxmox/tools/websocket: introduce WebSocketError and use it

this patch introduces a custom WebSocketError, so that we can
detect errors in the websocket protocol and react to it in the
right way

the channel now sends a Result<(OpCode, Box<[u8]>), WebSocketError>
so that we can either react to a control frame, or react to an
errornous data stream (which means sending a close frame
with the appropriate error code)

while at it, change FrameHeader::try_from_bytes to return
Result<Option<FrameHeader>, WebSocketError> instead of a nested
Result with the *guessed* remaining size. This was neither used by
us, nor was it really meaningful, since this can change during the
decode every time new data is read (extensions, mask, payload length, etc.)
so simply returning an Option is enough information for us

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: formatting fixups
Wolfgang Bumiller [Thu, 16 Jul 2020 12:13:13 +0000 (14:13 +0200)]
api-macro: formatting fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoa lot more clippy lint fixes
Wolfgang Bumiller [Thu, 16 Jul 2020 12:11:01 +0000 (14:11 +0200)]
a lot more clippy lint fixes

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agovarious clippy lint fixes
Wolfgang Bumiller [Thu, 16 Jul 2020 11:44:42 +0000 (13:44 +0200)]
various clippy lint fixes

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agowebsocket feature dependency fixup
Wolfgang Bumiller [Wed, 15 Jul 2020 12:59:39 +0000 (14:59 +0200)]
websocket feature dependency fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox/tools/websocket: add WebSocket implementation
Dominik Csapak [Tue, 14 Jul 2020 11:09:57 +0000 (13:09 +0200)]
proxmox/tools/websocket: add WebSocket implementation

uses the existing WebSocketReader and Writer to establish a
two-way communication between an upstream and downstream connection.

The upstream connection sends and receives WebSocket frames, while
the downstream one only receives and sends raw data.

For now we do not support extensions, and only accept the protocol version 13

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox/tools/websocket: replace CallBack with a channel
Dominik Csapak [Tue, 14 Jul 2020 11:09:56 +0000 (13:09 +0200)]
proxmox/tools/websocket: replace CallBack with a channel

instead of having a callback that we call on a control frame,
use a channel to send the data to a receiver

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox/tools/websocket: implement send_control_frame for writer
Dominik Csapak [Tue, 14 Jul 2020 11:09:55 +0000 (13:09 +0200)]
proxmox/tools/websocket: implement send_control_frame for writer

so that we can easily send a control frame to the endpoint

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox/tools/websocket: improve mask_bytes and create_frame interface
Dominik Csapak [Wed, 15 Jul 2020 09:08:40 +0000 (11:08 +0200)]
proxmox/tools/websocket: improve mask_bytes and create_frame interface

by using a Box<[u8]> instead of a vector (we do not need it)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox/tools/websocket: use io::Error and Result explicitely
Dominik Csapak [Tue, 14 Jul 2020 11:09:53 +0000 (13:09 +0200)]
proxmox/tools/websocket: use io::Error and Result explicitely

and add a helper struct for the ReadResult
(so that the types are properly documented)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox/tools/websocket: correctly return eof
Dominik Csapak [Tue, 14 Jul 2020 11:09:52 +0000 (13:09 +0200)]
proxmox/tools/websocket: correctly return eof

only return Ok(0) when the upstream reader did return that, not when
we have no data in the buffer, else the downstream reader believes
we are EOF (even if we are not)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox/tools/websocket: use ready macro for WebSocketWriter
Dominik Csapak [Tue, 14 Jul 2020 11:09:51 +0000 (13:09 +0200)]
proxmox/tools/websocket: use ready macro for WebSocketWriter

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox/tools/byte_buffer: impl Default
Dominik Csapak [Tue, 14 Jul 2020 11:09:50 +0000 (13:09 +0200)]
proxmox/tools/byte_buffer: impl Default

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox/tools/byte_buffer: improve ByteBuffer interface
Dominik Csapak [Tue, 14 Jul 2020 11:09:49 +0000 (13:09 +0200)]
proxmox/tools/byte_buffer: improve ByteBuffer interface

by implementing Deref and DerefMut, renaming consume to 'remove_data'
adapt the usage inside of websocket (we did not use it anywhere else for now)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools::common_regex: add IPRE_BRACKET
Wolfgang Bumiller [Mon, 13 Jul 2020 08:27:40 +0000 (10:27 +0200)]
tools::common_regex: add IPRE_BRACKET

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump proxmox version to 0.2.0-1
Wolfgang Bumiller [Fri, 10 Jul 2020 09:00:01 +0000 (11:00 +0200)]
bump proxmox version to 0.2.0-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump api macro to 0.2.0-1
Wolfgang Bumiller [Fri, 10 Jul 2020 08:56:24 +0000 (10:56 +0200)]
bump api macro to 0.2.0-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: test using return schemas within return objects
Wolfgang Bumiller [Fri, 10 Jul 2020 09:03:51 +0000 (11:03 +0200)]
api-macro: test using return schemas within return objects

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: reference consistency
Wolfgang Bumiller [Fri, 10 Jul 2020 08:39:49 +0000 (10:39 +0200)]
api-macro: reference consistency

API_RETURN_* and API_PARAMETER_* schemas are no references
anymore to allow using them as external schemas via the
`"schema"` key inside object schemas inside the `#[api]`
macro.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agocompletion: COMP_POINT is a codepoint count not a byte index
Wolfgang Bumiller [Thu, 9 Jul 2020 12:01:03 +0000 (14:01 +0200)]
completion: COMP_POINT is a codepoint count not a byte index

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agocompile fixups
Wolfgang Bumiller [Tue, 7 Jul 2020 12:43:47 +0000 (14:43 +0200)]
compile fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd websocket (default-)feature, make futures optional
Wolfgang Bumiller [Tue, 7 Jul 2020 09:57:18 +0000 (11:57 +0200)]
add websocket (default-)feature, make futures optional

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agomake the proxmox crate without default features again
Wolfgang Bumiller [Tue, 7 Jul 2020 09:41:49 +0000 (11:41 +0200)]
make the proxmox crate without default features again

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosome minor clippy lint cleanups
Wolfgang Bumiller [Tue, 7 Jul 2020 07:44:50 +0000 (09:44 +0200)]
some minor clippy lint cleanups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoByteBuffer: use T: AsyncRead, not AsyncReadExt
Wolfgang Bumiller [Tue, 7 Jul 2020 07:37:24 +0000 (09:37 +0200)]
ByteBuffer: use T: AsyncRead, not AsyncReadExt

it's just weird otherwise

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotest cleanups
Wolfgang Bumiller [Tue, 7 Jul 2020 07:37:10 +0000 (09:37 +0200)]
test cleanups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoByteBuffer: don't require Sized on Read references
Wolfgang Bumiller [Tue, 7 Jul 2020 07:33:35 +0000 (09:33 +0200)]
ByteBuffer: don't require Sized on Read references

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoByteBuffer: actually test the doc comment code
Wolfgang Bumiller [Tue, 7 Jul 2020 07:32:16 +0000 (09:32 +0200)]
ByteBuffer: actually test the doc comment code

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoByteBuffer: skip the temporary Vec
Wolfgang Bumiller [Tue, 7 Jul 2020 07:27:17 +0000 (09:27 +0200)]
ByteBuffer: skip the temporary Vec

The docs say `into_boxed_slice()` "drops" excess capacity,
but doesn't specify whether that just means it becomes
inaccessible or the vector potentially reallocates to the
exact size.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 0.1.42-1
Dietmar Maurer [Fri, 3 Jul 2020 11:01:00 +0000 (13:01 +0200)]
bump version to 0.1.42-1

4 years agosys/linux/pty: add examples and docs
Dominik Csapak [Fri, 3 Jul 2020 09:56:42 +0000 (11:56 +0200)]
sys/linux/pty: add examples and docs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agotools/byte_buffer: add examples and docs
Dominik Csapak [Fri, 3 Jul 2020 09:56:41 +0000 (11:56 +0200)]
tools/byte_buffer: add examples and docs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agotools/websocket: add examples and docs
Dominik Csapak [Fri, 3 Jul 2020 09:56:40 +0000 (11:56 +0200)]
tools/websocket: add examples and docs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agotools/websocket: improve traits for WebSocketReader
Dominik Csapak [Fri, 3 Jul 2020 09:56:39 +0000 (11:56 +0200)]
tools/websocket: improve traits for WebSocketReader

by dropping unecessary trais for R
and impl Sync for ReaderState when R implements Sync

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agotools/websocket: require writer to be Unpin
Dominik Csapak [Fri, 3 Jul 2020 09:56:38 +0000 (11:56 +0200)]
tools/websocket: require writer to be Unpin

so we can safely pin/unpin it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agotools/websocket: make mask not a reference
Dominik Csapak [Fri, 3 Jul 2020 09:56:37 +0000 (11:56 +0200)]
tools/websocket: make mask not a reference

so we can drop the dereferencing, also use shorter syntax for mask_bit

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agotools: add Websocket helper
Dominik Csapak [Thu, 2 Jul 2020 15:17:48 +0000 (17:17 +0200)]
tools: add Websocket helper

for now there is a helper for Reading and Writing
still missing is a utility for the handshake/accepting a connection

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agosys/linux: add PTY helper
Dominik Csapak [Thu, 2 Jul 2020 15:17:47 +0000 (17:17 +0200)]
sys/linux: add PTY helper

for creating a PTY and make the secondary part a
controlling terminal for a child process

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agotools: add ByteBuffer
Dominik Csapak [Thu, 2 Jul 2020 15:17:46 +0000 (17:17 +0200)]
tools: add ByteBuffer

this is a Buffer struct that holds u8 and has convenience methods
for reading onto the back and consuming from the front

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agocleanup: libc has 'getrandom' since 0.2.59
Wolfgang Bumiller [Wed, 1 Jul 2020 08:54:06 +0000 (10:54 +0200)]
cleanup: libc has 'getrandom' since 0.2.59

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump proxmox to 0.1.41-1
Dietmar Maurer [Fri, 26 Jun 2020 08:36:35 +0000 (10:36 +0200)]
bump proxmox to 0.1.41-1

4 years agoapi/router: percent decode the components of the uri
Dominik Csapak [Thu, 25 Jun 2020 08:47:54 +0000 (10:47 +0200)]
api/router: percent decode the components of the uri

those can contain percent encoded values, so we have to decode them
before lookin up the path

this is especially important for the 'MatchAll' branch
when the parameter can contain some reserved characters

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agobump proxmox to 0.1.40-1
Wolfgang Bumiller [Fri, 12 Jun 2020 11:56:00 +0000 (13:56 +0200)]
bump proxmox to 0.1.40-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: add mmap helper
Wolfgang Bumiller [Fri, 12 Jun 2020 11:53:24 +0000 (13:53 +0200)]
tools: add mmap helper

Mmap<T> acts like a slice of `T`s, inhereting its `Send` and
`Sync` traits

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoAsHex Display helper
Wolfgang Bumiller [Fri, 12 Jun 2020 09:17:43 +0000 (11:17 +0200)]
AsHex Display helper

This way we can use
    println!("something: {}", AsHex(bytes));

without having to turn them into an allocated string first.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd TtyOutpu helper and use it for read_password
Wolfgang Bumiller [Tue, 9 Jun 2020 09:16:41 +0000 (11:16 +0200)]
add TtyOutpu helper and use it for read_password

This way read_password() will not write the prompt into
stdout if stdout was redirected into a file, but instead
opens `/dev/tty`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 0.1.39-1
Dietmar Maurer [Fri, 5 Jun 2020 05:27:10 +0000 (07:27 +0200)]
bump version to 0.1.39-1

4 years agofix Permission::Privilege path check
Dominik Csapak [Thu, 4 Jun 2020 14:52:12 +0000 (16:52 +0200)]
fix Permission::Privilege path check

when checking a path, we only pushed the components to the checked value
that would contain a parameter and not fixed ones

e.g. from the path components (with params datastore="foo")
["datastore", "{datastore}"]

only ["foo"] was given to the lookup_privs function
instead of ["datastore", "foo"]

this fixes an issue where e.g. a prune on /datastore/foo would fail
for a user that has the role DatastorePowerUser on /datastore (with
propagate) or /datastore/foo

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agoadd tests for check_api_permission
Dominik Csapak [Thu, 4 Jun 2020 14:52:11 +0000 (16:52 +0200)]
add tests for check_api_permission

add tests for check_api_permission and many Permission combinations
this test fails for now and will be fixed with the next commit

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agobump version to 0.1.38-1
Dietmar Maurer [Thu, 28 May 2020 07:51:42 +0000 (09:51 +0200)]
bump version to 0.1.38-1

4 years agoproxmox/src/tools/fs.rs: add additional helpers to get file contents
Dietmar Maurer [Thu, 28 May 2020 07:49:45 +0000 (09:49 +0200)]
proxmox/src/tools/fs.rs: add additional helpers to get file contents

4 years agobump version toö 0.1.37-1
Dietmar Maurer [Tue, 26 May 2020 10:55:04 +0000 (12:55 +0200)]
bump version toö 0.1.37-1

4 years agoproxmox: add string_as_base64 serde (de)serializer
Dominik Csapak [Tue, 26 May 2020 10:23:23 +0000 (12:23 +0200)]
proxmox: add string_as_base64 serde (de)serializer

this can be used to automatically convert string fields to base64

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agobump proxmox to 0.1.36-1
Wolfgang Bumiller [Mon, 25 May 2020 10:12:07 +0000 (12:12 +0200)]
bump proxmox to 0.1.36-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoprocfs: iowait_percent fixup
Wolfgang Bumiller [Mon, 25 May 2020 10:09:16 +0000 (12:09 +0200)]
procfs: iowait_percent fixup

Fix time delta calculation, and use old percentage when
querying more often than once a second.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoformatting fixup
Wolfgang Bumiller [Mon, 25 May 2020 09:12:08 +0000 (11:12 +0200)]
formatting fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump proxmox to 0.1.35-1
Wolfgang Bumiller [Mon, 25 May 2020 09:11:21 +0000 (11:11 +0200)]
bump proxmox to 0.1.35-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoprocfs: add loadavg reader
Wolfgang Bumiller [Mon, 25 May 2020 09:07:24 +0000 (11:07 +0200)]
procfs: add loadavg reader

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>