__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
#!/usr/bin/perl

# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; version 2
# of the License.
#
# 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
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1335  USA

# ****************************
package MySQLaccess;
#use strict;
use File::Temp qw(tempfile tmpnam);
use Fcntl;

BEGIN {
	# ****************************
	# static information...
	$VERSION     = "2.10, 13 Sep 2019";
	$0           =~ m%/([^/]+)$%o;
	$script      = $1;
        $script      = 'MySQLAccess' unless $script;
	$script_conf = "$script.conf";
	$script_log  = $ENV{'HOME'}."/$script.log";

	# ****************************
	# information on MariaDB
	$MYSQL     = '/usr/bin/mariadb';    # path to mariadb executable
	$SERVER    = '3.21';
	$MYSQL_OPT = ' --batch --unbuffered';
	$ACCESS_DB = 'mysql';		 # name of DB with grant-tables
	$ACCESS_H  = 'host';		 # 
	$ACCESS_U  = 'user';	         # 
	$ACCESS_D  = 'db';               #
	# Add/Edit privileges
	$ACCESS_H_TMP = 'host_tmp';      
	$ACCESS_U_TMP = 'user_tmp';      
	$ACCESS_D_TMP = 'db_tmp';        
	$ACCESS_H_BCK = 'host_backup';   
	$ACCESS_U_BCK = 'user_backup';   
	$ACCESS_D_BCK = 'db_backup';     
        $DIFF      = '/usr/bin/diff'; 
        $MYSQLDUMP = '/usr/bin/mariadb-dump';
                                         #path to mariadb-dump executable

        $MYSQLADMIN= 'http://foobar.com/MySQLadmin';
                                         #URL of CGI for manipulating
                                         #the temporary grant-tables
}

END {
	unlink $MYSQL_CNF if defined $MYSQL_CNF and not $DEBUG;
}

$INFO = <<"_INFO";
--------------------------------------------------------------------------
   mysqlaccess (Version $VERSION)
   ~~~~~~~~~~~
   Copyright (C) 1997,1998 Yves.Carlier\@rug.ac.be
                           University of Ghent (RUG), Belgium
                           Administratieve Informatieverwerking (AIV)

   report the access-privileges for a USER from a HOST to a DB

   Many thanks go to <monty\@mysql.com> and <psmith\@BayNetworks.COM>
   for their suggestions, debugging and patches. 

   use `$script -?' to get more information on available options.

   From version 2.0x, $script can also be used through a WEB-browser
   if it is ran as a CGI-script.  (See the release-notes)

--------------------------------------------------------------------------
_INFO

$OPTIONS = <<_OPTIONS;

Usage: $script [host [user [db]]] OPTIONS

  -?, --help           display this helpscreen and exit
  -v, --version        print information on the program `$script'

  -u, --user=#         username for logging in to the db
  -p, --password=#     validate password for user
  -h, --host=#         name or IP-number of the host
  -d, --db=#           name of the database

  -U, --superuser=#    connect as superuser
  -P, --spassword=#    password for superuser
  -H, --rhost=#        remote MariaDB-server to connect to
      --old_server     connect to old MariaDB-server (before v3.21) which 
                       does not yet know how to handle full where clauses.

  -b, --brief          single-line tabular report
  -t, --table          report in table-format

  --relnotes           print release-notes
  --plan               print suggestions/ideas for future releases
  --howto              some examples of how to run `$script'
  --debug=N            enter debuglevel N (0..3)

  --copy               reload temporary grant-tables from original ones
  --preview            show differences in privileges after making
                       changes in (temporary) grant-tables
  --commit             copy grant-rules from temporary tables to grant-tables
                       (!don't forget to do an mysqladmin reload)
  --rollback           undo the last changes to the grant-tables.

  Note:
    At least the user and the db must be given (even with wildcards)
    If no host is given, `localhost' is assumed
    Wilcards (*,?,%,_) are allowed for host, user and db, but be sure 
    to escape them from your shell!! (ie type \\* or '*')
_OPTIONS

$RELEASE = <<'_RELEASE';
 
Release Notes:
-------------
  0.1-beta1: internal
  - first trial.
 
  0.1-beta2: (1997-02-27)
  - complete rewrite of the granting-rules, based on the documentation
    found in de FAQ.
  - IP-number and name for a host are equiv.
 
  0.1-beta3: (1997-03-10)
  - more information
  - 'localhost' and the name/ip of the local machine are now equiv.

  0.1-beta4: (1997-03-11)
  - inform the user if he has not enough priv. to read the mysql db

  1.0-beta1: (1997-03-12)
  suggestions by Monty:
  - connect as superuser with superpassword.
  - mysqlaccess could also notice if all tables are empty. This means
    that all user have full access!
  - It would be nice if one could optionally start mysqlaccess without
    any options just the arguments 'user db' or 'host user db', where
    host is 'localhost' if one uses only two arguments.

  1.0-beta2: (1997-03-14)
  - bugfix: translation to reg.expr of \_ and \%.
  - bugfix: error in matching regular expression and string given
            by user which resulted in
            'test_123' being matched with 'test'

  1.0-beta3: (1997-03-14)
  - bugfix: the user-field should not be treated as a sql-regexpr,
            but as a plain string.
  - bugfix: the host-table should not be used if the host isn't empty in db
                                          or  if the host isn't emty in user
            (Monty)
 
  1.0-beta4: (1997-03-14)
  - bugfix: in an expression "$i = $j or $k", the '=' binds tighter than the or
            which results in problems...
            (by Monty)
  - running mysqlaccess with "perl -w" gives less warnings...   ;-)

  1.0-beta5: (1997-04-04)
  - bugfix: The table sorting was only being applied to the "user" table; all
            the tables need to be sorted.  Rewrote the sort algorithm, and
            the table walk algorithm (no temp file anymore), and various
            other cleanups.  I believe the access calculation is 100% correct.
            (by Paul D. Smith <psmith\@baynetworks.com>)
  - Allow the debug level to be set on the cmd line with --debug=N.
            (by Paul D. Smith <psmith\@baynetworks.com>)
  - More -w cleanups; should be totally -w-clean.
            (by Paul D. Smith <psmith\@baynetworks.com>)
 
  1.1-beta1: (1997-04-xx) 
  1.1-beta2: (1997-04-11)
  - new options:
             --all_users : report access-rights for all possible users
             --all_dbs   : report access-rights for all possible dbs
             --all_hosts : report access-rights for all possible hosts
             --brief     : as brief as possible, don't mention notes,warnings and rules
             --password  : validate password for user 
  - layout: long messages are wrapped on the report.
  - functionality:
            more descriptive notes and warnings
            wildcards (*,?) are allowed in the user,host and db options
            setting xxxx=* is equiv to using option --all_xxxx
            note: make sure you escape your wildcards, so they don't get
                  interpreted by the shell.  use \* or '*'
  - bugfix: Fieldnames which should be skipped on the output can now have
            a first capital letter.
  - bugfix: any option with a '.' (eg ip-number) was interpreted as
            a wildcard-expression.
  - bugfix: When no entry was found in the db-table, the default accessrights are
            N, instead of the faulty Y in a previous version.
 
  1.1-beta-3  : (1997-04-xx)
  1.1-beta-4  : (1997-04-xx)
  1.1-beta-5  : (1997-04-xx)
  1.1         : (1997-04-28)
  - new options:
            --rhost     : name of mysql-server to connect to
            --plan      : print suggestions/ideas for future releases
            --relnotes  : display release-notes
            --howto     : display examples on how to use mysqlaccess
            --brief     : single-line tabular output
  - functionality/bugfix:
    *      removed options --all_users,--all_dbs,--all_hosts, which 
           were redundant with the wildcard-expressions for the corresponding
           options. They made the processing of the commandline too painful 
           and confusing ;-)
           (suggested by psmith)
    *      redefined the option --brief, which now gives a single-line 
           tabular output
    *      Now we check if the right version of the mysql-client is used,
           since we might use an option not yet implemented in an
           older version (--unbuffered, since 3.0.18)
           Also the error-messages the mysql-client reports are 
           better interpreted ;-)  
    *      Wildcards can now be given following the SQL-expression 
           (%,_) and the Regular-expression (*,?) syntax.
  - speed: we now open a bidirectional pipe to the mysql-client, and keep 
           it open throughout the whole run. Queries are written to,
           and the answers read from the pipe.
           (suggested by monty)
  - bugfixes:
    *      the Rules were not properly reset over iterations 
    *      when in different tables the field-names were not identical, 
           eg. Select_priv and select_priv, they were considered as 
           definitions of 2 different access-rights.
    *      the IP-number of a host with a name containing wildcards should
           not be searched for in Name2IP and IP2Name.
    *      various other small things, pointed out by <monty> and <psmith>

  1.2         : (1997-05-13)
  - bugfix:
    * Fixed bug in acl with anonymous user:  Now if one gets accepted by the
      user table as a empty user name, the user name is set to '' when 
      checking against the 'db' and 'host' tables. (Bug fixed in MySQL3.20.19)

  1.2-1       : (1997-xx-xx)
  - bugfix:
    * hashes should  be initialized with () instead of {} <psmith>
    * "my" variable $name masks earlier declaration in same scope,
      using perl 5.004 <????>

  1.2-2       : (1997-06-10)
    
  2.0p1-3     : (1997-10-xx)
  - new
    * packages
    * log-file for debug-output : /tmp/mysqlaccess.log
    * default values are read from a configuration file $script.conf
      first this file is looked for in the current directory; if not
      found it is looked for in 
      Note that when default-values are given, these can't get overridden
      by empty (blanc) values!
    * CGI-BIN version with HTML and forms interface.  Simply place the
      script in an ScriptAliased directory, make the configuration file
      available in the that directory or in , and point your browser
      to the right URL. 
    * copy the grant-rules to temporary tables, where you are safe to
      play with them.
    * preview changes in privileges after changing grant-rules,
      before taking them into production
    * copy the new grant-rules from the temporary tables back to the
      grant-tables.
    * Undo all changes made in the grant-tables (1-level undo).
  -new options:
    * --table   : as opposite of the --brief option.
    * --copy    : (re)load temporary grant-tables from original ones.
    * --preview : preview changes in privileges after changing
                  some or more entries in the grant-tables.
    * --commit  : copy grant-rules from temporary tables to grant-tables
                  (!don't forget to do an mysqladmin reload)
    * --rollback: undo the last changes to the grant-tables.

  - bugfix:
    * if the table db is empty, mysqlaccess freezed 
      (by X Zhu <X.Zhu@Bradford.ac.uk>)

  2.0         : (1997-10-09)
  - fixed some "-w" warnings.
  - complain when certain programs and paths can't be found.

  2.01        : (1997-12-12)
  - bugfix:
    * rules for db-table where not calculated and reported correctly.
  2.02        : (1998-01-xx)
  - bugfix:
    * Privileges of the user-table were not AND-ed properly with the
      other privileges. (reported by monty)
  - new option:
    * --old_server: mysqlaccess will now use a full where clause when
                    retrieving information from the MySQL-server.  If
                    you are connecting to an old server (before v3.21)
                    then use the option --old_server.
  2.03         : (1998-02-27)
  - bugfix:
    * in Host::MatchTemplate: incorrect match if host-field was left empty.

  2.04-alpha1  : (2000-02-11)
  Closes vulnerability due to former implementation requiring passwords
  to be passed on the command line.
  - functionality
    Option values for --password -p -spassword -P  may now be omitted from
    command line, in which case the values will be prompted for.
      (fix supplied by Steve Harvey <sgh@vex.net>)

   2.05: (2000-02-17)   Monty
   Moved the log file from /tmp to ~

   2.06:  Don't print '+++USING FULL WHERE CLAUSE+++'

_RELEASE

$TODO = <<_TODO;

 Plans:
 -----
  -a full where clause is use now.  How can we handle older servers?
  -add some more functionality for DNS.
  -select the warnings more carefuly.
  >>  I think that the warnings should either be enhanced to _really_
  >>  understand and report real problems accurately, or restricted to
  >>  only printing things that it knows with 100% certainty. <psmith)
  >>  Why do I have both '%' and 'any_other_host' in there?  Isn't that
  >>  the same thing?  I think it's because I have an actual host '%' in
  >>  one of my tables.  Probably the script should catch that and not
  >>  duplicate output. <psmith>

_TODO

# From the FAQ: the Grant-algorithm
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# The host table is mainly to maintain a list of "secure" servers.
# At TCX hosts contain a list of all machines on local network. These are granted
# all privileges.
# Technically the user grant is calculated by:
#
#    1.First sort all entries by host by putting host without wildcards first,
#      after this host with wildcards and entries with host = ".
#      Under each host sort user by the same criterias.
#    2.Get grant for user from the "db" table.
#    3.If hostname is "empty" for the found entry, AND the privileges with
#      the privileges for the host in "host" table.
#      (Remove all which is not "Y" in both)
#    4.OR (add) the privileges for the user from the "user" table.
#     (add all privileges which is "Y" in "user")
#
#    When matching, use the first found match.
#
# -----------------------------------------------------------------------------------

$HOWTO = <<_HOWTO;

Examples of how to call $script:
~~~~~~~~
1)Calling $script with 2 arguments:

  \$ $script root mysql
     ->report rights of user root logged on at the local host in db mysql

  Access-rights
  for USER 'root', from HOST 'localhost', to DB 'mysql'
          +-----------------+---+ +-----------------+---+
          | select_priv     | Y | | drop_priv       | Y |
          | insert_priv     | Y | | reload_priv     | Y |
          | update_priv     | Y | | shutdown_priv   | Y |
          | delete_priv     | Y | | process_priv    | Y |
          | create_priv     | Y | | file_priv       | Y |
          +-----------------+---+ +-----------------+---+
  BEWARE:  Everybody can access your DB as user 'root'
        :  WITHOUT supplying a password.  Be very careful about it!!

  The following rules are used:
   db    : 'No matching rule'
   host  : 'Not processed: host-field is not empty in db-table.'
   user  : 'localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'

2)Calling $script with 3 arguments:

  \$ $script foo.bar nobody Foo 
     ->report rights of user root logged in at machine foobar to db Foo

  Access-rights
  for USER 'nobody', from HOST 'foo.bar', to DB 'Foo'
          +-----------------+---+ +-----------------+---+
          | select_priv     | Y | | drop_priv       | N |
          | insert_priv     | Y | | reload_priv     | N |
          | update_priv     | Y | | shutdown_priv   | N |
          | delete_priv     | Y | | process_priv    | N |
          | create_priv     | N | | file_priv       | N |
          +-----------------+---+ +-----------------+---+
  BEWARE:  Everybody can access your DB as user 'nobody'
        :  WITHOUT supplying a password.  Be very careful about it!!

  The following rules are used:
   db    : 'foo.bar','Foo','nobody','Y','Y','Y','N','N','N'
   host  : 'Not processed: host-field is not empty in db-table.'
   user  : 'foo.bar','nobody','','N','N','N','Y','N','N','N','N','N','N'

3)Using wildcards:

  \$ $script  \\* nobody Foo --brief
     ->report access-rights of user nobody from all machines to db Foo,
       and use a matrix-report.

  Sel  Ins  Upd  Del  Crea Drop Reld Shut Proc File Host,User,DB        
  ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --------------------
   Y    Y    Y    Y    N    N    N    N    N    N   localhost,nobody,Foo
   N    N    N    N    N    N    N    N    N    N   %,nobody,Foo  
   N    N    N    N    N    N    N    N    N    N   any_other_host,nobody,Foo

_HOWTO


# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
#                       START OF THE PROGRAM                            #
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #

use Getopt::Long;
use Sys::Hostname;
use IPC::Open3;


# ****************************
# debugging flag
# can be set to 0,1,2,3
# a higher value gives more info
# ! this can also be set on the command-line
	$DEBUG   = 0;

# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>8
#  Normally nothing should be changed beneeth this line


# ****************************
# no caching on STDOUT
	$|=1;

	$MYSQL_CNF = tmpnam();
	%MYSQL_CNF = (client    => { },
                      mysql     => { },
                      mysqldump => { },
	);



$NEW_USER = 'ANY_NEW_USER';
$NEW_DB   = 'ANY_NEW_DB'  ;


# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #
#  mysqlaccess:                                              #
#  ~~~~~~~~~~~                                               #
#  Lets get to it,                                           #
#  and start the program by processing the parameters        #
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #

($CMD,$CGI) = GetMode();

# ****************************
# the copyright message should
# always be printed (once)
MySQLaccess::Report::Print_Header();

# *****************************
# Read configuration-file
  MySQLaccess::Debug::Print(1, "Reading configuration file...");
  if (-f "/$script_conf") {
     print "Configuration file '$script_conf' is found in '/'\n";
     require "/$script_conf";
  }
  elsif (-f "/usr/$script_conf") {
     print "Configuration file '$script_conf' is found in '/usr/'\n";
     require "/usr/$script_conf";
  }
  elsif (-f "./$script_conf") {
     print "\nERROR! Configuration file '$script_conf' is found in the current ";
     print "directory.\nThe permissible locations for this file are either ";
     print "/ or /usr/\n";
     print "Please move it to one of these locations and retry.\n\n";
     exit 0;
  }


# ****************************
# Read in all parameters
if ($MySQLaccess::CMD) { #command-line version
	# ----------------------------
	# Get options from commandline
	$Getopt::Long::ignorecase=0; #case sensitive options
	if ( grep(/\-\?/,@ARGV) ) { MySQLaccess::Report::Print_Usage(); exit 0; }
	GetOptions("help"          => \$Param{'help'}
	          ,"host|h=s"      => \$Param{'host'}
	          ,"user|u=s"      => \$Param{'user'}
	          ,"password|p:s"  => \$Param{'password'}
	          ,"db|d=s"        => \$Param{'db'}
	          ,"superuser|U=s" => \$Param{'superuser'}
	          ,"spassword|P:s" => \$Param{'spassword'}
	          ,"rhost|H=s"     => \$Param{'rhost'}
                  ,"old_server"    => \$Param{'old_server'}
	          ,"debug=i"       => \$Param{'DEBUG'}
	          ,"brief|b"       => \$Param{'brief'}
	          ,"table|t"       => \$Param{'table'}
	          ,"relnotes"      => \$Param{'relnotes'}
	          ,"plan"          => \$Param{'plan'}
	          ,"howto"         => \$Param{'howto'}
	          ,"version|v"     => \$Param{'version'}
                  ,"preview"       => \$Param{'preview'}
                  ,"copy"          => \$Param{'copy'}
                  ,"commit"        => \$Param{'commit'}
                  ,'rollback'      => \$Param{'rollback'}
		  );

        # -----------------------------
        # set DEBUG
        $DEBUG = $Param{'DEBUG'} if ($Param{'DEBUG'}>=$DEBUG);

	# -----------------------------
	# check for things which aren't
	# declared as options:
	# 2 arguments: (user,db) -> ('localhost','user','db')
	if ($#ARGV == 1) {
	   MySQLaccess::Debug::Print(2,"$script called with 2 arguments:");
	   $Param{'host'} = $Param{'host'} || 'localhost'; 
	   $Param{'user'} = $ARGV[0] || $Param{'user'};
           $Param{'db'}   = $ARGV[1] || $Param{'db'}; 
	}
	# 3 arguments: (host,user,db)
	if ($#ARGV == 2) {
	   MySQLaccess::Debug::Print(2,"$script called with 3 arguments:");
	   $Param{'host'} = $ARGV[0] || $Param{'host'};
	   $Param{'user'} = $ARGV[1] || $Param{'user'};
	   $Param{'db'}   = $ARGV[2] || $Param{'db'};
	}

	# -------------------------------------
	# prompt for user password if requested
	if ( defined($Param{'password'}) && length($Param{'password'}) == 0 ) {
           $Param{'password'} = PromptPass(
	                        "Password for MySQL user $Param{'user'}: ");
	}
}
if ($MySQLaccess::CGI) { #CGI-version
	require CGI;
 	$Q = new CGI;
	$Param{'help'} = $Q->param('help') ;
	$Param{'host'} = $Q->param('host') || $Q->param('h') || $Param{'host'};
	$Param{'user'} = $Q->param('user') || $Q->param('u') || $Param{'user'};
	$Param{'db'}   = $Q->param('db')   || $Q->param('d') || $Param{'db'};
	$Param{'password'}  = $Q->param('password')  || $Q->param('p') || $Param{'password'};
	$Param{'superuser'} = $Q->param('superuser') || $Q->param('U') || $Param{'superuser'};
	$Param{'spassword'} = $Q->param('spassword') || $Q->param('P') || $Param{'spassword'};
	$Param{'rhost'}     = $Q->param('rhost')     || $Q->param('H') || $Param{'rhost'};
	$Param{'old_server'}= $Q->param('old_server')|| $Param{'old_server'};
	$Param{'debug'}     = $Q->param('debug')     || $Param{'debug'};
	$Param{'brief'}     = $Q->param('brief')     || $Param{'brief'}; 
	$Param{'table'}     = $Q->param('table')     || $Param{'table'}; 
	$Param{'relnotes'}  = $Q->param('relnotes');
	$Param{'plan'}      = $Q->param('plan');
	$Param{'howto'}     = $Q->param('howto'); 
	$Param{'version'}   = $Q->param('version') ? $Q->param('version') : $Q->param('v');
	$Param{'edit'}      = $Q->param('edit'); 
	$Param{'preview'}   = $Q->param('preview'); 
	$Param{'copy'}      = $Q->param('copy'); 
	$Param{'commit'}    = $Q->param('commit'); 
	$Param{'rollback'}  = $Q->param('rollback'); 
        # -----------------------------
        # set DEBUG
        $DEBUG = $Q->param('debug') if ($Q->param('debug')>=$DEBUG);
}

# ----------------------
# brief and table-format 
# exclude each-other
# table-format is preferred
if (defined($Param{'table'})) { undef($Param{'brief'}); }
if (defined($Param{'preview'}) or
    defined($Param{'copy'}) or
    defined($Param{'commit'}) or
    defined($Param{'rollback'}) ) { $Param{'edit'}='on'; }


# ----------------------
# if no host is given
# assume we mean 'localhost'
if (!defined($Param{'host'}))      { $Param{'host'}='localhost'; }

# ----------------------
# perform some checks
# -> eliminate 'broken pipe' error
push(@MySQLaccess::Grant::Error,'not_found_mysql')     if !(-x $MYSQL);
push(@MySQLaccess::Grant::Error,'not_found_diff')      if !(-x $DIFF);
push(@MySQLaccess::Grant::Error,'not_found_mysqldump') if !(-x $MYSQLDUMP);
if (@MySQLaccess::Grant::Error) {
   MySQLaccess::Report::Print_Error_Messages() ;
   exit 0;
}

#-----------------------
# get info/help if necc.
$print_usage=1;
if ( defined($Param{'version'}) ) {
   MySQLaccess::Report::Print_Version();
   $print_usage=0;
   MySQLaccess::Report::Print_Footer();
   MySQLaccess::DB::CloseConnection();
   exit 0;
#   exit 0;
}
if ( defined($Param{'relnotes'}) ) {
   MySQLaccess::Report::Print_Relnotes();
   $print_usage=0;
   MySQLaccess::Report::Print_Footer();
   MySQLaccess::DB::CloseConnection();
   exit 0;
#   exit 0;
}
if ( defined($Param{'plan'}) ) {
   MySQLaccess::Report::Print_Plans();
   $print_usage=0;
   MySQLaccess::Report::Print_Footer();
   MySQLaccess::DB::CloseConnection();
   exit 0;
#   exit 0;
}
if ( defined($Param{'howto'}) ) {
   MySQLaccess::Report::Print_HowTo();
   $print_usage=0;
   MySQLaccess::Report::Print_Footer();
   MySQLaccess::DB::CloseConnection();
   exit 0;
#   exit 0;
}

# -----------------------------
# generate a help-screen in CMD-mode
# or a blanc form in CGI-mode 
if ( defined($Param{'help'}) 
     or !defined($Param{'user'}) 
     or !defined($Param{'host'})
     or !defined($Param{'db'}) 
   ) {
   push(@MySQLaccess::Grant::Error,'user_required') unless defined($Param{'user'});
   push(@MySQLaccess::Grant::Error,'db_required') unless defined($Param{'db'});
   push(@MySQLaccess::Grant::Error,'host_required') unless defined($Param{'host'});
   MySQLaccess::Report::Print_Usage() if $print_usage;
   exit 0;
}


# ----------------------------
# get hostname and local-ip
# for localhost
$localhost = MySQLaccess::Host::LocalHost();
$local_ip  = MySQLaccess::Host::Name2IP($localhost);
$MySQLaccess::Host::localhost = MySQLaccess::Host::LocalHost();
$MySQLaccess::Host::local_ip  = MySQLaccess::Host::Name2IP($localhost);
MySQLaccess::Debug::Print(3, "localhost name=$localhost, ip=$local_ip");

#-----------------------------------
# version of MySQL-server to connect
# to determine use of full where clause
$MySQLaccess::Host::SERVER = $Param{'old_server'} ? '3.20' : $SERVER;

#---------------------------------
# create the config file for mysql and mysqldump
# to avoid passing authentication info on the command line
#
MergeConfigFiles();
die "Unsafe config file found: $unsafeConfig\n"  if $unsafeConfig;
if (defined($Param{'superuser'})) {
   $MYSQL_CNF{'mysql'}{'user'} = $Param{'superuser'};
   $MYSQL_CNF{'mysqldump'}{'user'} = $Param{'superuser'};
}
if (defined($Param{'spassword'})) {
   if ( $CMD && length($Param{'spassword'}) == 0 ) {
      $Param{'spassword'} =
           PromptPass("Password for MySQL superuser $Param{'superuser'}: ");
   }
   if ( length($Param{'spassword'}) > 0 ) {
      $MYSQL_CNF{'mysql'}{'password'} = $Param{'spassword'};
      $MYSQL_CNF{'mysqldump'}{'password'} = $Param{'spassword'};
   }
}
WriteTempConfigFile();

#---------------------------------
# Inform user if he has not enough
# privileges to read the access-db
if ( $nerror=MySQLaccess::DB::OpenConnection() ) {
    MySQLaccess::Report::Print_Error_Access($nerror);
    exit 0;
}

# -----------------------
# Read MySQL ACL-files
if ($nerror=MySQLaccess::Grant::ReadTables()) {
    MySQLaccess::Report::Print_Error_Access($nerror);
    exit 0;
};
if ($Param{'edit'} and $nerror=MySQLaccess::Grant::ReadTables('tmp')) {
    MySQLaccess::Report::Print_Error_Access($nerror);
    exit 0;
}

#---------------------------------
# reload temporay grant-tables 
# with data from original ones
if ( defined($Param{'copy'}) ) {
   $nerror=MySQLaccess::DB::LoadTmpTables();
   if ($nerror) {
      MySQLaccess::Report::Print_Error_Access($nerror);
      exit 0;
   }
   my $msg = "The grant-rules are copied from the grant-tables to\n"
           . "the temporary tables.";
   MySQLaccess::Report::Print_Message([$msg]);
#   MySQLaccess::Report::Print_Footer();
#   MySQLaccess::DB::CloseConnection();
#   exit 0;
}


#---------------------------------
# preview result of changes in the 
# grant-tables
if ( defined($Param{'preview'}) ) {
   $aref=MySQLaccess::Grant::Diff_Privileges();
   MySQLaccess::Report::Print_Diff_ACL($aref);
#   MySQLaccess::Report::Print_Footer();
#   MySQLaccess::DB::CloseConnection();
#   exit 0;
}


#---------------------------------
# reload grant-tables 
# with data from temporary tables
if ( defined($Param{'commit'}) ) {
   if ($nerror = MySQLaccess::DB::CommitGrantTables()) {
      MySQLaccess::Report::Print_Error_Access($nerror);
      exit 0;
   }
   my $msg = "The grant-rules have been copied from the temporary tables\n"
           . "to the grant-tables.";
   my $msg1= "Don't forget to do an 'mysqladmin reload' before these\n"
           . "changes take effect.";
   my $msg2= "A backup-version of your original grant-rules are saved in the\n"
           . "backup-tables, so you can always perform a 1-level rollback.";
   MySQLaccess::Report::Print_Message([$msg,$msg1,$msg2]);
#   MySQLaccess::Report::Print_Footer();
#   MySQLaccess::DB::CloseConnection();
#   exit 0;
}

#---------------------------------
# restore previous grant-rules
# with data from backup tables
if ( defined($Param{'rollback'}) ) {
   if ($nerror = MySQLaccess::DB::RollbackGrantTables()) {
      MySQLaccess::Report::Print_Error_Access($nerror);
      exit 0;
   }
   my $msg = "The old grant-rules have been copied back from the backup tables\n"
           . "to the grant-tables.";
   my $msg1= "Don't forget to do an 'mysqladmin reload' before these\n"
           . "changes take effect.";
   MySQLaccess::Report::Print_Message([$msg,$msg1]);
#   MySQLaccess::Report::Print_Footer();
#   MySQLaccess::DB::CloseConnection();
#   exit 0;
}
#----------------------------------
# show edit-taskbar
if ( defined($Param{'edit'})) {
   if ($MySQLaccess::CGI ) {
   MySQLaccess::Report::Print_Edit();
   $print_usage=0;
   MySQLaccess::Report::Print_Footer();
   MySQLaccess::DB::CloseConnection();
   exit 0;
   }
   else {
   MySQLaccess::Report::Print_Edit();
   $print_usage=0;
   MySQLaccess::Report::Print_Footer();
   MySQLaccess::DB::CloseConnection();
   exit 0;
   }
}


# -----------------------------
# Build list of users,dbs,hosts
# to process...
@all_dbs   = @{MySQLaccess::DB::Get_All_dbs($Param{'db'})};
@all_users = @{MySQLaccess::DB::Get_All_users($Param{'user'})};
@all_hosts = @{MySQLaccess::DB::Get_All_hosts($Param{'host'})};
#if EDIT-mode
#@all_dbs_tmp   = @{MySQLaccess::DB::Get_All_dbs($Param{'db'},'tmp')};
#@all_users_tmp = @{MySQLaccess::DB::Get_All_users($Param{'user'},'tmp')};
#@all_hosts_tmp = @{MySQLaccess::DB::Get_All_hosts($Param{'host'},'tmp')};

# -----------------------------
# Report access-rights for each
# tuple (host,user,db)
#$headers=0;
my %Access = ();
foreach $host (@all_hosts) {
  foreach $user (@all_users) {
    foreach $db (@all_dbs) {
      MySQLaccess::Grant::Initialize();
      %Access = MySQLaccess::Grant::Get_Access_Rights($host,$user,$db);	
      MySQLaccess::Report::Print_Access_rights($host,$user,$db,\%Access);
    }
  }
}

# -----------------------------
# End script
MySQLaccess::Report::Print_Footer();
MySQLaccess::DB::CloseConnection();
exit 0;

#############################################################
#  FUNCTIONS  #
###############
sub GetMode {
   my $cmd=0;
   my $cgi=0;
   if (defined($ENV{'HTTP_HOST'})) { $cmd=0; $cgi=1; }
   else                            { $cmd=1; $cgi=0; } 
   return ($cmd,$cgi);
}

# ================================
# sub PromptPass
#  prompt tty for a password
# ================================
sub PromptPass {
    my ($prompt) = @_;
    my $password;
    $ENV{PATH} = "/bin:/usr/bin";
    $ENV{IFS} = " \t\n";
    $ENV{SHELL} = "/bin/sh";
    system "stty -echo";
    print $prompt;
    chomp($password = <STDIN>);
    print "\n";
    system "stty echo";
    $password;
}

# =================================
# sub CheckUnsafeFile
#  tell if a config file containing a password is unsafe
# =================================
sub CheckUnsafeFile {
    my ($fname) = @_;
    my ($dev, $ino, $mode, $nlink,
        $uid, $gid, $rdev, $size,
        $atime, $mtime, $ctime, $blksize, $blocks) = stat($fname);

    if ( $uid != $< ) {   # unsafe if owned by other than current user
        return 1;
    }
    if ( $mode & 066 ) {  # unsafe if accessible by other
        return 1;
    }
    $fname =~ s#/[^/]+$##;
    if ( (length $fname) > 0 ) {
        return CheckUnsafeDir($fname);
    }
    return 0;
}

# =================================
# sub CheckUnsafeDir
#  tell if a directory is unsafe
# =================================
sub CheckUnsafeDir {
    my ($fname) = @_;
    my ($dev, $ino, $mode, $nlink,
        $uid, $gid, $rdev, $size,
        $atime, $mtime, $ctime, $blksize, $blocks) = stat($fname);

    # not owned by me or root
    if ( ($uid != $<) && ($uid != 0) ) {
        return 1;
    }
    if ( $mode & 022 ) {  # unsafe if writable by other
        return 1  unless $mode & 01000;  # but sticky bit ok
    }
    $fname =~ s#/[^/]+$##;
    if ( (length $fname) > 0 ) {
        return CheckUnsafeDir($fname);
    }
    return 0;
}

# =================================
# sub MergeConfigFile
#  merge data from .cnf file
# =================================
sub MergeConfigFile {
    my ($fname) = @_;
    my ($group, $item, $value);
    if ( open CNF, $fname ) {
         while (<CNF>) {
             s/^\s+//;
             next if /^[#;]/;
             if ( /\[\s*(\w+)\s*]/ ) {
                 $group = $1;
                 $group =~ tr/A-Z/a-z/;
                 if ( !exists $MYSQL_CNF{$group} ) {
                     undef $group;
                 }
             } elsif ( defined $group ) {
                 ($item, $value) = /((?:\w|-)+)\s*=\s*(\S+)/;
                 # don't unquote backslashes as we just write it back out
                 if ( defined $item ) {
                     if ( $item =~ /^password$/ ) {
                         if ( CheckUnsafeFile($fname) ) {
                             $unsafeConfig = $fname;
                         }
                     }
                     if ( $group eq 'client' || $group eq "client-server") {
                         $MYSQL_CNF{'mysql'}{$item} = $value;
                         $MYSQL_CNF{'mysqldump'}{$item} = $value;
                     } else {
                         $MYSQL_CNF{$group}{$item} = $value;
                     }
                 }
             }
         }
         close(CNF);
    }
}

# =================================
# sub MergeConfigFiles
#  merge options from config files
#  NOTE: really should do two separate merges for each
#    client to exactly duplicate order of resulting argument lists
# =================================
sub MergeConfigFiles {
    my ($name,$pass,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = getpwuid $<;
    MergeConfigFile("/usr/my.cnf");
    MergeConfigFile("/my.cnf");
    MergeConfigFile("$dir/.my.cnf");
}

# =================================
# sub WriteTempConfigFile
#  write 
# =================================
sub WriteTempConfigFile {
   sysopen CNFFILE, $MYSQL_CNF, O_RDWR|O_CREAT|O_EXCL, 0700
      or die "sysopen $MYSQL_CNF: $!";
   
   # groups may be in any order, generic groups such as [client] assumed
   # here to be empty
   foreach $group (keys %MYSQL_CNF) {
      print CNFFILE "[$group]\n";
      foreach $item (keys %{$MYSQL_CNF{$group}}) {
         if ( defined $MYSQL_CNF{$group}{$item} ) {
            print CNFFILE "$item=$MYSQL_CNF{$group}{$item}\n";
         } else {
            print CNFFILE "$item\n";
         }
      }
      print CNFFILE "\n";
   }
   close(CNFFILE);
}

######################################################################
package MySQLaccess::DB;
###########
BEGIN {
    $DEBUG     = 2;
    $DEBUG     = $MySQLaccess::DEBUG unless ($DEBUG);
    # Error-messages from the MySQL client
    %ACCESS_ERR= ('Access_denied'       => 'Access denied' 
                 ,'Dbaccess_denied'     => 'Access to database denied'
                 ,'Unrecognized_option' => 'unrecognized option' 
                 ,'Unknown_table'       => "Can't find file:"
                 ,'unknown_error'       => '^ERROR:'
                 );
}
# ######################################
#  Connecting to the MYSQL DB
# ======================================
# sub OpenConnection
#  Open an connection to the mysql-db
#  questions to MYSQL_Q
#  answers from MYSQL_A
# ======================================
sub OpenConnection {
    my $pid;
    MySQLaccess::Debug::Print(2,"OpenConnection:");

    # check path to mysql-client executable
    if (! -f $MySQLaccess::MYSQL) {
       if ($MySQLaccess::CMD) { die "Could not find MySQL-client '$MySQLaccess::MYSQL'"; }
       if ($MySQLaccess::CGI) { 
          print "<center>\n<font color=Red>\n";
          print "ERROR: Could not find MySQL-client '$MySQLaccess::MYSQL'";
          print "</center>\n</font>\n";
          exit 0;
       }
    }

    # path to mysql executable
    my $connect = "$MySQLaccess::MYSQL --defaults-file=$MySQLaccess::MYSQL_CNF";
    $connect .= " $MySQLaccess::MYSQL_OPT";
    # superuser, spassword transmitted via defaults-file
    if (defined($MySQLaccess::Param{'rhost'}))     { $connect .= " --host=$MySQLaccess::Param{'rhost'}"; }
    # other options??

    # grant-database
    $connect .= " $MySQLaccess::ACCESS_DB";

    # open connection (not using /bin/sh -c)
    MySQLaccess::Debug::Print(2,"Connecting to: $connect");
    $pid=IPC::Open3::open3(\*MYSQL_Q,\*MYSQL_A,"",split /\s+/,$connect);
    MySQLaccess::Debug::Print(2,"PID of open pipe: $pid");
    
    # check connection 
    print MYSQL_Q "select 'ok';\n";
    $answer = <MYSQL_A>; #answer from mysql
    MySQLaccess::Debug::Print(2,"Answer: $answer\n");
    foreach $nerror (sort(keys(%ACCESS_ERR))) {
      MySQLaccess::Debug::Print(3,"check answer for error $ACCESS_ERR{$nerror}");
      if (grep(/$ACCESS_ERR{$nerror}/i,$answer)) { 
         MySQLaccess::Debug::Print(2,"Answer contain error [$nerror]");
         return $nerror; 
      }
    }

if (0) {
    # check server-version 
    print MYSQL_Q "select 'ok';\n";
    $answer = <MYSQL_A>; #answer from mysql
    MySQLaccess::Debug::Print(2,"Answer: $answer\n");
    foreach $nerror (sort(keys(%ACCESS_ERR))) {
      MySQLaccess::Debug::Print(3,"check answer for error $ACCESS_ERR{$nerror}");
      if (grep(/$ACCESS_ERR{$nerror}/i,$answer)) { 
         MySQLaccess::Debug::Print(2,"Answer contain error [$nerror]");
         return $nerror; 
      }
    }
}

    my $skip=<MYSQL_A>; 
    return 0; 
}

# ======================================
# sub CloseConnection
#  Close the connection to the mysql-db
# ======================================
sub CloseConnection {
    close MYSQL_Q;
    close MYSQL_A;
}

# ===========================================================
# sub CreateTable($table)
#  Create temporary/backup table
# ===========================================================
sub CreateTable {
    my $pid;
    my ($table,$force) = @_;
    my %tables = ( $MySQLaccess::ACCESS_U_TMP => $MySQLaccess::ACCESS_U,
                   $MySQLaccess::ACCESS_H_TMP => $MySQLaccess::ACCESS_H,
                   $MySQLaccess::ACCESS_D_TMP => $MySQLaccess::ACCESS_D,
                   $MySQLaccess::ACCESS_U_BCK => $MySQLaccess::ACCESS_U,
                   $MySQLaccess::ACCESS_H_BCK => $MySQLaccess::ACCESS_H,
                   $MySQLaccess::ACCESS_D_BCK => $MySQLaccess::ACCESS_D,
                   $MySQLaccess::ACCESS_U => $MySQLaccess::ACCESS_U_BCK,
                   $MySQLaccess::ACCESS_H => $MySQLaccess::ACCESS_H_BCK,
                   $MySQLaccess::ACCESS_D => $MySQLaccess::ACCESS_D_BCK,
                 ); 
    my $tbl;
    my $query="";
    my $delim;
    my $skip;
    my $create;
    my @known_tables=();

#    print STDERR "CreateTable($table)\n";
    MySQLaccess::Debug::Print(1,"CreateTable($table):");

    ## error-handling
    return 'Unknown_table' unless defined($tables{$table});

    ## build list of known/existing tables;
    ## if 'force' existing table is dropped first
    if (defined($force) and $force) {
       @known_tables = Show_Tables();
       if (grep(/^$table$/,@known_tables)) {
       $query = "DROP TABLE $table;";
       }
    }

    ## path to mysqldump executable
    my $connect = $MySQLaccess::MYSQLDUMP;
    $connect .= " --defaults-file=$MySQLaccess::MYSQL_CNF --no-data";
    # superuser, spassword transmitted via defaults-file
    if (defined($MySQLaccess::Param{'rhost'}))     { $connect .= " --host=$MySQLaccess::Param{'rhost'}"; }
    $connect .= " $MySQLaccess::ACCESS_DB";
    $connect .= " $tables{$table}";


    ## get creation-data for original table
    $create = '';
    my $mysqldump = $connect;
    $mysqldump =~ s/ \$TABLE / $tbl /;

    # open connection (not using /bin/sh -c)
    MySQLaccess::Debug::Print(2,"Connecting to: $connect");
    $pid=IPC::Open3::open3(\*DONTCARE,\*CREATE,"",split /\s+/,$mysqldump);
    MySQLaccess::Debug::Print(2,"PID of open pipe: $pid");
    #open(CREATE,"$mysqldump");
    @create = <CREATE>;
    $create = "@create";
    foreach $nerror (sort(keys(%ACCESS_ERR))) {
       MySQLaccess::Debug::Print(3,"check answer for error $ACCESS_ERR{$nerror}");
       if (grep(/$ACCESS_ERR{$nerror}/i,$create)) { 
          MySQLaccess::Debug::Print(2,"Answer contain error [$nerror]");
          return $nerror; 
       }
    }
    close(CREATE);
    close(DONTCARE);

    ## manipulate result for creation-data for temporary table
    $create =~ s/CREATE TABLE $tables{$table} \(/CREATE TABLE $table \(/;

    ## recreate temporary table
    $query .= "$create\n";
    $query .= "select 'ok';";

    ## execute query
    print MYSQL_Q "$query\n";
#    print STDERR $query;

    $answer = <MYSQL_A>; #answer from mysql
#    print STDERR "A>",$answer;
    MySQLaccess::Debug::Print(2,"Answer: $answer\n");
    foreach $nerror (sort(keys(%ACCESS_ERR))) {
#       print STDERR "->$nerror?";
       MySQLaccess::Debug::Print(3,"check answer for error $ACCESS_ERR{$nerror}");
       if (grep(/$ACCESS_ERR{$nerror}/i,$answer)) { 
#          print STDERR "Yes!";
          MySQLaccess::Debug::Print(2,"Answer contain error [$nerror]");
          return $nerror; 
       }
    }

    $delim = <MYSQL_A>; # read header
    if ($delim ne "ok\n") {
       while (($line=<MYSQL_A>) ne "ok\n")
       { MySQLaccess::Debug::Print(3," A> $line"); }
        $skip = <MYSQL_A>; # skip result 'ok'
    }
#    print STDERR "CreateTable done\n";
    return 0;
}


# ===========================================================
# sub CopyTable()
#  Copy the structure and the data of a table to another table
# ===========================================================
sub CopyTable {
    my ($from,$to,$force) = @_;
    my @known_tables  = Show_Tables();    
    my $query = "";
    my $nerror= 0;
    my $skip;

#    print STDERR "CopyTable($from,$to)\n";
    MySQLaccess::Debug::Print(1,"MySQLaccess::DB::CopyTable($from,$to)");

    ## error-handling
    if (!grep(/^$from$/,@known_tables)) { return 'Unknown_table'; }

    ## copy structure 
    ## if forced
    if (defined($force) and $force) {
       return $nerror if ($nerror=CreateTable($to,$force)); 
#       print STDERR "Structure copied\n";
    }

    ## copy data
    $query .= "DELETE FROM $to;";
    $query .= "INSERT INTO $to SELECT * FROM $from;";
    $query .= "SELECT 'ok';\n";
    MySQLaccess::Debug::Print(2,"Query: $query");
       
    ## execute query
    print MYSQL_Q "$query\n";
#    print STDERR $query;

    ## check for errors...
    my $answer = <MYSQL_A>; #answer from mysql
#    print STDERR $answer;
    MySQLaccess::Debug::Print(2,"Answer: $answer\n");
    foreach $nerror (sort(keys(%ACCESS_ERR))) {
       MySQLaccess::Debug::Print(3,"check answer for error $ACCESS_ERR{$nerror}");
       if (grep(/$ACCESS_ERR{$nerror}/i,$answer)) { 
          MySQLaccess::Debug::Print(2,"Answer contain error [$nerror]");
          return $nerror; 
       }
    }

    my $delim = <MYSQL_A>; # read header
#    print STDERR $delim;
    if ($delim ne "ok\n") {
       while (($line=<MYSQL_A>) ne "ok\n")
       { MySQLaccess::Debug::Print(3," A> $line"); }
       $skip = <MYSQL_A>; # skip result 'ok'
    }

    return 0;
}

# ===========================================================
# sub LoadTmpTables()
#  (Re)load temporary tables with entries of ACL-tables
# ===========================================================
sub LoadTmpTables {
    my %tables = ( $MySQLaccess::ACCESS_U => $MySQLaccess::ACCESS_U_TMP,
                   $MySQLaccess::ACCESS_H => $MySQLaccess::ACCESS_H_TMP,
                   $MySQLaccess::ACCESS_D => $MySQLaccess::ACCESS_D_TMP,
                 ); 
    my $tbl;
    my $nerror;
    
#    print STDERR "LoadTmpTables:\n";
    MySQLaccess::Debug::Print(1,"LoadTmpTables():");
    foreach $tbl (keys(%tables)) {
#       print STDERR "$tbl -> $tables{$tbl}\n";
       MySQLaccess::Debug::Print(2,"Loading table $tbl -> $tables{$tbl}.");
       return $nerror if ($nerror=CopyTable($tbl,$tables{$tbl},'force'));
    }
    return 0;
}

# ===========================================================
# sub BackupGrantTables()
#  Make a backup of the original grant-tables
# ===========================================================
sub BackupGrantTables {
    my %tables = ( $MySQLaccess::ACCESS_U => $MySQLaccess::ACCESS_U_BCK,
                   $MySQLaccess::ACCESS_H => $MySQLaccess::ACCESS_H_BCK,
                   $MySQLaccess::ACCESS_D => $MySQLaccess::ACCESS_D_BCK,
                 ); 
    my $tbl;
    my $nerror;
    
#    print STDERR "BackupGrantTables:\n";
    MySQLaccess::Debug::Print(1,"BackupGrantTables():");
    foreach $tbl (keys(%tables)) {
#       print STDERR "$tbl -> $tables{$tbl}\n";
       MySQLaccess::Debug::Print(2,"Backup table $tbl -> $tables{$tbl}.");
       return $nerror if ($nerror=CopyTable($tbl,$tables{$tbl},'force'));
    }
    return 0;
}

# ===========================================================
# sub RollbackGrantTables()
#  Rollback the backup of the grant-tables
# ===========================================================
sub RollbackGrantTables {
    my %tables = ( $MySQLaccess::ACCESS_U_BCK => $MySQLaccess::ACCESS_U,
                   $MySQLaccess::ACCESS_H_BCK => $MySQLaccess::ACCESS_H,
                   $MySQLaccess::ACCESS_D_BCK => $MySQLaccess::ACCESS_D,
                 ); 
    my $tbl;
    my $nerror;
    
#    print STDERR "RollbackGrantTables:\n";
    MySQLaccess::Debug::Print(1,"RollbackGrantTables():");
    foreach $tbl (keys(%tables)) {
#       print STDERR "$tbl -> $tables{$tbl}\n";
       MySQLaccess::Debug::Print(2,"Rollback table $tbl -> $tables{$tbl}.");
       return $nerror if ($nerror=CopyTable($tbl,$tables{$tbl},'force'));
    }
    return 0;
}


# ===========================================================
# sub CommitGrantTables()
#  Copy grant-rules from temporary tables to the ACL-tables
# ===========================================================
sub CommitGrantTables {
    my %tables = ( $MySQLaccess::ACCESS_U => $MySQLaccess::ACCESS_U_TMP,
                   $MySQLaccess::ACCESS_H => $MySQLaccess::ACCESS_H_TMP,
                   $MySQLaccess::ACCESS_D => $MySQLaccess::ACCESS_D_TMP,
                 ); 
    my $tbl;
    my $query;
    my $delim;
    my $skip;
    my $create;

    print STDERR "CommitGrantTables()\n";
    MySQLaccess::Debug::Print(1,"CommitGrantTables():");
    
    ## Make backup of original grant-tables
    MySQLaccess::Debug::Print(2,"Making backup of original grant-tables...");
    BackupGrantTables();

    ## Copy data from temporay tables to grant-tables
    foreach $tbl (keys(%tables)) {
       print STDERR "$tbl -> $tables{$tbl}\n";
       MySQLaccess::Debug::Print(2,"Loading data $tables{$tbl} -> $tbl.");
       return $nerror if ($nerror=CopyTable($tables{$tbl},$tbl));
    }
    return 0;
}


# ===========================================================
# sub Show_Fields($table): 
#  return (a reference to) a hash which holds the names
#  of all relevant grant-fields, with their index in the record,
#  and (a reference to) an array which holds the fieldnames.
# ===========================================================
sub Show_Fields {
    my ($table) = @_;
    my %skip = ('host' => [0,1]
               ,'user' => [0,1,2]
               ,'db'   => [0,1,2]
               );
    my %Struct = ();
    my @Struct = ();
    my $query = "show fields from $table;select 'ok';\n";
    my $i=0;
    my $line;

#print STDERR $query;
    MySQLaccess::Debug::Print(1,"Show_Fields($table):");
    MySQLaccess::Debug::Print(2,"SQL: $query");

    print MYSQL_Q "$query";
    my $skip = <MYSQL_A>;  #skip header
    while (($line=<MYSQL_A>) ne "ok\n")
    {
#print STDERR ">",$line;
	chop($line);
	MySQLaccess::Debug::Print(2," $table>: $line");
	my ($field,$type,$null,$key,$default,$extra) = split(' ',$line);
        $field = ucfirst($field); 
	MySQLaccess::Debug::Print(3, " <split: $field - $type - $null - $key - $default - $extra");
	if (! grep(/$i/,@{$skip{$table}}) ){
	   $Struct{$field} = $i; #hash
	   push(@Struct,$field); #array
	   MySQLaccess::Debug::Print(3," ==> added column[$i]: $field ($Struct{$field})");
	} 
        else {
           MySQLaccess::Debug::Print(3," ==> skipped column[$i], value=[$field]");
        }
	$i++;
    }

    $skip=<MYSQL_A>;  # Get ok row (found already ok header)

    MySQLaccess::Debug::Print(2, "Array:");
    foreach $field (@Struct) { MySQLaccess::Debug::Print(2,"+ $field"); }
    MySQLaccess::Debug::Print(2,"Hash:");
    foreach $field (keys(%Struct)) { MySQLaccess::Debug::Print(2,"+ $field -> $Struct{$field}"); }

    return  (\%Struct,\@Struct); 
}

# ===========================================================
# sub Show_Tables(): 
#  return (a reference to) an array which holds all 
#  known tables.
# ===========================================================
sub Show_Tables {
    my @Tables = ();
    my $query = "show tables;select 'ok';\n";
    my $i=0;
    my $line;

    MySQLaccess::Debug::Print(1,"Show_Tables():");
    MySQLaccess::Debug::Print(2,"SQL: $query");

    print MYSQL_Q "$query";
    my $skip = <MYSQL_A>;  #skip header
    while (($line=<MYSQL_A>) ne "ok\n")
    {
	chop($line);
	push(@Tables,$line); #array
	MySQLaccess::Debug::Print(3," ==> added table: $line");
    }

    $skip=<MYSQL_A>;  # Get ok row (found already ok header)

    MySQLaccess::Debug::Print(2, "Array:");
    foreach $tbl (@Tables) { MySQLaccess::Debug::Print(2,"+ $tbl"); }

    return @Tables; 
}

# ======================================
# sub Validate_Password($passwd,$host,$user,$encpw)
#  Validate the given password 
#  for user '$user' 
#  connecting from host '$host'
# ======================================
sub Validate_Password {
    my ($password,$host,$user,$encpw) = @_;
    my $valid=0;

    MySQLaccess::Debug::Print(1,"Validate_Password($password,$host,$user,$encpw)");
    my $sql = "select host,user,password from user having "
             ."host='$host' and user='$user' and password='$encpw' "
             ."and password=PASSWORD('$password');\n";
    $sql .= "select 'ok';\n";
    MySQLaccess::Debug::Print(2,"SQL = $sql");
    print MYSQL_Q "$sql";
    
    # if password is valid, at least 1 row returns before we read 'ok'
    while ( ($line=<MYSQL_A>) ne "ok\n") {
      MySQLaccess::Debug::Print(2," A> $line");
      $valid = defined($line); 
    }
    my $skip = <MYSQL_A>; # read 'ok'

    return $valid;
}


# ==========================================================
# sub Sort_fields: (rewritten by psmith)
#  Build the query for an ordered list of entries
# ==========================================================
sub Sort_fields {
  my ($start, $end, $sofar, $this, @rest) = (@_);
  my @where = ("((FIELD not like '\\%') AND (FIELD <> ''))",
               "((FIELD like '%\\%%') OR (FIELD like '%\\_%'))",
               "(FIELD = '')");
  my $res = '';

  $this or return ("$start $sofar $end");

  $sofar .= ' AND ' if $sofar;

  foreach $w (@where) {
    my $f = $w;
    $f =~ s/FIELD/$this/g;

    $res .= Sort_fields($start, $end, "$sofar$f", @rest);
  }

  return ($res);
}

# ===========================================================
# sub Sort_table: (rewritten by psmith)
#  return all entries in the given table,
#  in an ordered fashion
# ===========================================================
sub Sort_table {
    my ($tbl, @order) = @_;
    my @res=();

    # as long as there's no full where clause (Distrib 3.20)...
    # use having :-(
    # NOTE: this clause WILL NOT work on 3.21, because of the
    # order of 'ORDER BY' and 'HAVING'
    my $start = "SELECT *,UCASE(host) as ucase_host FROM $tbl ";
    $start   .= 'ORDER BY ' . join(',', @order) ." HAVING ";
    my $end   = ";\n";

    # server version 3.21 has a full where clause :-)
    if ($MySQLaccess::Host::SERVER >= '3.21') {
    # print "+++USING FULL WHERE CLAUSE+++\n";
       $start = "SELECT *,UCASE(host) as ucase_host FROM $tbl WHERE ";
       $end = ' ORDER BY ' . join(',', @order) . ";\n";
    }

    MySQLaccess::Debug::Print(1,"Sort_table():");
    MySQLaccess::Debug::Print(2,"Sorting table $tbl by `@order'");

    my $tmp;
    foreach $tmp (@order)
    {
      $tmp="UCASE(host)" if ($tmp eq "ucase_host");
    }
    my $query  = Sort_fields($start, $end, '', @order);
    $query    .= "select 'ok';\n";
    MySQLaccess::Debug::Print(2,"Query: $query");

    print MYSQL_Q "$query\n";

    my $delim = <MYSQL_A>; # read header
    MySQLaccess::Debug::Print(3," A> $delim");
    if ($delim ne "ok\n") {
       if ($delim =~ /^ERROR/) {
       push(@MySQLaccess::Grant::Error,'use_old_server');
       MySQLaccess::Report::Print_Error_Messages() ;
       exit 1;
       }
       while (($line=<MYSQL_A>) ne "ok\n")
       {
           MySQLaccess::Debug::Print(3," A> $line");
           push(@res,$line);
       }
    }
    my $skip = <MYSQL_A>; # skip result 'ok'

    # remove columnheaders from output
    @res = grep(!/^\Q$delim\E$/, @res);
    # remove trailing \n from each returned record
    chomp(@res); 
    # each record has 1 field to much : ucase_host
    @res = grep { /(.*)\t.*$/; $_ = $1; } @res;

    MySQLaccess::Debug::Print(2,"Result of sorted table $tbl:");
    foreach $line (@res) { MySQLaccess::Debug::Print(2," >>$line"); }
    return @res;
}

# ===========================================================
# sub Get_All_db(template): 
#  return all db the grant-tables are working on,
#  which conform to the template
# ===========================================================
sub Get_All_dbs {
   my ($template,$tmp) = @_;
   my @db=();
   my $aref;

   # working with  temporary tables or production tables
   if (defined($tmp) and $tmp) {
      $aref = \@MySQLaccess::Grant::sorted_db_tmp_table ;
   }
   else {
      $aref = \@MySQLaccess::Grant::sorted_db_table;
   }

   MySQLaccess::Debug::Print(1," template=[$template]");

   # get all db for which access-rights can be calculated,
   # which conform to the template.
   # !! these db's don't have to exist yet, so it's not
   #    enough to look which db already exist on the system
   $reg_expr = $template;
   if ($template =~ /[\*\?]/) {
      $reg_expr =~ tr/*?/%_/;
      #$reg_expr = MySQLaccess::Wildcards::Wild2Reg($template);
   }
   $reg_expr = MySQLaccess::Wildcards::SQL2Reg("$reg_expr");

   if ( ! ($template =~ /[\*\?%_]/) ) {
      push(@db,$template);
      return \@db;
   }

   MySQLaccess::Debug::Print(2,"#Reading db-table...");
   foreach $record (@{$aref}) { #MySQLaccess::Grant::sorted_db_table) {
    my @record=split(/\t/,$record);
    my $db = $record[1];
    MySQLaccess::Debug::Print(2,"> $db ");
    if ( (!grep(/$db/i,@db)) and ($db =~/$reg_expr/i) ) {
       push(@db,$db);
       MySQLaccess::Debug::Print(2,"added");
    } 
    else {
       MySQLaccess::Debug::Print(2,"skipped");
    }
   }
   # if no rule is found for a certain db in the db-table,
   # the rights of the user are used, so we should inform
   # the user for
   if (!grep(/^%$/,@db)) { push(@db,"$MySQLaccess::NEW_DB"); }
   return \@db;
}

# ===========================================================
# sub Get_All_users(template): 
#  return all users the grant-tables are working on,
#  which conform to the template
# ===========================================================
sub Get_All_users {
   ($template,$tmp) = @_; # nog verder uitwerken!!!
   my @user=();
   my $aref;

   # working with  temporary tables or production tables
   if (defined($tmp) and $tmp) {
      $aref = \@MySQLaccess::Grant::sorted_user_tmp_table ;
   }
   else {
      $aref = \@MySQLaccess::Grant::sorted_user_table;
   }

   MySQLaccess::Debug::Print(1,"Debug Get_All_users:");
   # get all db for which access-rights can be calculated.
   # !! these db's don't have to exist yet, so it's not
   #    enough to look which db already exist on the system
   $reg_expr = $template;
   if ($template =~ /[\*\?]/) {
      $reg_expr =~ tr/*?/%_/;
      #$reg_expr = MySQLaccess::Wildcards::Wild2Reg($template);
   }
   $reg_expr = MySQLaccess::Wildcards::SQL2Reg("$reg_expr");

   if ( ! ($template =~ /[\*\?%_]/) ) {
      push(@user,$template);
      return \@user;
   }

   MySQLaccess::Debug::Print(2,"#Reading user-table...");
   foreach $record (@{$aref}) { #MySQLaccess::Grant::sorted_user_table) {
    my @record=split(/\t/,$record);
    my $user = $record[1];
    MySQLaccess::Debug::Print(2,"> $user ");
    if ( (!grep(/$user/,@user)) and ($user=~/$reg_expr/)) {
       push(@user,$user);
       MySQLaccess::Debug::Print(2, "added");
    } 
    else {
       MySQLaccess::Debug::Print(2, "skipped");
    }
   }
   # Any user means also:
   # - the 'empty' user, ie without supplying a username
   # - any user still to be defined/created
   #push(@user,'');               #without_suplying_a_username
   push(@user,"$MySQLaccess::NEW_USER");
   #push(@Warnings,'minimum_priv');
   return \@user;
}

# ===========================================================
# sub Get_All_hosts(template): 
#  return all hosts the grant-tables are working on,
#  which conform to the template
# ===========================================================
sub Get_All_hosts {
   my ($template,$tmp) = @_;
   my @host=();
   my $aref;
   my $aref1;

   # working with  temporary tables or production tables
   if (defined($tmp) and $tmp) {
      $aref = \@MySQLaccess::Grant::sorted_host_tmp_table ;
      $aref1= \@MySQLaccess::Grant::sorted_db_tmp_table ;
   }
   else {
      $aref = \@MySQLaccess::Grant::sorted_host_table;
      $aref1= \@MySQLaccess::Grant::sorted_db_table ;
   }

   MySQLaccess::Debug::Print(1, "Debug Get_All_hosts:");
   # get all db for which access-rights can be calculated.
   # !! these db's don't have to exist yet, so it's not
   #    enough to look which db already exist on the system
   $reg_expr = $template;
   if ($template =~ /[\*\?]/) {
      $reg_expr =~ tr/*?/%_/;
      #$reg_expr = MySQLaccess::Wildcards::Wild2Reg($template);
   }
   $reg_expr = MySQLaccess::Wildcards::SQL2Reg("$reg_expr");

   if ( ! ($template =~ /[\*\?%_]/) ) {
      push(@host,$template);
      return \@host;
   }

   MySQLaccess::Debug::Print(1, "#Reading db-table...");
   foreach $record (@{$aref1}) { #MySQLaccess::Grant::sorted_db_table) {
    my @record=split(/\t/,$record);
    my $host = $record[0];
    MySQLaccess::Debug::Print(2, "> $host ");
    if (! grep(/$host/i,@host)) {
       push(@host,$host);
       MySQLaccess::Debug::Print(2, "added");
    } 
    else {
       MySQLaccess::Debug::Print(2, "skipped");
    }
   }
   MySQLaccess::Debug::Print(1, "#Reading host-table...");
   foreach $record (@{$aref}) {
    my @record=split(/\t/,$record);
    my $host = $record[0];
    MySQLaccess::Debug::Print(2, "> $host ");
    if ( (!grep(/$host/,@host)) and ($host=~/$reg_expr/)) {
       push(@host,$host);
       MySQLaccess::Debug::Print(2, "added");
    } 
    else {
       MySQLaccess::Debug::Print(2, "skipped");
    }
   }
   # DOUBT:
   #print "#Reading user-table...\n" if ($DEBUG>1);
   #foreach $record (@MySQLaccess::Grant::sorted_user_table) {
   # my @record=split(/\t/,$record);
   # my $host = $record[0];
   # print "> $host " if ($DEBUG>2);
   # if ( (!grep(/$host/,@host)) and ($host=~/$reg_expr/)) {
   #    push(@host,$host);
   #    print "added\n" if ($DEBUG>2);
   # } 
   # else {
   #    print "skipped\n" if ($DEBUG>2);
   # }
   #}
   # Any host also means:
   # - any host still to be defined/created
   #push(@host,"any_other_host");

   @host = sort(@host);
   return \@host;
}


##########################################################################
package MySQLaccess::Grant;
##############
BEGIN {
    $DEBUG     = 0;
    $DEBUG     = $MySQLaccess::DEBUG unless ($DEBUG);
}



# ===========================================================
# sub Diff_Privileges()
#  Calculate diff between temporary and original grant-tables
# ===========================================================
sub Diff_Privileges {
   my @before=();
   my @after =();
   my @diffs =();

   # -----------------------------
   # Build list of users,dbs,hosts
   # to process...
   my @all_dbs   = @{MySQLaccess::DB::Get_All_dbs('*')};
   my @all_users = @{MySQLaccess::DB::Get_All_users('*')};
   my @all_hosts = @{MySQLaccess::DB::Get_All_hosts('*')};
   #if EDIT-mode
   my @all_dbs_tmp   = @{MySQLaccess::DB::Get_All_dbs('*','tmp')};
   my @all_users_tmp = @{MySQLaccess::DB::Get_All_users('*','tmp')};
   my @all_hosts_tmp = @{MySQLaccess::DB::Get_All_hosts('*','tmp')};


   my %Access;
   # ------------------------------------
   # Build list of priv. for grant-tables
   foreach $host (@all_hosts) {
     foreach $user (@all_users) {
       foreach $db (@all_dbs) {
         MySQLaccess::Grant::Initialize();
         %Access = MySQLaccess::Grant::Get_Access_Rights($host,$user,$db);	
         push(@before,MySQLaccess::Report::Raw_Report($host,$user,$db,\%Access));
       }
     }
   }

   # ----------------------------------
   # Build list of priv. for tmp-tables
   foreach $host (@all_hosts_tmp) {
     foreach $user (@all_users_tmp) {
       foreach $db (@all_dbs_tmp) {
         MySQLaccess::Grant::Initialize('tmp');
         %Access = MySQLaccess::Grant::Get_Access_Rights($host,$user,$db,'tmp');	
         push(@after,MySQLaccess::Report::Raw_Report($host,$user,$db,\%Access));
       }
     }
   }

   # ----------------------------------
   # Write results to temp-file to make
   # DIFF
   @before = sort(@before);
   @after  = sort(@after);

   ($hb, $before) = tempfile("$MySQLaccess::script.XXXXXX") or
    push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!");
   ($ha, $after)  = tempfile("$MySQLaccess::script.XXXXXX") or
    push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!");

   print $hb join("\n",@before);
   print $ha join("\n",@after);
   close $hb;
   close $ha;

   # ----------------------------------
   # compute difference
   my $cmd="$MySQLaccess::DIFF $before $after |";
   open(DIFF,"$cmd");
   @diffs = <DIFF>;
   @diffs = grep(/[<>]/,@diffs);
   chomp(@diffs);
   close(DIFF);

   # ----------------------------------
   # cleanup temp. files
   unlink($before);
   unlink($after);

   return \@diffs;
}

# ===========================================================
# sub Initialize()
#
# ===========================================================
sub Initialize {
    %MySQLaccess::Grant::Access       = %{Default_Access_Rights()};
    @MySQLaccess::Grant::Errors       = ();
    @MySQLaccess::Grant::Warnings     = ();
    @MySQLaccess::Grant::Notes        = ();
    # -----
    # rules
    $MySQLaccess::Grant::Rules{'user'} = 'no_rule_found';
    $MySQLaccess::Grant::Rules{'db'}   = 'no_rule_found';
    $MySQLaccess::Grant::Rules{'host'} = 'no_equiv_host';
    $MySQLaccess::Grant::full_access   = 1;

    $MySQLaccess::Grant::process_host_table = 0;
    return 1;
}

# ===========================================================
# sub ReadTables()
#  
# ===========================================================
sub ReadTables {
    my ($tmp) = @_;
    my ($HOST,$DB,$USER);
    my @tables;

    # build list of available tables
    @tables = MySQLaccess::DB::Show_Tables();

    # reading production grant-tables or temporary tables?
    $tmp = (defined($tmp) and $tmp) ? 1 : 0;
    if ($tmp) { #reading temporary tables
       $HOST=$MySQLaccess::ACCESS_H_TMP;
       $DB  =$MySQLaccess::ACCESS_D_TMP;
       $USER=$MySQLaccess::ACCESS_U_TMP;

       # ----------------------------
       # do tables exist?
       if (!grep(/$HOST/,@tables)) { MySQLaccess::DB::CreateTable($HOST); }
       if (!grep(/$USER/,@tables)) { MySQLaccess::DB::CreateTable($USER); }
       if (!grep(/$DB/,@tables))   { MySQLaccess::DB::CreateTable($DB); }

       MySQLaccess::Debug::Print(1,"Finding fields in tmp-ACL files:");
       # -----------------------------
       # Get record-layout 
       my ($h1,$h2) = MySQLaccess::DB::Show_Fields($HOST);
       my ($d1,$d2) = MySQLaccess::DB::Show_Fields($DB);
       my ($u1,$u2) = MySQLaccess::DB::Show_Fields($USER);
       %MySQLaccess::Grant::H_tmp = %{$h1}; @MySQLaccess::Grant::H_tmp = @{$h2};
       %MySQLaccess::Grant::D_tmp = %{$d1}; @MySQLaccess::Grant::D_tmp = @{$d2};
       %MySQLaccess::Grant::U_tmp = %{$u1}; @MySQLaccess::Grant::U_tmp = @{$u2};

#       @MySQLaccess::Grant::Privileges_tmp=@{Make_Privlist()};
#
       MySQLaccess::Debug::Print(1, "Reading sorted temp-tables:");
       @MySQLaccess::Grant::sorted_db_tmp_table  = MySQLaccess::DB::Sort_table($DB, 'ucase_host', 'user', 'db');
       @MySQLaccess::Grant::sorted_host_tmp_table= MySQLaccess::DB::Sort_table($HOST, 'ucase_host', 'db');
       @MySQLaccess::Grant::sorted_user_tmp_table= defined($MySQLaccess::Param{'password'}) ?
                           MySQLaccess::DB::Sort_table($USER, 'ucase_host', 'user', 'password'):
                           MySQLaccess::DB::Sort_table($USER, 'ucase_host', 'user');
    }
    else {      #reading production grant-tables
       $HOST=$MySQLaccess::ACCESS_H;
       $DB  =$MySQLaccess::ACCESS_D;
       $USER=$MySQLaccess::ACCESS_U;

       MySQLaccess::Debug::Print(1,"Finding fields in ACL files:");
       # -----------------------------
       # Get record-layout 
       my ($h1,$h2) = MySQLaccess::DB::Show_Fields($HOST);
       my ($d1,$d2) = MySQLaccess::DB::Show_Fields($DB);
       my ($u1,$u2) = MySQLaccess::DB::Show_Fields($USER);
       %MySQLaccess::Grant::H = %{$h1}; @MySQLaccess::Grant::H = @{$h2};
       %MySQLaccess::Grant::D = %{$d1}; @MySQLaccess::Grant::D = @{$d2};
       %MySQLaccess::Grant::U = %{$u1}; @MySQLaccess::Grant::U = @{$u2};

       @MySQLaccess::Grant::Privileges=@{Make_Privlist()};

       MySQLaccess::Debug::Print(1, "Reading sorted tables:");
       @MySQLaccess::Grant::sorted_db_table  = MySQLaccess::DB::Sort_table($DB, 'ucase_host', 'user', 'db');
       @MySQLaccess::Grant::sorted_host_table= MySQLaccess::DB::Sort_table($HOST, 'ucase_host', 'db');
       @MySQLaccess::Grant::sorted_user_table= defined($MySQLaccess::Param{'password'}) ?
                           MySQLaccess::DB::Sort_table($USER, 'ucase_host', 'user', 'password'):
                           MySQLaccess::DB::Sort_table($USER, 'ucase_host', 'user');
    }

    return 0;
}

# ===========================================================
# sub Get_Access_Rights(host,user,db)
#  report the access_rights for the tuple ($host,$user,$db).
# ===========================================================
sub Get_Access_Rights {
  local ($host,$user,$db,$tmp) = @_;

   my $aref_user;
   my $aref_host;
   my $aref_db;
   # working with  temporary tables or production tables
   if (defined($tmp) and $tmp) {
      $aref_user = \@MySQLaccess::Grant::sorted_user_tmp_table;
      $aref_host = \@MySQLaccess::Grant::sorted_host_tmp_table;
      $aref_db   = \@MySQLaccess::Grant::sorted_db_tmp_table;   
   }
   else {
      $aref_user = \@MySQLaccess::Grant::sorted_user_table;
      $aref_host = \@MySQLaccess::Grant::sorted_host_table;
      $aref_db   = \@MySQLaccess::Grant::sorted_db_table; 
   }


  my ($refrecord,$refgrant);
  my ($_host_,$_user_,$encpw_);
  my %_Access_;

  MySQLaccess::Debug::Print(1, "for ($host,$user,$db):");  

  # ******************************************************************************
  # Create default access-rights
  #   default access-rights are no access at all!!


  # ******************************************************************************
  # get hostname for IP-address
  # get IP-address for hostname
  local $host_name = MySQLaccess::Host::IP2Name($host);
  local $host_ip   = MySQLaccess::Host::Name2IP($host);

  MySQLaccess::Debug::Print(3,"host=$host, hostname=$host_name, host-ip =$host_ip");
  MySQLaccess::Debug::Print(3,"user=$user");
  MySQLaccess::Debug::Print(3,"db  =$db");

  # ***********************************************************************
  # retrieve information on USER
  #  check all records in mysql::user for matches with the tuple (host,user)
  # ***********************************************************************
  #    4.OR (add) the privileges for the user from the "user" table.
  #     (add all privileges which is "Y" in "user")
  ($refrecord,$refgrant)    = Get_grant_from_user($host,$user,$aref_user);
  ($_host_,$_user_,$encpw_) = @{$refrecord};
  %_access_                 = %{$refgrant};

  foreach $field (keys(%U)) { ##only priv. set in user-table
    $MySQLaccess::Grant::Access{$field} = ($MySQLaccess::Grant::Access{$field} or $_access_{$field});
  }

  if ($_user_ eq $MySQLaccess::NEW_USER) { 
     push(@Warnings,'minimum_priv');
  }
  if ($_user_ ne $user) {
     $user=$_user_;
     push(@Warnings,'anonymous_access');
  }

  # *******************************************************
  #  Validate password if this has been asked to do
  # *******************************************************
  if (defined($password)) {
     $valid = Validate_Password($password,$_host_,$_user_,$_encpw_,$aref_user);
     if (!$valid) { push(@Errors,'invalid_password'); }
     else         { push(@Notes,'valid_password'); }
  }

  # ******************************************************************************
  # retrieve information on DB
  #  check all records in mysql::db for matches with the triple (host,db,user)
  #  first match is used.
  # ******************************************************************************
  #    2.Get grant for user from the "db" table.

  ($refrecord,$refgrant)=Get_grant_from_db($host,$db,$user,$aref_db); #set process_host_table
  ($_host_,$_user_,$encpw_) = @{$refrecord};
  %_access_                 = %{$refgrant};

  foreach $field (keys(%D)) { ##only priv. set in db-table
    $MySQLaccess::Grant::Access{$field} = ($MySQLaccess::Grant::Access{$field} or $_access_{$field});
  }

  # ***********************************************************************
  # retrieve information on HOST
  #  check all records in mysql::host for matches with the tuple (host,db)
  #
  #  ' The host table is mainly to maintain a list of "secure" servers. '
  # ***********************************************************************
  #    3.If hostname is "empty" for the found entry, AND the privileges with
  #      the privileges for the host in "host" table.
  #      (Remove all which is not "Y" in both)

  if ($MySQLaccess::Grant::process_host_table) {
     ($refrecord,$refgrant)=Get_grant_from_host($host,$db,$aref_host);
     ($_host_,$_user_,$encpw_) = @{$refrecord};
     %_access_                 = %{$refgrant};

     foreach $field (keys(%H)) {  ##only priv. set in host-table 
       $MySQLaccess::Grant::Access{$field} = ($MySQLaccess::Grant::Access{$field} and $_access_{$field});
     } 
  }

  MySQLaccess::Debug::Print(1,"done for ($host,$user,$db)");
  return %MySQLaccess::Grant::Access;
}

# ####################################
# FINDING THE RIGHT GRANT-RULE
# ==========================================================
# sub Get_grant_from_user:
# ==========================================================
sub Get_grant_from_user {
  my ($host,$user,$aref) = @_;

  MySQLaccess::Debug::Print(1, "");
  MySQLaccess::Debug::Print(1, "(host=$host,user=$user)");

  my %Access_user = %{Default_Access_Rights()}; 

  my $rule_found=0;
  my @record = ();
  my $record;

  foreach $record (@{$aref}) {
    $MySQLaccess::Grant::full_access=0;
    MySQLaccess::Debug::Print(3, "Record= $record");
    @record=split(/\t/,$record);

    # check host and db
    # with possible wildcards in field
    # replace mysql-wildcards by reg-wildcards
    my $host_tpl = MySQLaccess::Wildcards::SQL2Reg($record[0]);
    my $user_tpl = $record[1]; #user field isn't pattern-matched!!
    my $passwd   = $record[2];

    MySQLaccess::Debug::Print(3, "=>host_tpl : read=$record[0] -> converted=$host_tpl");
    MySQLaccess::Debug::Print(3, "=>user_tpl : read=$record[1] -> $user_tpl");
    MySQLaccess::Debug::Print(3, "=>password : read=$record[2] -> $passwd");


    if ( MySQLaccess::Host::MatchTemplate($host,$host_tpl) and
         MySQLaccess::Wildcards::MatchTemplate($user_tpl,$user)
       ) 
    {
  MySQLaccess::Debug::Print(2, "FOUND!!");
        if ($passwd eq '') { push(@Warnings,'insecure_user');  }
        else               { push(@Notes,'password_required'); }

        foreach $field (keys(%U)) {
          $Access_user{$field} = $MySQLaccess::Report::Answer{$record[$U{$field}]};
        }
        #print "\n" if $DEBUG;
        $MySQLaccess::Grant::Rules{'user'} = $record;
        $rule_found=1;
        last;
    }
  }

  # -------------------------------
  #  setting privileges to user-priv
  MySQLaccess::Debug::Print(2, "Rights after parsing user-table..:");
  if (! $rule_found ) {
     @record=();
     MySQLaccess::Debug::Print(2, "NO record found in the user-table!!");
  }
  else {
     MySQLaccess::Debug::Print(2, "Selected record=@record");
     MySQLaccess::Debug::Print(2, "<=?=> $record");
  }
 
  MySQLaccess::Debug::Print(1, "returning @record");

  return (\@record,\%Access_user); #matching record in user-table
}

# ==========================================================
# sub Get_grant_from_db:
# ==========================================================
sub Get_grant_from_db {
  my ($host,$db,$user,$aref) = @_;

  MySQLaccess::Debug::Print(1, "(host=$host,user=$user,db=$db)");

  my %Access_db    = %{Default_Access_Rights()};
  my $rule_found=0;

  foreach $record (@{$aref}) {
    $full_access=0;
    MySQLaccess::Debug::Print(2, "Read db: $record");
    @record=split(/\t/,$record);

    # check host and db
    # with possible wildcards in field
    # replace mysql-wildcards by reg-wildcards
    my $host_tpl = MySQLaccess::Wildcards::SQL2Reg($record[0]);
    my $db_tpl   = MySQLaccess::Wildcards::SQL2Reg($record[1]);
    my $user_tpl = $record[2]; #user field isn't pattern matched!!
    MySQLaccess::Debug::Print(3, "=>host_tpl : read=$record[0] -> converted=$host_tpl");
    MySQLaccess::Debug::Print(3, "=>db_tpl   : read=$record[1] -> $db_tpl");
    MySQLaccess::Debug::Print(3, "=>user_tpl : read=$record[2] -> $user_tpl");

    if ( ( MySQLaccess::Host::Is_localhost($host_tpl)
           or  MySQLaccess::Wildcards::MatchTemplate($host_tpl,$host_name)
           or  MySQLaccess::Wildcards::MatchTemplate($host_tpl,$host_ip) )
         and ( MySQLaccess::Wildcards::MatchTemplate($db_tpl,$db) )
         and ( MySQLaccess::Wildcards::MatchTemplate($user_tpl,$user) ) ) {
 
      $MySQLaccess::Grant::process_host_table = ($record[0] eq '');

      if ($user_tpl eq '') { push(@Warnings,'public_database'); }

      foreach $field (keys(%D)) {
        $Access_db{$field} = $MySQLaccess::Report::Answer{$record[$D{$field}]};
      }
      $rule_found=1;
      $MySQLaccess::Grant::Rules{'db'} = $record;
      last;
    }
  }

  # -------------------------------
  #  setting privileges to db-priv
  MySQLaccess::Debug::Print(2, "Rights after parsing db-table..:");
  if (! $rule_found ) {
    MySQLaccess::Debug::Print(2, "NO rule found in db-table => no access granted!!");
  }

  return (\@record,\%Access_db);
}

# ==========================================================
# sub Get_grant_from_host:
# ==========================================================
sub Get_grant_from_host {
  my ($host,$db,$aref) = @_;

  MySQLaccess::Debug::Print(1, "Get_grant_from_host()");

  my %Access_host = %{Default_Access_Rights()};

  # the host-table doesn't have to be processed if the host-field
  # in the db-table isn't empty
  if (!$MySQLaccess::Grant::process_host_table) {
    MySQLaccess::Debug::Print(2, ">> Host-table doesn't have to be processed!!");
    $MySQLaccess::Grant::Rules{'host'} = 'no_equiv_host';
    return ([],\%Access_host);
  }

  my $rule_found=0;
  my @record = ();

  foreach $record (@{$aref}) {
    $full_access=0;
    MySQLaccess::Debug::Print(2, "host: $record");
    @record=split(/\t/,$record);

    # check host and db
    # with possible wildcards in field
    # replace mysql-wildcards by reg-wildcards
    my $host_tpl = MySQLaccess::Wildcards::SQL2Reg($record[0]);
    my $db_tpl   = MySQLaccess::Wildcards::SQL2Reg($record[1]);
    MySQLaccess::Debug::Print(3, "=>host_tpl : $record[0] -> $host_tpl");
    MySQLaccess::Debug::Print(3, "=>db_tpl   : $record[1] -> $db_tpl");

    if ( ( MySQLaccess::Host::Is_localhost($host_tpl)
           or MySQLaccess::Wildcards::MatchTemplate($host_tpl,$host_name)
           or MySQLaccess::Wildcards::MatchTemplate($host_tpl,$host_ip) )
         and ( MySQLaccess::Wildcards::MatchTemplate($db_tpl,$db) ) ) {

      $MySQLaccess::Grant::Rules{'host'} = $record;
      $rule_found=1;
      foreach $field (keys(%H)) {
        $Access_host{$field} = $MySQLaccess::Report::Answer{$record[$H{$field}]};
      }
      last;
    }
  }

  # -------------------------------
  #  setting privileges to host-priv
  MySQLaccess::Debug::Print(2, "Rights after parsing host-table..:");
  if (! $rule_found ) {
     @record=();
     MySQLaccess::Debug::Print(2, "NO restrictions found in the host-table!!");
  }

  # --------------------------------
  # debugging access-rights in db 

  return (\@record,\%Access_host); #matching record in host-table
}



# ===========================================================
# sub Default_Access_Rights():
#  return (a reference to) a hash which holds all default
#  priviliges currently defined in the grant-tables.
# ===========================================================
sub Default_Access_Rights {
    my %right = ();

    MySQLaccess::Debug::Print(2, "Debug Default_Access_Rights():");
    # add entry for all fields in the HOST-table
    foreach $field (keys(%MySQLaccess::Grant::H)) {
	$right{$field}='0' unless (defined($right{$field}));
    }
    # add entry for all fields in the DB-table
    foreach $field (keys(%MySQLaccess::Grant::D)) {
	$right{$field}='0' unless (defined($right{$field}));
    }
    # add entry for all fields in the USER-table
    foreach $field (keys(%MySQLaccess::Grant::U)) {
	$right{$field}='0' unless (defined($right{$field}));
    }
    # --------------
    # debugging info
    foreach $field (keys(%right)) { MySQLaccess::Debug::Print(3, sprintf("> %15s : %1s",$field,$right{$field})); }

    return \%right;
}

# ======================================
# sub Make_Privlist
#  Make an ordered list of the privileges
#  that should be reported
# ======================================
sub Make_Privlist {
    # layout:
    #'select_priv',     'create_priv',
    #'insert_priv',     'drop_priv',
    #'update_priv',     'reload_priv',
    #'delete_priv',     'process_priv',
    #'file_priv',       'shutdown_priv');
    my $right;
    my @privlist=();
    foreach $right (@U) {
	if (! grep(/$right/,@privlist)) { push(@privlist,$right); }
    };
    foreach $right (@D) {
	if (! grep(/$right/,@privlist)) { push(@privlist,$right); }
    };
    foreach $right (@H) {
	if (! grep(/$right/,@privlist)) { push(@privlist,$right); }
    };
#       print "Privileges:\n";
#       foreach $field (@privlist) { print " > $field\n"; }
    return \@privlist;
}



########################################################################
package MySQLaccess::Report;
use Exporter ();
@EXPORT = qw(&Print_Header());
BEGIN {
    $FORM = $ENV{'SCRIPT_NAME'};
    $DEBUG     = 0;
    $DEBUG     = $MySQLaccess::DEBUG unless ($DEBUG);

    # translation-table for poss. answers
    %Answer =  ('Y' =>  1 , 'N' =>  0
               , 1  => 'Y',  0  => 'N'
               ,'?' => '?', ''  => '?'
               );
    $headers   = 0;
    $separator = 0;

# ****************************
# Notes and warnings
%MESSAGES = ( 
  'insecure_user' 
   => "Everybody can access your DB as user `\$user' from host `\$host'\n"
     ."WITHOUT supplying a password.\n"
     ."Be very careful about it!!"
 ,'password_required' 
   => "A password is required for user `\$user' :-("
 ,'invalid_password'
   => "The password '\$password' for user `\$user' is invalid :-P"
 , 'valid_password'
   => "You supplied the right password for user `\$user' :-)"
 ,'public_database' 
   => "Any user with the appropriate permissions has access to your DB!\n"
     ."Check your users!"
 ,'full_access' 
   => "All grant-tables are empty, which gives full access to ALL users !!"
 ,'no_rule_found'
   => "No matching rule"
 ,'no_equiv_host' 
   => "Not processed: host-field is not empty in db-table."
 ,'least_priv'
   => "If the final priveliges of the user are more then you gave the user,\n"
     ."check the priveliges in the db-table `\$db'."
 ,'minimum_priv'
   => "The privileges for any new user are AT LEAST\n"
     ."the ones shown in the table above,\n"
     ."since these are the privileges of the db `\$db'.\n"
 ,'not_found_mysql'
   => "The MySQL client program <$MySQLaccess::MYSQL> could not be found.\n"
     ."+ Check your path, or\n"
     ."+ edit the source of this script to point \$MYSQL to the mysql client.\n"
 ,'not_found_mysqldump'
   => "The MySQL dump program <$MySQLaccess::MYSQLDUMP> could not be found.\n"
     ."+ Check your path, or\n"
     ."+ edit the source of this script to point \$MYSQLDUMP to the mysqldump program.\n"
 ,'not_found_diff'
   => "The diff program <$MySQLaccess::DIFF> could not be found.\n"
     ."+ Check your path, or\n"
     ."+ edit the source of this script to point \$DIFF to the diff program.\n"
 ,'Unrecognized_option'
   => "Sorry,\n"
     ."You are using an old version of the mysql-program,\n"
     ."which does not yet implement a neccessary option.\n"
     ."\n"
     ."You need at least Version 6.2 of the mysql-client,\n"
     ."which was build in MySQL v3.0.18, to use this version\n"
     ."of `$MySQLaccess::script'."
 ,'Access_denied'
   => "Sorry,\n"
     ."An error occurred when trying to connect to the database\n"
     ."with the grant-tables:\n"
     ."* Maybe YOU do not have READ-access to this database?\n"
     ."* If you used the -U option, you may have supplied an invalid username?\n"
     ."  for the superuser?\n"
     ."* If you used the -U option, it may be possible you have to supply\n"
     ."  a superuser-password to, with the -P option?\n"
     ."* If you used the -P option, you may have supplied an invalid password?\n"
 ,'Dbaccess_denied'
   => "Sorry,\n"
     ."An error occurred when trying to connect to the database\n"
     ."with the grant-tables. (dbaccess denied)\n"
 ,'Unknown_tmp_table'
   => "Sorry,\n"
     ."An error occurred when trying to work with the temporary tables in the database\n"
     ."with the grant-tables. (One of the temporary tables does not exist)\n"
 ,'Unknown_table'
   => "Sorry,\n"
     ."An error occurred when trying to work with some tables in the database\n"
     ."with the grant-tables. (table does not exist)\n"
 ,'use_old_server'
   => "Sorry,\n"
     ."An error occurred when executing an SQL statement.\n"
     ."You might consider altering the use of the parameter `--old_server' when \n"
     ."calling `$MySQLaccess::script'."
 ,'unknown_error'
   => "Sorry,\n"
     ."An error occurred when trying to connect to the database\n"
     ."with the grant-tables. (unknown error)\n"
 ,'anonymous_access'
   => "Accessing the db as an anonymous user.\n"
     ."Your username has no relevance\n"
 ,'user_required'
   => "You have to supply a userid."
 ,'db_required'
   => "You have to supply the name of a database."
 ,'host_required'
   => "You have to supply the name of a host."
 );


} 
# =====================================
# sub Print_Header:
#  print header info
# =====================================
sub Print_Header {
    if ($MySQLaccess::CMD) { #command-line mode
    print "$MySQLaccess::script Version $MySQLaccess::VERSION\n"
         ."By RUG-AIV, by Yves Carlier (Yves.Carlier\@rug.ac.be)\n"
         ."Changes by Steve Harvey (sgh\@vex.net)\n"
         ."This software comes with ABSOLUTELY NO WARRANTY.\n";
    }
    if ($MySQLaccess::CGI) { #CGI-BIN mode
    print "content-type: text/html\n\n" 
       . "<HTML>\n"
         ."<HEAD>\n"
         ."<TITLE>MySQLaccess</TITLE>\n"
         ."</HEAD>\n"
         ."<BODY>\n"
         ."<H1>$MySQLaccess::script Version $MySQLaccess::VERSION</H1>\n" 
         ."<CENTER>\n<ADDRESS>\n"
         ."By RUG-AIV, by Yves Carlier (<a href=mailto:Yves.Carlier\@rug.ac.be>Yves.Carlier\@rug.ac.be</a>)<BR>\n"
         ."Changes by Steve Harvey (<a href=mailto:sgh\@vex.net>sgh\@vex.net</a>)<BR>\n"
         ."This software comes with ABSOLUTELY NO WARRANTY.<BR>\n"
         ."</ADDRESS>\n</CENTER>\n"
         ."<HR>\n";
    Print_Taskbar();
    print "<HR>\n";
    }
    return 1;
}

# =====================================
# sub Print_Footer:
#  print footer info
# =====================================
sub Print_Footer {
    if ($MySQLaccess::CMD) { #command-line mode
    print "\n"
         ."BUGs can be reported at https://jira.mariadb.org\n";
    }
    if ($MySQLaccess::CGI) { #CGI-BIN mode
    if ($MySQLaccess::Param{'brief'}) {
    print "</table>\n";  #close table in brief-output
    }
    print "<HR>\n"
         ."<ADDRESS>\n"
         ."BUGs can be reported at <a href=\"https://jira.mariadb.org\">MariaDB JIRA</a><BR>\n"
#         ."Don't forget to mention the version $VERSION!<BR>\n"
         ."</ADDRESS>\n"
         ."</BODY>\n"
         ."</HTML>\n";
    }
    return 1;
}

# =====================================
# sub Print_Taskbar:
#  print taskbar on STDOUT
# =====================================
sub Print_Taskbar {
    print "<CENTER>\n"
         ."[<a href=$FORM?relnotes=on>Release&nbsp;Notes</a>] \n"
         ."[<a href=$FORM?version=on>Version</a>] \n"
         ."[<a href=$FORM?plan=on>Future&nbsp;Plans</a>] \n"
         ."[<a href=$FORM?howto=on>Examples</a>] \n"
         ."[<a href=$FORM?help=on>New check</a>] \n"
         ."[<a href=$FORM?edit=on>Change/edit ACL</a>] \n"
         ."</CENTER>\n";
    return 1;
}

# =====================================
# sub Print_Form:
#  print CGI-form
# =====================================
sub Print_Form {
print <<EOForm;
<center>
<!-- Quering -->
<FORM method=POST action=$FORM>

<table border width="100%" >
<tr>
  <th>MySQL server</th>
  <th>User information</th>
  <th>Reports</th>
  </tr>

<tr>
  <td valign=top>
  <table>
  <tr>
    <td halign=right><b>Host</b><br><font size=-2>(Host on which MySQL-server resides.)</font></td>
    <td valign=top><INPUT name=rhost type=text size=15 maxlength=15 value="$MySQLaccess::Param{'rhost'}"></td>
    </tr>
  <tr>
    <td halign=right><b>Superuser</b><br><font size=-2>(User which has <font color="Red">read-access</font> to grant-tables.)</font></td>
    <td valign=top><INPUT name=superuser type=text size=15 maxlength=15 value="$MySQLaccess::Param{'superuser'}"></td>
    </tr>
  <tr>
    <td halign=right><b>Password</b><br><font size=-2>(of Superuser.)</font></td>
    <td valign=top><INPUT name=spassword type=password size=15 maxlength=15 value="$MySQLaccess::Param{'spassword'}"></td>
    </tr>
  </table>
  </td>

  <td valign=top>
  <table>
  <tr>
    <td halign=right><b><font color=Red>User</font></b><br><font size=-2>(Userid used to connect to MySQL-database.)</font></td>
    <td halign=top><INPUT name=user type=text size=15 maxlength=15 value="$MySQLaccess::Param{'user'}"></td>
    </tr>
  <tr>
    <td halign=right><b>Password</b><br><font size=-2>(Password user has to give to get access to MySQL-database.)</font></td>
    <td valign=top><INPUT name=password type=password size=15 maxlength=15 value="$MySQLaccess::Param{'password'}"></td>
    </tr>
  <tr>
    <td halign=right><b><font color=Red>Database</font></b><br><font size=-2>(Name of MySQL-database user tries to connect to.</font><br><font size=-2>Wildcards <font color="Green">(*,?,%,_)</font> are allowed.)</font></td>
    <td valign=top><INPUT name=db type=text size=15 maxlength=15 value="$MySQLaccess::Param{'db'}"></td>
    </tr>
  <tr>
    <td halign=right><b>Host</b><br><font size=-2>(Host from where the user is trying to connect to MySQL-database.</font><br><font size=-2>Wildcards <font color="Green">(*,?,%,_)</font> are allowed.)</font></td>
    <td valign=top><INPUT name=host type=text size=15 maxlength=15 value="$MySQLaccess::Param{'host'}"></td>
    </tr>
  </table>
  </td>

  <td valign=center>
  <table cellspacing=5 cellpadding=2 cols=1 height="100%">
  <tr align=center>
    <td halign=right><INPUT type=submit name=brief value="Brief"><br>
                     <INPUT type=submit name=table value="Tabular"></td>
    </tr>
  <tr align=center>
    <td></td>
    </tr>
  <tr align=center>
    <td halign=right><INPUT type=reset value="Clear"></td>
    </tr>
  </table>
  </td>
  </tr>

</table>
</form>


</BODY>
</HTML>
EOForm
    return 1;
}

# =====================================
# sub Print_Usage:
#  print some information on STDOUT
# =====================================
sub Print_Usage {
    Print_Error_Messages();
    if ($MySQLaccess::CMD) { #command-line mode
        Print_Options();
    }
    if ($MySQLaccess::CGI) { #CGI-BIN mode
        Print_Form();
    }    
    return 1;
}

# ======================================
# sub Print_Version:
# ======================================
sub Print_Version {
    if ($MySQLaccess::CMD) {
       print $MySQLaccess::INFO;
    }
    if ($MySQLaccess::CGI) { 
       print "<PRE>\n"; 
       print $MySQLaccess::INFO;
       print "</PRE>\n"; 
    }
    return 1;
}

# ======================================
# sub Print_Relnotes:
# ======================================
sub Print_Relnotes {
    if ($MySQLaccess::CMD) {
       print $MySQLaccess::RELEASE;
    }
    if ($MySQLaccess::CGI) { 
       print "<PRE>\n";
       print $MySQLaccess::RELEASE;
       print "</PRE>\n"; 
    }
    return 1;
}

# ======================================
# sub Print_Plans:
# ======================================
sub Print_Plans {
    if ($MySQLaccess::CMD) {
       print $MySQLaccess::TODO;
    }
    if ($MySQLaccess::CGI) { 
       print "<PRE>\n";
       print $MySQLaccess::TODO;
       print "</PRE>\n"; 
    }
    return 1;
}

# ======================================
# sub Print_HowTo:
# ======================================
sub Print_HowTo {
    if ($MySQLaccess::CMD) {
       print $MySQLaccess::HOWTO;
    }
    if ($MySQLaccess::CGI) { 
       print "<PRE>\n"; 
       print $MySQLaccess::HOWTO;
       print "</PRE>\n"; 
    }
    return 1;
}

# ======================================
# sub Print_Options:
# ======================================
sub Print_Options {
    if ($MySQLaccess::CGI) { print "<PRE>\n"; }
    print $MySQLaccess::OPTIONS;
    if ($MySQLaccess::CGI) { print "</PRE>\n"; }
    return 1;
}

# ======================================
# sub Print_Error_Access:
# ======================================
sub Print_Error_Access {
    my ($error) = @_;
    print "\n";
    if ($MySQLaccess::CGI) { print "<font color=Red>\n<PRE>\n"; }
    print $MESSAGES{$error};
    if ($MySQLaccess::CGI) { print "</PRE>\n</font>\n"; }
    print "\n";
    return 1;
}

# ======================================
# sub Print_Error_Messages:
# ======================================
sub Print_Error_Messages {
#    my ($error) = @_;
    print "\n";
    if ($MySQLaccess::CGI) { print "<font color=Red>\n<center>\n"; }
    foreach $error (@MySQLaccess::Grant::Error) {
       print $MESSAGES{$error};
       print $MySQLaccess::CGI ? "<br>\n" : "\n";
    }
    if ($MySQLaccess::CGI) { print "</center>\n</font>\n"; }
    print "\n";
    return 1;
}

# ======================================
# sub Print_Message:
# ======================================
sub Print_Message {
    my ($aref) = @_;
    my @messages = @{$aref};
    print "\n";
    if ($MySQLaccess::CGI) { print "<font color=DarkGreen>\n<center>\n"; }
    foreach $msg (@messages) {
       print $msg;
       print $MySQLaccess::CGI ? "<br>\n" : "\n";
    }
    if ($MySQLaccess::CGI) { print "</center>\n</font>\n"; }
    print "\n";
    return 1;
}

# ======================================
# sub Print_Edit:
# ======================================
sub Print_Edit {
    print "\n";
    if (!$MySQLaccess::CGI) { 
       print "Note: Editing the temporary tables is NOT supported in CMD-line mode!\n";
       return 0;
    }
    print "<CENTER>\n"
         ."<form action=$FORM method=GET>\n"
         ."<table width=90% border>\n"
         ."<tr>\n"
         ." <td><input type=checkbox name=copy value=on> Copy grant-rules to temporary tables<br></td>\n"
         ." <td rowspan=5 align=center valign=center><input type=submit value=Go></td>\n"
         ."</tr>\n"
         ."<tr>\n"
         ." <td> Edit temporary tables with external application:<br>"
         ." <a href=\"$MySQLaccess::MYSQLADMIN\">$MySQLaccess::MYSQLADMIN</a></td>\n"
         ."</tr>\n"
         ."<tr>\n"
         ." <td><input type=checkbox name=preview value=on> Preview changes made in temporary tables</td>\n"
         ."</tr>\n"
         ."<tr>\n"
         ." <td><input type=checkbox name=commit value=on> Make changes permanent</td>\n"
         ."</tr>\n"
         ."<tr>\n"
         ." <td><input type=checkbox name=rollback value=on> Restore previous grand-rules</td>\n"
         ."</tr>\n"
         ."<tr>\n"
         ." <td colspan=2 align=center><font size=-2 color=Red>You need write,delete and drop-privileges to perform the above actions</font></td>\n"
         ."</tr>\n"
         ."</table>\n"
         ."</form>\n"
         ."</CENTER>\n";

    return 1;
}


# ======================================
# sub Print_Access_rights:
#  print the access-rights on STDOUT
# ======================================
sub Print_Access_rights {
    my ($host,$user,$db,$refhash) = @_;

    if (defined($MySQLaccess::Param{'brief'})) { 
#       if ($MySQLaccess::CGI) { print "<PRE>\n"; }
       Matrix_Report($host,$user,$db,$refhash);  
#       if ($MySQLaccess::CGI) { print "</PRE>\n"; }
    }
    else { 
       Tabular_Report($host,$user,$db,$refhash); 
       $MySQLaccess::Report::separator = $MySQLaccess::CGI ? "<hr>" : "-"x80;
    }
    return 1;
}

# ======================================
# sub Print_Diff_ACL:
#  print the diff. in the grants before and after
# ======================================
sub Print_Diff_ACL {
    my ($aref) = @_;
    my @diffs = @{$aref};
    my %block = ( '<' => 'Before',
                  '>' => 'After',
                );
    my %color = ( '<' => 'Green',
                  '>' => 'Red',
                ); 
    my $curblock = '';

    # -----------------------------
    # create column-headers
    foreach $field (@MySQLaccess::Grant::Privileges) {
      push(@headers,substr($field,0,4));
    }

    if ($MySQLaccess::CMD) {
    print "\n";
    print "Differences in access-rights BEFORE and AFTER changes in grant-tables\n";
#    print "---------------------------------------------------------------------\n";
      my $line1="";
      my $line2="";
      $line1 .= sprintf("| %-30s|",'Host,User,DB');
      $line2 .= sprintf("+-%-30s+",'-' x 30);
      foreach $header (@headers) {
        $line1 .= sprintf("%-4s|",$header);
        $line2 .= sprintf("%s+",'----');
      }
      print "$line2\n";
      print "$line1\n";
      print "$line2\n";

      $format = "format STDOUT = \n"
              . "^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " . " @|||" x 10 ."\n"
              . '$host_user_db,@priv' . "\n"
              . ".\n";
#print $format;
      eval $format;
    }
    if ($MySQLaccess::CGI) {
    print "<table border width=100%>\n";
    print "<tr>\n";
    print "<th colspan=11>";
    print "Differences in access-rights <font color=$color{'<'}>BEFORE</font> "
         ."and <font color=$color{'>'}>AFTER</font> changes to grant-tables</font>\n";
    print "</th>";
    print "</tr>\n";
    print "<tr>\n";    
    $line1 .= sprintf("<th>%-20s</th>",'Host, User, DB');
    foreach $header (@headers) {
      $line1 .= sprintf("<th>%-4s</th>",$header);
    }
    print "$line1</tr>\n";
    }

    foreach $line (@diffs) {
        $type = substr($line,0,1);
        $line = substr($line,1);
        ($host,$user,$db,@priv) = split(/,/,$line);
        if ($MySQLaccess::CMD) {
           if ($type ne $curblock) {
              $curblock = $type;
              print $block{$curblock},":\n";
           }
           #print "$line\n";
           write;
        }
        if ($MySQLaccess::CGI) {
           if ($type ne $curblock) {
              $curblock = $type;
              print "<tr><td><b>$block{$curblock}<b></td></tr>\n";
           }
           $line1="<td><font color=$color{$type}>$host, $user, $db</font></td>";
           foreach $field (@priv) {
              $line1 .= sprintf("<td align=center><font color=$color{$type}>%-4s</font></td>",$field);
           }
           print "<tr>$line1</tr>\n";
        }
    }
    print      "\n";
    if ($MySQLaccess::CMD) {
    print "---------------------------------------------------------------------\n";
    }
    if ($MySQLaccess::CGI) {
    print      "</table><br>";
    }


    return 1;
}

# ======================================
# sub Tabular_Report
#  Tabular report,
#  suitable for 1 triple (host,db,user)
# ======================================
sub Tabular_Report {
    my ($host,$user,$db,$a) = @_;
    my $column=2;

    # -----------------------------
    # separator
    if ($MySQLaccess::Report::separator) { print "$MySQLaccess::Report::separator\n"; }
    
    # -----------------------------
    # print table of access-rights
    my $rows = int(@MySQLaccess::Grant::Privileges/2);  #round up
    my @table=();
    $j=0;
    for $i (0 .. $rows-1) {
      $table[$j]=$MySQLaccess::Grant::Privileges[$i];
      $j = $j+2;
    }
    $j=1;
    for $i ($rows .. $#MySQLaccess::Grant::Privileges) {
      $table[$j]=$MySQLaccess::Grant::Privileges[$i];
      $j = $j+2;
    }
    if ($MySQLaccess::CMD) {
    print "\n";
    print "Access-rights\n";
    print "for USER '$user', from HOST '$host', to DB '$db'\n";
    }
    if ($MySQLaccess::CGI) {
    print "<table border width=100%>\n";
    print "<tr>\n";
    }
    if ($MySQLaccess::CGI) {
    print "<th colspan=5>";
    print "<font color=Red>Access-rights</font>\n";
    print "for USER '<font color=Green>$user</font>', from HOST '<font color=Green>$host</font>', to DB '<font color=Green>$db</font>'\n";
    print "</th>";
    print "</tr>\n";
    print "<tr>\n";
    }
    if ($MySQLaccess::CMD) {
    print      "\t+-----------------+---+\t+-----------------+---+";
    }
    foreach $field (@table) {
        if ($MySQLaccess::CMD) {
          if ($column==2) { print "\n\t"; $column=1;}
          else            { print "\t";   $column=2;}
          printf "| %-15s | %s |",$field,$Answer{$a->{$field}}; 
        }
        if ($MySQLaccess::CGI) {
          if ($column==2) { print "</tr>\n<tr>\n"; $column=1;}
          else            { print "<td width=10%></td>";   $column=2;}
          printf " <td width=35%><b>%-15s</b></td><td width=10%>%s</td>\n",$field,$Answer{$a->{$field}}; 
        }
    }
    print      "\n";
    if ($MySQLaccess::CMD) {
    print      "\t+-----------------+---+\t+-----------------+---+\n";
    }
    if ($MySQLaccess::CGI) {
    print      "</tr>\n</table><br>";
    }

    # ---------------
    # print notes:
    foreach $note (@MySQLaccess::Grant::Notes) {
      my $message = $MESSAGES{$note};
      $message =~ s/\$user/$user/g; 
      $message =~ s/\$db/$db/g;
      $message =~ s/\$host/$host/g;
      $message =~ s/\$password/$password/g;
      $PREFIX='NOTE';
      if ($MySQLaccess::CMD) {
      my @lines = split(/\n/,$message);
      foreach $line (@lines) { 
        print "$PREFIX:\t $line\n"; 
        $PREFIX='    ';
      }
      }
      if ($MySQLaccess::CGI) {
      print "<b>$PREFIX:</b> $message<br>\n";
      }
    } 

    # ---------------
    # print warnings:
    foreach $warning (@MySQLaccess::Grant::Warnings) {
      my $message = $MESSAGES{$warning};
      $message =~ s/\$user/$user/g;
      $message =~ s/\$db/$db/g;
      $message =~ s/\$host/$host/g;
      $message =~ s/\$password/$password/g;
      $PREFIX='BEWARE';
      if ($MySQLaccess::CMD) {
      my @lines = split(/\n/,$message);
      foreach $line (@lines) { 
        print "$PREFIX:\t $line\n"; 
        $PREFIX='      ';
      }
      }
      if ($MySQLaccess::CGI) {
      print "<b>$PREFIX:</b> $message<br>\n";
      }
    }

    # ---------------
    # print errors:
    foreach $error (@MySQLaccess::Grant::Errors) {
      my $message = $MESSAGES{$error};
      $message =~ s/\$user/$user/g;
      $message =~ s/\$db/$db/g;
      $message =~ s/\$host/$host/g;
      $message =~ s/\$password/$password/g;
      $PREFIX='ERROR';
      if ($MySQLaccess::CMD) {
      my @lines = split(/\n/,$message);
      foreach $line (@lines) { 
        print "$PREFIX:\t $line\n"; 
        $PREFIX='    ';
      }
      }
      if ($MySQLaccess::CGI) {
      print "<b>$PREFIX:</b> $message<br>\n";
      }
    }

    # ---------------
    # inform if there are no rules ==> full access for everyone.
    if ($MySQLaccess::Grant::full_access) { print "$MESSAGES{'full_access'}\n"; }

    # ---------------
    # print the rules used
    print "\n";
    if ($MySQLaccess::CMD) {
    print "The following rules are used:\n";
    foreach $field (sort(keys(%MySQLaccess::Grant::Rules))) {
      my $rule = (defined($MESSAGES{$MySQLaccess::Grant::Rules{$field}}) ? $MESSAGES{$MySQLaccess::Grant::Rules{$field}} : $MySQLaccess::Grant::Rules{$field});
      $rule =~ s/\t/','/g;
      printf " %-5s : '%s'\n",$field,$rule;
    }
    }
    if ($MySQLaccess::CGI) {
    print "<br>\n";
    print "<table border width=100%>\n";
    print "<tr><th colspan=2>The following rules are used:</th></tr>\n";
    foreach $field (sort(keys(%MySQLaccess::Grant::Rules))) {
      my $rule = (defined($MESSAGES{$MySQLaccess::Grant::Rules{$field}}) ? $MESSAGES{$MySQLaccess::Grant::Rules{$field}} : $MySQLaccess::Grant::Rules{$field});
      $rule =~ s/\t/','/g;
      printf "<tr><th>%-5s</th><td>'%s'</td></tr>\n",$field,$rule;
    }
    print "</table>\n";
    }
 
    return 1;
}

# ======================================
# sub Matrix_Report:
#  single-line output foreach triple,
#  no notes,warnings,...
# ======================================
sub Matrix_Report {
    my ($host,$user,$db,$a) = @_;
    my @headers = ();
    
    if (! $headers) {
       # -----------------------------
       # create column-headers
       foreach $field (@MySQLaccess::Grant::Privileges) {
         push(@headers,substr($field,0,4));
       }
    
       # -----------------------------
       # print column-headers
       print "\n";
       if ($MySQLaccess::CMD) {
         my $line1="";
         my $line2="";
         foreach $header (@headers) {
           $line1 .= sprintf("%-4s ",$header);
           $line2 .= sprintf("%s ",'----');
         }
         $line1 .= sprintf("| %-20s",'Host,User,DB');
         $line2 .= sprintf("+ %-20s",'-' x 20);
         print "$line1\n";
         print "$line2\n";
       }
       if ($MySQLaccess::CGI) {
         print "<table width=100% border>\n";
         my $line1="<tr>";
         foreach $header (@headers) {
           $line1 .= sprintf("<th>%-4s</th>",$header);
         }
         $line1 .= sprintf("<th>%-20s</th>",'Host, User, DB');
         print "$line1</tr>\n";
       }

       # ----------------------------
       # column-headers should only be 
       # printed once.
       $MySQLaccess::Report::headers=1;
    }

    # ------------------------
    # print access-information
    if ($MySQLaccess::CMD) {
      foreach $field (@MySQLaccess::Grant::Privileges) {
  	  printf " %-2s  ",$Answer{$a->{$field}}; 
      }
      printf "| %-20s",join(',',$host,$user,$db);
      print "\n";
    }
    if ($MySQLaccess::CGI) {
      print "<tr>";
      foreach $field (@MySQLaccess::Grant::Privileges) {
  	  printf "<td align=center>%-2s</td>",$Answer{$a->{$field}}; 
      }
      printf "<td><b>%-20s</b></td>",join(', ',$host,$user,$db);
      print "</tr>\n";
    }

    return 1;
}


# ======================================
# sub Raw_Report:
#  single-line output foreach triple,
#  no notes,warnings,...
# ======================================
sub Raw_Report {
    my ($host,$user,$db,$a) = @_;
    my @headers = ();
    my $string = "";
    
    # ------------------------
    # print access-information
    $string = "$host,$user,$db,";
    foreach $field (@MySQLaccess::Grant::Privileges) {
	  $string .= $Answer{$a->{$field}} . ","; 
    }
    return $string;
}


#######################################################################
package MySQLaccess::Wildcards;
BEGIN {
    $DEBUG     = 0;
    $DEBUG     = $MySQLaccess::DEBUG unless ($DEBUG);
}
# ############################################
# SQL, WILDCARDS and REGULAR EXPRESSIONS 
# ============================================
# translage SQL-expressions to Reg-expressions
# ============================================
sub SQL2Reg {
    my ($expr) = @_;
    my $expr_o = $expr;
    $expr  =~ s/\./\\./g;
    $expr  =~ s/\\%/\002/g;
    $expr  =~ s/%/.*/g;
    $expr  =~ s/\002/%/g;
    $expr  =~ s/\\_/\002/g;
    $expr  =~ s/_/.+/g;
    $expr  =~ s/\002/_/g;
    MySQLaccess::Debug::Print(2,"$expr_o --> $expr");
    return $expr;
}

# translage WILDcards to Reg-expressions
# ============================================
sub Wild2Reg {
    my ($expr) = @_;
    my $expr_o = $expr;
    $expr  =~ s/\./\\./g;
    $expr  =~ s/\\\*/\002/g;
    $expr  =~ s/\*/.*/g;
    $expr  =~ s/\002/*/g;
    $expr  =~ s/\\\?/\002/g;
    $expr  =~ s/\?/.+/g;
    $expr  =~ s/\002/?/g;
    MySQLaccess::Debug::Print(2,"$expr_o --> $expr");
    return $expr;
}

# =============================================
# match a given string with a template
# =============================================
sub MatchTemplate {
    my ($tpl,$string) = @_;
    my $match=0;
    if ($string=~ /^$tpl$/ or $tpl eq '') { $match=1; }
    else                                  { $match=0;}
    MySQLaccess::Debug::Print(2,"($tpl,$string) --> $match");
    return $match;
}

#######################################################################
package MySQLaccess::Host;
BEGIN {
    $localhost = undef;
    $DEBUG     = 2;
    $DEBUG     = $MySQLaccess::DEBUG unless ($DEBUG);
}
# ======================================
# sub IP2Name
#  return the Name with the corr. IP-nmbr
#  (no aliases yet!!)
# ======================================
sub IP2Name {
    my ($ip) = @_;
    my $ip_o = $ip;
    if ($ip !~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/o) {
       MySQLaccess::Debug::Print(3,"'$ip' is not an ip-number, returning IP=$ip");
       return $ip;
    }
    MySQLaccess::Debug::Print(4,"IP=$ip split up => $1.$2.$3.$4");
    $ip = pack "C4",$1,$2,$3,$4;
    MySQLaccess::Debug::Print(4,"IP packed -> >>$ip<<\n");
    my ($name,$aliases,$addrtype,$length,@addrs) = gethostbyaddr($ip, AF_INET);
    MySQLaccess::Debug::Print(3,"IP=$ip_o => hostname=$name");
    MySQLaccess::Debug::Print(4,"aliases=$aliases");
    MySQLaccess::Debug::Print(4,"addrtype=$addrtype - length=$length");
    return ($name || $ip);
    #return ($name || undef);
}

# ======================================
# sub Name2IP
#  return the IP-number of the host
# ======================================
sub Name2IP {
    my ($name) = @_;
    if ($name =~ /[%_]/) { 
       MySQLaccess::Debug::Print(3,"'$name' contains SQL-wildcards, returning name=$name");
       return $name; 
    }
    my ($_name,$aliases,$addrtype,$length,@addrs) = gethostbyname($name);
    my ($a,$b,$c,$d) = unpack('C4',$addrs[0]);
    my $ip = "$a.$b.$c.$d";
    MySQLaccess::Debug::Print(3,"hostname=$name => IP=$ip");
    MySQLaccess::Debug::Print(4,"aliases=$aliases");
    MySQLaccess::Debug::Print(4,"addrtype=$addrtype - length=$length");
    #if ($ip ne "") { return "$ip"; }
    #else           { return undef; }
    return ($ip || $name);
}

# ========================================
# sub LocalHost
#  some special action has to be taken for
#  the localhost
# ========================================
sub LocalHost {
    if (!defined($MySQLaccess::Host::localhost)) {
       $MySQLaccess::Host::localhost = Sys::Hostname::hostname();
       MySQLaccess::Debug::Print(3,"Setting package variable \$localhost=$MySQLaccess::Host::localhost");
    }
    my $host = $localhost;
    MySQLaccess::Debug::Print(3,"localhost = $host");
    return $host;
}

# ========================================
# check if the given hostname (or ip)
# corresponds with the localhost
# ========================================
sub Is_localhost {
    my ($host_tpl) = @_;
    my $isit = 0;
    if (($MySQLaccess::host_name eq $localhost) or ($MySQLaccess::host_ip eq $local_ip)) {
	MySQLaccess::Debug::Print(2,"Checking for localhost");
      MySQLaccess::Debug::Print(3,"because ($MySQLaccess::host_name EQ $localhost) AND ($MySQLaccess::host_ip EQ $local_ip)");
      $isit = ( 'localhost' =~ /$host_tpl/ ) ? 1 : 0;
      MySQLaccess::Debug::Print(3," 'localhost' =?= $host_tpl  -> $isit");
      return $isit;
    }
    else {
      MySQLaccess::Debug::Print(4,"Not checking for localhost");
      MySQLaccess::Debug::Print(4,"because ($MySQLaccess::host_name != $localhost) AND ($MySQLaccess::host_ip != $local_ip)");
      return 0;
    }
}


# =========================================
# check if host (IP or name) can be matched
# on the template.
# =========================================
sub MatchTemplate {
    my ($host,$tpl) = @_;
    my $match = 0;
   
    MySQLaccess::Debug::Print(1, "($host) =?= ($tpl)");

    my $host_name = IP2Name($host);
    my $host_ip   = Name2IP($host);

    MySQLaccess::Debug::Print(2, "name=$host_name ; ip=$host_ip");
    $match = (MySQLaccess::Wildcards::MatchTemplate($tpl,$host_name) or
             MySQLaccess::Wildcards::MatchTemplate($tpl,$host_ip));

    MySQLaccess::Debug::Print(2, "($host_name,$host_ip) =?= ($tpl): $ncount");

    return $match;
}

########################################################################
package MySQLaccess::Debug;
BEGIN {
   my $dbg_file = "$MySQLaccess::script_log";
   open(DEBUG,"> $dbg_file") or warn "Could not open outputfile $dbg_file for debugging-info\n";
   select DEBUG;
   $| = 1;
   select STDOUT;
}
# =========================================
# Print debugging information on STDERR
# =========================================
sub Print {
    my ($level,$mesg) = @_;
    my ($pack,$file,$line,$subname,$hasargs,$wantarray) = caller(1);
    my ($PACK)  = split('::',$subname); 
    my $DEBUG = ${$PACK."::DEBUG"} ? ${$PACK."::DEBUG"} : $MySQLaccess::DEBUG ;
    my ($sec,$min,$hour) = localtime();
    print DEBUG "[$hour:$min:$sec $subname] $mesg\n" if ($DEBUG>=$level);
}


Filemanager

Name Type Size Permission Actions
X11 Folder 0755
411toppm File 14.3 KB 0755
JxrDecApp File 26.38 KB 0755
JxrEncApp File 27.77 KB 0755
NF File 963 B 0755
VGAuthService File 130.54 KB 0755
[ File 54.44 KB 0755
aa-enabled File 18.3 KB 0755
aa-exec File 18.3 KB 0755
aa-features-abi File 18.3 KB 0755
ab File 58.43 KB 0755
acpidbg File 1.58 KB 0755
add-apt-repository File 16.04 KB 0755
addpart File 14.38 KB 0755
animate File 14.31 KB 0755
animate-im6 File 14.31 KB 0755
animate-im6.q16 File 14.31 KB 0755
anytopnm File 12.26 KB 0755
apport-bug File 2.27 KB 0755
apport-cli File 13.31 KB 0755
apport-collect File 2.27 KB 0755
apport-unpack File 3.7 KB 0755
appstreamcli File 138.23 KB 0755
apropos File 47.28 KB 0755
apt File 18.38 KB 0755
apt-add-repository File 16.04 KB 0755
apt-cache File 86.47 KB 0755
apt-cdrom File 26.47 KB 0755
apt-config File 30.39 KB 0755
apt-extracttemplates File 22.47 KB 0755
apt-ftparchive File 222.48 KB 0755
apt-get File 50.47 KB 0755
apt-key File 27.99 KB 0755
apt-mark File 54.47 KB 0755
apt-sortpkgs File 50.4 KB 0755
arch File 34.51 KB 0755
aria_chk File 5.52 MB 0755
aria_dump_log File 5.31 MB 0755
aria_ftdump File 5.32 MB 0755
aria_pack File 5.35 MB 0755
aria_read_log File 5.48 MB 0755
arpaname File 14.3 KB 0755
asciitopgm File 14.3 KB 0755
atktopbm File 14.3 KB 0755
automat-visualize3 File 984 B 0755
avstopam File 14.3 KB 0755
awk File 722.5 KB 0755
b2sum File 54.51 KB 0755
base32 File 38.51 KB 0755
base64 File 38.51 KB 0755
basename File 34.51 KB 0755
basenc File 46.51 KB 0755
bash File 1.38 MB 0755
bashbug File 6.82 KB 0755
bc File 90.82 KB 0755
bdftopcf File 42.26 KB 0755
bdftruncate File 14.15 KB 0755
bioradtopgm File 14.3 KB 0755
bmptopnm File 26.3 KB 0755
bmptoppm File 26.3 KB 0755
boltctl File 122.84 KB 0755
bpftrace File 2.15 MB 0755
bpftrace-aotrt File 985.37 KB 0755
brushtopbm File 14.3 KB 0755
btrfs File 1001.25 KB 0755
btrfs-convert File 576.3 KB 0755
btrfs-find-root File 520.3 KB 0755
btrfs-image File 552.3 KB 0755
btrfs-map-logical File 520.3 KB 0755
btrfs-select-super File 516.3 KB 0755
btrfsck File 1001.25 KB 0755
btrfstune File 544.3 KB 0755
busctl File 94.59 KB 0755
busybox File 2.03 MB 0755
byobu File 8.5 KB 0755
byobu-config File 996 B 0755
byobu-ctrl-a File 4.66 KB 0755
byobu-disable File 1.26 KB 0755
byobu-disable-prompt File 1.31 KB 0755
byobu-enable File 1.15 KB 0755
byobu-enable-prompt File 1.42 KB 0755
byobu-export File 1.39 KB 0755
byobu-janitor File 7.04 KB 0755
byobu-keybindings File 1.47 KB 0755
byobu-launch File 3.25 KB 0755
byobu-launcher File 1.87 KB 0755
byobu-launcher-install File 2.47 KB 0755
byobu-launcher-uninstall File 1.52 KB 0755
byobu-layout File 3.27 KB 0755
byobu-prompt File 1.13 KB 0755
byobu-quiet File 1.38 KB 0755
byobu-reconnect-sockets File 3.22 KB 0755
byobu-screen File 8.5 KB 0755
byobu-select-backend File 1.42 KB 0755
byobu-select-profile File 5.06 KB 0755
byobu-select-session File 1012 B 0755
byobu-shell File 1.66 KB 0755
byobu-silent File 1.28 KB 0755
byobu-status File 5.87 KB 0755
byobu-status-detail File 1.18 KB 0755
byobu-tmux File 8.5 KB 0755
byobu-ugraph File 4.56 KB 0755
byobu-ulevel File 11.71 KB 0755
c_rehash File 6.68 KB 0755
cacaclock File 14.45 KB 0755
cacademo File 278.39 KB 0755
cacafire File 18.3 KB 0755
cacaplay File 14.3 KB 0755
cacaserver File 18.3 KB 0755
cacaview File 22.39 KB 0755
cameratopam File 110.38 KB 0755
captoinfo File 90.41 KB 0755
cat File 38.46 KB 0755
catman File 30.77 KB 0755
certbot File 958 B 0755
cftp3 File 224 B 0755
cgi-fcgi File 18.15 KB 0755
chafa File 170.23 KB 0755
chage File 70.49 KB 2755
chardet File 221 B 0755
chardetect File 221 B 0755
chattr File 14.31 KB 0755
chcon File 58.51 KB 0755
checkgid File 14.3 KB 0755
chfn File 71.09 KB 4755
chgrp File 58.51 KB 0755
chmod File 54.51 KB 0755
choom File 22.38 KB 0755
chown File 58.51 KB 0755
chrt File 30.38 KB 0755
chsh File 43.71 KB 4755
chvt File 14.37 KB 0755
cifsiostat File 26.45 KB 0755
cistopbm File 14.3 KB 0755
ckbcomp File 147.14 KB 0755
ckeygen3 File 227 B 0755
cksum File 102.52 KB 0755
clear File 14.31 KB 0755
clear_console File 14.23 KB 0755
cmp File 42.39 KB 0755
cmuwmtopbm File 14.3 KB 0755
codepage File 14.3 KB 0755
col File 22.38 KB 0755
col1 File 963 B 0755
col2 File 963 B 0755
col3 File 963 B 0755
col4 File 963 B 0755
col5 File 963 B 0755
col6 File 963 B 0755
col7 File 963 B 0755
col8 File 963 B 0755
col9 File 963 B 0755
colcrt File 14.38 KB 0755
colrm File 14.38 KB 0755
column File 38.38 KB 0755
comm File 38.52 KB 0755
compare File 14.31 KB 0755
compare-im6 File 14.31 KB 0755
compare-im6.q16 File 14.31 KB 0755
composite File 14.31 KB 0755
composite-im6 File 14.31 KB 0755
composite-im6.q16 File 14.31 KB 0755
conch3 File 225 B 0755
conjure File 14.31 KB 0755
conjure-im6 File 14.31 KB 0755
conjure-im6.q16 File 14.31 KB 0755
convert File 14.31 KB 0755
convert-im6 File 14.31 KB 0755
convert-im6.q16 File 14.31 KB 0755
corelist File 15.01 KB 0755
cp File 138.52 KB 0755
cpan File 8.16 KB 0755
cpan5.38-x86_64-linux-gnu File 8.18 KB 0755
cpio File 137.67 KB 0755
cpupower File 1.58 KB 0755
crontab File 38.73 KB 2755
csplit File 50.51 KB 0755
ctail File 960 B 0755
ctstat File 22.66 KB 0755
curl File 290.32 KB 0755
cut File 38.51 KB 0755
cvtsudoers File 321.1 KB 0755
dash File 126.74 KB 0755
date File 106.51 KB 0755
dbilogstrip File 1.35 KB 0755
dbiprof File 6.06 KB 0755
dbiproxy File 5.27 KB 0755
dbus-cleanup-sockets File 14.29 KB 0755
dbus-daemon File 230.64 KB 0755
dbus-monitor File 26.3 KB 0755
dbus-run-session File 14.3 KB 0755
dbus-send File 30.29 KB 0755
dbus-update-activation-environment File 14.29 KB 0755
dbus-uuidgen File 14.29 KB 0755
dbxtool File 30.3 KB 0755
dd File 70.54 KB 0755
ddbugtopbm File 14.3 KB 0755
deallocvt File 14.37 KB 0755
deb-systemd-helper File 23.79 KB 0755
deb-systemd-invoke File 6.97 KB 0755
debconf File 2.8 KB 0755
debconf-apt-progress File 11.57 KB 0755
debconf-communicate File 623 B 0755
debconf-copydb File 1.68 KB 0755
debconf-escape File 668 B 0755
debconf-set-selections File 3.14 KB 0755
debconf-show File 1.78 KB 0755
debian-distro-info File 30.95 KB 0755
delpart File 14.38 KB 0755
delv File 45.32 KB 0755
df File 87.08 KB 0755
dh_bash-completion File 4.42 KB 0755
dh_installxmlcatalogs File 9.22 KB 0755
dh_perl_dbi File 1.17 KB 0755
diff File 134.55 KB 0755
diff3 File 58.52 KB 0755
dig File 150.83 KB 0755
dir File 138.98 KB 0755
dircolors File 46.52 KB 0755
dirmngr File 473.77 KB 0755
dirmngr-client File 54.92 KB 0755
dirname File 34.38 KB 0755
display File 14.31 KB 0755
display-im6 File 14.31 KB 0755
display-im6.q16 File 14.31 KB 0755
distro-info File 26.89 KB 0755
dmesg File 68.64 KB 0755
dnsdomainname File 22.23 KB 0755
dnssec-cds File 51.39 KB 0755
dnssec-dsfromkey File 38.38 KB 0755
dnssec-importkey File 38.38 KB 0755
dnssec-keyfromlabel File 42.38 KB 0755
dnssec-keygen File 46.38 KB 0755
dnssec-revoke File 30.38 KB 0755
dnssec-settime File 46.38 KB 0755
dnssec-signzone File 90.41 KB 0755
dnssec-verify File 30.39 KB 0755
do-release-upgrade File 10.42 KB 0755
domainname File 22.23 KB 0755
dpkg File 310.72 KB 0755
dpkg-deb File 142.58 KB 0755
dpkg-divert File 118.57 KB 0755
dpkg-maintscript-helper File 20.71 KB 0755
dpkg-query File 134.56 KB 0755
dpkg-realpath File 4.09 KB 0755
dpkg-split File 98.53 KB 0755
dpkg-statoverride File 50.38 KB 0755
dpkg-trigger File 42.53 KB 0755
du File 98.51 KB 0755
dumpkeys File 162.85 KB 0755
dvipdf File 1007 B 0755
ec2metadata File 8.38 KB 0755
echo File 34.38 KB 0755
ed File 58.55 KB 0755
editor File 272.5 KB 0755
egrep File 41 B 0755
eject File 42.23 KB 0755
enc2xs File 40.96 KB 0755
encguess File 3 KB 0755
env File 46.95 KB 0755
envsubst File 34.38 KB 0755
eps2eps File 639 B 0755
eqn File 188.45 KB 0755
escp2topbm File 14.3 KB 0755
ex File 3.94 MB 0755
expand File 34.53 KB 0755
expiry File 26.52 KB 2755
expr File 42.41 KB 0755
eyuvtoppm File 14.3 KB 0755
factor File 62.51 KB 0755
fail2ban-client File 1.39 KB 0755
fail2ban-python File 7.65 MB 0755
fail2ban-regex File 1.25 KB 0755
fail2ban-server File 1.38 KB 0755
fail2ban-testcases File 2.23 KB 0755
faillog File 22.63 KB 0755
fallocate File 26.38 KB 0755
false File 26.3 KB 0755
fc-cache File 22.38 KB 0755
fc-cat File 18.38 KB 0755
fc-conflist File 14.38 KB 0755
fc-list File 14.38 KB 0755
fc-match File 14.38 KB 0755
fc-pattern File 14.38 KB 0755
fc-query File 14.38 KB 0755
fc-scan File 14.38 KB 0755
fc-validate File 14.38 KB 0755
fcgistarter File 14.3 KB 0755
fgconsole File 14.37 KB 0755
fgrep File 41 B 0755
fiascotopnm File 95.15 KB 0755
figlet File 26.68 KB 0755
figlet-toilet File 26.68 KB 0755
filan File 50.48 KB 0755
file File 30.6 KB 0755
finalrd File 2.06 KB 0755
find File 199.48 KB 0755
findmnt File 67.66 KB 0755
fitstopnm File 18.3 KB 0755
flock File 22.48 KB 0755
fmt File 38.51 KB 0755
fold File 34.51 KB 0755
fonttosfnt File 38.16 KB 0755
free File 26.38 KB 0755
fstopgm File 14.3 KB 0755
ftp File 182.9 KB 0755
funzip File 26.3 KB 0755
fuser File 39.34 KB 0755
fusermount File 38.38 KB 4755
fusermount3 File 38.38 KB 4755
fwupdmgr File 118.3 KB 0755
fwupdtool File 110.3 KB 0755
g3topbm File 19.13 KB 0755
galera_new_cluster File 917 B 0755
galera_recovery File 3.29 KB 0755
gapplication File 22.38 KB 0755
gawk File 722.5 KB 0755
gawkbug File 6.74 KB 0755
gdbus File 50.38 KB 0755
gdk-pixbuf-csource File 14.33 KB 0755
gdk-pixbuf-pixdata File 14.31 KB 0755
gdk-pixbuf-thumbnailer File 18.39 KB 0755
gemtopbm File 14.3 KB 0755
gemtopnm File 14.3 KB 0755
gencat File 26.44 KB 0755
geoiplookup File 18.3 KB 0755
geoiplookup6 File 14.3 KB 0755
geqn File 188.45 KB 0755
getconf File 26.36 KB 0755
getent File 38.72 KB 0755
getkeycodes File 14.37 KB 0755
getopt File 22.38 KB 0755
gettext File 34.38 KB 0755
gettext.sh File 5.07 KB 0755
ghostscript File 14.15 KB 0755
giftopnm File 26.3 KB 0755
ginstall-info File 47.24 KB 0755
gio File 102.4 KB 0755
gio-querymodules File 18.3 KB 0755
git File 3.88 MB 0755
git-receive-pack File 3.88 MB 0755
git-shell File 624.81 KB 0755
git-upload-archive File 3.88 MB 0755
git-upload-pack File 3.88 MB 0755
glib-compile-schemas File 54.3 KB 0755
gouldtoppm File 14.3 KB 0755
gpasswd File 74.46 KB 4755
gpg File 1.09 MB 0755
gpg-agent File 357.52 KB 0755
gpg-connect-agent File 87.3 KB 0755
gpg-wks-client File 139.37 KB 0755
gpgconf File 115.36 KB 0755
gpgparsemail File 34.38 KB 0755
gpgsm File 501.37 KB 0755
gpgsplit File 26.62 KB 0755
gpgtar File 67.83 KB 0755
gpgv File 303.14 KB 0755
gpic File 196.06 KB 0755
gpu-manager File 78.82 KB 0755
grep File 182.45 KB 0755
gresource File 22.3 KB 0755
groff File 94.51 KB 0755
grog File 18.75 KB 0755
grops File 162.55 KB 0755
grotty File 118.51 KB 0755
groups File 34.51 KB 0755
growpart File 29.19 KB 0755
grub-editenv File 393.16 KB 0755
grub-file File 741.88 KB 0755
grub-fstest File 863.32 KB 0755
grub-glue-efi File 102.88 KB 0755
grub-kbdcomp File 1.64 KB 0755
grub-menulst2cfg File 83.2 KB 0755
grub-mkfont File 131.45 KB 0755
grub-mkimage File 377.26 KB 0755
grub-mklayout File 103.23 KB 0755
grub-mknetdir File 429.77 KB 0755
grub-mkpasswd-pbkdf2 File 111.32 KB 0755
grub-mkrelpath File 259.79 KB 0755
grub-mkrescue File 1019.84 KB 0755
grub-mkstandalone File 510.16 KB 0755
grub-mount File 682.21 KB 0755
grub-ntldr-img File 38.39 KB 0755
grub-render-label File 750.23 KB 0755
grub-script-check File 126.76 KB 0755
grub-syslinux2cfg File 698.71 KB 0755
gs File 14.15 KB 0755
gsbj File 350 B 0755
gsdj File 352 B 0755
gsdj500 File 352 B 0755
gsettings File 30.3 KB 0755
gslj File 353 B 0755
gslp File 350 B 0755
gsnd File 277 B 0755
gtbl File 134.48 KB 0755
gunzip File 2.29 KB 0755
gzexe File 6.3 KB 0755
gzip File 91.23 KB 0755
h2ph File 28.54 KB 0755
h2xs File 59.51 KB 0755
hardlink File 46.48 KB 0755
hd File 46.39 KB 0755
hdifftopam File 14.3 KB 0755
head File 42.51 KB 0755
helpztags File 2.46 KB 0755
hexdump File 46.39 KB 0755
hipstopgm File 14.3 KB 0755
host File 118.82 KB 0755
hostid File 34.51 KB 0755
hostname File 22.23 KB 0755
hostnamectl File 30.45 KB 0755
hpcdtoppm File 798 B 0755
htcacheclean File 34.31 KB 0755
htdbm File 26.3 KB 0755
htdigest File 14.3 KB 0755
htop File 370.33 KB 0755
htpasswd File 26.3 KB 0755
hwe-support-status File 11.24 KB 0755
i386 File 26.65 KB 0755
icontopbm File 14.3 KB 0755
iconv File 66.48 KB 0755
id File 38.51 KB 0755
identify File 14.31 KB 0755
identify-im6 File 14.31 KB 0755
identify-im6.q16 File 14.31 KB 0755
ilbmtoppm File 38.38 KB 0755
imagetops File 1.21 KB 0755
img2sixel File 26.3 KB 0755
img2txt File 18.66 KB 0755
imgtoppm File 14.3 KB 0755
import File 14.31 KB 0755
import-im6 File 14.31 KB 0755
import-im6.q16 File 14.31 KB 0755
inetutils-telnet File 177.85 KB 0755
info File 241.73 KB 0755
infobrowser File 241.73 KB 0755
infocmp File 66.38 KB 0755
infotocap File 90.41 KB 0755
infotopam File 18.3 KB 0755
innochecksum File 4.57 MB 0755
innotop File 445.71 KB 0755
install File 142.52 KB 0755
install-info File 47.24 KB 0755
instmodsh File 4.27 KB 0755
ionice File 18.38 KB 0755
iostat File 54.44 KB 0755
ip File 754.8 KB 0755
ipcmk File 22.45 KB 0755
ipcrm File 18.38 KB 0755
ipcs File 38.38 KB 0755
iptables-xml File 92.95 KB 0755
ischroot File 14.48 KB 0755
iscsiadm File 370.43 KB 0755
jbigtopnm File 57.14 KB 0755
join File 50.55 KB 0755
journalctl File 78.91 KB 0755
jp2a File 50.75 KB 0755
jpeg2ktopam File 208.82 KB 0755
jpegtopnm File 38.38 KB 0755
jq File 30.15 KB 0755
json_pp File 4.88 KB 0755
kbd_mode File 14.66 KB 0755
kbdinfo File 18.37 KB 0755
kbxutil File 62.83 KB 0755
keep-one-running File 3.51 KB 0755
kernel-install File 54.67 KB 0755
kill File 22.38 KB 0755
killall File 31.34 KB 0755
kmod File 170.24 KB 0755
kmodsign File 18.45 KB 0755
landscape-sysinfo File 646 B 0755
last File 34.38 KB 0755
lastb File 34.38 KB 0755
lastlog File 27.79 KB 0755
lcf File 7.6 KB 0755
ld.so File 231.07 KB 0755
ldd File 5.26 KB 0755
leaftoppm File 14.3 KB 0755
less File 190.38 KB 0755
lessecho File 14.31 KB 0755
lessfile File 8.83 KB 0755
lesskey File 23.7 KB 0755
lesspipe File 8.83 KB 0755
letsencrypt File 958 B 0755
lexgrog File 99.51 KB 0755
libnetcfg File 15.41 KB 0755
libsixel-config File 1.81 KB 0755
link File 34.51 KB 0755
linux-boot-prober File 1.54 KB 0755
linux-check-removal File 3.99 KB 0755
linux-update-symlinks File 6.17 KB 0755
linux-version File 2.63 KB 0755
linux32 File 26.65 KB 0755
linux64 File 26.65 KB 0755
lispmtopgm File 14.3 KB 0755
ln File 54.51 KB 0755
lnstat File 22.66 KB 0755
loadkeys File 202.9 KB 0755
loadunimap File 34.46 KB 0755
locale File 49.63 KB 0755
locale-check File 14.15 KB 0755
localectl File 26.45 KB 0755
localedef File 319.09 KB 0755
logger File 38.97 KB 0755
login File 51.81 KB 0755
loginctl File 66.58 KB 0755
logname File 34.51 KB 0755
logresolve File 14.31 KB 0755
look File 18.38 KB 0755
lowntfs-3g File 118.98 KB 0755
ls File 138.98 KB 0755
lsattr File 14.31 KB 0755
lsb_release File 2.59 KB 0755
lsblk File 146.38 KB 0755
lscpu File 110.38 KB 0755
lshw File 957.2 KB 0755
lsinitramfs File 735 B 0755
lsipc File 50.38 KB 0755
lslocks File 30.77 KB 0755
lslogins File 50.38 KB 0755
lsmem File 38.38 KB 0755
lsmod File 170.24 KB 0755
lsns File 42.38 KB 0755
lsof File 171.66 KB 0755
lspci File 100.11 KB 0755
lspgpot File 1.06 KB 0755
lspower File 1.18 KB 0755
lsusb File 246.52 KB 0755
lzcat File 86.92 KB 0755
lzcmp File 7.25 KB 0755
lzdiff File 7.25 KB 0755
lzegrep File 10.09 KB 0755
lzfgrep File 10.09 KB 0755
lzgrep File 10.09 KB 0755
lzless File 1.77 KB 0755
lzma File 86.92 KB 0755
lzmainfo File 14.38 KB 0755
lzmore File 2.14 KB 0755
macptopbm File 14.3 KB 0755
mailmail3 File 227 B 0755
man File 125.41 KB 0755
man-recode File 35.4 KB 0755
mandb File 143.67 KB 0755
manifest File 1.9 KB 0755
manpath File 26.78 KB 0755
mapscrn File 30.46 KB 0755
mariadb File 5.07 MB 0755
mariadb-access File 109.31 KB 0755
mariadb-admin File 4.85 MB 0755
mariadb-analyze File 4.84 MB 0755
mariadb-binlog File 5.13 MB 0755
mariadb-check File 4.84 MB 0755
mariadb-conv File 4.56 MB 0755
mariadb-convert-table-format File 4.12 KB 0755
mariadb-dump File 4.93 MB 0755
mariadb-dumpslow File 8.05 KB 0755
mariadb-find-rows File 3.21 KB 0755
mariadb-fix-extensions File 1.22 KB 0755
mariadb-hotcopy File 34.53 KB 0755
mariadb-import File 4.83 MB 0755
mariadb-install-db File 22.13 KB 0755
mariadb-optimize File 4.84 MB 0755
mariadb-plugin File 4.54 MB 0755
mariadb-repair File 4.84 MB 0755
mariadb-report File 49.02 KB 0755
mariadb-secure-installation File 13.49 KB 0755
mariadb-service-convert File 2.45 KB 0755
mariadb-setpermission File 17.56 KB 0755
mariadb-show File 4.83 MB 0755
mariadb-slap File 4.85 MB 0755
mariadb-tzinfo-to-sql File 4.53 MB 0755
mariadb-upgrade File 4.97 MB 0755
mariadb-waitpid File 4.53 MB 0755
mariadbcheck File 4.84 MB 0755
mariadbd-multi File 26.69 KB 0755
mariadbd-safe File 30.42 KB 0755
mariadbd-safe-helper File 4.49 MB 0755
markdown-it File 220 B 0755
mawk File 166.77 KB 0755
mbim-network File 11.08 KB 0755
mbimcli File 216.74 KB 0755
mcookie File 26.45 KB 0755
md5sum File 38.41 KB 0755
md5sum.textutils File 38.41 KB 0755
mdatopbm File 14.3 KB 0755
mdig File 50.4 KB 0755
memhog File 14.42 KB 0755
memusage File 7.32 KB 0755
memusagestat File 22.44 KB 0755
mesg File 14.38 KB 0755
mgrtopbm File 14.3 KB 0755
migrate-pubring-from-classic-gpg File 3.02 KB 0755
migratepages File 14.38 KB 0755
migspeed File 14.3 KB 0755
mk_modmap File 15.78 KB 0755
mkdir File 74.51 KB 0755
mkfifo File 42.51 KB 0755
mkfontdir File 65 B 0755
mkfontscale File 42.67 KB 0755
mknod File 42.51 KB 0755
mkpasswd File 26.38 KB 0755
mksquashfs File 286.95 KB 0755
mktemp File 34.51 KB 0755
mmcli File 273.94 KB 0755
mogrify File 14.31 KB 0755
mogrify-im6 File 14.31 KB 0755
mogrify-im6.q16 File 14.31 KB 0755
montage File 14.31 KB 0755
montage-im6 File 14.31 KB 0755
montage-im6.q16 File 14.31 KB 0755
more File 46.38 KB 0755
mount File 50.38 KB 4755
mountpoint File 18.38 KB 0755
mpstat File 50.45 KB 0755
mrftopbm File 14.3 KB 0755
msql2mysql File 1.41 KB 0755
mt File 70.73 KB 0755
mt-gnu File 70.73 KB 0755
mtr File 76.25 KB 0755
mtr-packet File 34.3 KB 0755
mtrace File 6.37 KB 0755
mtvtoppm File 14.3 KB 0755
mv File 134.52 KB 0755
my_print_defaults File 4.53 MB 0755
myisam_ftdump File 4.87 MB 0755
myisamchk File 4.99 MB 0755
myisamlog File 4.85 MB 0755
myisampack File 4.9 MB 0755
mysql File 5.07 MB 0755
mysql_convert_table_format File 4.12 KB 0755
mysql_find_rows File 3.21 KB 0755
mysql_fix_extensions File 1.22 KB 0755
mysql_install_db File 22.13 KB 0755
mysql_plugin File 4.54 MB 0755
mysql_secure_installation File 13.49 KB 0755
mysql_setpermission File 17.56 KB 0755
mysql_tzinfo_to_sql File 4.53 MB 0755
mysql_upgrade File 4.97 MB 0755
mysql_waitpid File 4.53 MB 0755
mysqlaccess File 109.31 KB 0755
mysqladmin File 4.85 MB 0755
mysqlanalyze File 4.84 MB 0755
mysqlbinlog File 5.13 MB 0755
mysqlcheck File 4.84 MB 0755
mysqld_multi File 26.69 KB 0755
mysqld_safe File 30.42 KB 0755
mysqld_safe_helper File 4.49 MB 0755
mysqldump File 4.93 MB 0755
mysqldumpslow File 8.05 KB 0755
mysqlhotcopy File 34.53 KB 0755
mysqlimport File 4.83 MB 0755
mysqloptimize File 4.84 MB 0755
mysqlrepair File 4.84 MB 0755
mysqlreport File 49.02 KB 0755
mysqlshow File 4.83 MB 0755
mysqlslap File 4.85 MB 0755
mytop File 71.95 KB 0755
named-checkconf File 38.4 KB 0755
named-checkzone File 30.4 KB 0755
named-compilezone File 30.4 KB 0755
named-journalprint File 14.3 KB 0755
named-nzd2nzf File 14.3 KB 0755
named-rrchecker File 22.3 KB 0755
namei File 22.38 KB 0755
nano File 272.5 KB 0755
nawk File 722.5 KB 0755
nc File 38.63 KB 0755
nc.openbsd File 38.63 KB 0755
neofetch File 333.58 KB 0755
neotoppm File 14.3 KB 0755
neqn File 913 B 0755
netaddr File 959 B 0755
netcat File 38.63 KB 0755
networkctl File 122.58 KB 0755
networkd-dispatcher File 19.88 KB 0755
newgrp File 39.71 KB 4755
ngettext File 34.38 KB 0755
nice File 34.51 KB 0755
nisdomainname File 22.23 KB 0755
nl File 38.6 KB 0755
nohup File 34.41 KB 0755
nproc File 34.51 KB 0755
nroff File 5.58 KB 0755
nsec3hash File 14.3 KB 0755
nsenter File 30.6 KB 0755
nslookup File 122.82 KB 0755
nstat File 30.38 KB 0755
nsupdate File 74.55 KB 0755
ntfs-3g File 159.01 KB 0755
ntfs-3g.probe File 14.38 KB 0755
ntfscat File 26.38 KB 0755
ntfscluster File 38.38 KB 0755
ntfscmp File 30.38 KB 0755
ntfsdecrypt File 42.38 KB 0755
ntfsfallocate File 26.38 KB 0755
ntfsfix File 34.38 KB 0755
ntfsinfo File 54.38 KB 0755
ntfsls File 27.45 KB 0755
ntfsmove File 30.38 KB 0755
ntfsrecover File 102.38 KB 0755
ntfssecaudit File 78.86 KB 0755
ntfstruncate File 26.3 KB 0755
ntfsusermap File 18.3 KB 0755
ntfswipe File 46.91 KB 0755
numactl File 35.23 KB 0755
numastat File 35.56 KB 0755
numfmt File 58.54 KB 0755
nvidia-detector File 270 B 0755
od File 70.51 KB 0755
oem-getlogs File 8.3 KB 0755
on_ac_power File 3.7 KB 0755
openssl File 981.8 KB 0755
openvt File 22.73 KB 0755
os-prober File 4.42 KB 0755
pager File 190.38 KB 0755
palmtopnm File 26.3 KB 0755
pamaddnoise File 18.3 KB 0755
pamaltsat File 14.34 KB 0755
pamarith File 22.3 KB 0755
pambackground File 18.3 KB 0755
pambayer File 14.38 KB 0755
pambrighten File 14.3 KB 0755
pamcat File 22.3 KB 0755
pamchannel File 14.3 KB 0755
pamcomp File 18.3 KB 0755
pamcrater File 18.3 KB 0755
pamcut File 18.3 KB 0755
pamdeinterlace File 14.3 KB 0755
pamdepth File 14.3 KB 0755
pamdice File 18.3 KB 0755
pamditherbw File 26.3 KB 0755
pamedge File 14.3 KB 0755
pamendian File 14.3 KB 0755
pamenlarge File 18.38 KB 0755
pamexec File 14.3 KB 0755
pamfile File 14.3 KB 0755
pamfind File 14.3 KB 0755
pamfix File 14.3 KB 0755
pamfixtrunc File 2.01 KB 0755
pamflip File 22.3 KB 0755
pamfunc File 18.3 KB 0755
pamgauss File 14.3 KB 0755
pamgetcolor File 18.38 KB 0755
pamgradient File 14.3 KB 0755
pamhomography File 18.3 KB 0755
pamhue File 14.3 KB 0755
pamlevels File 18.3 KB 0755
pamlookup File 14.3 KB 0755
pammasksharpen File 14.3 KB 0755
pammixinterlace File 14.38 KB 0755
pammixmulti File 18.3 KB 0755
pammosaicknit File 14.3 KB 0755
pamoil File 14.3 KB 0755
pampaintspill File 18.3 KB 0755
pamperspective File 30.38 KB 0755
pampick File 14.3 KB 0755
pampop9 File 14.3 KB 0755
pamrecolor File 18.3 KB 0755
pamrestack File 14.3 KB 0755
pamrgbatopng File 34.3 KB 0755
pamrubber File 34.3 KB 0755
pamscale File 34.38 KB 0755
pamseq File 14.3 KB 0755
pamshadedrelief File 14.3 KB 0755
pamsharpmap File 14.3 KB 0755
pamsharpness File 14.3 KB 0755
pamshuffle File 14.3 KB 0755
pamsistoaglyph File 14.3 KB 0755
pamslice File 14.3 KB 0755
pamsplit File 14.3 KB 0755
pamstack File 14.3 KB 0755
pamstereogram File 30.3 KB 0755
pamstretch File 14.3 KB 0755
pamstretch-gen File 3.83 KB 0755
pamsumm File 14.3 KB 0755
pamsummcol File 14.3 KB 0755
pamtable File 14.3 KB 0755
pamthreshold File 18.3 KB 0755
pamtilt File 18.3 KB 0755
pamtoavs File 14.3 KB 0755
pamtodjvurle File 14.3 KB 0755
pamtofits File 14.3 KB 0755
pamtogif File 26.3 KB 0755
pamtohdiff File 14.3 KB 0755
pamtohtmltbl File 14.3 KB 0755
pamtojpeg2k File 212.82 KB 0755
pamtompfont File 14.3 KB 0755
pamtooctaveimg File 14.3 KB 0755
pamtopam File 14.3 KB 0755
pamtopdbimg File 18.38 KB 0755
pamtopfm File 14.3 KB 0755
pamtopng File 34.3 KB 0755
pamtopnm File 14.3 KB 0755
pamtoqoi File 18.3 KB 0755
pamtosrf File 18.3 KB 0755
pamtosvg File 70.15 KB 0755
pamtotga File 18.3 KB 0755
pamtotiff File 46.38 KB 0755
pamtouil File 14.3 KB 0755
pamtowinicon File 18.3 KB 0755
pamtoxvmini File 14.3 KB 0755
pamtris File 26.3 KB 0755
pamundice File 18.3 KB 0755
pamunlookup File 14.3 KB 0755
pamvalidate File 14.3 KB 0755
pamwipeout File 14.3 KB 0755
pamx File 42.38 KB 0755
paperconf File 14.15 KB 0755
partx File 62.38 KB 0755
passwd File 62.65 KB 4755
paste File 38.41 KB 0755
pastebinit File 16.31 KB 0755
patch File 182.52 KB 0755
pathchk File 34.51 KB 0755
pbget File 2.51 KB 0755
pbmclean File 18.3 KB 0755
pbmlife File 14.3 KB 0755
pbmmake File 14.3 KB 0755
pbmmask File 14.3 KB 0755
pbmminkowski File 14.3 KB 0755
pbmnoise File 14.3 KB 0755
pbmpage File 14.3 KB 0755
pbmpscale File 14.3 KB 0755
pbmreduce File 14.3 KB 0755
pbmtext File 30.48 KB 0755
pbmtextps File 22.3 KB 0755
pbmto10x File 14.3 KB 0755
pbmto4425 File 14.3 KB 0755
pbmtoascii File 14.3 KB 0755
pbmtoatk File 14.3 KB 0755
pbmtobbnbg File 14.3 KB 0755
pbmtocis File 14.3 KB 0755
pbmtocmuwm File 14.3 KB 0755
pbmtodjvurle File 14.3 KB 0755
pbmtoepsi File 14.3 KB 0755
pbmtoepson File 14.3 KB 0755
pbmtoescp2 File 14.3 KB 0755
pbmtog3 File 19.13 KB 0755
pbmtogem File 14.3 KB 0755
pbmtogo File 14.3 KB 0755
pbmtoibm23xx File 14.3 KB 0755
pbmtoicon File 14.3 KB 0755
pbmtolj File 18.3 KB 0755
pbmtoln03 File 14.3 KB 0755
pbmtolps File 14.3 KB 0755
pbmtomacp File 14.3 KB 0755
pbmtomatrixorbital File 14.3 KB 0755
pbmtomda File 14.3 KB 0755
pbmtomgr File 14.3 KB 0755
pbmtomrf File 14.3 KB 0755
pbmtonokia File 14.3 KB 0755
pbmtopgm File 14.3 KB 0755
pbmtopi3 File 14.3 KB 0755
pbmtopk File 26.6 KB 0755
pbmtoplot File 14.3 KB 0755
pbmtoppa File 30.38 KB 0755
pbmtopsg3 File 15.94 KB 0755
pbmtoptx File 14.3 KB 0755
pbmtosunicon File 14.3 KB 0755
pbmtowbmp File 14.3 KB 0755
pbmtox10bm File 2.83 KB 0755
pbmtoxbm File 14.3 KB 0755
pbmtoybm File 14.3 KB 0755
pbmtozinc File 14.3 KB 0755
pbmupc File 22.3 KB 0755
pbput File 2.51 KB 0755
pbputs File 2.51 KB 0755
pc1toppm File 14.3 KB 0755
pcdindex File 6.56 KB 0755
pcdovtoppm File 6.56 KB 0755
pcxtoppm File 18.3 KB 0755
pdb3 File 67.83 KB 0755
pdb3.12 File 67.83 KB 0755
pdbimgtopam File 18.38 KB 0755
pdf2dsc File 698 B 0755
pdf2ps File 909 B 0755
pear File 793 B 0755
peardev File 814 B 0755
pecl File 727 B 0755
peekfd File 14.3 KB 0755
perf File 1.58 KB 0755
perl File 3.83 MB 0755
perl5.38-x86_64-linux-gnu File 14.3 KB 0755
perl5.38.2 File 3.83 MB 0755
perlbug File 44.52 KB 0755
perldoc File 125 B 0755
perlivp File 10.61 KB 0755
perlthanks File 44.52 KB 0755
perror File 4.72 MB 0755
pf2afm File 498 B 0755
pfbtopfa File 516 B 0755
pfmtopam File 14.3 KB 0755
pgmabel File 18.3 KB 0755
pgmbentley File 14.3 KB 0755
pgmcrater File 3.49 KB 0755
pgmdeshadow File 14.3 KB 0755
pgmedge File 14.3 KB 0755
pgmenhance File 14.3 KB 0755
pgmhist File 18.3 KB 0755
pgmkernel File 14.3 KB 0755
pgmmake File 14.3 KB 0755
pgmmedian File 18.3 KB 0755
pgmminkowski File 14.3 KB 0755
pgmmorphconv File 14.3 KB 0755
pgmnoise File 14.3 KB 0755
pgmnorm File 18.3 KB 0755
pgmoil File 14.3 KB 0755
pgmramp File 14.3 KB 0755
pgmslice File 14.3 KB 0755
pgmtexture File 26.3 KB 0755
pgmtofs File 14.3 KB 0755
pgmtolispm File 14.3 KB 0755
pgmtopbm File 22.3 KB 0755
pgmtopgm File 14.3 KB 0755
pgmtoppm File 14.3 KB 0755
pgmtosbig File 14.3 KB 0755
pgmtost4 File 14.3 KB 0755
pgrep File 34.47 KB 0755
phar File 14.84 KB 0755
phar.phar File 14.84 KB 0755
phar.phar8.3 File 14.84 KB 0755
phar8.3 File 14.84 KB 0755
phar8.3.phar File 14.84 KB 0755
php File 5.52 MB 0755
php8.3 File 5.52 MB 0755
pi1toppm File 14.3 KB 0755
pi3topbm File 14.3 KB 0755
pic File 196.06 KB 0755
pico File 272.5 KB 0755
piconv File 8.16 KB 0755
pidof File 26.23 KB 0755
pidstat File 50.45 KB 0755
pidwait File 34.47 KB 0755
pinentry File 58.65 KB 0755
pinentry-curses File 58.65 KB 0755
ping File 87.7 KB 0755
ping4 File 87.7 KB 0755
ping6 File 87.7 KB 0755
pinky File 38.41 KB 0755
pjtoppm File 18.3 KB 0755
pkaction File 18.3 KB 0755
pkcheck File 22.3 KB 0755
pkcon File 54.3 KB 0755
pkill File 34.47 KB 0755
pkmon File 22.3 KB 0755
pktopbm File 18.3 KB 0755
pkttyagent File 22.3 KB 0755
pl2pm File 4.43 KB 0755
pldd File 22.44 KB 0755
plymouth File 46.3 KB 0755
pmap File 34.4 KB 0755
pngtopam File 34.38 KB 0755
pngtopnm File 34.38 KB 0755
pnmalias File 18.3 KB 0755
pnmarith File 22.3 KB 0755
pnmcat File 22.3 KB 0755
pnmcolormap File 18.3 KB 0755
pnmcomp File 18.3 KB 0755
pnmconvol File 34.3 KB 0755
pnmcrop File 26.38 KB 0755
pnmcut File 18.3 KB 0755
pnmdepth File 14.3 KB 0755
pnmenlarge File 18.38 KB 0755
pnmfile File 14.3 KB 0755
pnmflip File 3.63 KB 0755
pnmgamma File 18.3 KB 0755
pnmhisteq File 14.3 KB 0755
pnmhistmap File 18.3 KB 0755
pnmindex File 18.3 KB 0755
pnminterp File 14.3 KB 0755
pnminterp-gen File 3.83 KB 0755
pnminvert File 14.3 KB 0755
pnmmargin File 2.42 KB 0755
pnmmercator File 14.3 KB 0755
pnmmontage File 18.3 KB 0755
pnmnlfilt File 22.36 KB 0755
pnmnoraw File 31 B 0755
pnmnorm File 18.3 KB 0755
pnmpad File 22.3 KB 0755
pnmpaste File 18.3 KB 0755
pnmpsnr File 18.3 KB 0755
pnmquant File 10.63 KB 0755
pnmquantall File 6.84 KB 0755
pnmremap File 18.3 KB 0755
pnmrotate File 18.3 KB 0755
pnmscale File 34.38 KB 0755
pnmscalefixed File 18.3 KB 0755
pnmshear File 14.3 KB 0755
pnmsmooth File 14.3 KB 0755
pnmsplit File 14.3 KB 0755
pnmstitch File 34.97 KB 0755
pnmtile File 14.3 KB 0755
pnmtoddif File 18.3 KB 0755
pnmtofiasco File 164.21 KB 0755
pnmtofits File 14.3 KB 0755
pnmtojbig File 61.14 KB 0755
pnmtojpeg File 26.3 KB 0755
pnmtopalm File 26.3 KB 0755
pnmtopclxl File 22.81 KB 0755
pnmtoplainpnm File 31 B 0755
pnmtopng File 54.3 KB 0755
pnmtopnm File 14.3 KB 0755
pnmtops File 34.3 KB 0755
pnmtorast File 18.3 KB 0755
pnmtorle File 34.55 KB 0755
pnmtosgi File 14.3 KB 0755
pnmtosir File 14.3 KB 0755
pnmtotiff File 46.38 KB 0755
pnmtotiffcmyk File 38.38 KB 0755
pnmtoxwd File 18.3 KB 0755
pod2html File 3.95 KB 0755
pod2man File 18.46 KB 0755
pod2text File 12.8 KB 0755
pod2usage File 4.01 KB 0755
podchecker File 3.57 KB 0755
pollinate File 8.54 KB 0755
pphs File 404 B 0755
ppm3d File 18.3 KB 0755
ppmbrighten File 2 KB 0755
ppmchange File 14.3 KB 0755
ppmcie File 26.47 KB 0755
ppmcolormask File 14.3 KB 0755
ppmcolors File 14.3 KB 0755
ppmdcfont File 14.3 KB 0755
ppmddumpfont File 14.3 KB 0755
ppmdim File 14.3 KB 0755
ppmdist File 14.3 KB 0755
ppmdither File 14.3 KB 0755
ppmdmkfont File 22.02 KB 0755
ppmdraw File 22.3 KB 0755
ppmfade File 14.76 KB 0755
ppmflash File 14.3 KB 0755
ppmforge File 22.3 KB 0755
ppmglobe File 14.3 KB 0755
ppmhist File 18.3 KB 0755
ppmlabel File 14.3 KB 0755
ppmmake File 14.3 KB 0755
ppmmix File 14.3 KB 0755
ppmnorm File 18.3 KB 0755
ppmntsc File 14.3 KB 0755
ppmpat File 30.3 KB 0755
ppmquant File 2.3 KB 0755
ppmquantall File 6.84 KB 0755
ppmrainbow File 3.48 KB 0755
ppmrelief File 14.3 KB 0755
ppmrough File 18.3 KB 0755
ppmshadow File 10.85 KB 0755
ppmshift File 14.3 KB 0755
ppmspread File 14.3 KB 0755
ppmtoacad File 19.15 KB 0755
ppmtoapplevol File 14.3 KB 0755
ppmtoarbtxt File 18.3 KB 0755
ppmtoascii File 14.38 KB 0755
ppmtobmp File 18.3 KB 0755
ppmtoeyuv File 18.3 KB 0755
ppmtogif File 14.3 KB 0755
ppmtoicr File 14.3 KB 0755
ppmtoilbm File 42.39 KB 0755
ppmtojpeg File 26.3 KB 0755
ppmtoleaf File 14.3 KB 0755
ppmtolj File 14.3 KB 0755
ppmtomap File 82 B 0755
ppmtomitsu File 22.3 KB 0755
ppmtompeg File 494.09 KB 0755
ppmtoneo File 14.3 KB 0755
ppmtopcx File 18.3 KB 0755
ppmtopgm File 18.3 KB 0755
ppmtopi1 File 14.3 KB 0755
ppmtopict File 14.3 KB 0755
ppmtopj File 14.38 KB 0755
ppmtopjxl File 18.38 KB 0755
ppmtoppm File 14.3 KB 0755
ppmtopuzz File 14.3 KB 0755
ppmtorgb3 File 14.3 KB 0755
ppmtosixel File 14.3 KB 0755
ppmtospu File 14.3 KB 0755
ppmtoterm File 14.3 KB 0755
ppmtotga File 18.3 KB 0755
ppmtouil File 14.3 KB 0755
ppmtowinicon File 18.3 KB 0755
ppmtoxpm File 18.3 KB 0755
ppmtoyuv File 14.3 KB 0755
ppmtoyuvsplit File 14.3 KB 0755
ppmtv File 14.3 KB 0755
ppmwheel File 14.3 KB 0755
pr File 70.58 KB 0755
preconv File 58.48 KB 0755
printafm File 395 B 0755
printenv File 34.38 KB 0755
printf File 54.44 KB 0755
prlimit File 26.89 KB 0755
pro File 1003 B 0755
procan File 42.41 KB 0755
prove File 13.34 KB 0755
prtstat File 18.38 KB 0755
ps File 142.99 KB 0755
ps2ascii File 631 B 0755
ps2epsi File 1.23 KB 0755
ps2pdf File 272 B 0755
ps2pdf12 File 215 B 0755
ps2pdf13 File 215 B 0755
ps2pdf14 File 215 B 0755
ps2pdfwr File 1.05 KB 0755
ps2ps File 647 B 0755
ps2ps2 File 669 B 0755
ps2txt File 631 B 0755
psfaddtable File 22.37 KB 0755
psfgettable File 22.37 KB 0755
psfstriptable File 22.37 KB 0755
psfxtable File 22.37 KB 0755
psidtopgm File 14.3 KB 0755
pslog File 14.3 KB 0755
pstopnm File 22.38 KB 0755
pstree File 35.32 KB 0755
pstree.x11 File 35.32 KB 0755
ptar File 3.48 KB 0755
ptardiff File 2.58 KB 0755
ptargrep File 4.29 KB 0755
ptx File 54.54 KB 0755
purge-old-kernels File 1.12 KB 0755
pv File 79.41 KB 0755
pwd File 34.51 KB 0755
pwdx File 14.38 KB 0755
py3clean File 7.63 KB 0755
py3compile File 13 KB 0755
py3versions File 12.52 KB 0755
pydoc3 File 80 B 0755
pydoc3.12 File 80 B 0755
pygettext3 File 23.66 KB 0755
pygettext3.12 File 23.66 KB 0755
pygmentize File 215 B 0755
pyhtmlizer3 File 222 B 0755
pyserial-miniterm File 975 B 0755
pyserial-ports File 969 B 0755
python3 File 7.65 MB 0755
python3.12 File 7.65 MB 0755
pzstd File 690.54 KB 0755
qmi-firmware-update File 168.09 KB 0755
qmi-network File 16.04 KB 0755
qmicli File 586.84 KB 0755
qoitopam File 14.3 KB 0755
qrttoppm File 14.3 KB 0755
quirks-handler File 2.4 KB 0755
rasttopnm File 18.3 KB 0755
rawtopgm File 14.3 KB 0755
rawtoppm File 14.3 KB 0755
rbash File 1.38 MB 0755
rdma File 102.52 KB 0755
readlink File 42.41 KB 0755
realpath File 42.41 KB 0755
red File 89 B 0755
rename.ul File 22.38 KB 0755
renice File 14.38 KB 0755
replace File 4.51 MB 0755
rescan-scsi-bus.sh File 38.05 KB 0755
reset File 26.31 KB 0755
resizecons File 26.46 KB 0755
resizepart File 22.38 KB 0755
resolve_stack_dump File 4.53 MB 0755
resolvectl File 158.67 KB 0755
resolveip File 4.53 MB 0755
rev File 14.38 KB 0755
rgb3toppm File 14.3 KB 0755
rgrep File 30 B 0755
rlatopam File 14.3 KB 0755
rletopnm File 38.55 KB 0755
rm File 58.51 KB 0755
rmdir File 46.41 KB 0755
rnano File 272.5 KB 0755
rotatelogs File 26.38 KB 0755
routel File 1.62 KB 0755
rpcgen File 94.59 KB 0755
rrsync File 12.34 KB 0755
rsync File 502.13 KB 0755
rsync-ssl File 5.02 KB 0755
rtla File 1.58 KB 0755
rtstat File 22.66 KB 0755
run-one File 3.51 KB 0755
run-one-constantly File 3.51 KB 0755
run-one-until-failure File 3.51 KB 0755
run-one-until-success File 3.51 KB 0755
run-parts File 26.82 KB 0755
run-this-one File 3.51 KB 0755
runcon File 34.51 KB 0755
rview File 3.94 MB 0755
rvim File 3.94 MB 0755
sadf File 382.31 KB 0755
sar File 137.38 KB 0755
sar.sysstat File 137.38 KB 0755
savelog File 10.24 KB 0755
sbattach File 22.54 KB 0755
sbigtopgm File 14.3 KB 0755
sbkeysync File 34.74 KB 0755
sbsiglist File 14.6 KB 0755
sbsign File 34.7 KB 0755
sbvarsign File 22.73 KB 0755
sbverify File 30.61 KB 0755
scalar File 668.94 KB 0755
scandeps File 6.47 KB 0755
scp File 134.59 KB 0755
screen File 478.24 KB 0755
screendump File 14.3 KB 0755
script File 54.38 KB 0755
scriptlive File 42.38 KB 0755
scriptreplay File 34.38 KB 0755
scsi_logging_level File 8.38 KB 0755
scsi_mandat File 3.52 KB 0755
scsi_readcap File 1.3 KB 0755
scsi_ready File 1.09 KB 0755
scsi_satl File 3.74 KB 0755
scsi_start File 1.25 KB 0755
scsi_stop File 1.44 KB 0755
scsi_temperature File 936 B 0755
sdiff File 50.39 KB 0755
sed File 110.57 KB 0755
select-editor File 2.39 KB 0755
sensible-browser File 1.55 KB 0755
sensible-editor File 1.52 KB 0755
sensible-pager File 921 B 0755
sensible-terminal File 1.15 KB 0755
seq File 50.51 KB 0755
setarch File 26.65 KB 0755
setfont File 54.46 KB 0755
setkeycodes File 14.37 KB 0755
setleds File 18.43 KB 0755
setlogcons File 14.37 KB 0755
setmetamode File 14.41 KB 0755
setpci File 30.38 KB 0755
setpriv File 38.38 KB 0755
setsid File 14.38 KB 0755
setterm File 34.38 KB 0755
setupcon File 40.06 KB 0755
sftp File 150.66 KB 0755
sg File 39.71 KB 4755
sg_bg_ctl File 14.51 KB 0755
sg_compare_and_write File 26.91 KB 0755
sg_copy_results File 23.3 KB 0755
sg_dd File 54.33 KB 0755
sg_decode_sense File 14.76 KB 0755
sg_emc_trespass File 14.3 KB 0755
sg_format File 39.35 KB 0755
sg_get_config File 35.38 KB 0755
sg_get_elem_status File 26.79 KB 0755
sg_get_lba_status File 22.95 KB 0755
sg_ident File 14.6 KB 0755
sg_inq File 115.61 KB 0755
sg_logs File 146.93 KB 0755
sg_luns File 22.79 KB 0755
sg_map File 18.3 KB 0755
sg_map26 File 26.7 KB 0755
sg_modes File 46.08 KB 0755
sg_opcodes File 35.01 KB 0755
sg_persist File 36.08 KB 0755
sg_prevent File 14.51 KB 0755
sg_raw File 26.91 KB 0755
sg_rbuf File 22.73 KB 0755
sg_rdac File 18.3 KB 0755
sg_read File 26.31 KB 0755
sg_read_attr File 36.65 KB 0755
sg_read_block_limits File 14.54 KB 0755
sg_read_buffer File 27.56 KB 0755
sg_read_long File 14.7 KB 0755
sg_readcap File 22.79 KB 0755
sg_reassign File 18.66 KB 0755
sg_referrals File 14.66 KB 0755
sg_rep_pip File 14.57 KB 0755
sg_rep_zones File 26.8 KB 0755
sg_requests File 22.76 KB 0755
sg_reset File 14.66 KB 0755
sg_reset_wp File 14.6 KB 0755
sg_rmsn File 14.51 KB 0755
sg_rtpg File 14.6 KB 0755
sg_safte File 22.7 KB 0755
sg_sanitize File 27.01 KB 0755
sg_sat_identify File 18.73 KB 0755
sg_sat_phy_event File 19.01 KB 0755
sg_sat_read_gplog File 18.73 KB 0755
sg_sat_set_features File 18.7 KB 0755
sg_scan File 18.38 KB 0755
sg_seek File 18.88 KB 0755
sg_senddiag File 27.2 KB 0755
sg_ses File 119.97 KB 0755
sg_ses_microcode File 27.36 KB 0755
sg_start File 18.85 KB 0755
sg_stpg File 22.73 KB 0755
sg_stream_ctl File 18.7 KB 0755
sg_sync File 14.66 KB 0755
sg_test_rwbuf File 18.6 KB 0755
sg_timestamp File 22.83 KB 0755
sg_turs File 26.7 KB 0755
sg_unmap File 22.76 KB 0755
sg_verify File 22.91 KB 0755
sg_vpd File 118.42 KB 0755
sg_wr_mode File 22.73 KB 0755
sg_write_buffer File 27.23 KB 0755
sg_write_long File 14.76 KB 0755
sg_write_same File 26.95 KB 0755
sg_write_verify File 26.79 KB 0755
sg_write_x File 55.6 KB 0755
sg_xcopy File 42.32 KB 0755
sg_zone File 14.86 KB 0755
sginfo File 76.01 KB 0755
sgitopnm File 18.3 KB 0755
sgm_dd File 34.31 KB 0755
sgp_dd File 46.31 KB 0755
sh File 126.74 KB 0755
sha1sum File 38.41 KB 0755
sha224sum File 38.41 KB 0755
sha256sum File 38.41 KB 0755
sha384sum File 38.41 KB 0755
sha512sum File 38.41 KB 0755
shasum File 9.75 KB 0755
showconsolefont File 18.37 KB 0755
showkey File 18.37 KB 0755
shred File 54.51 KB 0755
shuf File 46.51 KB 0755
sirtopnm File 14.3 KB 0755
sixel2png File 14.3 KB 0755
skill File 26.41 KB 0755
slabtop File 22.44 KB 0755
sldtoppm File 18.35 KB 0755
sleep File 34.51 KB 0755
slogin File 827.04 KB 0755
snap File 20.84 MB 0755
snapctl File 7.37 MB 0755
snapfuse File 38.23 KB 0755
snice File 26.41 KB 0755
socat File 447.68 KB 0755
socat-broker.sh File 2.24 KB 0755
socat-chain.sh File 7.86 KB 0755
socat-mux.sh File 3.47 KB 0755
socat1 File 447.68 KB 0755
soelim File 34.48 KB 0755
sort File 102.8 KB 0755
sos File 612 B 0755
sos-collector File 1.04 KB 0755
sosreport File 1.03 KB 0755
sotruss File 4.21 KB 0755
spctoppm File 14.3 KB 0755
splain File 18.99 KB 0755
split File 54.94 KB 0755
splitfont File 14.3 KB 0755
spottopgm File 14.31 KB 0755
sprof File 34.44 KB 0755
sputoppm File 14.3 KB 0755
sqfscat File 147.9 KB 0755
sqfstar File 286.95 KB 0755
srftopam File 18.3 KB 0755
ss File 129.07 KB 0755
ssh File 827.04 KB 0755
ssh-add File 294.42 KB 0755
ssh-agent File 302.43 KB 2755
ssh-argv0 File 1.42 KB 0755
ssh-copy-id File 12.77 KB 0755
ssh-import-id File 985 B 0755
ssh-import-id-gh File 785 B 0755
ssh-import-id-lp File 785 B 0755
ssh-keygen File 442.44 KB 0755
ssh-keyscan File 330.44 KB 0755
st4topgm File 14.3 KB 0755
stat File 86.52 KB 0755
static-sh File 2.03 MB 0755
stdbuf File 50.51 KB 0755
strace File 1.99 MB 0755
strace-log-merge File 1.78 KB 0755
stream File 14.31 KB 0755
stream-im6 File 14.31 KB 0755
stream-im6.q16 File 14.31 KB 0755
streamzip File 7.87 KB 0755
stty File 78.52 KB 0755
su File 54.38 KB 4755
sudo File 271.42 KB 4755
sudoedit File 271.42 KB 4755
sudoreplay File 95.95 KB 0755
sum File 34.41 KB 0755
sunicontopnm File 14.3 KB 0755
svgtopam File 22.3 KB 0755
sync File 34.41 KB 0755
systemctl File 1.43 MB 0755
systemd File 98.45 KB 0755
systemd-ac-power File 14.45 KB 0755
systemd-analyze File 198.85 KB 0755
systemd-ask-password File 18.58 KB 0755
systemd-cat File 18.45 KB 0755
systemd-cgls File 22.57 KB 0755
systemd-cgtop File 38.47 KB 0755
systemd-confext File 54.64 KB 0755
systemd-creds File 42.72 KB 0755
systemd-cryptenroll File 70.92 KB 0755
systemd-cryptsetup File 78.95 KB 0755
systemd-delta File 26.45 KB 0755
systemd-detect-virt File 18.45 KB 0755
systemd-escape File 22.45 KB 0755
systemd-firstboot File 58.82 KB 0755
systemd-hwdb File 154.74 KB 0755
systemd-id128 File 22.45 KB 0755
systemd-inhibit File 22.47 KB 0755
systemd-machine-id-setup File 18.63 KB 0755
systemd-mount File 50.78 KB 0755
systemd-notify File 26.66 KB 0755
systemd-path File 18.45 KB 0755
systemd-repart File 195.23 KB 0755
systemd-run File 66.79 KB 0755
systemd-socket-activate File 30.45 KB 0755
systemd-stdio-bridge File 22.45 KB 0755
systemd-sysext File 54.64 KB 0755
systemd-sysusers File 66.63 KB 0755
systemd-tmpfiles File 114.7 KB 0755
systemd-tty-ask-password-agent File 34.45 KB 0755
systemd-umount File 50.78 KB 0755
tabs File 18.3 KB 0755
tac File 38.41 KB 0755
tail File 62.53 KB 0755
tapestat File 26.44 KB 0755
tar File 421.92 KB 0755
taskset File 30.38 KB 0755
tbl File 134.48 KB 0755
tclsh File 14.15 KB 0755
tclsh8.6 File 14.15 KB 0755
tcpdump File 1.21 MB 0755
tee File 38.51 KB 0755
telnet File 177.85 KB 0755
tempfile File 14.3 KB 0755
test File 46.44 KB 0755
tgatoppm File 18.3 KB 0755
thinkjettopbm File 18.3 KB 0755
tic File 90.41 KB 0755
tifftopnm File 42.38 KB 0755
time File 26.52 KB 0755
timedatectl File 46.45 KB 0755
timeout File 38.95 KB 0755
tkconch3 File 227 B 0755
tload File 22.39 KB 0755
tmux File 1.05 MB 0755
tnftp File 182.9 KB 0755
toe File 22.3 KB 0755
toilet File 26.68 KB 0755
top File 131.7 KB 0755
touch File 94.51 KB 0755
tput File 26.34 KB 0755
tr File 46.51 KB 0755
trace-cmd File 435.41 KB 0755
tracepath File 18.15 KB 0755
trial3 File 219 B 0755
troff File 726.62 KB 0755
true File 26.3 KB 0755
truncate File 38.51 KB 0755
tset File 26.31 KB 0755
tsort File 46.51 KB 0755
tty File 34.51 KB 0755
turbostat File 1.58 KB 0755
twist3 File 239 B 0755
twistd3 File 220 B 0755
tzselect File 15.02 KB 0755
ua File 1003 B 0755
ubuntu-advantage File 1003 B 0755
ubuntu-bug File 2.27 KB 0755
ubuntu-distro-info File 26.89 KB 0755
ubuntu-drivers File 18.97 KB 0755
ubuntu-security-status File 22.25 KB 0755
ucf File 40.68 KB 0755
ucfq File 18.91 KB 0755
ucfr File 10.85 KB 0755
uclampset File 30.38 KB 0755
ucs2any File 26.15 KB 0755
udevadm File 1.37 MB 0755
udisksctl File 62.38 KB 0755
ul File 22.38 KB 0755
umount File 38.38 KB 4755
uname File 34.51 KB 0755
unattended-upgrade File 97.21 KB 0755
unattended-upgrades File 97.21 KB 0755
uncompress File 2.29 KB 0755
unexpand File 38.53 KB 0755
unicode_start File 2.71 KB 0755
unicode_stop File 528 B 0755
uniq File 38.51 KB 0755
unlink File 34.51 KB 0755
unlzma File 86.92 KB 0755
unminimize File 5.59 KB 0755
unmkinitramfs File 3.7 KB 0755
unshare File 42.6 KB 0755
unsquashfs File 147.9 KB 0755
unxz File 86.92 KB 0755
unzip File 174.42 KB 0755
unzipsfx File 74.42 KB 0755
unzstd File 998.79 KB 0755
update-alternatives File 58.38 KB 0755
update-mime-database File 74.33 KB 0755
upower File 14.3 KB 0755
uptime File 14.38 KB 0755
usb-devices File 4.83 KB 0755
usbhid-dump File 30.38 KB 0755
usbip File 1.58 KB 0755
usbipd File 1.58 KB 0755
usbreset File 14.3 KB 0755
users File 34.51 KB 0755
utmpdump File 22.38 KB 0755
uuidgen File 18.38 KB 0755
uuidparse File 22.38 KB 0755
varlinkctl File 30.45 KB 0755
vcs-run File 6.75 KB 0755
vdir File 138.98 KB 0755
vi File 3.94 MB 0755
view File 3.94 MB 0755
vigpg File 2.58 KB 0755
vim File 3.94 MB 0755
vim.basic File 3.94 MB 0755
vim.tiny File 1.66 MB 0755
vimdiff File 3.94 MB 0755
vimtutor File 2.1 KB 0755
vm-support File 9.83 KB 0755
vmhgfs-fuse File 46.73 KB 0755
vmstat File 38.78 KB 0755
vmtoolsd File 74.56 KB 0755
vmware-alias-import File 42.52 KB 0755
vmware-checkvm File 14.38 KB 0755
vmware-hgfsclient File 14.38 KB 0755
vmware-namespace-cmd File 22.3 KB 0755
vmware-rpctool File 18.3 KB 0755
vmware-toolbox-cmd File 54.59 KB 0755
vmware-vgauth-cmd File 18.3 KB 0755
vmware-vmblock-fuse File 22.78 KB 0755
vmware-xferlogs File 32.33 KB 0755
w File 26.38 KB 0755
w3m File 1.58 MB 0755
w3mman File 1.37 KB 0755
wall File 22.38 KB 0755
watch File 30.84 KB 0755
watchgnupg File 22.3 KB 0755
wbmptopbm File 14.3 KB 0755
wc File 54.52 KB 0755
wcmgr File 26.2 KB 0755
wdctl File 34.4 KB 0755
webalizer File 212.35 KB 0755
webazolver File 212.35 KB 0755
wget File 459.02 KB 0755
whatis File 47.28 KB 0755
whereis File 30.84 KB 0755
which File 1.05 KB 0755
which.debianutils File 1.05 KB 0755
whiptail File 30.16 KB 0755
who File 58.52 KB 0755
whoami File 34.51 KB 0755
whois File 155.66 KB 0755
wifi-status File 2.06 KB 0755
winicontopam File 22.3 KB 0755
winicontoppm File 18.3 KB 0755
write File 22.38 KB 0755
wsrep_sst_backup File 2.39 KB 0755
wsrep_sst_common File 66.86 KB 0755
wsrep_sst_mariabackup File 49.23 KB 0755
wsrep_sst_mysqldump File 8.11 KB 0755
wsrep_sst_rsync File 29.72 KB 0755
wsrep_sst_rsync_wan File 29.72 KB 0755
www-browser File 1.58 MB 0755
x86_64 File 26.65 KB 0755
x86_energy_perf_policy File 1.58 KB 0755
xargs File 62.41 KB 0755
xauth File 54.96 KB 0755
xbmtopbm File 14.3 KB 0755
xdg-user-dir File 234 B 0755
xdg-user-dirs-update File 26.23 KB 0755
ximtoppm File 14.3 KB 0755
xpmtoppm File 18.35 KB 0755
xsubpp File 5.05 KB 0755
xvminitoppm File 14.3 KB 0755
xwdtopnm File 26.3 KB 0755
xxd File 22.28 KB 0755
xz File 86.92 KB 0755
xzcat File 86.92 KB 0755
xzcmp File 7.25 KB 0755
xzdiff File 7.25 KB 0755
xzegrep File 10.09 KB 0755
xzfgrep File 10.09 KB 0755
xzgrep File 10.09 KB 0755
xzless File 1.77 KB 0755
xzmore File 2.14 KB 0755
ybmtopbm File 14.3 KB 0755
yes File 34.38 KB 0755
ypdomainname File 22.23 KB 0755
yuvsplittoppm File 14.3 KB 0755
yuvtoppm File 14.3 KB 0755
yuy2topam File 14.3 KB 0755
zcat File 1.94 KB 0755
zcmp File 1.64 KB 0755
zdiff File 6.31 KB 0755
zdump File 30.28 KB 0755
zegrep File 29 B 0755
zeisstopnm File 14.3 KB 0755
zfgrep File 29 B 0755
zforce File 2.03 KB 0755
zgrep File 7.91 KB 0755
zip File 206.98 KB 0755
zipcloak File 70.4 KB 0755
zipdetails File 68.55 KB 0755
zipgrep File 2.89 KB 0755
zipinfo File 174.42 KB 0755
zipnote File 62.4 KB 0755
zipsplit File 58.4 KB 0755
zless File 2.15 KB 0755
zmore File 1.8 KB 0755
znew File 4.47 KB 0755
zstd File 998.79 KB 0755
zstdcat File 998.79 KB 0755
zstdgrep File 3.78 KB 0755
zstdless File 197 B 0755
zstdmt File 998.79 KB 0755
Filemanager