Commit graph

43 commits

Author SHA1 Message Date
Hauke Mehrtens
52bbc99f69 Replace malloc() + memset() with calloc()
Instead of manually clearing the memory with memset() use calloc().

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2020-10-06 08:35:23 +02:00
Hauke Mehrtens
2c8e4a347b util: Fix error path
Unlock and close the stream in case some file operations in
uci_open_stream() fail.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2019-11-01 16:58:14 +01:00
Felix Fietkau
e66c20610e allow "-" in package names
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-12-18 15:19:47 +01:00
Felix Fietkau
b342283d2d fix a few formatting issues
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-11-25 11:54:09 +01:00
Yousong Zhou
f8f9decc54 Use offset into parser buffer to avoid potential heap overflow.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-11-25 11:44:17 +01:00
Jo-Philipp Wich
e339407372 Preserve original permissions when rewriting config files on commit
Patch provided by Patrick Grimm <patrick@lunatiki.de>

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-04-11 18:10:27 +02:00
Luka Perkov
42429219a9 file: make uci commits atomic
Avoids issues with UBIFS file system.

http://www.linux-mtd.infradead.org/faq/ubifs.html#L_atomic_change

Signed-off-by: Luka Perkov <luka@openwrt.org>
Reported-by: Tim Harvey <tharvey@gateworks.com>
2013-10-15 12:31:41 +02:00
Felix Fietkau
51f2ea3271 util: fix compile error
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-10 14:11:46 +02:00
Etienne CHAMPETIER
07d6fd66f6 uci: copy permisions of /etc/config/ files for temp files
Hi

Using uci as a non root user i can get network configuration but not network state (for exemple).
The idea of this patch is to copy permission from config file, or if it doesn't exist use UCI_FILEMODE / UCI_DIRMODE

Tested on tplink wr1043nd. (you have to remove some mkdir from /etc/init.d/boot to fully see this patch work)
If you apply this patch (or a modified version), please also backport to AA

Signed-off-by: Etienne CHAMPETIER <etienne.champetier@free.fr>

openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
2013-04-24 11:23:35 +02:00
Felix Fietkau
e4516d01a7 remove plugin support, it has been unused for a long time and should not be used for any new code
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-04 17:08:14 +01:00
Felix Fietkau
4a7d8053ae fix lgpl license headers 2011-08-31 16:55:25 +02:00
Felix Fietkau
853f586e48 split off and compile util.c separately 2010-08-20 14:56:30 +02:00
Felix Fietkau
6ce771b109 split off and compile file.c separately 2010-08-20 14:51:18 +02:00
Felix Fietkau
7840d049ef don't bail out on locking errors, when flock() is not supported 2009-04-23 17:06:10 +02:00
Felix Fietkau
25e6437875 add missing fflush() on close - fixes a bug in the lock/unlock order (thx, Cyrus) 2009-03-24 16:48:13 +01:00
Felix Fietkau
cfdea3894f fix signed vs unsigned char validation bug 2009-01-20 14:17:29 +01:00
Felix Fietkau
1a388b01f8 overhaul package and section type validation - makes it easier to read and fixes some bugs in uci changes and uci show without explicit package references 2008-09-05 21:51:46 +02:00
Felix Fietkau
f8cf80970b fix segfault in uci batch 2008-08-31 12:17:56 +02:00
Felix
8500c9b016 add an extra option check for tuple parsing 2008-08-26 01:20:43 +02:00
Felix Fietkau
87e8931579 remove uci_parse_tuple, preparation for adding a new api for lookups 2008-08-22 17:31:06 +02:00
Felix Fietkau
976e6db54e implement extended uci lookup syntax 2008-08-17 18:03:13 +02:00
Felix Fietkau
714c75c47a another one 2008-07-31 18:13:57 +02:00
Felix Fietkau
d65c93f0d0 fix a really stupid bug 2008-07-31 17:49:06 +02:00
Felix Fietkau
8a06b55c63 some more input validation 2008-07-30 21:53:30 +02:00
Felix Fietkau
6c020def58 allow more types of characters for uci package names 2008-05-03 19:02:56 +02:00
Felix Fietkau
d4bab37948 parser: fix precedence of quoting over ; as command terminator, thx to netprince for spotting the bug 2008-04-08 21:20:41 +02:00
Felix Fietkau
ce0ffab408 more functionality for plugins 2008-02-12 13:31:43 +01:00
Felix Fietkau
7cefa00ead more plugin support 2008-02-12 13:19:42 +01:00
Felix Fietkau
7ca5c675d7 fix uci_set 2008-02-12 11:49:56 +01:00
Felix Fietkau
9f540f2106 reorganize some code, add an extra command for adding unnamed sections 2008-02-09 17:31:21 +01:00
Felix Fietkau
735792ded0 use strsep instead of strtok to avoid a segfault 2008-02-06 15:47:04 +01:00
Felix Fietkau
12bdbcd95d fix uci_parse_tuple 2008-02-05 21:25:00 +01:00
Felix Fietkau
cba72526bb fix an off-by-one error that prevented the open() check from succeeding, if stdin is closed 2008-02-05 03:25:54 +01:00
Felix Fietkau
c394d8787d improve the argument parser 2008-02-05 00:33:59 +01:00
Felix Fietkau
1ac34884c1 export a function for parsing shell-style arguments in libuci 2008-02-04 23:51:08 +01:00
Felix Fietkau
e828bcf07c improve validation, accept more characters in the section type 2008-02-04 22:56:03 +01:00
Felix Fietkau
65e2c3559b implement uci revert 2008-02-03 06:05:08 +01:00
Felix Fietkau
818f7b8433 move history code into history.c 2008-02-03 05:10:21 +01:00
Felix Fietkau
a49b8b7e23 constify 2008-02-02 22:55:01 +01:00
Felix Fietkau
d3740c6347 fix updated parse_tuple function 2008-01-29 19:19:53 +01:00
Felix Fietkau
41aae0e497 more input validation 2008-01-29 19:00:21 +01:00
Felix Fietkau
eadddde859 cleanup, move parse_tuple to libuci, add some input validation 2008-01-29 18:55:31 +01:00
Felix Fietkau
171170de64 implement more suggestions by lorenz schori 2008-01-23 16:06:29 +01:00