diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2011-10-08 20:30:28 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2011-10-08 20:30:28 +0200 |
| commit | 5df79c53745fde5d6c3340a2979b1429cd5892c1 (patch) | |
| tree | 1a81af141708b826e9c61e8a04019994fcca8298 /src/sh/user.h | |
Initial import of htcd system 1.0
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/sh/user.h')
| -rw-r--r-- | src/sh/user.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/sh/user.h b/src/sh/user.h new file mode 100644 index 0000000..cc00e21 --- /dev/null +++ b/src/sh/user.h | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | /************************************************************************* | ||
| 2 | * | ||
| 3 | * HTCd - Copyright (C) 1998-2006 Henrik Rydberg | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef USERH | ||
| 21 | #define USERH | ||
| 22 | |||
| 23 | #include <lang/env.h> | ||
| 24 | #include <mt/lookup.h> | ||
| 25 | |||
| 26 | ///////////////////////////////////////////////////////// | ||
| 27 | |||
| 28 | const mstring root_tag="ROOT"; | ||
| 29 | const mstring lastin_def="0.0.0.0"; | ||
| 30 | |||
| 31 | const mstring USERS_tag="USERS"; | ||
| 32 | const mstring PREFS_tag="PREFS"; | ||
| 33 | const mstring TREE_tag="TREE"; | ||
| 34 | |||
| 35 | const int user_tabs=10,user_uid=0,user_alias=4,user_email=5,user_access=9; | ||
| 36 | const mstring user_tab[user_tabs]={ | ||
| 37 | "UID","GROUP","FAIL","PIN","ALIAS","EMAIL","NAME","LAST","LASTIN","ACCESS" | ||
| 38 | }; | ||
| 39 | |||
| 40 | const int prefs_tabs=8; | ||
| 41 | const mstring prefs_tab[prefs_tabs]={ | ||
| 42 | "ID","EXT","ROOM","URL","POSIT","NOTE","ABSTRACT","LASTMOD" | ||
| 43 | }; | ||
| 44 | |||
| 45 | const int tree_tabs=17; | ||
| 46 | const mstring tree_tab[tree_tabs]={ | ||
| 47 | "URI","REFER","PARENT","MIME", | ||
| 48 | "MOD","UID","GID","SIZE","LASTMOD", | ||
| 49 | "ALIAS","BANNER", | ||
| 50 | "X.CLEAR","X.COOKIE","X.DOMAIN","X.USER","X.CACHE", | ||
| 51 | "XMOD" | ||
| 52 | }; | ||
| 53 | |||
| 54 | int allow(const sref& s,const sref& grp,time_t now,int rootok=0); | ||
| 55 | |||
| 56 | struct user_t { | ||
| 57 | spile list; | ||
| 58 | |||
| 59 | user_t() : list(user_tabs) {} | ||
| 60 | user_t(const user_t& us); | ||
| 61 | |||
| 62 | void operator=(const user_t&); | ||
| 63 | |||
| 64 | mstring& uid() { return list[0]; } | ||
| 65 | mstring& group() { return list[1]; } | ||
| 66 | mstring& fail() { return list[2]; } | ||
| 67 | mstring& pin() { return list[3]; } | ||
| 68 | mstring& alias() { return list[4]; } | ||
| 69 | mstring& email() { return list[5]; } | ||
| 70 | mstring& name() { return list[6]; } | ||
| 71 | mstring& last() { return list[7]; } | ||
| 72 | mstring& lastin() { return list[8]; } | ||
| 73 | mstring& access() { return list[9]; } | ||
| 74 | |||
| 75 | void reset(); | ||
| 76 | int allow(const sref& grp,time_t now,int rootok=0); | ||
| 77 | int allow_list(const sref& grps,time_t now,int rootok=0); | ||
| 78 | // rootok<0 -> ignore special root handling (new; should not interfere) | ||
| 79 | // rootok==0 -> root not allowed here | ||
| 80 | // rootok>0 -> root always allowed here | ||
| 81 | |||
| 82 | void add(const sref& grp); | ||
| 83 | void add_list(const sref& grps); | ||
| 84 | void rem(const sref& grp); | ||
| 85 | void rem_list(const sref& grps); | ||
| 86 | }; | ||
| 87 | |||
| 88 | ///////////////////////////////////////////////////////// | ||
| 89 | |||
| 90 | void envAddUser(tokmap& T) throw(merror_t); | ||
| 91 | |||
| 92 | #endif | ||
