GRAYBYTE WORDPRESS FILE MANAGER4117

Server IP : 149.255.58.128 / Your IP : 216.73.216.15
System : Linux cloud516.thundercloud.uk 5.14.0-427.26.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 17 15:51:13 EDT 2024 x86_64
PHP Version : 8.2.28
Disable Function : allow_url_include, apache_child_terminate, apache_setenv, exec, passthru, pcntl_exec, posix_kill, posix_mkfifo, posix_getpwuid, posix_setpgid, posix_setsid, posix_setuid, posix_setgid, posix_seteuid, posix_setegid, posix_uname, proc_close, proc_get_status, proc_open, proc_terminate, shell_exec, show_source, system
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /usr/lib/python3.9/site-packages/up2date_client/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /usr/lib/python3.9/site-packages/up2date_client//rhnserver.py
#   rhn-client-tools
#
# Copyright (c) 2006--2016 Red Hat, Inc.
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU 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 General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#   02110-1301  USA
#
# In addition, as a special exception, the copyright holders give
# permission to link the code of portions of this program with the
# OpenSSL library under certain conditions as described in each
# individual source file, and distribute linked combinations
# including the two.
# You must obey the GNU General Public License in all respects
# for all of the code used other than OpenSSL.  If you modify
# file(s) with this exception, you may extend this exception to your
# version of the file(s), but you are not obligated to do so.  If you
# do not wish to do so, delete this exception statement from your
# version.  If you delete this exception statement from all source
# files in the program, then also delete it here.


from rhn.tb import raise_with_tb
from up2date_client import rpcServer
from up2date_client import up2dateErrors
from up2date_client import capabilities
import sys
import OpenSSL

try: # python2
    import xmlrpclib
except ImportError: # python3
    import xmlrpc.client as xmlrpclib

class _DoCallWrapper(object):

    """
    A callable object that will handle multiple levels of attributes,
    and catch exceptions.
    """

    def __init__(self, server, method_name):
        self._server = server
        self._method_name = method_name

    def __getattr__(self, method_name):
        """ Recursively build up the method name to pass to the server. """
        return _DoCallWrapper(self._server,
            "%s.%s" % (self._method_name, method_name))

    def __call__(self, *args, **kwargs):
        """ Call the method. Catch faults and translate them. """
        method = getattr(self._server, self._method_name)

        try:
            return rpcServer.doCall(method, *args, **kwargs)
        except xmlrpclib.Fault:
            raise_with_tb(self.__exception_from_fault(sys.exc_info()[1]))
        except OpenSSL.SSL.Error:
            # TODO This should probably be moved to rhnlib and raise an
            # exception that subclasses OpenSSL.SSL.Error
            # TODO Is there a better way to detect cert failures?
            error = str(sys.exc_info()[1])
            error = error.strip("[()]")
            pieces = error.split(',')
            message = ""
            if len(pieces) > 2:
                message = pieces[2]
            elif len(pieces) == 2:
                message = pieces[1]
            message = message.strip(" '")
            if message == 'certificate verify failed':
                raise_with_tb(up2dateErrors.SSLCertificateVerifyFailedError())
            else:
                raise_with_tb(up2dateErrors.NetworkError(message))

    def __exception_from_fault(self, fault):
            if fault.faultCode == -3:
                # This username is already taken, or the password is incorrect.
                exception = up2dateErrors.AuthenticationOrAccountCreationError(fault.faultString)
            elif fault.faultCode == -2:
                # Invalid username and password combination.
                exception = up2dateErrors.AuthenticationOrAccountCreationError(fault.faultString)
            elif fault.faultCode == -110:
                # Account is disabled
                exception = up2dateErrors.AuthenticationOrAccountCreationError(fault.faultString)
            elif fault.faultCode == -1:
                exception = up2dateErrors.UnknownMethodException(fault.faultString)
            elif fault.faultCode == -13:
                # Username is too short.
                exception = up2dateErrors.LoginMinLengthError(fault.faultString)
            elif fault.faultCode == -14:
                # too short password
                exception = up2dateErrors.PasswordMinLengthError(
                                          fault.faultString)
            elif fault.faultCode == -15:
                # bad chars in username
                exception = up2dateErrors.ValidationError(fault.faultString)
            elif fault.faultCode == -16:
                # Invalid product registration code.
                # TODO Should this really be a validation error?
                exception = up2dateErrors.ValidationError(fault.faultString)
            elif fault.faultCode == -19:
                # invalid
                exception = up2dateErrors.NoBaseChannelError(fault.faultString)
            elif fault.faultCode == -31:
                # No entitlement
                exception = up2dateErrors.InsuffMgmntEntsError(fault.faultString)
            elif fault.faultCode == -36:
                # rhnException.py says this means "Invalid action."
                # TODO find out which is right
                exception = up2dateErrors.PasswordError(fault.faultString)
            elif abs(fault.faultCode) == 49:
                exception = up2dateErrors.AbuseError(fault.faultString)
            elif abs(fault.faultCode) == 60:
                exception = up2dateErrors.AuthenticationTicketError(fault.faultString)
            elif abs(fault.faultCode) == 74:
                exception = up2dateErrors.RegistrationDeniedError()
            elif abs(fault.faultCode) == 105:
                exception = up2dateErrors.RhnUuidUniquenessError(fault.faultString)
            elif fault.faultCode == 99:
                exception = up2dateErrors.DelayError(fault.faultString)
            elif abs(fault.faultCode) == 91:
                exception = up2dateErrors.InsuffMgmntEntsError(fault.faultString)
            elif fault.faultCode == -106:
                # Invalid username.
                exception = up2dateErrors.ValidationError(fault.faultString)
            elif fault.faultCode == -600:
                # Invalid username.
                exception = up2dateErrors.InvalidRegistrationNumberError(fault.faultString)
            elif fault.faultCode == -601:
                # No entitlements associated with given hardware info
                exception = up2dateErrors.NotEntitlingError(fault.faultString)
            elif fault.faultCode == -602:
                # No entitlements associated with reg num
                exception = up2dateErrors.NotEntitlingError(fault.faultString)
            elif fault.faultCode == -2001 or fault.faultCode == -700:
                exception = up2dateErrors.AuthenticationOrAccountCreationError(
                                          fault.faultString)
            elif fault.faultCode == -701:
                exception = up2dateErrors.PasswordMaxLengthError(
                                          fault.faultString)
            elif fault.faultCode == -61:
                exception = up2dateErrors.ActivationKeyUsageLimitError(
                                          fault.faultString)
            elif fault.faultCode == -5:
                exception = up2dateErrors.UnableToCreateUser(
                            fault.faultString)
            else:
                exception = up2dateErrors.CommunicationError(fault.faultString)

            return exception


class RhnServer(object):

    """
    An rpc server object that calls doCall for you, and catches lower
    level exceptions
    """

    def __init__(self, serverOverride=None, timeout=None, rpcServerOverride=None):
        if rpcServerOverride is None:
            self._server = rpcServer.getServer(serverOverride=serverOverride,
                    timeout=timeout)
        else:
            self._server = rpcServerOverride
        self._capabilities = None

    def __get_capabilities(self):
        if self._capabilities is None:
            headers = self._server.get_response_headers()
            if headers is None:
                self.registration.welcome_message()
                headers = self._server.get_response_headers()
            self._capabilities = capabilities.Capabilities()
            self._capabilities.populate(headers)
        return self._capabilities

    capabilities = property(__get_capabilities)

    def add_header(self, key, value):
        self._server.add_header(key, value)

    def __getattr__(self, method_name):
        """ Return a callable object that will do the work for us. """
        return _DoCallWrapper(self._server, method_name)

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
March 19 2025 22:42:16
0 / root
0755
__pycache__
--
March 18 2025 22:42:18
0 / root
0755
__init__.py
0 KB
February 26 2025 11:13:36
0 / root
0644
capabilities.py
7.277 KB
February 26 2025 11:13:36
0 / root
0644
clientCaps.py
2.156 KB
February 26 2025 11:13:36
0 / root
0644
clpwd.py
3.558 KB
February 26 2025 11:13:36
0 / root
0644
config.py
12.505 KB
February 26 2025 11:13:36
0 / root
0644
debUtils.py
2.764 KB
February 26 2025 11:13:36
0 / root
0644
getMethod.py
4.201 KB
February 26 2025 11:13:36
0 / root
0644
haltree.py
4.533 KB
February 26 2025 11:13:36
0 / root
0644
hardware.py
31.91 KB
February 26 2025 11:13:36
0 / root
0644
hardware_gudev.py
12.906 KB
February 26 2025 11:13:36
0 / root
0644
hardware_hal.py
11.332 KB
February 26 2025 11:13:36
0 / root
0644
hardware_udev.py
12.988 KB
February 26 2025 11:13:36
0 / root
0644
pkgUtils.py
0.288 KB
February 26 2025 11:13:36
0 / root
0644
pkgplatform.py
0.302 KB
February 26 2025 11:56:05
0 / root
0644
pmPlugin.py
2.792 KB
February 26 2025 11:13:36
0 / root
0644
rhnChannel.py
4.913 KB
February 26 2025 11:13:36
0 / root
0644
rhnHardware.py
0.32 KB
February 26 2025 11:13:36
0 / root
0644
rhnPackageInfo.py
2.34 KB
February 26 2025 11:13:36
0 / root
0644
rhncli.py
9.116 KB
February 26 2025 11:13:36
0 / root
0644
rhnreg.py
31.219 KB
February 26 2025 11:13:36
0 / root
0644
rhnreg_constants.py
18.134 KB
February 26 2025 11:13:36
0 / root
0644
rhnserver.py
8.655 KB
February 26 2025 11:13:36
0 / root
0644
rpcServer.py
10.959 KB
February 26 2025 11:13:36
0 / root
0644
rpmUtils.py
5.196 KB
February 26 2025 11:13:36
0 / root
0644
transaction.py
4.095 KB
February 26 2025 11:13:36
0 / root
0644
tui.py
43.702 KB
February 26 2025 11:13:36
0 / root
0644
up2dateAuth.py
9.472 KB
February 26 2025 11:13:36
0 / root
0644
up2dateErrors.py
10.256 KB
February 26 2025 11:13:36
0 / root
0644
up2dateLog.py
2.059 KB
February 26 2025 11:13:36
0 / root
0644
up2dateUtils.py
5.033 KB
February 26 2025 11:56:05
0 / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF