-
Notifications
You must be signed in to change notification settings - Fork 1
/
global.h
159 lines (139 loc) · 3.88 KB
/
global.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
* vQadmin Virtual Administration Interface
* Copyright (C) 2000-2002 Inter7 Internet Technologies, Inc.
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <vauth.h>
#include <stdint.h>
#define MAX_WARNING_BUFF 500
/*
Access list stuff
*/
#define ACL_NONE 0L
#define ACL_USER_CREATE 1
#define ACL_USER_DELETE 2
#define ACL_USER_VIEW 4
#define ACL_USER_MOD 8
#define ACL_DOMAIN_CREATE 16
#define ACL_DOMAIN_DELETE 32
#define ACL_DOMAIN_VIEW 64
#define ACL_DOMAIN_MOD 128
#define ACL_ALL ( \
ACL_USER_CREATE | \
ACL_USER_DELETE | \
ACL_USER_VIEW | \
ACL_USER_MOD | \
ACL_DOMAIN_CREATE | \
ACL_DOMAIN_DELETE | \
ACL_DOMAIN_VIEW | \
ACL_DOMAIN_MOD )
#define ACL_FILENAME "vqadmin.acl"
/*
Variable maximum lengths
*/
#define MAX_CONTENT_LENGTH 10000
#define MAX_GLOBAL_LENGTH 500
#define MAX_TEMPLATE_LINE_LENGTH 500
#define MAX_QUOTA_LENGTH 13
#define MAX_PASSWORD_LENGTH 28
#define MAX_USERNAME_LENGTH 28
#define MAX_EMAIL_LENGTH (64 + 1 + MAX_USERNAME_LENGTH + 1)
/*
Template definitions
*/
#define T_INIT_ERROR "html/init_error.html"
#define T_ERROR "html/error.html"
#define T_AUTH_FAILED "html/auth_failed.html"
#define T_MAIN "html/main.html"
#define T_EDIT "html/edit.html"
#define T_QONTROL "html/control.html"
#define T_CTRL_FILE "html/ctrl_file.html"
#define T_HEADER "html/header.html"
#define T_FOOTER "html/footer.html"
#define T_COL "html/col.html"
/* main.c */
void send_html(char *command);
/* cgi.c */
void cgi_nav(void);
void cgi_var(void);
void cgi_parse_hex(void);
void cgi_env(void);
void cgi_init(void);
char *cgi_is_env(char *);
char *cgi_is_var(char *);
char matoh(char);
unsigned char hex2asc(char, char);
/* template.c */
void t_code(char);
void g_code(char *);
void t_printf(char *);
void t_open(char *template, int exit_when_done);
void t_page(char *template, int exit_when_done);
void t_main(int exit_when_done);
/* global.c */
void global_init(void);
void global_error(char *, char, char);
void global_warning(char *);
void global_par(char *, char *);
char *f_global_par(char *);
void global_f_warning(void);
void global_exit(int exit_code);
/* acl.c */
void acl_init(void);
void acl_read(void);
void acl_parse(char *);
char acl_parse_features(char *);
int acl_parse_multi(char *);
/* edit.c */
void go_edit(char *);
void u_edit(void);
int check_box(char *, char, char, struct vqpasswd *, struct vqpasswd *, char *);
/* misc.c */
char *mstrdup(char *);
void tfatal(void);
/* domain.c */
void add_domain();
void del_domain();
void view_domain();
void list_domains();
void mod_domain();
void post_domain_info(char *domain);
void add_alias_domain();
/* lang.c */
void set_language();
int open_lang( char *lang);
void put_lang_code( char *index );
char *get_lang_code( char *index );
/* user.c */
void add_user();
void del_user();
void view_user();
void mod_user();
void post_email_info( char *eaddr, struct vqpasswd *vpwd, char *domain);
void show_users();
/* cedit.c */
void display_file();
void modify_file();
void show_controls();
void delete_file();
typedef uint64_t storage_t;
int quota_to_bytes(char[], char*); //jhopper prototype
int quota_to_megabytes(char[], char*); //jhopper prototype