/************************************************************************* * * HTCd - Copyright (C) 1998-2006 Henrik Rydberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef USERH #define USERH #include #include ///////////////////////////////////////////////////////// const mstring root_tag="ROOT"; const mstring lastin_def="0.0.0.0"; const mstring USERS_tag="USERS"; const mstring PREFS_tag="PREFS"; const mstring TREE_tag="TREE"; const int user_tabs=10,user_uid=0,user_alias=4,user_email=5,user_access=9; const mstring user_tab[user_tabs]={ "UID","GROUP","FAIL","PIN","ALIAS","EMAIL","NAME","LAST","LASTIN","ACCESS" }; const int prefs_tabs=8; const mstring prefs_tab[prefs_tabs]={ "ID","EXT","ROOM","URL","POSIT","NOTE","ABSTRACT","LASTMOD" }; const int tree_tabs=17; const mstring tree_tab[tree_tabs]={ "URI","REFER","PARENT","MIME", "MOD","UID","GID","SIZE","LASTMOD", "ALIAS","BANNER", "X.CLEAR","X.COOKIE","X.DOMAIN","X.USER","X.CACHE", "XMOD" }; int allow(const sref& s,const sref& grp,time_t now,int rootok=0); struct user_t { spile list; user_t() : list(user_tabs) {} user_t(const user_t& us); void operator=(const user_t&); mstring& uid() { return list[0]; } mstring& group() { return list[1]; } mstring& fail() { return list[2]; } mstring& pin() { return list[3]; } mstring& alias() { return list[4]; } mstring& email() { return list[5]; } mstring& name() { return list[6]; } mstring& last() { return list[7]; } mstring& lastin() { return list[8]; } mstring& access() { return list[9]; } void reset(); int allow(const sref& grp,time_t now,int rootok=0); int allow_list(const sref& grps,time_t now,int rootok=0); // rootok<0 -> ignore special root handling (new; should not interfere) // rootok==0 -> root not allowed here // rootok>0 -> root always allowed here void add(const sref& grp); void add_list(const sref& grps); void rem(const sref& grp); void rem_list(const sref& grps); }; ///////////////////////////////////////////////////////// void envAddUser(tokmap& T) throw(merror_t); #endif