userinfo-passwd-file.c revision ff241f9ad7b65c684f6670d142d3936ca919f527
/* Copyright (C) 2002 Timo Sirainen */
#include "config.h"
#ifdef USERINFO_PASSWD_FILE
#include "userinfo-passwd.h"
#include "buffer.h"
#include "istream.h"
#include "hash.h"
#include "hex-binary.h"
#include "md5.h"
#include "mycrypt.h"
#include <stdlib.h>
#include <fcntl.h>
struct passwd_file {
char *path;
int fd;
struct hash_table *users;
};
enum password_type {
};
struct passwd_user {
char *user_realm; /* user:realm */
const char *realm; /* NULL or points to user_realm */
char *password;
char *home;
char *mail;
enum password_type password_type;
unsigned int chroot:1;
};
static struct passwd_file *passwd_file;
static void passwd_file_sync(void);
struct auth_cookie_reply_data *reply)
{
const char *user;
/* all required information was not set in passwd file,
check from system's passwd */
return FALSE;
}
i_panic("home overflow");
}
i_panic("mail overflow");
}
sizeof(reply->virtual_user)) < 0)
i_panic("virtual_user overflow");
/* @UNSAFE: ':' -> '@' to make it look prettier */
}
return TRUE;
}
struct auth_cookie_reply_data *reply)
{
struct passwd_user *pu;
unsigned char digest[16];
const char *str;
/* find it from all realms */
return FALSE;
/* verify that password matches */
switch (pu->password_type) {
case PASSWORD_DES:
return FALSE;
break;
case PASSWORD_MD5:
return FALSE;
break;
case PASSWORD_DIGEST_MD5:
/* user:realm:passwd */
return FALSE;
break;
default:
i_unreached();
}
/* found */
}
unsigned char digest[16],
struct auth_cookie_reply_data *reply)
{
const char *id;
struct passwd_user *pu;
/* FIXME: we simply ignore UTF8 setting.. */
return FALSE;
/* found */
return FALSE;
}
{
/* args = uid, gid, user info, home dir, shell, realm, mail, chroot */
struct passwd_user *pu;
const char *p;
i_error("Username %s is too long (max. %d chars) in password "
return;
}
if (p == NULL) {
} else {
/* password[type] - we're being libpam-pwdfile compatible
here. it uses 13 = DES and 34 = MD5. We add
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 */
i_error("User %s has too long home directory in "
return;
}
args++;
}
/* shell */
args++;
/* realm */
i_error("User %s already exists in password file %s",
return;
}
} else {
i_error("User %s already exists in realm %s in "
return;
}
}
/* mail storage */
i_error("User %s has too long mail storage in "
return;
}
args++;
}
/* chroot */
}
{
const char *const *args;
const char *line;
for (;;) {
if (i_stream_read(input) <= 0)
break;
continue;
}
continue; /* no username */
t_push();
}
t_pop();
}
}
{
struct passwd_file *pw;
int fd;
if (fd == -1) {
}
return pw;
}
{
}
static void passwd_file_init(const char *args)
{
}
static void passwd_file_deinit(void)
{
}
static void passwd_file_sync(void)
{
const char *path;
}
}
struct user_info_module userinfo_passwd_file = {
};
#endif