db-passwd-file.c revision 63c6eefc07085070733e702208101662bc5ccb45
/* Copyright (C) 2002-2003 Timo Sirainen */
#include "config.h"
#if defined (USERDB_PASSWD_FILE) || defined(PASSDB_PASSWD_FILE)
#include "common.h"
#include "userdb.h"
#include "db-passwd-file.h"
#include "buffer.h"
#include "istream.h"
#include "hash.h"
#include "str.h"
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
{
/* args = uid, gid, user info, home dir, shell, flags, mail */
struct passwd_user *pu;
const char *p;
i_error("User %s already exists in password file %s",
return;
}
if (p == NULL) {
} else {
/* password[type] - we're being libpam-pwdfile compatible
here. it uses 13 = DES and 34 = MD5. For backwards
comaptibility with ourself, we have also 56 = Digest-MD5. */
if (p[1] == '3' && p[2] == '4') {
} else if (p[1] == '5' && p[2] == '6') {
i_error("User %s has invalid password in "
return;
}
} else {
}
}
i_error("User %s has UID 0 in password file %s",
return;
}
args++;
}
i_error("User %s has GID 0 in password file %s",
return;
}
args++;
}
/* user info */
args++;
/* home */
args++;
}
/* shell */
args++;
/* flags */
args++;
}
/* rest is MAIL environment */
args++;
args++;
}
}
}
{
const char *const *args;
const char *line;
int fd;
if (fd == -1)
continue; /* no username or comment */
t_push();
/* at least two fields */
}
t_pop();
}
}
{
i_error("close(passwd_file) failed: %m");
}
}
}
}
{
}
}
{
struct passwd_file *pw;
return pw;
}
{
}
}
struct passwd_user *
{
struct passwd_user *pu;
if (verbose)
}
return pu;
}
#endif