diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2006-01-20 11:19:12 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2006-01-20 11:19:12 +0000 |
commit | b6ceda56ffaa96350f03e04728096ba053779863 (patch) | |
tree | 5f44703e85f707de456c61a4dc47e7d18b2c9b6d | |
parent | f58d1a93345cd25ee5427be781d0f65d0ca655a6 (diff) | |
download | mailutils-b6ceda56ffaa96350f03e04728096ba053779863.tar.gz mailutils-b6ceda56ffaa96350f03e04728096ba053779863.tar.bz2 |
(imap4d_authenticate): Call
imap4d_check_home_dir before switching to user's privileges. Bail
out if it returns with an error.
Use util_chdir instead of chdir to change to user's home
directory.
-rw-r--r-- | imap4d/authenticate.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/imap4d/authenticate.c b/imap4d/authenticate.c index 3dd55bae3..a5d4d8632 100644 --- a/imap4d/authenticate.c +++ b/imap4d/authenticate.c @@ -1,5 +1,5 @@ /* GNU Mailutils -- a suite of utilities for electronic mail - Copyright (C) 1999, 2001, 2005 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2005, 2006 Free Software Foundation, Inc. GNU Mailutils is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -124,12 +124,15 @@ imap4d_authenticate (struct imap4d_command *command, char *arg) return util_finish (command, RESP_NO, "User name or passwd rejected"); + homedir = mu_normalize_path (strdup (auth_data->dir), "/"); + if (imap4d_check_home_dir (homedir, auth_data->uid, auth_data->gid)) + return util_finish (command, RESP_NO, + "User name or passwd rejected"); + if (auth_data->change_uid) setuid (auth_data->uid); - homedir = mu_normalize_path (strdup (auth_data->dir), "/"); - /* FIXME: Check for errors. */ - chdir (homedir); + util_chdir (homedir); namespace_init (homedir); syslog (LOG_INFO, _("User `%s' logged in"), adata.username); |