1. 18 Apr, 2019 1 commit
    • Thomas Haller's avatar
      shared: move most of "shared/nm-utils" to "shared/nm-glib-aux" · 80db06f7
      Thomas Haller authored
      From the files under "shared/nm-utils" we build an internal library
      that provides glib-based helper utilities.
      Move the files of that basic library to a new subdirectory
      "shared/nm-glib-aux" and rename the helper library "libnm-core-base.la"
      to "libnm-glib-aux.la".
       - the name "utils" is overused in our code-base. Everything's an
         "utils". Give this thing a more distinct name.
       - there were additional files under "shared/nm-utils", which are not
         part of this internal library "libnm-utils-base.la". All the files
         that are part of this library should be together in the same
         directory, but files that are not, should not be there.
       - the new name should better convey what this library is and what is isn't:
         it's a set of utilities and helper functions that extend glib with
         funcitonality that we commonly need.
      There are still some files left under "shared/nm-utils". They have less
      a unifying propose to be in their own directory, so I leave them there
      for now. But at least they are separate from "shared/nm-glib-aux",
      which has a very clear purpose.
  2. 04 Sep, 2018 10 commits
  3. 28 Aug, 2018 1 commit
  4. 23 Sep, 2016 1 commit
  5. 19 Feb, 2016 1 commit
    • Thomas Haller's avatar
      all: cleanup includes and let "nm-default.h" include "config.h" · 8bace23b
      Thomas Haller authored
      - All internal source files (except "examples", which are not internal)
        should include "config.h" first. As also all internal source
        files should include "nm-default.h", let "config.h" be included
        by "nm-default.h" and include "nm-default.h" as first in every
        source file.
        We already wanted to include "nm-default.h" before other headers
        because it might contains some fixes (like "nm-glib.h" compatibility)
        that is required first.
      - After including "nm-default.h", we optinally allow for including the
        corresponding header file for the source file at hand. The idea
        is to ensure that each header file is self contained.
      - Don't include "config.h" or "nm-default.h" in any header file
        (except "nm-sd-adapt.h"). Public headers anyway must not include
        these headers, and internal headers are never included after
        "nm-default.h", as of the first previous point.
      - Include all internal headers with quotes instead of angle brackets.
        In practice it doesn't matter, because in our public headers we must
        include other headers with angle brackets. As we use our public
        headers also to compile our interal source files, effectively the
        result must be the same. Still do it for consistency.
      - Except for <config.h> itself. Include it with angle brackets as suggested by
  6. 19 Nov, 2015 1 commit
  7. 05 Aug, 2015 2 commits
  8. 24 Jul, 2015 1 commit
    • Dan Winship's avatar
      all: rename nm-glib-compat.h to nm-glib.h, use everywhere · 3452ee2a
      Dan Winship authored
      Rather than randomly including one or more of <glib.h>,
      <glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include
      "nm-glib-compat.h" most of the time), rename nm-glib-compat.h to
      nm-glib.h, include <gio/gio.h> from there, and then change all .c
      files in NM to include "nm-glib.h" rather than including the glib
      headers directly.
      (Public headers files still have to include the real glib headers,
      since nm-glib.h isn't installed...)
      Also, remove glib includes from header files that are already
      including a base object header file (which must itself already include
      the glib headers).
  9. 01 Apr, 2015 1 commit
  10. 04 Dec, 2014 3 commits
  11. 13 Nov, 2014 2 commits
    • Dan Winship's avatar
      libnm*: fix library gettext usage · 53f5e9af
      Dan Winship authored
      Libraries need to include <gi18n-lib.h>, not <gi18n.h>, so that _()
      will get defined to "dgettext (GETTEXT_DOMAIN, string)" rather than
      "gettext (string)" (which will use the program's default domain, which
      works fine for programs in the NetworkManager tree, but not for
      external users). Likewise, we need to call bindtextdomain() so that
      gettext can find the translations if the library is installed in a
      different prefix from the program using it (and
      bind_textdomain_codeset(), so it will know the translations are in
      UTF-8 even if the locale isn't).
      (The fact that no one noticed this was broken before is because the
      libraries didn't really start returning useful translated strings much
      until 0.9.10, and none of the out-of-tree clients have been updated to
      actually show those strings to users yet.)
    • Dan Winship's avatar
      all: consistently include config.h · 3bfb163a
      Dan Winship authored
      config.h should be included from every .c file, and it should be
      included before any other include. Fix that.
      (As a side effect of how I did this, this also changes us to
      consistently use "config.h" rather than <config.h>. To the extent that
      it matters [which is not much], quotes are more correct anyway, since
      we're talking about a file in our own build tree, not a system
  12. 22 Oct, 2014 2 commits
    • Dan Winship's avatar
      libnm-core: add nm-errors.[ch] · b1bcfa8f
      Dan Winship authored
      Add nm-errors.[ch], and move libnm-core's two error domains
      (NMConnectionError and NMCryptoError) there.
      NMCryptoError wasn't previously visible, but it can be returned from
      some public API, so it should be.
    • Dan Winship's avatar
      libnm-core: fix up/simplify NMCryptoError · 663a06b6
      Dan Winship authored
      Many of NMCryptoError's codes would basically never be useful for
      programs to distinguish between. Streamline the codes, and fix the
      enumeration member names to start with "NM_CRYPTO_ERROR_" rather than
  13. 04 Sep, 2014 1 commit
  14. 01 Aug, 2014 1 commit
    • Dan Winship's avatar
      libnm: add libnm/libnm-core (part 1) · d595f784
      Dan Winship authored
      This commit begins creating the new "libnm", which will replace
      libnm-util and libnm-glib.
      The main reason for the libnm-util/libnm-glib split is that the daemon
      needs to link to libnm-util (to get NMSettings, NMConnection, etc),
      but can't link to libnm-glib (because it uses many of the same type
      names as the NetworkManager daemon. eg, NMDevice). So the daemon links
      to only libnm-util, but basically all clients link to both.
      With libnm, there will be only a single client-visible library, and
      NetworkManager will internally link against a private "libnm-core"
      containing the parts that used to be in libnm-util.
      (The "libnm-core" parts still need to be in their own directory so
      that the daemon can see those header files without also seeing the
      ones in libnm/ that conflict with its own headers.)
      [This commit just copies the source code from libnm-util/ to
      libnm-core/, and libnm-glib/ to libnm/:
        mkdir -p libnm-core/tests/
        mkdir -p libnm/tests/
        cp libnm-util/*.[ch] libnm-util/nm-version.h.in libnm-core/
        rm -f libnm-core/nm-version.h libnm-core/nm-setting-template.[ch] libnm-core/nm-utils-enum-types.[ch]
        cp libnm-util/tests/*.[ch] libnm-core/tests/
        cp libnm-glib/*.[ch] libnm/
        rm -f libnm/libnm_glib.[ch] libnm/libnm-glib-test.c libnm/nm-glib-enum-types.[ch]
        cp libnm-glib/tests/*.[ch] libnm/tests/
  15. 15 Jul, 2014 2 commits
    • Dan Winship's avatar
      libnm-util, libnm-glib: whitespace fixes · 2570c5a1
      Dan Winship authored
      Fix indentation, kill trailing whitespace, split some long lines.
    • Dan Winship's avatar
      libnm-util, libnm-glib: standardize copyright/license headers · cb7e1893
      Dan Winship authored
      - Remove list of authors from files that had them; these serve no
        purpose except to quickly get out of date (and were only used in
        libnm-util and not libnm-glib anyway).
      - Just say "Copyright", not "(C) Copyright" or "Copyright (C)"
      - Put copyright statement after the license, not before
      - Remove "NetworkManager - Network link manager" from the few files
        that contained it, and "libnm_glib -- Access network status &
        information from glib applications" from the many files that
        contained it.
      - Remove vim modeline from nm-device-olpc-mesh.[ch], add emacs modeline
        to files that were missing it.
  16. 11 Jul, 2014 1 commit
    • Dan Winship's avatar
      libnm-util: fix build with --with-crypto=gnutls · 09da1786
      Dan Winship authored
      The non-"_t"-suffixed type names in gnutls have been deprecated since
      1.x, and in recent versions will trigger deprecation warnings. Fix by
      using "gnutls_datum_t" instead of "gnutls_datum".
  17. 12 May, 2014 2 commits
  18. 13 Feb, 2013 1 commit
    • Dan Winship's avatar
      all: remove pointless NULL checks · d04f2863
      Dan Winship authored
      g_malloc(), etc, never return NULL, by API contract. Likewise, by
      extension, no other glib function ever returns NULL due to lack of
      memory. So remove lots of unnecessary checks (the vast majority of
      which would have immediately crashed had they ever run anyway, since
      g_set_error(), g_warning(), and nm_log_*() all need to allocate
  19. 13 May, 2011 1 commit
  20. 31 Mar, 2011 1 commit
    • Dan Williams's avatar
      libnm-util: don't ever deinit crypto methods (bgo #646300) · 5b0ef4c2
      Dan Williams authored
      Because we can't ever know if we're the last user of NSS or gnutls
      when nm_utils_deinit() is called, just don't bother deiniting
      the crypto providers.  And atexit handlers are generally frowned
      upon for the exact same reason.  You never know what library linked
      into your process might be also using NSS or gnutls, so basically
      if these libraries suck enough to use global data and not reference
      count it, just let the data leak.  If we do clean stuff up that
      can lead to crashes when other libraries might try to use NSS or
      gnutls after the atexit handler or nm_utils_deinit() has been run.
      See also:  https://bugzilla.mozilla.org/show_bug.cgi?id=54189#c1
  21. 14 Mar, 2011 1 commit
  22. 15 Sep, 2009 1 commit
    • Dan Williams's avatar
      libnm-util: add nm_utils_rsa_key_encrypt() and fix crypto padding mixups · 8c35e96b
      Dan Williams authored
      To be backwards compatible clients need to handle both paths to private
      keys and the decrypted private key data, which is what used to get passed
      in the private-key and phase2-private-key attributes of the 802.1x setting.
      When moving a connection around between system-settings and user-settings,
      if the private key is decrypted data, the settings service needs to store
      that decrypted data somewhere so that the key can be sent to NM during
      the connection process.
      But we don't want to store the decrypted private key data, so we have to
      re-encrypt it (possibly generating a private key password if one wasn't
      sent with the decrypted data) and save it to disk, then send NM a path
      to that private key during connection.
      To help clients do this, and so that they don't have to carry around
      multiple crypto implementations depending on whether they want to use
      NSS or gnutls/gcrypt, add a helper to libnm-util.
      Furthermore, I misunderstood a bunch of stuff with crypto padding when
      writing the encrypt/decrypt functions long ago, so fix that up.  Don't
      return padding as part of the decrypted data, and make sure to verify
      the padding's expected lengths and values when decrypting.  Many thanks
      to Nalin Dahyabhai for pointing me in the right direction.
  23. 13 Nov, 2008 1 commit
    • Dan Williams's avatar
      2008-11-13 Dan Williams <dcbw@redhat.com> · e2f65ce1
      Dan Williams authored
      	Add support for PKCS#12 private keys (bgo #558982)
      	* libnm-util/crypto.c
      		- (parse_old_openssl_key_file): rename from parse_key_file(); adapt to
      			take a GByteArray instead of a filename
      		- (file_to_g_byte_array): handle private key files too
      		- (decrypt_key): take a GByteArray rather than data + len
      		- (crypto_get_private_key_data): refactor crypto_get_private_key() into
      			one function that takes a filename, and one that takes raw data;
      			detect pkcs#12 files as well
      		- (crypto_load_and_verify_certificate): detect file type
      		- (crypto_is_pkcs12_data, crypto_is_pkcs12_file): add pkcs#12 detection
      	* libnm-util/crypto_gnutls.c
      		- (crypto_decrypt): take GByteArray rather than data + len; fix a bug
      			whereby tail padding was incorrectly handled, leading to erroneous
      			successes when trying to decrypt the data
      		- (crypto_verify_cert): rework somewhat
      		- (crypto_verify_pkcs12): validate pkcs#12 keys
      	* libnm-util/crypto_nss.c
      		- (crypto_init): enable various pkcs#12 ciphers
      		- (crypto_decrypt): take a GByteArray rather than data + len
      		- (crypto_verify_cert): clean up
      		- (crypto_verify_pkcs12): validate pkcs#12 keys
      	* libnm-util/test-crypto.c
      		- Handle pkcs#12 keys
      	* libnm-util/nm-setting-8021x.c
      		- Add two new properties, 'private-key-password' and
      			'phase2-private-key-password', to be used in conjunction with
      			pkcs#12 keys
      		- (nm_setting_802_1x_set_ca_cert_from_file,
      		   nm_setting_802_1x_set_phase2_client_from_file): return certificate
      		- (nm_setting_802_1x_get_private_key_password,
      		   nm_setting_802_1x_get_phase2_private_key_password): return private
      			key passwords
      		- (nm_setting_802_1x_set_private_key_from_file,
      		   nm_setting_802_1x_set_phase2_private_key_from_file): set the private
      			key from a file, and update the private key password at the same time
      		- (nm_setting_802_1x_get_private_key_type,
      		   nm_setting_802_1x_get_phase2_private_key_type): return the private
      			key type
      	* src/supplicant-manager/nm-supplicant-settings-verify.c
      		- Whitelist private key passwords
      	* src/supplicant-manager/nm-supplicant-config.c
      		- (nm_supplicant_config_add_setting_8021x): for pkcs#12 private keys,
      			add the private key password to the supplicant config, but do not
      			add the client certificate (as required by wpa_supplicant)
      git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4280 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
  24. 08 Sep, 2008 1 commit
    • Dan Williams's avatar
      2008-09-08 Dan Williams <dcbw@redhat.com> · 796829ce
      Dan Williams authored
      	Patch from Alexander Sack <asac@ubuntu.com>
      	* libnm-util/crypto_gnutls.c
      		- (crypto_init, crypto_deinit): just use a boolean instead of a refcount
      	* libnm-util/nm-utils.c
      		- (nm_utils_init): initialize libnm-util
      		- (nm_utils_deinit): de-initialize libnm-util and clean up resources
      	* libnm-util/nm-setting-8021x.c
      		- (nm_setting_802_1x_class_init): init libnm-util when needed
      git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4047 4912f4e0-d625-0410-9fb7-b9a5a253dbdc