]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
passwd-file fixes. passdb ignores now fields after password, so it can work
authorTimo Sirainen <tss@iki.fi>
Wed, 16 Apr 2003 13:38:17 +0000 (16:38 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 16 Apr 2003 13:38:17 +0000 (16:38 +0300)
with shadow-like file.

--HG--
branch : HEAD

src/auth/db-passwd-file.c
src/auth/db-passwd-file.h
src/auth/passdb-passwd-file.c
src/auth/userdb-passwd-file.c

index 4d2d72bb44917aaf3b2a144c5a330d3d99191ecf..1d740a2f6fd70a59666b3dcccd06bde6528996e7 100644 (file)
@@ -153,7 +153,9 @@ static void passwd_file_open(struct passwd_file *pw)
                args = t_strsplit(line, ":");
                if (args[1] != NULL) {
                        /* at least two fields */
-                       passwd_file_add(pw, args[0], args[1], args+2);
+                       const char *no_args = NULL;
+                       passwd_file_add(pw, args[0], args[1],
+                                       pw->userdb ? args+2 : &no_args);
                }
                t_pop();
        }
@@ -191,13 +193,14 @@ static void passwd_file_sync(struct passwd_file *pw)
        }
 }
 
-struct passwd_file *db_passwd_file_parse(const char *path)
+struct passwd_file *db_passwd_file_parse(const char *path, int userdb)
 {
        struct passwd_file *pw;
 
        pw = i_new(struct passwd_file, 1);
        pw->refcount = 1;
        pw->path = i_strdup(path);
+       pw->userdb = userdb;
 
        passwd_file_open(pw);
        return pw;
index e93386a519897813a1dd925485c2bcc0a9247929..40398ecb931cffb18f724461f457994ed6f4c961 100644 (file)
@@ -23,6 +23,7 @@ struct passwd_file {
        char *path;
        time_t stamp;
        int fd;
+       int userdb;
 
        struct hash_table *users;
 };
@@ -33,7 +34,7 @@ extern struct passwd_file *passdb_pwf;
 struct passwd_user *
 db_passwd_file_lookup(struct passwd_file *pw, const char *user);
 
-struct passwd_file *db_passwd_file_parse(const char *path);
+struct passwd_file *db_passwd_file_parse(const char *path, int userdb);
 void db_passwd_file_unref(struct passwd_file *pw);
 
 #endif
index 42d471311a594f56ec956b1f02fe3d6a3e69fdb0..84b7496a6debc074ddda615908521241aff11e7e 100644 (file)
@@ -73,7 +73,7 @@ static void passwd_file_init(const char *args)
                passdb_pwf = userdb_pwf;
                 passdb_pwf->refcount++;
        } else {
-               passdb_pwf = db_passwd_file_parse(args);
+               passdb_pwf = db_passwd_file_parse(args, FALSE);
        }
 }
 
index 0e0023f4d4fba50daa01ebb8a20e7147ee8b4c78..a7e8bd6b8c954a7a687d84508cce4e08f68719fc 100644 (file)
@@ -40,9 +40,13 @@ static void passwd_file_init(const char *args)
 {
        if (passdb_pwf != NULL && strcmp(passdb_pwf->path, args) == 0) {
                userdb_pwf = passdb_pwf;
-                userdb_pwf->refcount++;
+               userdb_pwf->refcount++;
+
+               /* resync */
+               userdb_pwf->userdb = FALSE;
+                userdb_pwf->stamp = 0;
        } else {
-               userdb_pwf = db_passwd_file_parse(args);
+               userdb_pwf = db_passwd_file_parse(args, TRUE);
        }
 }