Commit Graph

12 Commits

Author SHA1 Message Date
citronalco 83534952a5
autoupdater: Add HTTP-Header X-FIRMWARE-VERSION (#246)
X-FIRMWARE-VERSION gets set to the content of the file referenced by UCI setting "autoupdater.settings.version_file"
If "autoupdater.settings.version_file" is unset X-FIRMWARE-VERSION is
omitted
2021-07-16 19:25:06 +02:00
Jason 85af243158
autoupdater: Fixed segfault on wrong long option
If an autoupdater long option (prefixed with '--') are unknown then a segmentation fault occurs.
Example:
root@node:~# autoupdater --xyz
Segmentation fault

[Matthias Schiffer: changed sentinel syntax]
2020-01-10 00:34:44 +01:00
Ruben Barkow 71d0566b37 autoupdater: clarify usage of -n in help 2019-05-04 17:19:08 +02:00
Matthias Schiffer 30be52e03b
autoupdater: consider end of string smaller than all characters except for '~'
This fixes ordering for the following patterns:

* 1.0 < 1.0a
* 1.0a < 1.0ab
* 1.0a < 1.0a1

Note that trailing zeros are still ignored (1.0 == 1., 1test0 == 1test),
which matches the behaviour of dpkg and opkg.
2018-12-18 23:16:17 +01:00
Matthias Schiffer 688051cb21
autoupdater: fix regression in version compare
Version strings with the same prefix, e.g. "1.0" and "1.0~pre", or even
"1.0" and "1.0.1" were considered equal. This is a regression in the C
autoupdater rewrite.
2018-12-18 20:22:40 +01:00
lemoer ed7ed7dcba autoupdater: allow skipping the version check (#187)
this commit introduces a new cli flag "--force-version"
2018-06-03 12:13:50 +02:00
Tobias Schramm 5c6476ea58
autoupdater: use safe allocation functions
Give the user a better error message when allocations fail by using our
checked allocation functions.

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
[Matthias Schiffer: squash, use safe_realloc]
2018-02-22 02:39:48 +01:00
Tobias Schramm 3566cabef5
autoupdater: add safe allocation functions
safe_malloc() and safe_realloc() are wrappers around malloc() and realloc()
than abort the process if the memory allocation fails.

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
[Matthias Schiffer: add safe_realloc()]
2018-02-22 02:39:47 +01:00
Tobias Schramm 0b61fee98e
autoupdater: Check if allocation of uci contect was successfull
Previously the return value of uci_alloc_context was not checked leading
to a possible null ptr dereference

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
[Matthias Schiffer: use abort()]
2018-02-22 02:27:57 +01:00
Tobias c802276581 autoupdater: uclient: fix nullpointer dereference on invalid URL (#183)
Previously supplying an invalid url for download would result in
uclient_new returning NULL and crash the autoupdater as soon as
cl->priv is accessed.

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
2018-02-19 17:10:44 +01:00
Matthias Schiffer fc194bc7c8
autoupdater: uclient: add error handling in connection setup
Avoids a segfault when the connection fails early.
2018-01-22 10:57:35 +01:00
Jan-Philipp Litza 49cb4b3fdb
autoupdater: new implementation
This new version of the autoupdater is implemented in C instead of Lua,
allowing us to interface with libuclient (HTTP downloads) and libecdsautil
(signature checks) directly instead of spawning external processes,
saving RAM and making error handling more robust.

[Matthias Schiffer: add commit message]
2018-01-13 00:22:27 +01:00