phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] [18985] replace the hack with something the is actual


From: Dave Hall
Subject: [Phpgroupware-cvs] [18985] replace the hack with something the is actually useful
Date: Sun, 26 Oct 2008 20:57:57 +0000

Revision: 18985
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18985
Author:   skwashd
Date:     2008-10-26 20:57:57 +0000 (Sun, 26 Oct 2008)

Log Message:
-----------
replace the hack with something the is actually useful

Modified Paths:
--------------
    core/trunk/phpgwapi/inc/class.globally_denied.inc.php

Modified: core/trunk/phpgwapi/inc/class.globally_denied.inc.php
===================================================================
--- core/trunk/phpgwapi/inc/class.globally_denied.inc.php       2008-10-26 
20:53:58 UTC (rev 18984)
+++ core/trunk/phpgwapi/inc/class.globally_denied.inc.php       2008-10-26 
20:57:57 UTC (rev 18985)
@@ -1,39 +1,218 @@
-       <?
+<?php
        /**
-       * phpGroupWare API - globally_denied
-       * @author ? <address@hidden>
+       * Globally Denied Account Name Functions
+       *
+       * @author Joseph Engo <address@hidden>
+       * @author Bettina Gille <address@hidden>
+       * @author Philipp Kamps <address@hidden>
+       * @author Dave Hall <address@hidden>
        * @copyright Copyright (C) 2000-2008 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License v3 or later
-       * @package phpgroupware
-       * @subpackage phpgwapi
-       * @version $Id: class.globally_denied.inc.php $
+       * @package phpgwapi
+       * @subpackage utility
+       * @version $Id: class.accounts_.inc.php 779 2008-02-26 09:53:55Z dave $
        */
 
        /*
-               This program is free software: you can redistribute it and/or 
modify
-               it under the terms of the GNU Lesser General Public License as 
published by
-               the Free Software Foundation, either version 3 of the License, 
or
-               (at your option) any later version.
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU Lesser General Public License as 
published by
+          the Free Software Foundation, either version 3 of the License, or
+          (at your option) any later version.
 
-               This program is distributed in the hope that it will be useful,
-               but WITHOUT ANY WARRANTY; without even the implied warranty of
-               MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-               GNU Lesser General Public License for more details.
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
 
-               You should have received a copy of the GNU Lesser General 
Public License
-               along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
+          You should have received a copy of the GNU Lesser General Public 
License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
+       class phpgwapi_globally_denied
+       {
+               /**
+               * @var array $user_list list of banned user account names
+               */
+               private static $user_list = array
+               (
+                       'adm'                   => true,
+                       'alias'                 => true,
+                       'amanda'                => true,
+                       'apache'                => true,
+                       'avahi'                 => true,
+                       'backup'                => true,
+                       'backup'                => true,
+                       'beagleindex'   => true,
+                       'bin'                   => true,
+                       'cupsys'                => true,
+                       'cvs'                   => true,
+                       'cyrus'                 => true,
+                       'daemon'                => true,
+                       'dhcp'                  => true,
+                       'dnsmasq'               => true,
+                       'fetchmail'             => true,
+                       'ftp'                   => true,
+                       'games'                 => true,
+                       'gdm'                   => true,
+                       'gnats'                 => true,
+                       'gopher'                => true,
+                       'haldaemon'             => true,
+                       'hal'                   => true,
+                       'halt'                  => true,
+                       'hplip'                 => true,
+                       'ident'                 => true,
+                       'irc'                   => true,
+                       'klog'                  => true,
+                       'ldap'                  => true,
+                       'list'                  => true,
+                       'lp'                    => true,
+                       'mailnull'              => true,
+                       'mail'                  => true,
+                       'messagebus'    => true,
+                       'mysql'                 => true,
+                       'named'                 => true,
+                       'news'                  => true,
+                       'nobody'                => true,
+                       'nscd'                  => true,
+                       'operator'              => true,
+                       'oracle'                => true,
+                       'pgsql'                 => true,
+                       'postfix'               => true,
+                       'postgres'              => true,
+                       'proxy'                 => true,
+                       'pvm'                   => true,
+                       'qmaild'                => true,
+                       'qmaillog'              => true,
+                       'qmaill'                => true,
+                       'qmailp'                => true,
+                       'qmailq'                => true,
+                       'qmailr'                => true,
+                       'qmails'                => true,
+                       'root'                  => true,
+                       'rpc'                   => true,
+                       'rpcuser'               => true,
+                       'sabayon-admin' => true,
+                       'saned'                 => true,
+                       'shutdown'              => true,
+                       'squid'                 => true,
+                       'sshd'                  => true,
+                       'sweep'                 => true,
+                       'sync'                  => true,
+                       'syslog'                => true,
+                       'sys'                   => true,
+                       'uucp'                  => true,
+                       'web'                   => true,
+                       'www-data'              => true,
+                       'xfs'                   => true
+               );
 
-       /**
-       * phpGroupWare API - globally_denied
-       *
-       * @package phpgroupware
-       * @subpackage phpgwapi
-       */
-       class phpgwapi_globally_denied
-       {
-               static function user()
-               {
-                       return null;
-               }
-       }
+               /**
+               * @var array $group_list array list of banned user group names
+               */
+               private static $group_list = array
+               (
+                       'admin'                 => true,
+                       'adm'                   => true,
+                       'audio'                 => true,
+                       'avahi'                 => true,
+                       'backup'                => true,
+                       'bin'                   => true,
+                       'cdrom'                 => true,
+                       'console'               => true,
+                       'crontab'               => true,
+                       'cvs'                   => true,
+                       'daemon'                => true,
+                       'dba'                   => true,
+                       'dhcp'                  => true,
+                       'dialout'               => true,
+                       'dip'                   => true,
+                       'dirmngr'               => true,
+                       'disk'                  => true,
+                       'dnstools'              => true,
+                       'fax'                   => true,
+                       'floppy'                => true,
+                       'ftp'                   => true,
+                       'games'                 => true,
+                       'gdm'                   => true,
+                       'gnats'                 => true,
+                       'haldaemon'             => true,
+                       'hal'                   => true,
+                       'irc'                   => true,
+                       'klog'                  => true,
+                       'kmem'                  => true,
+                       'ldap'                  => true,
+                       'list'                  => true,
+                       'lpadmin'               => true,
+                       'lp'                    => true,
+                       'lp'                    => true,
+                       'mail'                  => true,
+                       'man'                   => true,
+                       'messagebus'    => true,
+                       'mysql'                 => true,
+                       'named'                 => true,
+                       'news'                  => true,
+                       'nobody'                => true,
+                       'nofiles'               => true,
+                       'nogroup'               => true,
+                       'oinstall'              => true,
+                       'operator'              => true,
+                       'oracle'                => true,
+                       'plugdev'               => true,
+                       'popusers'              => true,
+                       'postdrop'              => true,
+                       'postfix'               => true,
+                       'postgres'              => true,
+                       'pppusers'              => true,
+                       'proxy'                 => true,
+                       'qmail'                 => true,
+                       'root'                  => true,
+                       'sabayon-admin' => true,
+                       'saned'                 => true,
+                       'sasl'                  => true,
+                       'scanner'               => true,
+                       'shadow'                => true,
+                       'slipusers'             => true,
+                       'slocate'               => true,
+                       'src'                   => true,
+                       'ssh'                   => true,
+                       'ssl-cert'              => true,
+                       'staff'                 => true,
+                       'sudo'                  => true,
+                       'sweep'                 => true,
+                       'syslog'                => true,
+                       'sys'                   => true,
+                       'tape'                  => true,
+                       'tty'                   => true,
+                       'users'                 => true,
+                       'utmp'                  => true,
+                       'uucp'                  => true,
+                       'video'                 => true,
+                       'voice'                 => true,
+                       'web'                   => true,
+                       'wheel'                 => true,
+                       'www-data'              => true,
+                       'xfs'                   => true,
+               );
+
+               /**
+                * Check if the username is banned
+                *
+                * @param string $login the account login to lookup
+                * @return bool is the login banned?
+                */
+               public static function user($login)
+               {
+                       return !$login || isset(self::$user_list[$login]);
+               }
+
+               /**
+                * Check if the groupname is banned
+                *
+                * @param string $group the group name to lookup
+                * @return bool is the group banned?
+                */
+               public static function group($group)
+               {
+                       return !$group || isset(self::$group_list[$group]);
+               }
+
+       }
\ No newline at end of file






reply via email to

[Prev in Thread] Current Thread [Next in Thread]