This file is indexed.

/usr/share/rhn/up2date_client/yumPlugin.py is in rhn-client-tools 1.8.26-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Client code for enabling yum-rhn-plugin
# Copyright (c) 2000--2012 Red Hat, Inc.

import os
import re
import rpm

# global variables 
YUM_PLUGIN_CONF = '/etc/yum/pluginconf.d/rhnplugin.conf' 

def pluginEnable():
    """Enables yum-rhn-plugin, may throw IOError"""
    conf_changed = 0
    plugin_present = 0
    if YumRHNPluginPackagePresent():
        plugin_present = 1
        if YumRHNPluginConfPresent():
            if not YumRhnPluginEnabled():
                enableYumRhnPlugin()
                conf_changed = 1
        else:
            createDefaultYumRHNPluginConf()
            conf_changed = 1
    elif os.path.exists("/usr/lib/zypp/plugins/services/spacewalk"):
        """SUSE zypp plugin is installed"""
        plugin_present = 1
    return plugin_present, conf_changed

def YumRHNPluginPackagePresent():
    """ Returns positive number if packaga yum-rhn-plugin is installed, otherwise it return 0 """
    ts = rpm.TransactionSet()
    headers = ts.dbMatch('providename', 'yum-rhn-plugin')
    return headers.count()

def YumRHNPluginConfPresent():
    """ Returns true if /etc/yum/pluginconf.d/rhnplugin.conf is presented """
    try:
        os.stat(YUM_PLUGIN_CONF)
        return True
    except OSError:
        return False

def createDefaultYumRHNPluginConf():
    """ Create file /etc/yum/pluginconf.d/rhnplugin.conf with default values """
    f = open(YUM_PLUGIN_CONF, 'w')
    f.write("""[main]
enabled = 1
gpgcheck = 1""")
    f.close()

def YumRhnPluginEnabled():
    """ Returns True if yum-rhn-plugin is enabled
        Can thrown IOError exception.
    """
    f = open(YUM_PLUGIN_CONF, 'r')
    lines = f.readlines()
    f.close()
    main_section = False
    result = False
    for line in lines:
        if re.match("^\[.*]", line):
            if re.match("^\[main]", line):
                main_section = True
            else:
                main_section = False
        if main_section:
            m = re.match('^\s*enabled\s*=\s*([0-9])', line)
            if m:
                if int(m.group(1)):
                    result = True
                else:
                    result = False
    return result

def enableYumRhnPlugin():
    """ enable yum-rhn-plugin by setting enabled=1 in file
        /etc/yum/pluginconf.d/rhnplugin.conf
        Can thrown IOError exception.
    """
    f = open(YUM_PLUGIN_CONF, 'r')
    lines = f.readlines()
    f.close()
    main_section = False
    f = open(YUM_PLUGIN_CONF, 'w')
    for line in lines:
        if re.match("^\[.*]", line):
            if re.match("^\[main]", line):
                main_section = True
            else:
                main_section = False
        if main_section:
            line = re.sub('^(\s*)enabled\s*=.+', r'\1enabled = 1', line)
        f.write(line)
    f.close()