[dovecot-cvs] dovecot/src/auth auth-master-interface.h,1.1,1.2 db-passwd-file.c,1.7,1.8 db-passwd-file.h,1.3,1.4 master-connection.c,1.6,1.7 userdb-ldap.c,1.10,1.11 userdb-passwd-file.c,1.5,1.6 userdb-passwd.c,1.5,1.6 userdb-pgsql.c,1.3,1.4 userdb.h,1.6,1.7
cras at procontrol.fi
cras at procontrol.fi
Thu May 8 08:28:33 EEST 2003
Update of /home/cvs/dovecot/src/auth
In directory danu:/tmp/cvs-serv3042/src/auth
Modified Files:
auth-master-interface.h db-passwd-file.c db-passwd-file.h
master-connection.c userdb-ldap.c userdb-passwd-file.c
userdb-passwd.c userdb-pgsql.c userdb.h
Log Message:
Chrooting changes. Now all userdbs will support "<chroot>/./<homedir>" style
home directories.
Index: auth-master-interface.h
===================================================================
RCS file: /home/cvs/dovecot/src/auth/auth-master-interface.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- auth-master-interface.h 27 Jan 2003 01:33:40 -0000 1.1
+++ auth-master-interface.h 8 May 2003 04:28:30 -0000 1.2
@@ -14,7 +14,6 @@
unsigned int tag;
unsigned int success:1;
- unsigned int chroot:1; /* chroot to home directory */
uid_t uid;
gid_t gid;
@@ -24,7 +23,7 @@
Ignore if it points outside data_size. */
size_t system_user_idx;
size_t virtual_user_idx;
- size_t home_idx, mail_idx;
+ size_t home_idx, mail_idx, chroot_idx;
size_t data_size;
/* unsigned char data[]; */
Index: db-passwd-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/db-passwd-file.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- db-passwd-file.c 16 Apr 2003 13:38:17 -0000 1.7
+++ db-passwd-file.c 8 May 2003 04:28:30 -0000 1.8
@@ -100,8 +100,7 @@
/* flags */
if (*args != NULL) {
- if (strstr(*args, "chroot") != NULL)
- pu->chroot = TRUE;
+ /* no flags currently */
args++;
}
Index: db-passwd-file.h
===================================================================
RCS file: /home/cvs/dovecot/src/auth/db-passwd-file.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- db-passwd-file.h 16 Apr 2003 13:38:17 -0000 1.3
+++ db-passwd-file.h 8 May 2003 04:28:30 -0000 1.4
@@ -12,8 +12,6 @@
char *mail;
char *password;
-
- unsigned int chroot:1;
};
struct passwd_file {
Index: master-connection.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/master-connection.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- master-connection.c 4 Mar 2003 04:01:37 -0000 1.6
+++ master-connection.c 8 May 2003 04:28:30 -0000 1.7
@@ -39,6 +39,7 @@
{
struct auth_master_reply *reply;
buffer_t *buf;
+ char *p;
buf = buffer_create_dynamic(data_stack_pool,
sizeof(*reply) + 256, (size_t)-1);
@@ -46,14 +47,22 @@
reply->success = TRUE;
- reply->chroot = user->chroot;
reply->uid = user->uid;
reply->gid = user->gid;
reply->system_user_idx = reply_add(buf, user->system_user);
reply->virtual_user_idx = reply_add(buf, user->virtual_user);
- reply->home_idx = reply_add(buf, user->home);
reply->mail_idx = reply_add(buf, user->mail);
+
+ p = strstr(user->home, "/./");
+ if (p == NULL) {
+ reply->home_idx = reply_add(buf, user->home);
+ reply->chroot_idx = reply_add(buf, NULL);
+ } else {
+ /* wu-ftpd like <chroot>/./<home> */
+ reply->home_idx = reply_add(buf, t_strdup_until(user->home, p));
+ reply->chroot_idx = reply_add(buf, p + 3);
+ }
*reply_size = buffer_get_used_size(buf);
reply->data_size = *reply_size - sizeof(*reply);
Index: userdb-ldap.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userdb-ldap.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- userdb-ldap.c 19 Feb 2003 23:55:40 -0000 1.10
+++ userdb-ldap.c 8 May 2003 04:28:30 -0000 1.11
@@ -24,7 +24,6 @@
ATTR_SYSTEM_USER,
ATTR_UID_NUMBER,
ATTR_GID_NUMBER,
- ATTR_CHROOT,
ATTR_COUNT
};
@@ -77,9 +76,6 @@
break;
case ATTR_GID_NUMBER:
user->gid = atoi(value);
- break;
- case ATTR_CHROOT:
- user->chroot = value[0] == 'Y' || value[0] == 'y';
break;
case ATTR_COUNT:
Index: userdb-passwd-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userdb-passwd-file.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- userdb-passwd-file.c 16 Apr 2003 13:38:17 -0000 1.5
+++ userdb-passwd-file.c 8 May 2003 04:28:30 -0000 1.6
@@ -31,8 +31,6 @@
data.home = pu->home;
data.mail = pu->mail;
- data.chroot = pu->chroot;
-
callback(&data, context);
}
Index: userdb-passwd.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userdb-passwd.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- userdb-passwd.c 8 May 2003 03:36:21 -0000 1.5
+++ userdb-passwd.c 8 May 2003 04:28:30 -0000 1.6
@@ -15,7 +15,6 @@
{
struct user_data data;
struct passwd *pw;
- size_t len;
pw = getpwnam(user);
if (pw == NULL) {
@@ -32,16 +31,7 @@
data.gid = pw->pw_gid;
data.virtual_user = data.system_user = pw->pw_name;
-
- len = strlen(pw->pw_dir);
- if (len < 3 || strcmp(pw->pw_dir + len - 3, "/./") != 0)
- data.home = pw->pw_dir;
- else {
- /* wu-ftpd uses <chroot>/./<dir>. We don't support
- the dir after chroot, but this should work well enough. */
- data.home = t_strndup(pw->pw_dir, len-3);
- data.chroot = TRUE;
- }
+ data.home = pw->pw_dir;
callback(&data, context);
}
Index: userdb-pgsql.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userdb-pgsql.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- userdb-pgsql.c 27 Apr 2003 00:12:43 -0000 1.3
+++ userdb-pgsql.c 8 May 2003 04:28:30 -0000 1.4
@@ -69,7 +69,6 @@
struct userdb_pgsql_request *urequest =
(struct userdb_pgsql_request *) request;
struct user_data user;
- const char *str;
if (res != NULL && is_result_valid(res)) {
memset(&user, 0, sizeof(user));
@@ -79,8 +78,6 @@
user.mail = pg_get_str(res, "mail");
user.uid = atoi(PQgetvalue(res, 0, PQfnumber(res, "uid")));
user.gid = atoi(PQgetvalue(res, 0, PQfnumber(res, "gid")));
- str = pg_get_str(res, "chroot");
- user.chroot = str != NULL && (*str == 'Y' || *str == 'y');
urequest->userdb_callback(&user, request->context);
} else {
urequest->userdb_callback(NULL, request->context);
Index: userdb.h
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userdb.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- userdb.h 6 Mar 2003 23:20:16 -0000 1.6
+++ userdb.h 8 May 2003 04:28:30 -0000 1.7
@@ -9,8 +9,6 @@
const char *system_user;
uid_t uid;
gid_t gid;
-
- int chroot; /* chroot to home directory */
};
typedef void userdb_callback_t(struct user_data *user, void *context);
More information about the dovecot-cvs
mailing list