db-passwd-file.c revision 4e68f62aa0590d49967ec2d1ba216e2fb59196bf
6335b1be387359ac461b0c34087bbba98a925a49Phil Carmody/* Copyright (c) 2002-2012 Dovecot authors, see the included COPYING file */
6335b1be387359ac461b0c34087bbba98a925a49Phil Carmody#if defined (USERDB_PASSWD_FILE) || defined(PASSDB_PASSWD_FILE)
6335b1be387359ac461b0c34087bbba98a925a49Phil Carmodystatic void passwd_file_add(struct passwd_file *pw, const char *username,
6335b1be387359ac461b0c34087bbba98a925a49Phil Carmody /* args = uid, gid, user info, home dir, shell, extra_fields */
c81ec7de302a1c38f4ea27a82dad3b2f631701d9Timo Sirainen if (hash_table_lookup(pw->users, username) != NULL) {
6335b1be387359ac461b0c34087bbba98a925a49Phil Carmody i_error("passwd-file %s: User %s exists more than once",
6335b1be387359ac461b0c34087bbba98a925a49Phil Carmody if (len > 4 && pass[0] != '{' && pass[0] != '$' &&
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen /* password[type] - we're being libpam-pwdfile compatible
6335b1be387359ac461b0c34087bbba98a925a49Phil Carmody here. it uses 13 = DES and 34 = MD5. For backwards
6335b1be387359ac461b0c34087bbba98a925a49Phil Carmody comaptibility with ourself, we have also 56 = Digest-MD5. */
6335b1be387359ac461b0c34087bbba98a925a49Phil Carmody int num = (pass[len-3] - '0') * 10 + (pass[len-2] - '0');
6335b1be387359ac461b0c34087bbba98a925a49Phil Carmody pu->password = p_strconcat(pw->pool, "{PLAIN-MD5}",
6335b1be387359ac461b0c34087bbba98a925a49Phil Carmody pu->password = p_strconcat(pw->pool, "{DIGEST-MD5}",
6335b1be387359ac461b0c34087bbba98a925a49Phil Carmody "has invalid password",
6335b1be387359ac461b0c34087bbba98a925a49Phil Carmody pu->password = p_strconcat(pw->pool, "{CRYPT}",
args++;
args++;
args++;
args++;
args++;
args++;
args++;
args++;
static struct passwd_file *
return pw;
const char *line;
unsigned int time_secs;
int fd;
return FALSE;
return FALSE;
T_BEGIN {
} T_END;
return TRUE;
return FALSE;
return TRUE;
struct db_passwd_file *f;
return NULL;
struct db_passwd_file *
if (userdb)
return db;
if (userdb)
return db;
struct db_passwd_file **p;
if (*p == db) {
if (p == NULL)
return path;
struct passwd_user *
const char *username_format)
const char *path;
return NULL;
return pu;