commit a4b3b845e91a3d12a81d372b8635eaf76923071f
parent ed7e8e3ea59e94f8c695a145875e825d6ec6a86a
Author: Michael Gmelin <freebsd@grem.de>
Date: Sun, 26 Nov 2017 21:09:22 +0100
Fix bug #3924: Unbreak sieve host configuration on FreeBSD
Also, adds extra check for config->host
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/plugins/managesieve/sieve_prefs.c b/src/plugins/managesieve/sieve_prefs.c
@@ -480,7 +480,7 @@ struct SieveAccountConfig *sieve_prefs_account_get_config(
gchar enable, use_host, use_port;
guchar tls_type, auth, auth_type;
gsize len;
-#if defined(G_OS_WIN32) || defined(__OpenBSD__)
+#if defined(G_OS_WIN32) || defined(__OpenBSD__) || defined(__FreeBSD__)
/* Windows sscanf() does not understand the %ms format yet, so we
* have to do the allocation of target buffer ourselves before
* calling sscanf(), and copy the host string to config->host.
@@ -506,13 +506,13 @@ struct SieveAccountConfig *sieve_prefs_account_get_config(
enc_userid[0] = '\0';
enc_passwd[0] = '\0';
-#if defined(G_OS_WIN32) || defined(__OpenBSD__)
+#if defined(G_OS_WIN32) || defined(__OpenBSD__) || defined(__FreeBSD__)
sscanf(confstr, "%c%c %255s %c%hu %hhu %hhu %hhu %255s %255s",
#else
sscanf(confstr, "%c%c %ms %c%hu %hhu %hhu %hhu %255s %255s",
#endif
&enable, &use_host,
-#if defined(G_OS_WIN32) || defined(__OpenBSD__)
+#if defined(G_OS_WIN32) || defined(__OpenBSD__) || defined(__FreeBSD__)
tmphost,
#else
&config->host,
@@ -529,7 +529,7 @@ struct SieveAccountConfig *sieve_prefs_account_get_config(
config->auth = auth;
config->auth_type = auth_type;
-#if defined(G_OS_WIN32) || defined(__OpenBSD__)
+#if defined(G_OS_WIN32) || defined(__OpenBSD__) || defined(__FreeBSD__)
config->host = g_strndup(tmphost, 255);
#endif
@@ -537,7 +537,7 @@ struct SieveAccountConfig *sieve_prefs_account_get_config(
config->use_host = use_host == 'y';
config->use_port = use_port == 'y';
- if (config->host[0] == '!' && !config->host[1]) {
+ if (config->host != NULL && config->host[0] == '!' && !config->host[1]) {
g_free(config->host);
config->host = NULL;
}