MRatWork Forum by Mustafa Ramadhan

Sawo Project - Kloxo-MR Discussions => Kloxo-MR Bugs and Requests => Topic started by: tochits on 2016-12-13, 09:09:11

Title: "No permit to delete main FTPUser "
Post by: tochits on 2016-12-13, 09:09:11
Alerts happens every time an attempt to delete an FTP user is made, even if said FTP user is not the 'main' one.

I've attached several screenshots to illustrate the scenario. See in image #1 that I have created additional FTP users, and I get the alert shown in image #2.

sh /script/sysinfo
A. Control Panel:               
   - Kloxo-MR: 7.0.0.b-2016121201
   - Web: hiawatha-10.4.0-f.1.mr.el6.x86_64
   - PHP: php54s-5.4.45-2.w6 (fpm mode)
B. Plateform:
   - OS: CentOS release 6.8 (Final) x86_64
   - Hostname: kloxomr7-build.emc.ph
C. Services:
   1. MySQL: MariaDB-server-10.0.28-1.el6.x86_64
   2. PHP:
      - Installed:
        - Branch: php56u-cli-5.6.28-1.ius.el6.x86_64
      - Used: --PHP Branch--
      - Multiple: enable
   3. Web Used: apache
     - Hiawatha: hiawatha-10.4.0-f.1.mr.el6.x86_64
     - Lighttpd: lighttpd-1.4.43-2.el6.x86_64
     - Nginx: nginx-1.11.6-1.el6.ngx.x86_64
     - Apache: httpd-2.2.31-1.mr.el6.x86_64
       - PHP Type: php-fpm_event
       - Secondary PHP: on
   4. WebCache: none
     - ATS: --uninstalled--
     - Squid: --uninstalled--
     - Varnish: --uninstalled--
   5. Dns: none
     - Bind: --uninstalled--
     - DJBDns: --uninstalled--
     - NSD: --uninstalled--
     - PowerDNS: --uninstalled--
     - Yadifa: --uninstalled--
   6. Mail: qmail-toaster-1.03-1.3.55.mr.el6.x86_64
      - pop3/imap4: courier-imap-toaster-4.1.2-1.3.20.mr.el6.x86_64
      - smtp: qmail-toaster-1.03-1.3.55.mr.el6.x86_64
      - spam: --uninstalled--
   7. Stats: awstats
D. Memory:
                total       used       free     shared    buffers     cached
   Mem:         31866        828      31038          1          0        204
   -/+ buffers/cache:        623      31242
   Swap:            0          0          0
E. Disk Space:
   Filesystem      Size  Used Avail Use% Mounted on
   /dev/simfs      1.1T  202G  886G  19% /
Title: Re: "No permit to delete main FTPUser "
Post by: tochits on 2016-12-13, 09:18:46
Ok, this is definitely a bug. If I change the user's virtual directory to anything except the domain root, I am able to delete the FTP user.

Continuing on the same examples from the screenshots I provided,

testuser1@domain has virtual directory 'domaindir' -> Alert prevents from deleting user

Change virtual directory:

testuser1@domain now has virtual directory 'domaindir/subdir' or even to blank -> No problem deleting user
Title: Re: "No permit to delete main FTPUser "
Post by: MRatWork on 2016-12-13, 10:38:32
Yes, it's bug and will be fixed in next upload.
Title: Re: "No permit to delete main FTPUser "
Post by: MRatWork on 2016-12-13, 11:56:15
For awhile change inside '/usr/local/lxlabs/kloxo/httpdocs/driver/ftp/ftpuser__pureftplib.php':

from
Code: [Select]
function dbactionDelete()
{
global $gbl, $sgbl, $login, $ghtml;


$u = $this->main->__var_username;

$d = str_replace("/home/{$u}/", "", $this->main->__var_full_directory);

$c = db_get_count("web", "customer_name = '{$u}' AND docroot = '{$d}'");

if ((int)$c !== 0) {
throw new lxException($login->getThrow("no_permit_to_delete_main_ftpuser"), '', $this->main->nname);
}

lxshell_return("pure-pw", "userdel", $this->main->nname, "-m");
}
to:
Code: [Select]
function dbactionDelete()
{
global $gbl, $sgbl, $login, $ghtml;


$u = $this->main->__var_username;
$n = $this->main->nname;

$c = db_get_count("ftpuser", "nname = '{$n}' AND username = '{$u}'");
$d = db_get_count("web", "nname = '{$n}' AND username = '{$u}'");

if (((int)$c !== 0) && ((int)$d !== 0)) {
throw new lxException($login->getThrow("no_permit_to_delete_main_ftpuser"), '', $n);
}

lxshell_return("pure-pw", "userdel", $n, "-m");
}
Title: Re: "No permit to delete main FTPUser "
Post by: tochits on 2016-12-14, 06:12:33
Issue fixed. Thanks.