586 Commits

Author SHA1 Message Date
John Crispin
2549fb8454 uci_blob: add an element to uci_blob_param_list to allow the tracking of validation info
Signed-off-by: John Crispin <blogic@openwrt.org>
2014-02-17 13:20:11 +01:00
Felix Fietkau
262fede3e8 blob: use BLOBMSG_TYPE_STRING as a fallback type for arrays if no type was specified
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-12-02 11:11:21 +01:00
Felix Fietkau
2fe8dbda01 remove ucimap-example, as ucimap is deprecated
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-12-02 08:36:33 +01:00
Felix Fietkau
160a9e1313 blob: allow values to be added to blobmsg using multiple different types, but suppress duplicates
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-11-04 16:43:49 +01:00
Felix Fietkau
84492e759a ucimap: get rid of duplicate initialization warnings
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-29 16:50:47 +01:00
Felix Fietkau
be457b5263 parse: remove a check that is always true (due to unsigned data type)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-29 16:48:23 +01:00
Felix Fietkau
c1f1ec3514 file: add missing return code check for mktemp()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-24 23:25:02 +02:00
Felix Fietkau
376fdc74c7 file: fix memleak on mktemp() errors
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-24 23:24:32 +02:00
Luka Perkov
f506323c30 style: fix whitespace errors
Signed-off-by: Luka Perkov <luka@openwrt.org>
2013-10-15 13:17:09 +02:00
Luka Perkov
87be3798a9 style: free(NULL) is perfectly valid so we can drop some checks
Signed-off-by: Luka Perkov <luka@openwrt.org>
2013-10-15 13:16:32 +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
2fcc6d756f uci_delete: check ptr->o and its type before checking ptr->value
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-09-29 13:20:34 +02:00
Felix Fietkau
c9c9d5cb08 uci: fix excessive reorder delta entry duplication
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-11 14:50:57 +02:00
Felix Fietkau
9d8e1fe485 blob: add uci<->blob conversion library code
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-10 14:39:22 +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
Jo-Philipp Wich
9ef6964362 lua: emit a proper deletion when setting an existing list to a new list with only a single item 2013-05-26 18:55:20 +02:00
Krzysztof Kuźnik
b42ee8f218 uci: Fix uci_delete() when ptr->value is empty string
After fix for deleting list elements by index this function was
broken and didn't allow to invoke from command line:
uci set some.fancy.list=''
i.e. list wasn't cleared

Signed-off-by: Krzysztof Kuźnik <k.kuznik@avsystem.com>
2013-05-02 14:30:31 +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
Jo-Philipp Wich
ef12e67516 Change delta encoding of list deletions
When encoding list_del commands in delta files, '_' is used as prefix but this
breaks any command operating on files starting with an underscore since the
command prefix becomes indistinguishable from the filename.

The regression was introduced with ec8cbbbe0f.

Avoid this problem by using '~' as command prefix for list deletions.
2013-04-22 16:01:25 +02:00
Jérôme Poulin
1e1f503d8f Add multiple free for each call to lookup_args()
This memory leak can be reproduced using a tight loop to uci:get() a config.

lua -e 'require("posix"); require("uci");
function getconf()
   local tmp, uc = uci.cursor();
   tmp = uc:get("system", "ntp", "enable_server");
end;

while 1
do
   for i=0,1000 do getconf() end;
   print("gc");
   print(collectgarbage("count"));
   collectgarbage();
   print(collectgarbage("count"));
   print("sleep 1");
   posix.sleep(1);
end'
2013-04-22 15:10:46 +02:00
Krzysztof Kuznik
6c71e7ee00 uci: libuci leaking memory on non-existent config file
In file file.c function uci_file_load() allocates memory for filename.
When uci_open_stream() failed with exception this memory was never freed.
This patch makes call to uci_open_stream() wrapped in exception handling
inside uci_file_load() where filename is freed.

Signed-off-by: Krzysztof Kuznik <k.kuznik@avsystem.com>
2013-04-22 15:04:08 +02:00
Jo-Philipp Wich
28608b5321 ignore trailing carriage returns in file parser 2013-03-05 16:33:03 +01:00
Thomas Gstädtner
6f251b7f60 add main directory to include path 2013-03-04 19:17:19 +01:00
Felix Fietkau
08c51bfaf5 build: remove install prefix override
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-23 15:22:02 +01:00
Felix Fietkau
ec09159ac7 get rid of -rdynamic on link
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-04 17:24:35 +01:00
Felix Fietkau
6adc611deb remove unused hook support
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-04 17:16:41 +01:00
Felix Fietkau
e5bd3aa458 remove the libdl dependency
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-04 17:12:45 +01: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
517a772514 remove static libraries/binaries
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-31 16:57:13 +01:00
Luka Perkov
e81961bde8 extend delete command so it can delete list elemets using index 2012-11-09 11:45:00 +01:00
Luka Perkov
ec8cbbbe0f add new command del_list 2012-11-09 11:40:10 +01:00
Felix Fietkau
2e90d2637a lua: include /opt/local/lib and /opt/local/include in the search path on mac os x 2012-10-04 16:04:46 +02:00
Felix Fietkau
af26658660 cli: return non-zero status on errors 2012-03-28 13:29:48 +03:00
Jo-Philipp Wich
d3722382bd Do quote section names to keep the same style as option values 2012-02-24 15:08:34 +01:00
Jo-Philipp Wich
bddae56bac Section names, option names, list names can only be identifiers, so they don't need to be quoted.
Strip quotes except from values.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2012-02-24 12:24:17 +01:00
Jo-Philipp Wich
760c34c94a lua: properly handle corner cases in changes
The previous rework of the change serialization caused some deltas to incorrectly
get promoted to list appends. Rework the code to explicitely check for an add list
change type, in all other cases simply overwrite existing fields with the current
string value instead of coercing existing values into a table and append to that.
This hopefully sorts out the remaining issues.
2011-12-20 17:06:50 +01:00
Jo-Philipp Wich
aac40e9b49 lua: expose completely new lists in changes() as well
Since the first delta of a new list is of type UCI_CMD_CHANGE and
not UCI_CMD_LIST_ADD, the current code does not start a new table
and subsequent items are silently disacarded. Expose all items of
new list by coercing the existing string element into a table when
encountering subsequent items.
2011-12-19 19:25:00 +01:00
Jo-Philipp Wich
16efed5432 Merge branch 'master' of git://nbd.name/uci 2011-12-19 19:10:07 +01:00
Jo-Philipp Wich
7289b2d69a lua: simplify add_list changes handling, always create a table for LIST_ADD commands 2011-11-14 13:19:07 +01:00
Jo-Philipp Wich
ef5f4ae325 lua: expose add_list change items as table values 2011-11-14 13:19:06 +01:00
Jo-Philipp Wich
359c5c4dcc lua: simplify add_list changes handling, always create a table for LIST_ADD commands 2011-11-12 15:16:31 +01:00
Jo-Philipp Wich
dc47efacd6 lua: expose add_list change items as table values 2011-11-12 14:35:12 +01:00
Felix Fietkau
9d7dd37590 fix segfault on import of anonymous sections 2011-10-21 22:48:01 +02:00
Felix Fietkau
11b494045c lua: always return after calling luaL_error (patch by Stanislav Fomichev) 2011-10-21 15:17:06 +02:00
Felix Fietkau
a8c6241437 cli: check against multiple -f invocations to avoid leaks (patch by Stanislav Fomichev) 2011-10-21 15:17:06 +02:00
Felix Fietkau
d068b9f9d7 ucimap: initialize an uninitialized pointer (patch by Stanislav Fomichev) 2011-10-21 15:17:06 +02:00
Felix Fietkau
5077cdcee2 ucimap: fix a memory leak (patch by Stanislav Fomichev) 2011-10-21 15:17:06 +02:00
Felix Fietkau
1d6095d5ac add a few missing null pointer checks, and fix check vs dereference order in some cases (patch by Stanislav Fomichev) 2011-10-21 15:17:06 +02:00
Felix Fietkau
ef95525edc check result of memory allocations (patch by Stanislav Fomichev) 2011-10-21 15:17:06 +02:00
Felix Fietkau
2b86a11e49 ucimap: fix use-after-free on cleanup (patch by Stanislav Fomichev) 2011-10-21 15:17:06 +02:00