[dovecot-cvs] dovecot/src/auth userinfo-passwd-file.c,1.10,1.11
cras at procontrol.fi
cras at procontrol.fi
Sun Nov 17 16:52:45 EET 2002
Update of /home/cvs/dovecot/src/auth
In directory danu:/tmp/cvs-serv10646/auth
Modified Files:
userinfo-passwd-file.c
Log Message:
re-read passwd file when it changes.
Index: userinfo-passwd-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/userinfo-passwd-file.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- userinfo-passwd-file.c 4 Nov 2002 05:04:04 -0000 1.10
+++ userinfo-passwd-file.c 17 Nov 2002 14:52:43 -0000 1.11
@@ -48,6 +48,8 @@
static PasswdFile *passwd_file;
+static void passwd_file_sync(void);
+
static int get_reply_data(PasswdUser *pu, AuthCookieReplyData *reply)
{
const char *user;
@@ -95,6 +97,8 @@
unsigned char digest[16];
const char *str;
+ passwd_file_sync();
+
/* find it from all realms */
pu = hash_lookup(passwd_file->users, user);
if (pu == NULL) {
@@ -149,6 +153,8 @@
const char *id;
PasswdUser *pu;
+ passwd_file_sync();
+
/* FIXME: we simply ignore UTF8 setting.. */
id = realm == NULL || *realm == '\0' ? user :
@@ -355,6 +361,21 @@
static void passwd_file_deinit(void)
{
passwd_file_free(passwd_file);
+}
+
+static void passwd_file_sync(void)
+{
+ const char *path;
+ struct stat st;
+
+ if (stat(passwd_file->path, &st) < 0)
+ i_fatal("stat() failed for %s: %m", passwd_file->path);
+
+ if (st.st_mtime != passwd_file->stamp) {
+ path = t_strdup(passwd_file->path);
+ passwd_file_free(passwd_file);
+ passwd_file = passwd_file_parse(path);
+ }
}
UserInfoModule userinfo_passwd_file = {
More information about the dovecot-cvs
mailing list