Skip to content

Commit

Permalink
Bugfixing of Release 2.1
Browse files Browse the repository at this point in the history
- fixed bug that prevented creation of new users with the MySQL backend
- deleted redundant README file
- fixed config_example to use mysql by default
- fixed footer information
  • Loading branch information
ChristianBeer committed Mar 15, 2015
1 parent b72c047 commit 6ec9552
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 147 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Changes:
* separation of editing and removal in different php files
* fixed several bugs in the data model, e.g., updating a group's gid
also updates the gids of the users
* support for sqlite3 database
* support for pbkdf2 hash algorithm

Release: 2.0
Changes:
Expand Down
131 changes: 0 additions & 131 deletions README

This file was deleted.

13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Graphical User Interface for ProFTPd with MySQL and sqlite3 support

&copy; 2004 The Netherlands, Lex Brugman <lex_brugman@users.sourceforge.net>
&copy; 2012 Christian Beer <djangofett@gmx.net>
&copy; 2004 The Netherlands, Lex Brugman <lex_brugman@users.sourceforge.net>
&copy; 2012 Christian Beer <djangofett@gmx.net>
&copy; 2015 Ricardo Padilha <ricardo@droboports.com>

Published under the GPLv2 License (see LICENSE for details)
Expand All @@ -26,15 +26,15 @@ This GUI for ProFTPd was written to support a basic user management feature when

There is no build-in security, so you have to protect the directory with something else, like Apache Basic Authentication.

This software will be rewritten over time and will be object-oriented and equipped with unit tests at the end.
It's possible to use either of SHA1 and pbkdf2 with either of MySQL/MariaDB and sqlite3. pbkdf2 is supported since ProFTPd 1.3.5.

## To-Do

A lot ;) so help is very much appreciated

## Upgrade

As the software has undergone a complete rewrite of the config file you should not overwrite your old config.php and compare and change values manually.
As the software has undergone a complete rewrite of the config file you should not overwrite your old config.php and compare and change values manually. If you want to upgrade the hashing algorithm you have to change all passwords after changing the configs (both ProFTPd and ProFTPd Admin).

## Installation

Expand Down Expand Up @@ -125,5 +125,6 @@ SQLNamedQuery files-in-count UPDATE "files_in_used=files_in_used+1 WHE

## Thanks / Links

Lex Brugman for initiating this project
Justin Vincent for the ezSQL library
Lex Brugman for initiating this project
Justin Vincent for the ezSQL library
Ricardo Padilha for implementing sqlite3, pbkdf2 and bootstrap support
10 changes: 5 additions & 5 deletions configs/config_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
$cfg['default_homedir'] = "/srv/ftp";
// Use either SHA1 or MD5 or any other supported by your MySQL-Server and ProFTPd
// "pbkdf2" is supported if you are using ProFTPd 1.3.5.
$cfg['passwd_encryption'] = "SHA1";
$cfg['passwd_encryption'] = "SHA1";
$cfg['min_passwd_length'] = "6";
$cfg['max_userid_length'] = "20";
$cfg['max_groupname_length'] = "20";
Expand All @@ -62,7 +62,7 @@
$cfg['db_pass'] = "password";

// use this block for an sqlite3 backend
$cfg['db_type'] = "sqlite3";
$cfg['db_path'] = "configs/";
$cfg['db_name'] = "auth.sqlite3";
?>
//$cfg['db_type'] = "sqlite3";
//$cfg['db_path'] = "configs/";
//$cfg['db_name'] = "auth.sqlite3";
?>
11 changes: 7 additions & 4 deletions includes/AdminClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,11 @@ function add_user($userdata) {
$passwd_encryption = $this->config['passwd_encryption'];
if ($passwd_encryption == 'pbkdf2') {
$passwd = hash_pbkdf2("sha1", $userdata[$field_passwd], $userdata[$field_userid], 5000, 40);
$passwd = '"'.$passwd.'"';
} else {
$passwd = $passwd_encryption.'("'.$userdata[$field_passwd].'")';
}
$format = 'INSERT INTO %s (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) VALUES ("%s","%s","%s","%s","%s","%s","%s","%s","%s","%s","%s","%s","%s")';
$format = 'INSERT INTO %s (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) VALUES ("%s","%s","%s",%s,"%s","%s","%s","%s","%s","%s","%s","%s","%s")';
$query = sprintf($format, $this->config['table_users'],
$field_userid,
$field_uid,
Expand Down Expand Up @@ -557,11 +558,13 @@ function update_user($userdata) {

$passwd_query = '';
if (strlen($userdata[$field_passwd]) > 0) {
$passwd_format = ' %s="%s", ';
$passwd_format = '';
if ($passwd_encryption == 'pbkdf2') {
$passwd = hash_pbkdf2("sha1", $userdata[$field_passwd], $userdata[$field_userid], 5000, 40);
$passwd_format = ' %s="%s", ';
} else {
$passwd = $passwd_encryption.'("'.$userdata[$field_passwd].'")';
$passwd_format = ' %s=%s, ';
}
$passwd_query = sprintf($passwd_format, $field_passwd, $passwd);
}
Expand Down Expand Up @@ -615,12 +618,12 @@ function generate_random_string($length = 6) {
}

/**
* check the validity of the id
* check the validity of the id
* @param Integer $id
* @return Boolean true if the given id is a positive integer
*/
function is_valid_id($id) {
return is_numeric($id) && (int)$id > 0 && $id == round($id);
}
}
?>
?>
2 changes: 1 addition & 1 deletion includes/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<hr/>
<footer>
<center><p style="font-size:x-small">ProFTPd Admin <?php echo $ac->get_version(); ?> is licensed under GPLv2. See <a href="https://github.com/droboports/ProFTPd-Admin">github.com/droboports/ProFTPd-Admin</a> for more information.</p></center>
<center><p style="font-size:x-small">ProFTPd Admin <?php echo $ac->get_version(); ?> is licensed under GPLv2. See <a href="https://github.com/ChristianBeer/ProFTPd-Admin">github.com/ChristianBeer/ProFTPd-Admin</a> for more information.</p></center>
</footer>
</div> <!-- /container -->

Expand Down

0 comments on commit 6ec9552

Please sign in to comment.