Imported Upstream version 1.40
[platform/upstream/connman.git] / src / technology.c
index 4e053fc..672d6ea 100644 (file)
@@ -185,10 +185,12 @@ static void technology_save(struct connman_technology *technology)
                                        "Tethering.Identifier",
                                        technology->tethering_ident);
 
-       if (technology->tethering_passphrase)
+       if (technology->tethering_passphrase) {
+               char *enc = g_strescape(technology->tethering_passphrase, NULL);
                g_key_file_set_string(keyfile, identifier,
-                                       "Tethering.Passphrase",
-                                       technology->tethering_passphrase);
+                                       "Tethering.Passphrase", enc);
+               g_free(enc);
+       }
 
 done:
        g_free(identifier);
@@ -390,6 +392,7 @@ static void technology_load(struct connman_technology *technology)
        gchar *identifier;
        GError *error = NULL;
        bool enable, need_saving = false;
+       char *enc;
 
        DBG("technology %p", technology);
 
@@ -436,8 +439,10 @@ static void technology_load(struct connman_technology *technology)
        technology->tethering_ident = g_key_file_get_string(keyfile,
                                identifier, "Tethering.Identifier", NULL);
 
-       technology->tethering_passphrase = g_key_file_get_string(keyfile,
+       enc = g_key_file_get_string(keyfile,
                                identifier, "Tethering.Passphrase", NULL);
+       if (enc)
+               technology->tethering_passphrase = g_strcompress(enc);
 done:
        g_free(identifier);