libwbclient: Abstract out test_wbc_authenticate_user for reuse
authorVolker Lendecke <vl@samba.org>
Sat, 17 Apr 2010 12:05:57 +0000 (14:05 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 19 Apr 2010 12:27:20 +0000 (14:27 +0200)
nsswitch/libwbclient/tests/wbclient.c

index 7047e0905530dbf1ad0fe93e6c49ac405c215ad5..09f8fdbae7e05361a5296cf2f338a31714b9f188 100644 (file)
@@ -529,21 +529,22 @@ static bool test_wbc_get_sidaliases(struct torture_context *tctx)
        return true;
 }
 
-static bool test_wbc_authenticate_user(struct torture_context *tctx)
+static bool test_wbc_authenticate_user_int(struct torture_context *tctx,
+                                          const char *correct_password)
 {
        struct wbcAuthUserParams params;
        struct wbcAuthUserInfo *info = NULL;
        struct wbcAuthErrorInfo *error = NULL;
        wbcErr ret;
 
-       ret = wbcAuthenticateUser(getenv("USERNAME"), getenv("PASSWORD"));
+       ret = wbcAuthenticateUser(getenv("USERNAME"), correct_password);
        torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
                                 "wbcAuthenticateUser failed");
 
        ZERO_STRUCT(params);
        params.account_name             = getenv("USERNAME");
        params.level                    = WBC_AUTH_USER_LEVEL_PLAIN;
-       params.password.plaintext       = getenv("PASSWORD");
+       params.password.plaintext       = correct_password;
 
        ret = wbcAuthenticateUserEx(&params, &info, &error);
        torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
@@ -568,6 +569,11 @@ static bool test_wbc_authenticate_user(struct torture_context *tctx)
        return true;
 }
 
+static bool test_wbc_authenticate_user(struct torture_context *tctx)
+{
+       return test_wbc_authenticate_user_int(tctx, getenv("PASSWORD"));
+}
+
 static bool test_wbc_logon_user(struct torture_context *tctx)
 {
        struct wbcLogonUserParams params;