Skip to content

Commit af8f1ba

Browse files
committed
Added support for shell users in the interface and fixed several strict syntax issues.
1 parent df52d4b commit af8f1ba

20 files changed

+700
-8
lines changed

INSTALL_DEBIAN.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ a2enmod rewrite
3434

3535
apt-get install pure-ftpd-common pure-ftpd-mysql quota quotatool
3636

37+
Edit the file /etc/default/pure-ftpd-common
38+
39+
vi /etc/default/pure-ftpd-common
40+
41+
and change the start mode from inetd to standalone. Then execute:
42+
43+
/etc/init.d/openbsd-inetd restart
44+
3745

3846
5) Install mydns
3947

install/lib/installer_base.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ public function configure_pureftpd()
522522
exec("chmod 600 $config_dir/$configfile");
523523
exec("chown root:root $config_dir/$configfile");
524524
// **enable chrooting
525-
exec('mkdir -p '.$config_dir.'/conf/ChrootEveryone');
525+
//exec('mkdir -p '.$config_dir.'/conf/ChrootEveryone');
526526
exec('echo "yes" > '.$config_dir.'/conf/ChrootEveryone');
527527
}
528528

interface/web/admin/lib/lang/en_server_ip.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
$wb["server_id_txt"] = 'Server';
33
$wb["ip_address_txt"] = 'IP Address';
4-
$wb["virtualhost_txt"] = 'Virtualhost';
4+
$wb["virtualhost_txt"] = 'HTTP NameVirtualHost';
55
$wb["ip_err"] = 'IP address invalid';
66
$wb["btn_save_txt"] = 'Save';
77
$wb["btn_cancel_txt"] = 'Cancel';

interface/web/client/client_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function onAfterUpdate() {
9898
}
9999

100100
// password changed
101-
if($this->dataRecord["password"] != '') {
101+
if(isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
102102
$password = addslashes($this->dataRecord["password"]);
103103
$client_id = $this->id;
104104
$sql = "UPDATE sys_user SET passwort = md5('$password') WHERE client_id = $client_id";

interface/web/client/form/client.tform.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,20 @@
526526
'rows' => '',
527527
'cols' => ''
528528
),
529+
'limit_shell_user' => array (
530+
'datatype' => 'INTEGER',
531+
'formtype' => 'TEXT',
532+
'validators' => array ( 0 => array ( 'type' => 'ISINT',
533+
'errmsg'=> 'limit_shell_user_error_notint'),
534+
),
535+
'default' => '-1',
536+
'value' => '',
537+
'separator' => '',
538+
'width' => '10',
539+
'maxlength' => '10',
540+
'rows' => '',
541+
'cols' => ''
542+
),
529543
'default_dnsserver' => array (
530544
'datatype' => 'INTEGER',
531545
'formtype' => 'SELECT',

interface/web/client/lib/lang/en_client.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ $wb["limit_ftp_user_txt"] = 'Max. number of FTP users';
5353
$wb["default_dnsserver_txt"] = 'Default DNS Server';
5454
$wb["limit_dns_zone_txt"] = 'Max. number of DNS zones';
5555
$wb["limit_dns_record_txt"] = 'Max. number DNS records';
56-
56+
$wb["limit_shell_user_txt"] = 'Max. number of Shell users';
5757

5858
?>

interface/web/client/templates/client_edit_limits.htm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@
9090
<td class="frmText11" width="280">{tmpl_var name='limit_ftp_user_txt'}:</td>
9191
<td class="frmText11" width="220"><input name="limit_ftp_user" type="text" class="text" value="{tmpl_var name='limit_ftp_user'}" size="10" maxlength="10"></td>
9292
</tr>
93+
<tr>
94+
<td class="frmText11" width="280">{tmpl_var name='limit_shell_user_txt'}:</td>
95+
<td class="frmText11" width="220"><input name="limit_shell_user" type="text" class="text" value="{tmpl_var name='limit_shell_user'}" size="10" maxlength="10"></td>
96+
</tr>
9397
<tr>
9498
<td><h2>DNS</h2></td>
9599
</tr>
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
<?php
2+
3+
/*
4+
Form Definition
5+
6+
Tabledefinition
7+
8+
Datatypes:
9+
- INTEGER (Forces the input to Int)
10+
- DOUBLE
11+
- CURRENCY (Formats the values to currency notation)
12+
- VARCHAR (no format check, maxlength: 255)
13+
- TEXT (no format check)
14+
- DATE (Dateformat, automatic conversion to timestamps)
15+
16+
Formtype:
17+
- TEXT (Textfield)
18+
- TEXTAREA (Textarea)
19+
- PASSWORD (Password textfield, input is not shown when edited)
20+
- SELECT (Select option field)
21+
- RADIO
22+
- CHECKBOX
23+
- CHECKBOXARRAY
24+
- FILE
25+
26+
VALUE:
27+
- Wert oder Array
28+
29+
Hint:
30+
The ID field of the database table is not part of the datafield definition.
31+
The ID field must be always auto incement (int or bigint).
32+
33+
34+
*/
35+
36+
$form["title"] = "Shell User";
37+
$form["description"] = "";
38+
$form["name"] = "shell_user";
39+
$form["action"] = "shell_user_edit.php";
40+
$form["db_table"] = "shell_user";
41+
$form["db_table_idx"] = "shell_user_id";
42+
$form["db_history"] = "yes";
43+
$form["tab_default"] = "shell";
44+
$form["list_default"] = "shell_user_list.php";
45+
$form["auth"] = 'yes'; // yes / no
46+
47+
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
48+
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
49+
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
50+
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
51+
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
52+
53+
$form["tabs"]['shell'] = array (
54+
'title' => "Shell User",
55+
'width' => 100,
56+
'template' => "templates/shell_user_edit.htm",
57+
'fields' => array (
58+
##################################
59+
# Begin Datatable fields
60+
##################################
61+
'server_id' => array (
62+
'datatype' => 'INTEGER',
63+
'formtype' => 'SELECT',
64+
'default' => '',
65+
'datasource' => array ( 'type' => 'SQL',
66+
'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
67+
'keyfield'=> 'server_id',
68+
'valuefield'=> 'server_name'
69+
),
70+
'value' => ''
71+
),
72+
'parent_domain_id' => array (
73+
'datatype' => 'INTEGER',
74+
'formtype' => 'SELECT',
75+
'default' => '',
76+
'datasource' => array ( 'type' => 'SQL',
77+
'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
78+
'keyfield'=> 'domain_id',
79+
'valuefield'=> 'domain'
80+
),
81+
'value' => ''
82+
),
83+
'username' => array (
84+
'datatype' => 'VARCHAR',
85+
'formtype' => 'TEXT',
86+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
87+
'errmsg'=> 'username_error_empty'),
88+
1 => array ( 'type' => 'UNIQUE',
89+
'errmsg'=> 'username_error_unique'),
90+
2 => array ( 'type' => 'REGEX',
91+
'regex' => '/^[\w\.\-]{1,64}$/',
92+
'errmsg'=> 'username_error_regex'),
93+
),
94+
'default' => '',
95+
'value' => '',
96+
'width' => '30',
97+
'maxlength' => '255'
98+
),
99+
'password' => array (
100+
'datatype' => 'VARCHAR',
101+
'formtype' => 'PASSWORD',
102+
'encryption' => 'CRYPT',
103+
'default' => '',
104+
'value' => '',
105+
'width' => '30',
106+
'maxlength' => '255'
107+
),
108+
'quota_size' => array (
109+
'datatype' => 'INTEGER',
110+
'formtype' => 'TEXT',
111+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
112+
'errmsg'=> 'quota_size_error_empty'),
113+
),
114+
'default' => '-1',
115+
'value' => '',
116+
'width' => '7',
117+
'maxlength' => '7'
118+
),
119+
'active' => array (
120+
'datatype' => 'VARCHAR',
121+
'formtype' => 'CHECKBOX',
122+
'default' => 'y',
123+
'value' => array(0 => 'n',1 => 'y')
124+
),
125+
##################################
126+
# ENDE Datatable fields
127+
##################################
128+
)
129+
);
130+
131+
if($_SESSION["s"]["user"]["typ"] == 'admin') {
132+
133+
$form["tabs"]['advanced'] = array (
134+
'title' => "Options",
135+
'width' => 100,
136+
'template' => "templates/shell_user_advanced.htm",
137+
'fields' => array (
138+
##################################
139+
# Begin Datatable fields
140+
##################################
141+
'uid' => array (
142+
'datatype' => 'VARCHAR',
143+
'formtype' => 'TEXT',
144+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
145+
'errmsg'=> 'uid_error_empty'),
146+
),
147+
'default' => '0',
148+
'value' => '',
149+
'width' => '30',
150+
'maxlength' => '255'
151+
),
152+
'gid' => array (
153+
'datatype' => 'VARCHAR',
154+
'formtype' => 'TEXT',
155+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
156+
'errmsg'=> 'uid_error_empty'),
157+
),
158+
'default' => '0',
159+
'value' => '',
160+
'width' => '30',
161+
'maxlength' => '255'
162+
),
163+
'shell' => array (
164+
'datatype' => 'VARCHAR',
165+
'formtype' => 'TEXT',
166+
'default' => '/bin/bash',
167+
'value' => '',
168+
'width' => '30',
169+
'maxlength' => '255'
170+
),
171+
'dir' => array (
172+
'datatype' => 'VARCHAR',
173+
'formtype' => 'TEXT',
174+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
175+
'errmsg'=> 'directory_error_empty'),
176+
),
177+
'default' => '',
178+
'value' => '',
179+
'width' => '30',
180+
'maxlength' => '255'
181+
),
182+
##################################
183+
# ENDE Datatable fields
184+
##################################
185+
)
186+
);
187+
188+
}
189+
190+
191+
?>

interface/web/sites/ftp_user_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function onShowNew() {
6363
$client_group_id = $_SESSION["s"]["user"]["default_group"];
6464
$client = $app->db->queryOneRecord("SELECT limit_ftp_user FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
6565

66-
// Check if the user may add another maildomain.
66+
// Check if the user may add another ftp user.
6767
if($client["limit_ftp_user"] >= 0) {
6868
$tmp = $app->db->queryOneRecord("SELECT count(ftp_user_id) as number FROM ftp_user WHERE sys_groupid = $client_group_id");
6969
if($tmp["number"] >= $client["limit_ftp_user"]) {
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
$wb["uid_txt"] = 'Web Username';
3+
$wb["gid_txt"] = 'Group';
4+
$wb["shell_txt"] = 'Shell';
5+
$wb["dir_txt"] = 'Dir';
6+
$wb["btn_save_txt"] = 'Save';
7+
$wb["btn_cancel_txt"] = 'Cancel';
8+
$wb["server_id_txt"] = 'Server';
9+
$wb["parent_domain_id_txt"] = 'Site';
10+
$wb["username_txt"] = 'Username';
11+
$wb["password_txt"] = 'Password';
12+
$wb["quota_size_txt"] = 'Quota';
13+
$wb["active_txt"] = 'Active';
14+
?>

0 commit comments

Comments
 (0)