summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| | * keyfile: use nm_g_error_matches() in g_error_matches()Thomas Haller2020-05-071-4/+4
| | | | | | | | | | | | | | | | | | nm_g_error_matches() can be inlined and first checks whether the error argument is not NULL. At least from the keyfile accessor functions, use this macro, as they are called many times.
| | * keyfile,config: use nm_keyfile_error_is_not_found() helperThomas Haller2020-05-071-6/+2
| | |
| | * shared: add nm_keyfile_error_is_not_found() helperThomas Haller2020-05-071-0/+12
| | |
| | * shared: add nm_g_error_matches() helperThomas Haller2020-05-071-0/+15
| | |
| | * shared: add NM_STR_HAS_PREFIX_WITH_MORE() helperThomas Haller2020-05-071-0/+10
| | |
| | * shared: fix accessing "str" argument to NM_STR_HAS_PREFIX() macro twiceThomas Haller2020-05-071-6/+11
| |/ | | | | | | | | | | | | | | | | | | | | | | Macros preferably behave function-like, for example in that they evaluate arguments exactly ones. Sometimes, we want to evaluate arguments lazily, like in NM_IN_SET() or nm_g_set_error_take_lazy(). But it is almost always undesirable to evaluate an argument more than once. Fix NM_STR_HAS_PREFIX() for that. Also, rename the local variable to not use the name "_str", which may be a common name that the caller would like to use.
| * all: merge branch 'th/lgtm-com-fixes-1'Thomas Haller2020-05-0727-40/+73
| |\ | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/494
| | * examples: remove unused code from "examples/python/dbus/vpn.py"Thomas Haller2020-05-071-1/+0
| | | | | | | | | | | | | | | lgtm.com says "The value assigned to local variable all_connections is never used". Just drop the entire statement. It's not right there.
| | * examples: avoid "x == None" checks in python examplesThomas Haller2020-05-072-2/+2
| | | | | | | | | | | | lgmt.com says "Testing for None should use the is operator".
| | * examples: avoid "except" for BaseException in examplesThomas Haller2020-05-072-2/+2
| | | | | | | | | | | | lgtm.com flags this as "Except block directly handles BaseException".
| | * examples: avoid non-thread-safe localtime() function exampleThomas Haller2020-05-071-1/+6
| | | | | | | | | | | | Just to silence the warning on lgtm.com.
| | * examples: remove unused imports from python examplesThomas Haller2020-05-0712-13/+7
| | |
| | * examples: remove unused assignment in "examples/python/gi/wifi-p2p.py"Thomas Haller2020-05-071-1/+1
| | | | | | | | | | | | lgtm.com warns about this.
| | * libnm: remove unused import from "generate-setting-docs.py"Thomas Haller2020-05-071-1/+1
| | |
| | * libnm: fix redundant line constructing dbus_type_name_map in ↵Thomas Haller2020-05-071-1/+0
| | | | | | | | | | | | "generate-setting-docs.py"
| | * tests: add include guard to "nm-test-libnm-utils.h" headerThomas Haller2020-05-071-0/+5
| | | | | | | | | | | | It causes a warning on lgtm.com.
| | * config: avoid lgtm.com warning about int bitfield for ↵Thomas Haller2020-05-073-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NMConfigDeviceStateData.nm_owned lgtm.com warns: int nm_owned:3; >> Bit field nm_owned of type int should have explicitly unsigned integral, explicitly signed integral, or enumeration type. So make it a NMTernary instead. It's nicer anyway.
| | * cli: avoid empty if block without a commentThomas Haller2020-05-073-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | lgtm.com flags this as "Empty block without comment". Avoid it. This code is of course ugly. Much work was already done to port such occurrences, and more is needed. I won't add a FIXME comment, because lgtm.com flags those too. :)
| | * cli: avoid redundant "if" check that is always TRUE in ↵Thomas Haller2020-05-071-1/+1
| | | | | | | | | | | | nmcli_editor_tab_completion()
| | * cli: avoid non-thread-safe localtime() function in nmcliThomas Haller2020-05-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Static analysis tools flag the use of localtime() because it is not thread safe. Of course, that was no problem here, but avoiding the warning is simple. Also, if we allocate 128 bytes, let strftime use it.
| | * ndisc: avoid static analysis complaining about overflow check in receive_ra()Thomas Haller2020-05-071-3/+3
| | | | | | | | | | | | | | | | | | | | | lgtm.com flags this. The check was there to be better safe than sorry. Also, it seems better to have code that shows what happens instead of a verbose code comment (or no comment at all). Anyway, avoid the false positive.
| | * acd: avoid alloca() inside an unbounded loopThomas Haller2020-05-071-2/+16
| |/
| * device: fix compilation error "--without-more-asserts"Thomas Haller2020-05-071-2/+2
| | | | | | | | | | | | | | | | | | | | Defining the name "dispose" breaks object_class->dispose = dispose; below. Fixes: fdba9200c0c0 ('device: avoid coverity warning about unused variable')
| * merge: branch 'bg/coverity'Beniamino Galvani2020-05-075-5/+13
| |\ | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/495
| | * libnm: remove early return statement in test_nm_auth_permissions()Beniamino Galvani2020-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by coverity: >>> CID 210230: Control flow issues (UNREACHABLE) >>> This code cannot be reached: "i = 0;". Fixes: 09e17888f7f0 ('libnm: add mapping functions between string and NMClientPermission enum')
| | * ifcfg-rh: check return value of fdopen()Beniamino Galvani2020-05-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by coverity: >>> CID 210222: Null pointer dereferences (NULL_RETURNS) >>> Dereferencing a pointer that might be "NULL" "f" when calling "fseek". Fixes: ac5206aa9c5a ('2007-11-21')
| | * libnm: fix assertion in NML_IS_DBUS_OBJECT()Beniamino Galvani2020-05-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by coverity: >>> CID 210228: Null pointer dereferences (REVERSE_INULL) >>> Null-checking "dbobj" suggests that it may be null, but it has already been dereferenced on all paths leading to the check. Fixes: ce0e898fb476 ('libnm: refactor caching of D-Bus objects in NMClient')
| | * libnm-core: replace malloc() with g_malloc()Beniamino Galvani2020-05-071-1/+1
| | | | | | | | | | | | | | | For consistency with the rest of the code, prefer g_malloc() over malloc().
| | * cli/polkit: add missing variable initialization in retrieve_session_id_cb()Beniamino Galvani2020-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by coverity: >>> CID 210213 Uninitialized pointer read (UNINIT) >>> Using uninitialized value iter when calling _nm_auto_free_variant_iter Fixes: df1d214b2ea7 ('clients: polkit-agent: implement polkit agent without using libpolkit')
| | * cli/polkit: add missing variable initialization in dbus_method_call_cb()Beniamino Galvani2020-05-071-1/+1
| |/ | | | | | | | | | | | | | | | | | | Reported by coverity: >>> CID 210217: (UNINIT) >>> Using uninitialized value "identities_gvariant" when calling "gs_local_variant_unref". Fixes: df1d214b2ea7 ('clients: polkit-agent: implement polkit agent without using libpolkit')
| * all: merge branch 'af/settings-add-matches'Thomas Haller2020-05-0716-96/+745
| |\ | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/431
| | * device: style fixesth/af/settings-add-matchesThomas Haller2020-05-061-23/+28
| | |
| | * device: handle match.driver also with unknown device driverThomas Haller2020-05-061-11/+7
| | | | | | | | | | | | | | | | | | If the driver is unknown, that doesn't necessarily mean that the match passes. Instead, the match passes if there is no positive match that asks for the driver name.
| | * core: accept %NULL argument to nm_wildcard_match_check()Thomas Haller2020-05-061-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | %NULL means that the string is unknown. The pattern should still match if there are no positive matches that want to match against the string. For example, the nm_device_get_driver() might return NULL. If we have a match.driver setting, we still need to handle that somehow that it makes sense.
| | * ifcfg-rh: minor cleanup of make_match_setting()Thomas Haller2020-05-061-11/+11
| | |
| | * ifcfg-rh: refactor write_match_setting()Thomas Haller2020-05-061-50/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - write_match_setting() never fails. Don't let it return a boolean error result. - drop "if (!name || !name[0])" checks. It's not possibly to configure a name %NULL in NMSettingMatch (without triggering assertions). Also, an empty name "" is not valid, so we wouldn't expect it. There is one problem with the way how we concatenate the string list: it uses spaces as separator, while stripping spaces. That means, in the currenty format, an empty token "" cannot be expressed. On the other hand, serializing it would lead to duplicate spaces, that get dropped during re-read. So the empty name wasn't valid from the start, but it also cannot be encoded. - use nm_gstring_add_space_delimiter() and nm_gstring_prepare().
| | * cli: use default implementation of getter for NMSettingMatch propertiesThomas Haller2020-05-061-102/+3
| | | | | | | | | | | | The default implementation should be good enough. Use it.
| | * libnm: allocate device and kernel_command_line arrays in NMSettingMatch lazyThomas Haller2020-05-061-58/+60
| | |
| | * libnm: allocate interface_name array in NMSettingMatch lazyThomas Haller2020-05-061-30/+34
| | | | | | | | | | | | | | | | | | Also track the interface_name in a GArray so that nm_setting_match_get_interface_names() returns a NULL terminated strv array.
| | * shared: add nm_strvarray_*() helper APIThomas Haller2020-05-061-0/+48
| | | | | | | | | | | | | | | | | | GPtrArray does not support NULL terminating the pointer array. That makes it cumbersome to use it for tracking a strv array. Add a few helper functions nm_strvarray_*() that help using a GArray instead.
| | * shared: add nm_indirect_g_free() helperThomas Haller2020-05-062-0/+22
| | |
| | * shared: add nm_g_array_len() helperThomas Haller2020-05-061-0/+8
| | |
| | * shared: add nm_g_ptr_array_len() helperThomas Haller2020-05-061-0/+8
| | |
| | * libnm: cleanup NMSettingMatch.verify()Thomas Haller2020-05-061-10/+7
| | |
| | * libnm: fix gtk-doc annotations for ↵Thomas Haller2020-05-061-2/+4
| | | | | | | | | | | | | | | | | | nm_setting_match_get_{kernel_command_lines,drivers}() Otherwise the function is not usable via generated bindings.
| | * libnm: sort entires in libnm.verThomas Haller2020-05-061-7/+7
| | |
| | * ifcfg-rh: support new match filtersAdrian Freihofer2020-05-066-14/+72
| | |
| | * ifcfg-rh-reader: match refactoringAdrian Freihofer2020-05-061-15/+22
| | |
| | * po add libnm-core/nm-setting-match.cAdrian Freihofer2020-05-061-0/+1
| | |
| | * settings: add match for driverAdrian Freihofer2020-05-066-0/+276
| | | | | | | | | | | | | | | | | | Add a new "driver" match option to nm-settings. It allows to disable a network connection configuration if a pattern is found or is not found in the device driver name.