http://defect.opensolaris.org/bz/show_bug.cgi?id=13143


Michael Hunter <michael.hunter at sun.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ACCEPTED
                 CC|                            |michael.hunter at sun.com


--- Comment #1 from Michael Hunter <michael.hunter at sun.com> 2009-12-08 
07:59:38 UTC ---
test_condition_domain() needs to do the right thing with a NULL found_domain. 
Assuming we satisfy conditions as a NULL found_domain is an empty set the
following should be correct.

diff -r f162d36043d8 usr/src/cmd/cmd-inet/lib/nwamd/conditions.c
--- a/usr/src/cmd/cmd-inet/lib/nwamd/conditions.c       Fri Dec 04 14:31:34
2009 -0500
+++ b/usr/src/cmd/cmd-inet/lib/nwamd/conditions.c       Mon Dec 07 23:58:37
2009 -0800
@@ -201,13 +201,17 @@
 {
        switch (condition) {
        case NWAM_CONDITION_IS:
-               return (strcmp(found_domain, target_domain) == 0);
+               return (found_domain != NULL &&
+                   strcmp(found_domain, target_domain) == 0);
        case NWAM_CONDITION_IS_NOT:
-               return (strcmp(found_domain, target_domain) != 0);
+               return (found_domain == NULL ||
+                   strcmp(found_domain, target_domain) != 0);
        case NWAM_CONDITION_CONTAINS:
-               return (strstr(found_domain, target_domain) != NULL);
+               return (found_domain != NULL &&
+                   strstr(found_domain, target_domain) != NULL);
        case NWAM_CONDITION_DOES_NOT_CONTAIN:
-               return (strstr(found_domain, target_domain) == NULL);
+               return (found_domain == NULL ||
+                   strstr(found_domain, target_domain) == NULL);
        default:
                return (B_FALSE);
        }

-- 
Configure bugmail: http://defect.opensolaris.org/bz/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

Reply via email to