diff options
author | Jeremy Katz <katzj@redhat.com> | 2006-08-24 20:16:54 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2006-08-24 20:16:54 +0000 |
commit | 0d67085632ee9bd64eabad776f208fa250fe4a84 (patch) | |
tree | 99e294c1a675454878a146ecf0b9e49fb5b3f81c /isys | |
parent | bafe7b1a8184a23a14efe35f083c2fcb190cdc24 (diff) | |
download | anaconda-0d67085632ee9bd64eabad776f208fa250fe4a84.tar.gz anaconda-0d67085632ee9bd64eabad776f208fa250fe4a84.tar.xz anaconda-0d67085632ee9bd64eabad776f208fa250fe4a84.zip |
2006-08-24 Jeremy Katz <katzj@redhat.com>
* fsset.py (FileSystemType.mount): Reset file context on
mountpoints (#202525)
* packages.py (setFileCons): Use new parameter to resetFileContext
* isys/isys.py (resetFileContext): Allow passing a rootpath
* isys/isys.c (doResetFileContext): Likewise.
Diffstat (limited to 'isys')
-rw-r--r-- | isys/isys.c | 11 | ||||
-rw-r--r-- | isys/isys.py | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/isys/isys.c b/isys/isys.c index d494c4218..521e053d2 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -1209,15 +1209,22 @@ static PyObject * doGetIPAddress(PyObject * s, PyObject * args) { #ifdef USESELINUX static PyObject * doResetFileContext(PyObject * s, PyObject * args) { char *fn, *buf = NULL; + char * root = NULL; + char path[PATH_MAX]; int ret; - if (!PyArg_ParseTuple(args, "s", &fn)) + if (!PyArg_ParseTuple(args, "s|s", &fn, &root)) return NULL; ret = matchpathcon(fn, 0, &buf); /* fprintf(stderr, "matchpathcon returned %d: set %s to %s\n", ret, fn, buf);*/ if (ret == 0) { - ret = lsetfilecon(fn, buf); + if (root != NULL) + snprintf(path, PATH_MAX, "%s/%s", root, fn); + else + snprintf(path, PATH_MAX, "%s", root); + + ret = lsetfilecon(path, buf); } return Py_BuildValue("s", buf); diff --git a/isys/isys.py b/isys/isys.py index 416990f78..ac2acff97 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -847,8 +847,8 @@ def isWireless(dev): def getIPAddress(dev): return _isys.getIPAddress(dev) -def resetFileContext(fn): - return _isys.resetFileContext(fn) +def resetFileContext(fn, instroot = '/'): + return _isys.resetFileContext(fn, instroot) auditDaemon = _isys.auditdaemon |