Plug leaks in selinux context handling in fsm

This commit is contained in:
Panu Matilainen 2008-07-03 17:14:45 +03:00
parent 03b2c395b2
commit 2093f7cceb
2 changed files with 7 additions and 3 deletions

View File

@ -1217,11 +1217,13 @@ static int fsmMkdirs(FSM_t fsm)
rpmlog(RPMLOG_DEBUG,
"%s directory created with perms %04o, no context.\n",
fsm->path, (unsigned)(st->st_mode & 07777));
else
else {
rpmlog(RPMLOG_DEBUG,
"%s directory created with perms %04o, context %s.\n",
fsm->path, (unsigned)(st->st_mode & 07777),
fsm->fcontext);
freecon(fsm->fcontext);
}
fsm->fcontext = NULL;
}
*te = '/';
@ -1845,8 +1847,10 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
*/
if (!rc && !getuid()) {
rc = fsmMapFContext(fsm);
if (!rc)
if (!rc) {
rc = fsmNext(fsm, FSM_LSETFCON);
freecon(fsm->fcontext);
}
fsm->fcontext = NULL;
}
if (S_ISLNK(st->st_mode)) {

View File

@ -153,7 +153,7 @@ struct fsm_s {
const char * dirName; /*!< File directory name. */
const char * baseName; /*!< File base name. */
const char * digest; /*!< Binary checksum (NULL disables). */
const char * fcontext; /*!< File security context (NULL disables). */
security_context_t fcontext;/*!< File security context (NULL disables). */
pgpHashAlgo digestalgo; /*!< File checksum algorithm */
unsigned fflags; /*!< File flags. */