/*****************************************************************************\ * Copyright (c) 2002 Pelle Johansson. * * All rights reserved. * * * * This file is part of the moftpd package. Use and distribution of * * this software is governed by the terms in the file LICENCE, which * * should have come with this package. * \*****************************************************************************/ /* $moftpd: user.h 1251 2005-03-06 22:24:29Z morth $ */ #ifndef _USER_H #define _USER_H typedef struct user user_t; #include "server.h" #include "connection.h" #include "utf8fs/file.h" enum { ufPassword = 1 << 0, ufHome = 1 << 1, ufUid = 1 << 2, ufGid = 1 << 3, ufAnonymous = 1 << 4, ufChroot = 1 << 5 }; enum { admList = 1 << 0, admMsg = 1 << 1, admAbort = 1 << 2, admDisconnect = 1 << 3, admReload = 1 << 4 }; struct user { int spec_flags; char *name, *password, *home; uid_t uid; gid_t gid; unsigned int allowLogin:1, anonymous:1, passwordNeeded:1, allowSecLogin:1, defHardLink:1, allowForeign:1, allowOutOfRange:1; char *chroot, *dirMsgFile; access_t *access; char *access_program, *external_login; int maxIdle; int ngroups; gid_t groups[NGROUPS_MAX]; int maxLogins; #ifdef USE_SQL char *sqlDirQuery; #endif int adminPrivs; user_t *next; }; user_t *new_user(const char *name, void *parent); user_t *copy_user(const user_t *u, const char *newname, void *newparent); user_t *find_user (connection_t *conn, const char *name, int allowNoLogin, void *newparent); user_t *find_passwd_user(const char *name, void *newparent); user_t *find_server_user(const server_t *server, const char *name, void *newparent); const char *user_pass(const user_t *user); void user_setup_environ(user_t *user, int authed, int rFd, int wFd); #endif /*_USER_H*/