summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2012-08-24 15:12:21 +0200
committerMartin Kosek <mkosek@redhat.com>2012-09-06 09:24:58 +0200
commit33494689a288c8e55f76cc8bca87f94380d6859f (patch)
tree3c0d0e8cf7544b580a33f5e5c381828e94f3cb80
parent128257c68ba756deeb16b0a93d44d61f243c4ee5 (diff)
downloadfreeipa-33494689a288c8e55f76cc8bca87f94380d6859f.tar.gz
freeipa-33494689a288c8e55f76cc8bca87f94380d6859f.tar.xz
freeipa-33494689a288c8e55f76cc8bca87f94380d6859f.zip
ipasam: replace strnequal()
-rw-r--r--daemons/ipa-sam/ipa_sam.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/daemons/ipa-sam/ipa_sam.c b/daemons/ipa-sam/ipa_sam.c
index ce8f623bd..be033476d 100644
--- a/daemons/ipa-sam/ipa_sam.c
+++ b/daemons/ipa-sam/ipa_sam.c
@@ -95,7 +95,6 @@ int dom_sid_compare_domain(const struct dom_sid *sid1, const struct dom_sid *sid
char *sid_string_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid); /* available in libsmbconf.so */
char *sid_string_dbg(const struct dom_sid *sid); /* available in libsmbconf.so */
bool is_null_sid(const struct dom_sid *sid); /* available in libsecurity.so */
-bool strnequal(const char *s1,const char *s2,size_t n); /* available in libutil_str.so */
bool trim_char(char *s,char cfront,char cback); /* available in libutil_str.so */
bool sid_peek_check_rid(const struct dom_sid *exp_dom_sid, const struct dom_sid *sid, uint32_t *rid); /* available in libsecurity.so */
char *escape_ldap_string(TALLOC_CTX *mem_ctx, const char *s); /* available in libsmbconf.so */
@@ -169,6 +168,22 @@ struct ipasam_privates {
char *client_princ;
};
+static bool strnequal(const char *s1, const char *s2, size_t n) {
+ if (s1 == s2) {
+ return true;
+ }
+
+ if (s1 == NULL || s2 == NULL || n == 0) {
+ return false;
+ }
+
+ if (strncasecmp(s1, s2, n) == 0) {
+ return true;
+ }
+
+ return false;
+}
+
static LDAP *priv2ld(struct ldapsam_privates *priv)
{
return priv->smbldap_state->ldap_struct;