1 /* 2 * vQadmin Virtual Administration Interface 3 * Copyright (C) 2000-2002 Inter7 Internet Technologies, Inc. 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * vol@inter7.com 20 */ 21 22 #include <unistd.h> 23 #include <sys/types.h> 24 #include <pwd.h> 25 #include <vauth.h> 26 #include "config.h" 27 28 #define MAX_WARNING_BUFF 500 29 30 /* 31 Access list stuff 32 */ 33 #define ACL_NONE 0L 34 #define ACL_USER_CREATE 1 35 #define ACL_USER_DELETE 2 36 #define ACL_USER_VIEW 4 37 #define ACL_USER_MOD 8 38 #define ACL_DOMAIN_CREATE 16 39 #define ACL_DOMAIN_DELETE 32 40 #define ACL_DOMAIN_VIEW 64 41 #define ACL_DOMAIN_MOD 128 42 43 #define ACL_ALL ( \ 44 ACL_USER_CREATE | \ 45 ACL_USER_DELETE | \ 46 ACL_USER_VIEW | \ 47 ACL_USER_MOD | \ 48 ACL_DOMAIN_CREATE | \ 49 ACL_DOMAIN_DELETE | \ 50 ACL_DOMAIN_VIEW | \ 51 ACL_DOMAIN_MOD ) 52 53 #define ACL_FILENAME "vqadmin.acl" 54 55 /* 56 Variable maximum lengths 57 */ 58 #define MAX_CONTENT_LENGTH 10000 59 #define MAX_GLOBAL_LENGTH 500 60 #define MAX_TEMPLATE_LINE_LENGTH 500 61 #define MAX_QUOTA_LENGTH 13 62 #define MAX_PASSWORD_LENGTH 28 63 #define MAX_USERNAME_LENGTH 28 64 #define MAX_EMAIL_LENGTH (64 + 1 + MAX_USERNAME_LENGTH + 1) 65 66 /* 67 Template definitions 68 */ 69 #define T_INIT_ERROR "html/init_error.html" 70 #define T_ERROR "html/error.html" 71 #define T_AUTH_FAILED "html/auth_failed.html" 72 73 #ifdef ENABLE_MYSQL 74 #define T_MAIN "html/my_main.html" 75 #else 76 #define T_MAIN "html/main.html" 77 #endif 78 79 #define T_EDIT "html/edit.html" 80 #define T_QONTROL "html/control.html" 81 #define T_CTRL_FILE "html/ctrl_file.html" 82 #define T_ADD_HEAD "html/add_domain_head.html" 83 #define T_ADD_BODY "html/add_domain_body.html" 84 #define T_ADD_FOOT "html/add_domain_foot.html" 85 86 /* main.c */ 87 void send_html(char *command); 88 89 /* cgi.c */ 90 void cgi_nav(void); 91 void cgi_var(void); 92 void cgi_parse_hex(void); 93 void cgi_env(void); 94 void cgi_init(void); 95 char *cgi_is_env(char *); 96 char *cgi_is_var(char *); 97 char matoh(char); 98 unsigned char hex2asc(char, char); 99 100 /* template.c */ 101 void t_code(char); 102 void g_code(char *); 103 void t_printf(char *); 104 void t_open(char *template, int exit_when_done); 105 106 /* global.c */ 107 void global_init(void); 108 void global_error(char *, char, char); 109 void global_warning(char *); 110 void global_par(char *, char *); 111 char *f_global_par(char *); 112 void global_f_warning(void); 113 void global_exit(int exit_code); 114 115 /* acl.c */ 116 void acl_init(void); 117 void acl_read(void); 118 void acl_parse(char *); 119 char acl_parse_features(char *); 120 int acl_parse_multi(char *); 121 122 /* edit.c */ 123 void go_edit(char *); 124 void u_edit(void); 125 int check_box(char *, char, char, struct vqpasswd *, struct vqpasswd *, char *); 126 127 /* misc.c */ 128 char *mstrdup(char *); 129 void tfatal(void); 130 131 /* domain.c */ 132 void add_domain(); 133 void del_domain(); 134 void view_domain(); 135 void list_domains(); 136 void mod_domain(); 137 void post_domain_info(char *domain); 138 void add_alias_domain(); 139 140 /* lang.c */ 141 void set_language(); 142 int open_lang( char *lang); 143 void put_lang_code( char *index ); 144 char *get_lang_code( char *index ); 145 146 /* user.c */ 147 void add_user(); 148 void del_user(); 149 void view_user(); 150 void mod_user(); 151 void post_email_info( char *eaddr, struct vqpasswd *vpwd, char *domain); 152 void show_users(); 153 154 /* cedit.c */ 155 void display_file(); 156 void modify_file(); 157 void show_controls(); 158 void delete_file(); 159 160 #ifdef ENABLE_MYSQL 161 /* db_owner.c */ 162 void display_add_domain(void); 163 int insert_owner(char *domain); 164 #endif 165 166