~james-page/ubuntu/natty/cobbler/fix-764391

« back to all changes in this revision

Viewing changes to cobbler/cobblerd.py

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short, Chuck Short, Andres Rodriguez
  • Date: 2011-03-11 07:59:55 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20110311075955-9z16j4suh6xwcwh8
Tags: 2.1.0~bzr2005-0ubuntu1
[Chuck Short]
* New upstream release 

[Andres Rodriguez]
* Add python-koan package (LP: #731616):
  - debian/control: Add python-koan binary package; fix typo
  - debian/python-cobbler.install: Do not install koan python modules.
  - debian/python-koan.install: Add. Install koan python modules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
 
40
40
def main():
41
 
   core(logger=None)
 
41
    core(logger=None)
42
42
 
43
43
def core(api):
44
44
 
53
53
    # this is only used for Kerberos auth at the moment.
54
54
    # it identifies XMLRPC requests from Apache that have already
55
55
    # been cleared by Kerberos.
56
 
 
 
56
    ssfile = "/var/lib/cobbler/web.ss"
57
57
    fd = open("/dev/urandom")
58
58
    data = fd.read(512)
59
59
    fd.close()
60
 
    fd = open("/var/lib/cobbler/web.ss","w+")
61
 
    fd.write(binascii.hexlify(data))
62
 
    fd.close()
63
 
    utils.os_system("chmod 700 /var/lib/cobbler/web.ss")
64
 
    http_user = "apache"
65
 
    if utils.check_dist() in [ "debian", "ubuntu" ]:
66
 
        http_user = "www-data"
 
60
    if not os.path.isfile(ssfile):
 
61
        um = os.umask(int('0027',16))
 
62
        fd = open(ssfile,"w+")
 
63
        fd.write(binascii.hexlify(data))
 
64
        fd.close()
 
65
        os.umask(um)
 
66
        utils.os_system("chmod 700 /var/lib/cobbler/web.ss")
 
67
        http_user = "apache"
 
68
        if utils.check_dist() in [ "debian", "ubuntu" ]:
 
69
            http_user = "www-data"
 
70
        utils.os_system("chown %s /var/lib/cobbler/web.ss"%http_user )
 
71
    else:
 
72
        fd = open(ssfile,"w+")
 
73
        fd.write(binascii.hexlify(data))
 
74
        fd.close()
67
75
 
68
 
    cmd = "chown %s /var/lib/cobbler/web.ss" % http_user
69
 
    utils.os_system( cmd )
70
76
    return 1
71
77
 
72
78
def do_xmlrpc_tasks(bootapi, settings, xmlrpc_port):