summaryrefslogtreecommitdiffstats
path: root/ipa-python/setup.py
blob: 3a5a6f4eb14faf030677ec324f179a150b127edc (plain)
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
#!/usr/bin/env python
"""FreeIPA python support library

FreeIPA is a server for identity, policy, and audit.
"""

DOCLINES = __doc__.split("\n")

import os
import sys
import distutils.sysconfig

CLASSIFIERS = """\
Development Status :: 4 - Beta
Intended Audience :: System Environment/Base
License :: GPL
Programming Language :: Python
Operating System :: POSIX
Operating System :: Unix
"""

# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
# update it when the contents of directories change.
if os.path.exists('MANIFEST'): os.remove('MANIFEST')

def setup_package():

    from distutils.core import setup

    old_path = os.getcwd()
    local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
    os.chdir(local_path)
    sys.path.insert(0,local_path)

    try:
        setup(
            name = "freeipa-python",
            version = "0.5.0",
            license = "GPL",
            author = "Karl MacMillan, et.al.",
            author_email = "kmacmillan@redhat.com",
            maintainer = "freeIPA Developers",
            maintainer_email = "freeipa-devel@redhat.com",
            url = "http://www.freeipa.org/",
            description = DOCLINES[0],
            long_description = "\n".join(DOCLINES[2:]),
            download_url = "http://www.freeipa.org/page/Downloads",
            classifiers=filter(None, CLASSIFIERS.split('\n')),
            platforms = ["Linux", "Solaris", "Unix"],
            package_dir = {'ipa': ''},
            packages = [ "ipa" ],
            data_files = [('/etc/ipa', ['ipa.conf'])]
        )
    finally:
        del sys.path[0]
        os.chdir(old_path)
    return

if __name__ == '__main__':
    setup_package()
; i++) { if (fake_files[i].type==type) { break; } } if (fake_files[i].name == NULL) { return NULL; } DEBUG(5,("init_fake_file_handle: for [%s]\n",fake_files[i].name)); fh = talloc(NULL, struct fake_file_handle); if (fh == NULL) { DEBUG(0,("TALLOC_ZERO() failed.\n")); return NULL; } fh->type = type; if (fake_files[i].init_pd) { fh->private_data = fake_files[i].init_pd(fh); } return fh; } /**************************************************************************** Does this name match a fake filename ? ****************************************************************************/ enum FAKE_FILE_TYPE is_fake_file_path(const char *path) { int i; if (!path) { return FAKE_FILE_TYPE_NONE; } for (i=0;fake_files[i].name!=NULL;i++) { if (strncmp(path,fake_files[i].name,strlen(fake_files[i].name))==0) { DEBUG(5,("is_fake_file: [%s] is a fake file\n",path)); return fake_files[i].type; } } return FAKE_FILE_TYPE_NONE; } enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname) { char *fname = NULL; NTSTATUS status; enum FAKE_FILE_TYPE ret; if (!smb_fname) { return FAKE_FILE_TYPE_NONE; } status = get_full_smb_filename(talloc_tos(), smb_fname, &fname); if (!NT_STATUS_IS_OK(status)) { return FAKE_FILE_TYPE_NONE; } ret = is_fake_file_path(fname); TALLOC_FREE(fname); return ret; } /**************************************************************************** Open a fake quota file with a share mode. ****************************************************************************/ NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn, uint16_t current_vuid, enum FAKE_FILE_TYPE fake_file_type, const struct smb_filename *smb_fname, uint32 access_mask, files_struct **result) { files_struct *fsp = NULL; NTSTATUS status; status = smbd_calculate_access_mask(conn, smb_fname, false, /* fake files do not exist */ access_mask, &access_mask); if (!NT_STATUS_IS_OK(status)) { DEBUG(10, ("open_fake_file: smbd_calculate_access_mask " "on service[%s] file[%s] returned %s\n", lp_servicename(SNUM(conn)), smb_fname_str_dbg(smb_fname), nt_errstr(status))); return status; } /* access check */ if (geteuid() != sec_initial_uid()) { DEBUG(3, ("open_fake_file_shared: access_denied to " "service[%s] file[%s] user[%s]\n", lp_servicename(SNUM(conn)), smb_fname_str_dbg(smb_fname), conn->session_info->unix_info->unix_name)); return NT_STATUS_ACCESS_DENIED; } status = file_new(req, conn, &fsp); if(!NT_STATUS_IS_OK(status)) { return status; } DEBUG(5,("open_fake_file_shared: fname = %s, FID = %d, access_mask = 0x%x\n", smb_fname_str_dbg(smb_fname), fsp->fnum, (unsigned int)access_mask)); fsp->conn = conn; fsp->fh->fd = -1; fsp->vuid = current_vuid; fsp->fh->pos = -1; fsp->can_lock = False; /* Should this be true ? - No, JRA */ fsp->access_mask = access_mask; status = fsp_set_smb_fname(fsp, smb_fname); if (!NT_STATUS_IS_OK(status)) { file_free(req, fsp); return NT_STATUS_NO_MEMORY; } fsp->fake_file_handle = init_fake_file_handle(fake_file_type); if (fsp->fake_file_handle==NULL) { file_free(req, fsp); return NT_STATUS_NO_MEMORY; } *result = fsp; return NT_STATUS_OK; } NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp) { file_free(req, fsp); return NT_STATUS_OK; }