[dovecot-cvs] dovecot/src/auth auth-interface.h,1.2,1.3 userinfo-passwd-file.c,1.15,1.16 userinfo-passwd.c,1.6,1.7 userinfo-vpopmail.c,1.6,1.7
cras at procontrol.fi
cras at procontrol.fi
Tue Dec 17 05:00:46 EET 2002
- Previous message: [dovecot-cvs] dovecot/src/master auth-process.c,1.16,1.17 common.h,1.5,1.6 imap-process.c,1.13,1.14 login-process.c,1.18,1.19
- Next message: [dovecot-cvs] dovecot/src/lib restrict-access.c,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/auth
In directory danu:/tmp/cvs-serv28872/auth
Modified Files:
auth-interface.h userinfo-passwd-file.c userinfo-passwd.c
userinfo-vpopmail.c
Log Message:
Clear separation of virtual and system usernames. passwd-file didn't work
before if the user didn't exist in system. Prefixed also all setuid/etc.
restriction environments with RESTRICT_.
Index: auth-interface.h
===================================================================
RCS file: /home/cvs/dovecot/src/auth/auth-interface.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- auth-interface.h 8 Sep 2002 14:39:05 -0000 1.2
+++ auth-interface.h 17 Dec 2002 03:00:44 -0000 1.3
@@ -7,6 +7,7 @@
#define AUTH_MAX_REPLY_DATA_SIZE 4096
#define AUTH_MAX_USER_LEN 64
+#define AUTH_MAX_VUSER_LEN 256
#define AUTH_MAX_HOME_LEN 256
#define AUTH_MAX_MAIL_LEN 256
@@ -77,7 +78,8 @@
int id;
int success; /* FALSE if cookie wasn't found */
- char user[AUTH_MAX_USER_LEN]; /* system user, if available */
+ char system_user[AUTH_MAX_USER_LEN]; /* system user, if available */
+ char virtual_user[AUTH_MAX_VUSER_LEN]; /* for logging etc. */
uid_t uid;
gid_t gid;
Index: userinfo-passwd-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userinfo-passwd-file.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- userinfo-passwd-file.c 9 Dec 2002 16:43:09 -0000 1.15
+++ userinfo-passwd-file.c 17 Dec 2002 03:00:44 -0000 1.16
@@ -87,6 +87,17 @@
strcpy(reply->mail, pu->mail);
}
+ i_assert(sizeof(reply->virtual_user) > strlen(pu->user_realm));
+ strcpy(reply->virtual_user, pu->user_realm);
+
+ if (pu->realm != NULL) {
+ /* ':' -> '@' to make it look prettier */
+ size_t pos;
+
+ pos = (size_t) (pu->realm - (const char *) pu->user_realm);
+ reply->virtual_user[pos] = '@';
+ }
+
reply->chroot = pu->chroot;
return TRUE;
}
Index: userinfo-passwd.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userinfo-passwd.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- userinfo-passwd.c 26 Nov 2002 17:56:14 -0000 1.6
+++ userinfo-passwd.c 17 Dec 2002 03:00:44 -0000 1.7
@@ -15,13 +15,15 @@
void passwd_fill_cookie_reply(struct passwd *pw, AuthCookieReplyData *reply)
{
- i_assert(sizeof(reply->user) > strlen(pw->pw_name));
+ i_assert(sizeof(reply->system_user) > strlen(pw->pw_name));
+ i_assert(sizeof(reply->virtual_user) > strlen(pw->pw_name));
i_assert(sizeof(reply->home) > strlen(pw->pw_dir));
reply->uid = pw->pw_uid;
reply->gid = pw->pw_gid;
- strcpy(reply->user, pw->pw_name);
+ strcpy(reply->system_user, pw->pw_name);
+ strcpy(reply->virtual_user, pw->pw_name);
strcpy(reply->home, pw->pw_dir);
}
Index: userinfo-vpopmail.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userinfo-vpopmail.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- userinfo-vpopmail.c 26 Nov 2002 17:56:14 -0000 1.6
+++ userinfo-vpopmail.c 17 Dec 2002 03:00:44 -0000 1.7
@@ -95,12 +95,18 @@
strlen(vpw->pw_dir), sizeof(reply->home)-1);
}
- if (strlen(vpw->pw_name) >= sizeof(reply->user)) {
+ if (strlen(vpw->pw_name) >= sizeof(reply->system_user)) {
i_panic("Username too large (%u > %u)",
- strlen(vpw->pw_name), sizeof(reply->user)-1);
+ strlen(vpw->pw_name), sizeof(reply->system_user)-1);
}
- strcpy(reply->user, vpw->pw_name);
+ if (strlen(vpw->pw_name) >= sizeof(reply->virtual_user)) {
+ i_panic("Username too large (%u > %u)",
+ strlen(vpw->pw_name), sizeof(reply->virtual_user)-1);
+ }
+
+ strcpy(reply->system_user, vpw->pw_name);
+ strcpy(reply->virtual_user, vpw->pw_name);
strcpy(reply->home, vpw->pw_dir);
return TRUE;
- Previous message: [dovecot-cvs] dovecot/src/master auth-process.c,1.16,1.17 common.h,1.5,1.6 imap-process.c,1.13,1.14 login-process.c,1.18,1.19
- Next message: [dovecot-cvs] dovecot/src/lib restrict-access.c,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list