summaryrefslogtreecommitdiffstats
path: root/src/openvpn/misc.c
diff options
context:
space:
mode:
authorHeiko Hund <heiko.hund@sophos.com>2012-09-11 17:34:24 +0200
committerDavid Sommerseth <davids@redhat.com>2012-09-12 15:08:10 +0200
commite7412ca3eee2f2a2fb0af5acbe968137cfd7e995 (patch)
tree70909046f97e8c108422b6ada53342bb42be856b /src/openvpn/misc.c
parent5d4f5435a421299ed047485d8d99bdf9a0d22fd1 (diff)
downloadopenvpn-e7412ca3eee2f2a2fb0af5acbe968137cfd7e995.tar.gz
openvpn-e7412ca3eee2f2a2fb0af5acbe968137cfd7e995.tar.xz
openvpn-e7412ca3eee2f2a2fb0af5acbe968137cfd7e995.zip
Add --compat-names option
With this option, users can basically undo the changes of the UTF-8 support commit 5e86fd93779482b90a191f929edebe414cd78a4f. It's here for short term compatibility and should be removed again as soon as possible. When OpenSSL is used, the subject strings will be in the proprietary format again. Generally username, X.509 CN, and X.509 subject will again be subject to '_' replacemant, unless the "no-remapping" flag is also specified. That flag ensures compatibility with setups using the --no-name-remapping option, that has been removed in 2.3. [v2: More comments related to compat_flags() added by DS plus using COMPAT_FLAG_QUERY expclit] [v3: Improved the man page entry for --compat-names, after suggestions from Bernhard R. Link] Signed-off-by: Heiko Hund <heiko.hund@sophos.com> Signed-off-by: David Sommerseth <davids@redhat.com> Acked-by: Gert Doering <gert@greenie.muc.de> Acked-by: David Sommerseth <davids@redhat.com> Message-Id: 1347377664-15462-1-git-send-email-dazo@users.sourceforge.net URL: http://article.gmane.org/gmane.network.openvpn.devel/7053
Diffstat (limited to 'src/openvpn/misc.c')
-rw-r--r--src/openvpn/misc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index 7f72939..d2882d8 100644
--- a/src/openvpn/misc.c
+++ b/src/openvpn/misc.c
@@ -2120,3 +2120,24 @@ sanitize_control_message(const char *src, struct gc_arena *gc)
*dest = '\0';
return ret;
}
+
+/**
+ * Will set or query for a global compat flag. To modify the compat flags
+ * the COMPAT_FLAG_SET must be bitwise ORed together with the flag to set.
+ * If no "operator" flag is given it defaults to COMPAT_FLAG_QUERY,
+ * which returns the flag state.
+ *
+ * @param flag Flag to be set/queried for bitwise ORed with the operator flag
+ * @return Returns 0 if the flag is not set, otherwise the 'flag' value is returned
+ */
+bool
+compat_flag (unsigned int flag)
+{
+ static unsigned int compat_flags = 0;
+
+ if (flag & COMPAT_FLAG_SET)
+ compat_flags |= (flag >> 1);
+
+ return (compat_flags & (flag >> 1));
+
+}