summaryrefslogtreecommitdiffstats
path: root/phosphor-ldap-config/utils.hpp
diff options
context:
space:
mode:
authorNagaraju Goruganti <ngorugan@in.ibm.com>2018-10-12 07:00:20 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-11-20 02:11:46 +0000
commit59287f090c9ea371a6d7f9c151f26c46a068a0b3 (patch)
tree28757865672ab23acbeb19fb756a1da48c2321b6 /phosphor-ldap-config/utils.hpp
parentdb60f5847bc89e96fbee5eb504726c11382973b8 (diff)
downloadphosphor-user-manager-59287f090c9ea371a6d7f9c151f26c46a068a0b3.tar.gz
phosphor-user-manager-59287f090c9ea371a6d7f9c151f26c46a068a0b3.zip
phosphor-ldap-conf: validate LDAP Server URI
Validates given URI. Also updates secureLDAP property based on given URI. If URI is of LDAPS type, secureLDAP is set to true, else it is set to false. Change-Id: If96495c01a8bd911d255267ffbbbff7f28fa070b Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
Diffstat (limited to 'phosphor-ldap-config/utils.hpp')
-rw-r--r--phosphor-ldap-config/utils.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/phosphor-ldap-config/utils.hpp b/phosphor-ldap-config/utils.hpp
new file mode 100644
index 0000000..984aae6
--- /dev/null
+++ b/phosphor-ldap-config/utils.hpp
@@ -0,0 +1,20 @@
+#pragma once
+
+#include <string>
+
+namespace phosphor
+{
+namespace ldap
+{
+
+/** @brief checks that the given URI is valid LDAP's URI.
+ * LDAP's URL begins with "ldap://" and LDAPS's URL begins with "ldap://"
+ * @param[in] URI - URI which needs to be validated.
+ * @param[in] scheme - LDAP's scheme, scheme equals to "ldaps" to validate
+ * against LDAPS type URI, for LDAP type URI it is equals to "ldap".
+ * @returns true if it is valid otherwise false.
+ */
+bool isValidLDAPURI(const std::string& URI, const char* scheme);
+
+} // namespace ldap
+} // namespace phosphor
OpenPOWER on IntegriCloud