Send connman mailing list submissions to
[email protected]
To subscribe or unsubscribe via email, send a message with subject or
body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."
Today's Topics:
1. [PATCH 10/10] doc: Add VPN agent API documentation for
OpenVPN.PrivateKeyPassword
(Jussi Laakkonen)
2. [PATCH v3 0/4] Remove GDateTime API usage (Daniel Wagner)
3. [PATCH v3 1/4] util: Add timestamp helpers (Daniel Wagner)
4. [PATCH v3 2/4] service: Remove GDateTime API usage (Daniel Wagner)
5. [PATCH v3 3/4] wifi: Replace GDateVal API usage (Daniel Wagner)
6. [PATCH v3 4/4] tools: Remove GDateTime API usage (Daniel Wagner)
----------------------------------------------------------------------
Date: Mon, 11 Nov 2019 16:04:19 +0200
From: Jussi Laakkonen <[email protected]>
Subject: [PATCH 10/10] doc: Add VPN agent API documentation for
OpenVPN.PrivateKeyPassword
To: [email protected]
Message-ID: <[email protected]>
Document the encrypted private key password in the VPN agent API. This
is sent when OpenVPN process detects a encrypted private key file and
needs password for decryption.
---
doc/vpn-agent-api.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/doc/vpn-agent-api.txt b/doc/vpn-agent-api.txt
index 318bfc18..de37f4d6 100644
--- a/doc/vpn-agent-api.txt
+++ b/doc/vpn-agent-api.txt
@@ -107,6 +107,11 @@ Fields string Username
Return the final VPN server to use after possible
web authentication logins, selections and redirections.
+ string OpenVPN.PrivateKeyPassword
+
+ Return the private key password used to decrypt the
+ encrypted OpenVPN private key file.
+
boolean AllowStoreCredentials
Indicates to the receiving UI whether the values
--
2.20.1
------------------------------
Date: Tue, 12 Nov 2019 08:47:15 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH v3 0/4] Remove GDateTime API usage
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>
As it turns out, the GDateTime was introduced in 2.26 but not the
iso8601 function.
changes since v2:
- moved new code into util helper file
- updated wifi plugin as well
changes since v1:
- added error handling
- use gettimeofday() like Glib does
- backwards compatibility added to string parser
Daniel Wagner (4):
util: Add timestamp helpers
service: Remove GDateTime API usage
wifi: Replace GDateVal API usage
tools: Remove GDateTime API usage
plugins/wifi.c | 12 +++++++-----
src/service.c | 45 ++++++++++-----------------------------------
src/shared/util.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
src/shared/util.h | 6 ++++++
tools/stats-tool.c | 13 +++----------
5 files changed, 70 insertions(+), 50 deletions(-)
--
2.23.0
------------------------------
Date: Tue, 12 Nov 2019 08:47:16 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH v3 1/4] util: Add timestamp helpers
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>
Use POSIX APIs to implement a simple replacement for GDateTime.
The Glib code uses gettimeofday() to implement g_date_time_new_now(),
so use the same interface to avoid breakage.
Furthermore, the Glib code writes the timestamps with sub seconds
values, e.g. "2019-10-20T14:45:31.079935Z". The new code only writes
with second precision. That means the string parser needs to be able
to deal with the old time and new format.
---
src/shared/util.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
src/shared/util.h | 6 ++++++
2 files changed, 50 insertions(+)
diff --git a/src/shared/util.c b/src/shared/util.c
index df045c5bf799..6b2c43885428 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -88,3 +88,47 @@ void util_hexdump(const char dir, const unsigned char *buf,
size_t len,
function(str, user_data);
}
}
+
+void util_update_time(struct timeval *time)
+{
+ gettimeofday(time, NULL);
+}
+
+void util_update_time_from_iso8601(char *str, struct timeval *time)
+{
+ struct tm tm;
+ time_t t;
+ char *p;
+
+ p = strptime(str, "%FT%T", &tm);
+ if (!p)
+ return;
+
+ if (*p != 'Z') {
+ /* backwards compatibility */
+ if (*p != '.' || p[strlen(p) - 1] != 'Z')
+ return;
+ }
+
+ t = mktime(&tm);
+ if (t < 0)
+ return;
+
+ time->tv_sec = t;
+ time->tv_usec = 0;
+}
+
+char *util_get_time_format_iso8601(struct timeval *time)
+{
+ char buf[255];
+ struct tm tm;
+ time_t t;
+
+ t = time->tv_sec;
+ if (!localtime_r(&t, &tm))
+ return NULL;
+ if (!strftime(buf, sizeof(buf), "%FT%TZ", &tm))
+ return NULL;
+
+ return g_strdup(buf);
+}
diff --git a/src/shared/util.h b/src/shared/util.h
index 293fb3a4f3ba..4cdd75be899b 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -21,6 +21,8 @@
*
*/
+#include <sys/time.h>
+
#include <glib.h>
typedef void (*util_debug_func_t)(const char *str, void *user_data);
@@ -48,3 +50,7 @@ static inline struct cb_data *cb_data_new(void *cb, void
*user_data)
return ret;
}
+
+void util_update_time(struct timeval *time);
+void util_update_time_from_iso8601(char *str, struct timeval *time);
+char *util_get_time_format_iso8601(struct timeval *time);
--
2.23.0
------------------------------
Date: Tue, 12 Nov 2019 08:47:17 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH v3 2/4] service: Remove GDateTime API usage
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>
The g_date_time_new_from_iso8601() was introduced with GLib v2.56. We
don't want to update our version dependency. Instead use our replacement
API.
---
src/service.c | 45 ++++++++++-----------------------------------
1 file changed, 10 insertions(+), 35 deletions(-)
diff --git a/src/service.c b/src/service.c
index 7e1446b7cf3b..e60c8b61b04b 100644
--- a/src/service.c
+++ b/src/service.c
@@ -30,11 +30,14 @@
#include <gdbus.h>
#include <ctype.h>
#include <stdint.h>
+#include <sys/time.h>
#include <connman/storage.h>
#include <connman/setting.h>
#include <connman/agent.h>
+#include "src/shared/util.h"
+
#include "connman.h"
#define CONNECT_TIMEOUT 120
@@ -84,7 +87,7 @@ struct connman_service {
bool hidden;
bool ignore;
bool autoconnect;
- GDateTime *modified;
+ struct timeval modified;
unsigned int order;
char *name;
char *passphrase;
@@ -378,31 +381,6 @@ static void set_split_routing(struct connman_service
*service, bool value)
service->order = 10;
}
-static void update_modified(struct connman_service *service)
-{
- GTimeZone *tz;
-
- if (service->modified)
- g_date_time_unref(service->modified);
-
- tz = g_time_zone_new_local();
- service->modified = g_date_time_new_now(tz);
- g_time_zone_unref(tz);
-}
-
-static void update_modified_from_iso8601(struct connman_service *service,
- char *str)
-{
- GTimeZone *tz;
-
- if (service->modified)
- g_date_time_unref(service->modified);
-
- tz = g_time_zone_new_local();
- service->modified = g_date_time_new_from_iso8601(str, tz);
- g_time_zone_unref(tz);
-}
-
int __connman_service_load_modifiable(struct connman_service *service)
{
GKeyFile *keyfile;
@@ -444,7 +422,7 @@ int __connman_service_load_modifiable(struct
connman_service *service)
str = g_key_file_get_string(keyfile,
service->identifier, "Modified", NULL);
if (str) {
- update_modified_from_iso8601(service, str);
+ util_update_time_from_iso8601(str, &service->modified);
g_free(str);
}
@@ -561,7 +539,7 @@ static int service_load(struct connman_service *service)
str = g_key_file_get_string(keyfile,
service->identifier, "Modified", NULL);
if (str) {
- update_modified_from_iso8601(service, str);
+ util_update_time_from_iso8601(str, &service->modified);
g_free(str);
}
@@ -728,7 +706,7 @@ static int service_save(struct connman_service *service)
break;
}
- str = g_date_time_format_iso8601(service->modified);
+ str = util_get_time_format_iso8601(&service->modified);
if (str) {
g_key_file_set_string(keyfile, service->identifier,
"Modified", str);
@@ -3962,7 +3940,7 @@ static void service_complete(struct connman_service
*service)
if (service->connect_reason != CONNMAN_SERVICE_CONNECT_REASON_USER)
do_auto_connect(service, service->connect_reason);
- update_modified(service);
+ util_update_time(&service->modified);
service_save(service);
}
@@ -4890,7 +4868,7 @@ static DBusMessage *move_service(DBusConnection *conn,
}
}
- update_modified(service);
+ util_update_time(&service->modified);
service_save(service);
service_save(target);
@@ -5086,9 +5064,6 @@ static void service_free(gpointer user_data)
g_free(service->config_file);
g_free(service->config_entry);
- if (service->modified)
- g_date_time_unref(service->modified);
-
if (service->stats.timer)
g_timer_destroy(service->stats.timer);
if (service->stats_roaming.timer)
@@ -5975,7 +5950,7 @@ static int service_indicate_state(struct connman_service
*service)
"WiFi.UseWPS", false);
}
- update_modified(service);
+ util_update_time(&service->modified);
service_save(service);
domain_changed(service);
--
2.23.0
------------------------------
Date: Tue, 12 Nov 2019 08:47:18 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH v3 3/4] wifi: Replace GDateVal API usage
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>
GTimeVal has been deprecated. Replace it with our own replacement API.
---
plugins/wifi.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index e675e6a34804..572e37b1c646 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -59,6 +59,8 @@
#include <gsupplicant/gsupplicant.h>
+#include "src/shared/util.h"
+
#define CLEANUP_TIMEOUT 8 /* in seconds */
#define INACTIVE_TIMEOUT 12 /* in seconds */
#define FAVORITE_MAXIMUM_RETRIES 2
@@ -1611,15 +1613,15 @@ static int wifi_disable(struct connman_device *device)
}
struct last_connected {
- GTimeVal modified;
+ struct timeval modified;
gchar *ssid;
int freq;
};
static gint sort_entry(gconstpointer a, gconstpointer b, gpointer user_data)
{
- GTimeVal *aval = (GTimeVal *)a;
- GTimeVal *bval = (GTimeVal *)b;
+ struct timeval *aval = (struct timeval *)a;
+ struct timeval *bval = (struct timeval *)b;
/* Note that the sort order is descending */
if (aval->tv_sec < bval->tv_sec)
@@ -1646,7 +1648,7 @@ static int get_latest_connections(int max_ssids,
GSequence *latest_list;
struct last_connected *entry;
GKeyFile *keyfile;
- GTimeVal modified;
+ struct timeval modified;
gchar **services;
gchar *str;
char *ssid;
@@ -1690,7 +1692,7 @@ static int get_latest_connections(int max_ssids,
g_key_file_free(keyfile);
continue;
}
- g_time_val_from_iso8601(str, &modified);
+ util_update_time_from_iso8601(str, &modified);
g_free(str);
ssid = g_key_file_get_string(keyfile,
--
2.23.0
------------------------------
Date: Tue, 12 Nov 2019 08:47:19 +0100
From: Daniel Wagner <[email protected]>
Subject: [PATCH v3 4/4] tools: Remove GDateTime API usage
To: [email protected]
Cc: Daniel Wagner <[email protected]>
Message-ID: <[email protected]>
The g_date_time_new_from_iso8601() was introduced with GLib v2.56. We
don't want to update our version dependency. So let's use good old
POSIX APIs instead.
---
tools/stats-tool.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/tools/stats-tool.c b/tools/stats-tool.c
index 193eed24565f..105dc4973edb 100644
--- a/tools/stats-tool.c
+++ b/tools/stats-tool.c
@@ -108,18 +108,11 @@ static char *option_last_file_name = NULL;
static bool parse_start_ts(const char *key, const char *value,
gpointer user_data, GError **error)
{
- GTimeZone *tz;
- GDateTime *dt;
+ struct tm tm;
- tz = g_time_zone_new_local();
- dt = g_date_time_new_from_iso8601(value, tz);
- g_time_zone_unref(tz);
- if (!dt)
- return false;
+ strptime(value, "%FT%TZ", &tm);
+ option_start_ts = mktime(&tm);
- option_start_ts = g_date_time_get_second(dt);
-
- g_date_time_unref(dt);
return true;
}
--
2.23.0
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list -- [email protected]
To unsubscribe send an email to [email protected]
------------------------------
End of connman Digest, Vol 49, Issue 13
***************************************