Author: jra
Date: 2006-08-04 21:15:52 +0000 (Fri, 04 Aug 2006)
New Revision: 17407

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17407

Log:
Don't do strchr_m twice when once will do.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/passdb/lookup_sid.c
   branches/SAMBA_3_0_23/source/passdb/lookup_sid.c


Changeset:
Modified: branches/SAMBA_3_0/source/passdb/lookup_sid.c
===================================================================
--- branches/SAMBA_3_0/source/passdb/lookup_sid.c       2006-08-04 21:07:32 UTC 
(rev 17406)
+++ branches/SAMBA_3_0/source/passdb/lookup_sid.c       2006-08-04 21:15:52 UTC 
(rev 17407)
@@ -393,14 +393,15 @@
                 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 @@
                        if (!tmp) {
                                return False;
                        }
-                       p = strchr_m(tmp, *lp_winbind_separator());
-                       SMB_ASSERT(p != NULL);
-                       *p = '\\';
+                       tmp[p - full_name] = '\\';
                        full_name = tmp;
                }
 

Modified: branches/SAMBA_3_0_23/source/passdb/lookup_sid.c
===================================================================
--- branches/SAMBA_3_0_23/source/passdb/lookup_sid.c    2006-08-04 21:07:32 UTC 
(rev 17406)
+++ branches/SAMBA_3_0_23/source/passdb/lookup_sid.c    2006-08-04 21:15:52 UTC 
(rev 17407)
@@ -368,14 +368,15 @@
                 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 */
 
@@ -383,9 +384,7 @@
                        if (!tmp) {
                                return False;
                        }
-                       p = strchr_m(tmp, *lp_winbind_separator());
-                       SMB_ASSERT(p != NULL);
-                       *p = '\\';
+                       tmp[p - full_name] = '\\';
                        full_name = tmp;
                }
 

Reply via email to