+/* get_next_substring:
+ *
+ * Gets next substring in s, using d (or the end of the string '\0') as a
+ * string delimiter, and places it in a duplicated memory space. Leading
+ * spaces are ignored. String s **must** be null-terminated.
+ */
+
+static char *
+get_next_substring( const char * s, char d )
+{
+
+ char *str, *r;
+
+ r = str = ch_malloc( strlen(s) + 1 );
+
+ /* Skip leading spaces */
+
+ while ( *s && ASCII_SPACE(*s) ) {
+ s++;
+ }
+
+ /* Copy word */
+
+ while ( *s && (*s != d) ) {
+
+ /* Don't stop when you see trailing spaces may be a multi-word
+ * string, i.e. name=John Doe!
+ */
+
+ *str++ = *s++;
+
+ }
+
+ *str = '\0';
+
+ return r;
+
+}
+
+
+/* rdn_attr_type:
+ *
+ * Given a string (i.e. an rdn) of the form:
+ * "attribute_type = attribute_value"
+ * this function returns the type of an attribute, that is the
+ * string "attribute_type" which is placed in newly allocated
+ * memory. The returned string will be null-terminated.
+ */
+
+char * rdn_attr_type( const char * s )