summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2016-03-17 17:20:52 +0100
committerLukas Slebodnik <lslebodn@redhat.com>2016-06-09 13:08:26 +0200
commitd86224608ff60ec5cc7e7cbf9e53d8a04e083530 (patch)
tree8d3a0984008b8baf942d8ee86ab2dd125d87403d /src/tests
parent325ed9f92f1ea1f348fd7913229faecf3dc1d40b (diff)
downloadsssd-d86224608ff60ec5cc7e7cbf9e53d8a04e083530.tar.gz
sssd-d86224608ff60ec5cc7e7cbf9e53d8a04e083530.tar.xz
sssd-d86224608ff60ec5cc7e7cbf9e53d8a04e083530.zip
p11: add PKCS11_LOGIN_TOKEN_NAME environment variable
The PKCS11_LOGIN_TOKEN_NAME environment variable is e.g. used by the Gnome Settings Daemon to determine the name of the token used for login. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/cmocka/test_pam_srv.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/tests/cmocka/test_pam_srv.c b/src/tests/cmocka/test_pam_srv.c
index fdce524ce..2d4677e34 100644
--- a/src/tests/cmocka/test_pam_srv.c
+++ b/src/tests/cmocka/test_pam_srv.c
@@ -596,6 +596,8 @@ static int test_pam_simple_check(uint32_t status, uint8_t *body, size_t blen)
return EOK;
}
+#define PKCS11_LOGIN_TOKEN_ENV_NAME "PKCS11_LOGIN_TOKEN_NAME"
+
static int test_pam_cert_check(uint32_t status, uint8_t *body, size_t blen)
{
size_t rp = 0;
@@ -607,7 +609,7 @@ static int test_pam_cert_check(uint32_t status, uint8_t *body, size_t blen)
assert_int_equal(val, pam_test_ctx->exp_pam_status);
SAFEALIGN_COPY_UINT32(&val, body + rp, &rp);
- assert_int_equal(val, 2);
+ assert_int_equal(val, 3);
SAFEALIGN_COPY_UINT32(&val, body + rp, &rp);
assert_int_equal(val, SSS_PAM_DOMAIN_NAME);
@@ -620,6 +622,16 @@ static int test_pam_cert_check(uint32_t status, uint8_t *body, size_t blen)
rp += val;
SAFEALIGN_COPY_UINT32(&val, body + rp, &rp);
+ assert_int_equal(val, SSS_PAM_ENV_ITEM);
+
+ SAFEALIGN_COPY_UINT32(&val, body + rp, &rp);
+ assert_int_equal(val, (strlen(PKCS11_LOGIN_TOKEN_ENV_NAME "=")
+ + sizeof(TEST_TOKEN_NAME)));
+ assert_string_equal(body + rp,
+ PKCS11_LOGIN_TOKEN_ENV_NAME "=" TEST_TOKEN_NAME);
+ rp += val;
+
+ SAFEALIGN_COPY_UINT32(&val, body + rp, &rp);
assert_int_equal(val, SSS_PAM_CERT_INFO);
SAFEALIGN_COPY_UINT32(&val, body + rp, &rp);