BUG/MEDIUM: proxy: Perform a custom copy for default server settings

When a proxy is initialized with the settings of the default proxy, instead
of doing a raw copy of the default server settings, a custom copy is now
performed by calling srv_settings_copy(). This way, all settings will be
really duplicated. Without this deep copy, some pointers are shared between
several servers, leading to UAF, double-free or such bugs.

This patch relies on following commits:

  * b32cb9b51 REORG: server: Export srv_settings_cpy() function
  * 0b365e3cb MINOR: server: Constify source server to copy its settings

This patch should fix the issue #1804. It must be backported as far as 2.0.

(cherry picked from commit 6bb86539dbe66b79e011b287c8b750f2e4ee62a0)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit e75f1d3d04e6153d01fad3e79c8bc38b3f3e8ea9)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit bba6ec9c3e377fb5475cf6c415dcf48473a7a9f1)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/proxy.c b/src/proxy.c
index 07898b0..1ee4837 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -1512,7 +1512,7 @@
 	char *tmpmsg = NULL;
 
 	/* set default values from the specified default proxy */
-	memcpy(&curproxy->defsrv, &defproxy->defsrv, sizeof(curproxy->defsrv));
+	srv_settings_cpy(&curproxy->defsrv, &defproxy->defsrv, 0);
 
 	curproxy->disabled = defproxy->disabled;
 	curproxy->options = defproxy->options;