Mercurial > dovecot > original-hg > dovecot-1.2
comparison src/deliver/auth-client.c @ 4683:b60a8aec99ed HEAD
Use mail_chroot setting.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 15 Oct 2006 18:55:00 +0300 |
parents | 3da6580bb0ed |
children | 921d365e6bca |
comparison
equal
deleted
inserted
replaced
4682:bc071307fc2a | 4683:b60a8aec99ed |
---|---|
47 { | 47 { |
48 const char *const *tmp, *key, *value; | 48 const char *const *tmp, *key, *value; |
49 uid_t uid = 0; | 49 uid_t uid = 0; |
50 gid_t gid = 0; | 50 gid_t gid = 0; |
51 int home_found = FALSE; | 51 int home_found = FALSE; |
52 const char *chroot = getenv("MAIL_CHROOT"); | |
52 bool debug = getenv("DEBUG") != NULL; | 53 bool debug = getenv("DEBUG") != NULL; |
53 | 54 |
54 for (tmp = t_strsplit(args, "\t"); *tmp != NULL; tmp++) { | 55 for (tmp = t_strsplit(args, "\t"); *tmp != NULL; tmp++) { |
55 if (debug) | 56 if (debug) |
56 i_info("auth input: %s", *tmp); | 57 i_info("auth input: %s", *tmp); |
79 if (conn->euid == 0 || getegid() != gid) { | 80 if (conn->euid == 0 || getegid() != gid) { |
80 env_put(t_strconcat("RESTRICT_SETGID=", | 81 env_put(t_strconcat("RESTRICT_SETGID=", |
81 *tmp + 4, NULL)); | 82 *tmp + 4, NULL)); |
82 } | 83 } |
83 } else if (strncmp(*tmp, "chroot=", 7) == 0) { | 84 } else if (strncmp(*tmp, "chroot=", 7) == 0) { |
84 env_put(t_strconcat("RESTRICT_CHROOT=", | 85 chroot = *tmp + 7; |
85 *tmp + 7, NULL)); | |
86 } else if (strncmp(*tmp, "home=", 5) == 0) { | 86 } else if (strncmp(*tmp, "home=", 5) == 0) { |
87 home_found = TRUE; | 87 home_found = TRUE; |
88 env_put(t_strconcat("HOME=", *tmp + 5, NULL)); | 88 env_put(t_strconcat("HOME=", *tmp + 5, NULL)); |
89 } else { | 89 } else { |
90 key = t_str_ucase(t_strcut(*tmp, '=')); | 90 key = t_str_ucase(t_strcut(*tmp, '=')); |
102 if (gid == 0) { | 102 if (gid == 0) { |
103 i_error("userdb(%s) didn't return gid", conn->user); | 103 i_error("userdb(%s) didn't return gid", conn->user); |
104 return_value = EX_TEMPFAIL; | 104 return_value = EX_TEMPFAIL; |
105 return; | 105 return; |
106 } | 106 } |
107 | |
108 if (chroot != NULL) | |
109 env_put(t_strconcat("RESTRICT_CHROOT=", chroot, NULL)); | |
107 | 110 |
108 restrict_access_by_env(TRUE); | 111 restrict_access_by_env(TRUE); |
109 return_value = EX_OK; | 112 return_value = EX_OK; |
110 } | 113 } |
111 | 114 |