From ebadb3737f2cd95026a81b1b890cd7e7daaf7ae6 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 9 Dec 2001 03:02:29 +0000 Subject: [PATCH] Added dn_issuffixbv() like dn_issuffix, but with bervals. --- servers/slapd/dn.c | 12 ++++++++++++ servers/slapd/proto-slap.h | 1 + 2 files changed, 13 insertions(+) diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index a8b1eb654b..5dc8f50a7f 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -450,6 +450,18 @@ char **dn_subtree( } +dn_issuffixbv( + const struct berval *dn, + const struct berval *suffix +) +{ + if (suffix->bv_len > dn->bv_len) + return 0; + + return( strcmp( dn->bv_val + dn->bv_len - suffix->bv_len, + suffix->bv_val ) == 0 ); +} + /* * dn_issuffix - tells whether suffix is a suffix of dn. Both dn * and suffix must be normalized. diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 4f27f33e6b..7df651706b 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -329,6 +329,7 @@ LDAP_SLAPD_F (char **) dn_subtree LDAP_P(( Backend *be, const char *dn )); LDAP_SLAPD_F (char *) dn_rdn LDAP_P(( Backend *be, const char *dn )); LDAP_SLAPD_F (int) dn_rdnlen LDAP_P(( Backend *be, const char *dn )); LDAP_SLAPD_F (int) dn_issuffix LDAP_P(( const char *dn, const char *suffix )); +LDAP_SLAPD_F (int) dn_issuffixbv LDAP_P(( const struct berval *dn, const struct berval *suffix )); LDAP_SLAPD_F (int) rdn_validate LDAP_P(( const char* str )); LDAP_SLAPD_F (char *) rdn_attr_value LDAP_P(( const char * rdn )); LDAP_SLAPD_F (char *) rdn_attr_type LDAP_P(( const char * rdn )); -- 2.39.5