s3: Avoid adding a domain twice
authorVolker Lendecke <vl@samba.org>
Mon, 28 Dec 2009 17:11:34 +0000 (18:11 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 2 Jan 2010 11:09:05 +0000 (12:09 +0100)
If we found a match with sid==NULL, we ended up adding the domain twice

source3/winbindd/winbindd_util.c

index e56efa4c8c42bdffdab27317a37073962d054aee..01440b678fed0f3214bbf12b8c41f9adb80e35d4 100644 (file)
@@ -143,13 +143,14 @@ static struct winbindd_domain *add_trusted_domain(const char *domain_name, const
                }
        }
 
-       /* See if we found a match.  Check if we need to update the
-          SID. */
-
-       if ( domain && sid) {
-               if ( sid_equal( &domain->sid, &global_sid_NULL ) )
+       if (domain != NULL) {
+               /*
+                * We found a match. Possibly update the SID
+                */
+               if ((sid != NULL)
+                   && sid_equal(&domain->sid, &global_sid_NULL)) {
                        sid_copy( &domain->sid, sid );
-
+               }
                return domain;
        }