summaryrefslogtreecommitdiff
path: root/tests/src
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2012-03-28 16:14:40 +1100
committerRobert Ancell <robert.ancell@canonical.com>2012-03-28 16:14:40 +1100
commit1eaad3ab126f1c5e4abe176e06b44d477e4088c1 (patch)
treee7707f4280a8bb9553192d2757a31f4e213af7af /tests/src
parent5103712e0707ea8022f34d50d26c4a424e8e3e86 (diff)
downloadlightdm-1eaad3ab126f1c5e4abe176e06b44d477e4088c1.tar.gz
Add test for home directory being created on pam_open_session
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/libsystem.c7
-rw-r--r--tests/src/test-runner.c2
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/src/libsystem.c b/tests/src/libsystem.c
index 929bf339..df219fbe 100644
--- a/tests/src/libsystem.c
+++ b/tests/src/libsystem.c
@@ -728,6 +728,13 @@ pam_open_session (pam_handle_t *pamh, int flags)
if (pamh == NULL)
return PAM_SYSTEM_ERR;
+ if (strcmp (pamh->user, "make-home-dir") == 0)
+ {
+ struct passwd *entry;
+ entry = getpwnam (pamh->user);
+ g_mkdir_with_parents (entry->pw_dir, 0755);
+ }
+
return PAM_SUCCESS;
}
diff --git a/tests/src/test-runner.c b/tests/src/test-runner.c
index 4694278e..7220661d 100644
--- a/tests/src/test-runner.c
+++ b/tests/src/test-runner.c
@@ -1358,6 +1358,8 @@ main (int argc, char **argv)
{"have-session", "", TRUE, "Session User", "alternative", NULL, NULL, NULL, 1012},
/* This account has the home directory mounted on login */
{"mount-home-dir", "", FALSE, "Mounted Home Dir User", NULL, NULL, NULL, NULL, 1013},
+ /* This account has the home directory created when the session starts */
+ {"make-home-dir", "", FALSE, "Make Home Dir User", NULL, NULL, NULL, NULL, 1025},
/* This account is denied access */
{"denied", "", TRUE, "Denied User", NULL, NULL, NULL, NULL, 1014},
/* This account has expired */