diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2010-04-26 11:03:52 -0700 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-04-26 11:03:52 -0700 |
commit | 78c50664d6421cc5d0836bb03820680dc2cb7acf (patch) | |
tree | 20fcfadad9057617daa0b159216f0a92006969f5 /ldap/servers/slapd/slapi-plugin.h | |
parent | 4754291972668c37559a8f68d75ac6f8c477efb8 (diff) | |
download | ds-78c50664d6421cc5d0836bb03820680dc2cb7acf.tar.gz ds-78c50664d6421cc5d0836bb03820680dc2cb7acf.tar.xz ds-78c50664d6421cc5d0836bb03820680dc2cb7acf.zip |
Update to New DN Format
Fix Description:
. adding slapi_dn_normalize_ext and its siblings to normalize/validate
invalid DNs; deprecating slapi_dn_normalize and its siblings. (dn.c)
. replacing slapi_dn_normalize with new corresponding functions.
. normalizing hardcoded DNs (e.g., removing spaces around ',')
. setting correct DN syntax to nsslapd-suffix, nsslapd-ldapiautodnsuffix,
costemplatedn, nsslapd-changelogsuffix, nsBaseDN, nsBindDN
. if nsslapd-dn-validate-strict is enabled, incoming DN is examined and
rejected if it is invalid. Once approved, the DN is normalized.
. fixing compiler warnings and typos.
See also:
http://directory.fedoraproject.org/wiki/Upgrade_to_New_DN_Format
Related bugs:
Bug 199923 - subtree search fails to find items under a db containing special
characters
Bug 567968 - subtree/user level password policy created using 389-ds-console
doesn't work.
Bug 570107 - The import of LDIFs with base-64 encoded DNs fails, modrdn with
non-ASCII new rdn incorrect
Bug 570962 - ns-inactivate.pl does not work
Bug 572785 - DN syntax: old style of DN <type>="<DN>",<the_rest> is not
correctly normalized
Bug 573060 - DN normalizer: ESC HEX HEX is not normalized
Bug 574167 - An escaped space at the end of the RDN value is not handled
correctly
Diffstat (limited to 'ldap/servers/slapd/slapi-plugin.h')
-rw-r--r-- | ldap/servers/slapd/slapi-plugin.h | 67 |
1 files changed, 61 insertions, 6 deletions
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h index f7683b5e..2922a527 100644 --- a/ldap/servers/slapd/slapi-plugin.h +++ b/ldap/servers/slapd/slapi-plugin.h @@ -3025,28 +3025,74 @@ int slapi_rdn_partial_dup(Slapi_RDN *from, Slapi_RDN **to, int idx); * utility routines for dealing with DNs */ /** - * Normalizes a DN. + * Does nothing. (DEPRECATED) * * \param dn The DN to normalize. * \return The normalized DN. - * \deprecated Use slapi_sdn_get_ndn() instead. + * \deprecated Use slapi_dn_normalized_ext. */ char *slapi_dn_normalize( char *dn ); /** - * Normalizes a portion of a DN value. + * Does nothing. (DEPRECATED) * * \param dn The DN value to normalize. * \param end Pointer to the end of what will be normalized from the DN * value in \c dn. If this parameter is \c NULL, the DN value * will be wholly normalized. - * \return A pointer to the end of the DN that has been normalized. - * \warning This function does not null-terminate the string. Use this - * function only if you know what you are doing. + * \return The normalized DN. + * \deprecated Use slapi_dn_normalized_ext. */ char *slapi_dn_normalize_to_end( char *dn, char *end ); /** + * Normalizes a DN. + * + * \param src The DN to normalize. + * \param src_len The length of src DN to normalize. If 0 is given, strlen(src) is used. + * \param dest The normalized DN. + * \param dest The length of the normalized DN dest. + * \return \c 0 if successful. The dest DN is normalized in line. Caller must not free dest. + * \return \c 1 if successful. The dest DN is allocated. Caller must free dest. + * \return \c -1 if an error occurs (for example, if the src DN cannot be normalized) + */ +int slapi_dn_normalize_ext(char *src, size_t src_len, char **dest, size_t *dest_len); + +/** + * Normalizes a DN (in lower-case characters). + * + * \param src The DN to normalize. + * \param src_len The length of src DN to normalize. If 0 is given, strlen(src) is used internally. + * \param dest The normalized DN with the cases lowered. + * \param dest_len The length of the normalized DN dest. + * \return \c 0 if successful. The dest DN is normalized in line. Caller must not free dest. The string is NOT NULL terminated. + * \return \c 1 if successful. The dest DN is allocated. Caller must free dest. + * \return \c -1 if an error occurs (for example, if src DN cannot be normalized) + */ +int slapi_dn_normalize_case_ext(char *src, size_t src_len, char **dest, size_t *dest_len); + +/** + * Generate a valid DN string. + * + * \param fmt The format used to generate a DN string. + * \param ... The arguments to generate a DN string. + * \return A pointer to the generated DN. The + * \return NULL if failed. + * \note When a DN needs to be internally created, this function is supposed to be called. This function allocates the enough memory for the normalized DN and returns it filled with the normalized DN. + */ +char *slapi_create_dn_string(const char *fmt, ...); + +/** + * Generates a valid DN string (in lower-case characters). + * + * \param fmt The format used to generate a DN string. + * \param ... The arguments to generate a DN string. + * \return A pointer to the generated DN. + * \return NULL if failed. + */ +char *slapi_create_dn_string_case(const char *fmt, ...); + +/** * Converts a DN to lowercase. * * \param dn The DN to convert. @@ -3332,6 +3378,15 @@ int slapi_attr_get_oid_copy( const Slapi_Attr *attr, char **oidp ); int slapi_attr_get_syntax_oid_copy( const Slapi_Attr *a, char **oidp ); /** + * Checks if the attribute uses a DN syntax or not. + * + * \param attr The attribute to be checked. + * \return \c non 0 if the attribute uses a DN syntax. + * \return \c 0 if the attribute does not use a DN syntax. + */ +int slapi_attr_is_dn_syntax_attr(Slapi_Attr *attr); + +/** * Get the flags associated with a particular attribute. * * Valid flags are: |