From 43c7f6d1d1ca6de7f0185b07d4459350ad6c2ca2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Aug 2006 21:15:52 +0000 Subject: r17407: Don't do strchr_m twice when once will do. Jeremy. (This used to be commit b5f0b1b6447ac3c77558b32d97ce96d357ce15c0) --- source3/passdb/lookup_sid.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'source3') diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c index d4c1ff2059..f612cff092 100644 --- a/source3/passdb/lookup_sid.c +++ b/source3/passdb/lookup_sid.c @@ -393,14 +393,15 @@ BOOL lookup_name_smbconf(TALLOC_CTX *mem_ctx, DOM_SID *ret_sid, enum SID_NAME_USE *ret_type) { char *qualified_name; + const char *p; /* NB. No winbindd_separator here as lookup_name needs \\' */ - if (strchr_m(full_name, *lp_winbind_separator())) { + if ((p = strchr_m(full_name, *lp_winbind_separator())) != NULL) { /* The name is already qualified with a domain. */ if (*lp_winbind_separator() != '\\') { - char *p, *tmp; + char *tmp; /* lookup_name() needs '\\' as a separator */ @@ -408,9 +409,7 @@ BOOL lookup_name_smbconf(TALLOC_CTX *mem_ctx, if (!tmp) { return False; } - p = strchr_m(tmp, *lp_winbind_separator()); - SMB_ASSERT(p != NULL); - *p = '\\'; + tmp[p - full_name] = '\\'; full_name = tmp; } -- cgit