Commit Graph

9 Commits

Author SHA1 Message Date
Thomas Haller
49fd96bf01 libnm: add "nm-keyfile.h" header
Keyfile API will become part of public libnm API. Add "nm-keyfile.h"
header for that.
2020-10-28 14:30:48 +01:00
Thomas Haller
bd4b067186 keyfile: relicense the code under LGPL-2.1+
Historically, keyfile read/write code was part of core, and thus
GPL-2.0+ licensed. Keyfile is the native file format for NetworkManager
connection profiles, and code to handle that should be part of libnm.
This would unlock many interesting features, like tools being able
to import/export connection profiles in the native file format.
However, libnm is LGPL-2.1+ licensed, so this is a problem.

The alternative would be to add a separate, GPL licensed library
(libnm-keyfile.so or libnm-gpl.so). However that also requires a larger
rework, because the current keyfile implementation uses internal API
from libnm-core and it would need to be reworked to only use public
API of libnm.

Relicense the code instead. According to research and "keyfile-history.sh"
script, the following individuals and companies possibly hold copyright
on the code:

  <bgalvani(at)redhat.com>
  <blueowl(at)centrum.cz>
  <daniel(at)gnoutcheff.name>
  <danw(at)redhat.com>
  <dcantrell(at)redhat.com>
  <dcbw(at)redhat.com>
  <evan(at)ebroder.net>
  <fgiudici(at)redhat.com>
  <floe(at)butterbrot.org>
  <j(at)bootlab.org>
  <kmaraas(at)gnome.org>
  <lkundrak(at)v3.sk>
  <luzpaz(at)users.noreply.github.com>
  <martinpitt(at)gnome.org>
  <michael.i.doherty(at)intel.com>
  <pavlix(at)pavlix.net>
  <pmarti(at)warp.es>
  <rafaelff(at)gnome.org>
  <rstrode(at)redhat.com>
  <tambet(at)gmail.com>
  <tgraf(at)redhat.com>
  <thaller(at)redhat.com>
  <walters(at)verbum.org>
  <yurchor(at)ukr.net>
  Intel Corporation
  Novell, Inc.
  Red Hat, Inc.
  Ximian, Inc.

Most contributors on this list agreed to relicensing according to RELICENSE.md.

The following copyright holders did not answer the request for agreeing
to relicensing:

- <j(at)bootlab.org>: no contributions were made that are related to
  keyfile implementation. The script just gives a false positive.

- <pmarti(at)warp.es>: the contribution is a fix of a spelling error
  (commit 6029288ffb).

- <tgraf(at)redhat.com>: the contribution to keyfile code are small
  (I only identified commit 5b7503e95e).
  Also, Thomas worked for Red Hat at the time.

After research, I think it's fair to conclude that everybody who holds
non-trivial copyright on the keyfile code agreed to the relicensing.
2020-10-20 21:02:47 +02:00
Thomas Haller
88071abb43 all: unify comment style for SPDX-License-Identifier tag
Our coding style recommends C style comments (/* */) instead of C++
(//). Also, systemd (which we partly fork) uses C style comments for
the SPDX-License-Identifier.

Unify the style.

  $ sed -i '1 s#// SPDX-License-Identifier: \([^ ]\+\)$#/* SPDX-License-Identifier: \1 */#' -- $(git ls-files -- '*.[hc]' '*.[hc]pp')
2020-09-29 16:50:53 +02:00
Thomas Haller
740b092fda format: replace tabs for indentation in code comments
sed -i \
     -e 's/^'$'\t'' \*/     */g' \
     -e 's/^'$'\t\t'' \*/         */g' \
     -e 's/^'$'\t\t\t'' \*/             */g' \
     -e 's/^'$'\t\t\t\t'' \*/                 */g' \
     -e 's/^'$'\t\t\t\t\t'' \*/                     */g' \
     -e 's/^'$'\t\t\t\t\t\t'' \*/                         */g' \
     -e 's/^'$'\t\t\t\t\t\t\t'' \*/                             */g' \
     $(git ls-files -- '*.[hc]')
2020-09-28 16:07:52 +02:00
Antonio Cardace
328fb90f3e all: reformat all with new clang-format style
Run:

    ./contrib/scripts/nm-code-format.sh -i
    ./contrib/scripts/nm-code-format.sh -i

Yes, it needs to run twice because the first run doesn't yet produce the
final result.

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-09-28 16:07:51 +02:00
Thomas Haller
70971d1141 all: avoid wrong compiler warning about uninitalized variables with LTO
Seems with LTO the compiler can sometimes think that thes variables are
uninitialized. Usually those code paths are only after an assertion was
hit (g_return*()), but we still need to workaround the warning.
2020-08-17 15:18:02 +02:00
Yuri Chornoivan
4e33f8cd89 all: fix minor typos
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/565
2020-07-07 11:33:46 +02:00
Thomas Haller
3be4f38a15 keyfile: cleanup uses of GString in keyfile code
- in _keyfile_key_decode(), don't use GString. We know the maximum
  string length before, so we can just allocated one buffer.

- in qdisc and tfilter writers, reuse the same GString instance.
  No need to allocate a new temporary string buffer for each iteration.

- at other places, replace GString by NMStrBuf. This avoids the heap
  allocated GString instance. Also, most operations can be inlined.
  This results in larger code side, but avoids function calls to glib.
2020-06-26 09:29:54 +02:00
Thomas Haller
b760dee8c8 all: move "shared/nm-keyfile" to "libnm-core/nm-keyfile"
Originally, these files were part of libnm-core and linked together.
However, that is a licensing violation, because the code is GPL-2.0+
licensed, while libnm-core also gets linked with libnm (it must thus
be LGPL-2.1+). The original intent behind moving the code to "shared/"
was to avoid the licensing issue, but also to prepare when we would add
a separate, GPL licensed libnm-keyfile. However, currently we hope to
be able to relicense the code, so that it actually could be exposed as
part of libnm. This is work in progress at ([1]).

[1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/ ## 517

Anyway, the current directory layout is problematic. libnm-keyfile
depends on libnm-core, while libnm-core depends on code under shared.
That means, there is a circular dependency and meson's subdir() does
not work well.

Move the code.
2020-06-11 10:53:50 +02:00