Blame SOURCES/rsyslog-7.4.7-numeric-uid.patch

92fbf8
From 032fcabdb7f3fc515d8155f48751271535df7b8e Mon Sep 17 00:00:00 2001
92fbf8
From: Tomas Heinrich <theinric@redhat.com>
92fbf8
Date: Thu, 5 Dec 2013 19:46:51 +0100
92fbf8
Subject: [PATCH] Add directives for numerically specifying GIDs/UIDs
92fbf8
92fbf8
The already present directives (FileOwner, FileGroup, DirOwner,
92fbf8
DirGroup) translate names to numerical IDs, which depends on the user
92fbf8
information being available during rsyslog's startup. This can fail if
92fbf8
the information is obtained over a network or from a service such as
92fbf8
SSSD. The new directives provide a way to specify the numerical IDs
92fbf8
directly and bypass the lookup.
92fbf8
---
92fbf8
 doc/omfile.html              | 12 ++++++++++++
92fbf8
 doc/rsyslog_conf_global.html |  4 ++++
92fbf8
 tools/omfile.c               | 16 ++++++++++++++++
92fbf8
 3 files changed, 32 insertions(+)
92fbf8
92fbf8
diff --git a/doc/omfile.html b/doc/omfile.html
92fbf8
index 0f64f26..5f839fe 100644
92fbf8
--- a/doc/omfile.html
92fbf8
+++ b/doc/omfile.html
92fbf8
@@ -53,15 +53,27 @@
92fbf8
 	
  • DirOwner
  • 92fbf8
     	Set the file owner for directories newly created. Please note that this setting does not affect the owner of directories already existing. The parameter is a user name, for which the userid is obtained by rsyslogd during startup processing. Interim changes to the user mapping are not detected.

    92fbf8
     
    92fbf8
    +	
  • DirOwnerNum
  • 92fbf8
    +	Set the file owner for directories newly created. Please note that this setting does not affect the owner of directories already existing. The parameter is a numerical ID, which is used regardless of whether the user actually exists. This can be useful if the user mapping is not available to rsyslog during startup.

    92fbf8
    +
    92fbf8
     	
  • DirGroup
  • 92fbf8
     	Set the group for directories newly created. Please note that this setting does not affect the group of directories already existing. The parameter is a group name, for which the groupid is obtained by rsyslogd on during startup processing. Interim changes to the user mapping are not detected.

    92fbf8
     
    92fbf8
    +	
  • DirGroupNum
  • 92fbf8
    +	Set the group for directories newly created. Please note that this setting does not affect the group of directories already existing. The parameter is a numerical ID, which is used regardless of whether the group actually exists. This can be useful if the group mapping is not available to rsyslog during startup.

    92fbf8
    +
    92fbf8
     	
  • FileOwner
  • 92fbf8
     	Set the file owner for files newly created. Please note that this setting does not affect the owner of files already existing. The parameter is a user name, for which the userid is obtained by rsyslogd during startup processing. Interim changes to the user mapping are not detected.

    92fbf8
     
    92fbf8
    +	
  • FileOwnerNum
  • 92fbf8
    +	Set the file owner for files newly created. Please note that this setting does not affect the owner of files already existing. The parameter is a numerical ID, which which is used regardless of whether the user actually exists. This can be useful if the user mapping is not available to rsyslog during startup.

    92fbf8
    +
    92fbf8
     	
  • FileGroup
  • 92fbf8
     	Set the group for files newly created. Please note that this setting does not affect the group of files already existing. The parameter is a group name, for which the groupid is obtained by rsyslogd during startup processing. Interim changes to the user mapping are not detected.

    92fbf8
     
    92fbf8
    +	
  • $FileGroupNum
  • 92fbf8
    +	Set the group for files newly created. Please note that this setting does not affect the group of files already existing. The parameter is a numerical ID, which is used regardless of whether the group actually exists. This can be useful if the group mapping is not available to rsyslog during startup.

    92fbf8
    +
    92fbf8
     	
  • DirCreateMode [defaul 0700]
  • 92fbf8
     	This is the same as $FileCreateMode, but for directories automatically generated.

    92fbf8
     
    92fbf8
    diff --git a/doc/rsyslog_conf_global.html b/doc/rsyslog_conf_global.html
    92fbf8
    index e48ed6d..b9a2ba2 100644
    92fbf8
    --- a/doc/rsyslog_conf_global.html
    92fbf8
    +++ b/doc/rsyslog_conf_global.html
    92fbf8
    @@ -136,7 +136,9 @@ our paper on using multiple rule sets in rsyslog
    92fbf8
     
  • $CreateDirs [on/off] - create directories on an as-needed basis
  • 92fbf8
     
  • $DirCreateMode
  • 92fbf8
     
  • $DirGroup
  • 92fbf8
    +
  • $DirGroupNum
  • 92fbf8
     
  • $DirOwner
  • 92fbf8
    +
  • $DirOwnerNum
  • 92fbf8
     
  • $DropMsgsWithMaliciousDnsPTRRecords
  • 92fbf8
     
  • $DropTrailingLFOnReception
  • 92fbf8
     
  • $DynaFileCacheSize
  • 92fbf8
    @@ -148,7 +150,9 @@ our paper on using multiple rule sets in rsyslog
    92fbf8
     
  • $FailOnChownFailure
  • 92fbf8
     
  • $FileCreateMode
  • 92fbf8
     
  • $FileGroup
  • 92fbf8
    +
  • $FileGroupNum
  • 92fbf8
     
  • $FileOwner
  • 92fbf8
    +
  • $FileOwnerNum
  • 92fbf8
     
  • $GenerateConfigGraph
  • 92fbf8
     
  • $GssForwardServiceName
  • 92fbf8
     
  • $GssListenServiceName
  • 92fbf8
    diff --git a/tools/omfile.c b/tools/omfile.c
    92fbf8
    index 3dca347..fd14cb5 100644
    92fbf8
    --- a/tools/omfile.c
    92fbf8
    +++ b/tools/omfile.c
    92fbf8
    @@ -233,9 +233,13 @@ static struct cnfparamdescr actpdescr[] = {
    92fbf8
     	{ "flushontxend", eCmdHdlrBinary, 0 }, /* legacy: omfileflushontxend */
    92fbf8
     	{ "iobuffersize", eCmdHdlrSize, 0 }, /* legacy: omfileiobuffersize */
    92fbf8
     	{ "dirowner", eCmdHdlrUID, 0 }, /* legacy: dirowner */
    92fbf8
    +	{ "dirownernum", eCmdHdlrInt, 0 }, /* legacy: dirownernum */
    92fbf8
     	{ "dirgroup", eCmdHdlrGID, 0 }, /* legacy: dirgroup */
    92fbf8
    +	{ "dirgroupnum", eCmdHdlrInt, 0 }, /* legacy: dirgroupnum */
    92fbf8
     	{ "fileowner", eCmdHdlrUID, 0 }, /* legacy: fileowner */
    92fbf8
    +	{ "fileownernum", eCmdHdlrInt, 0 }, /* legacy: fileownernum */
    92fbf8
     	{ "filegroup", eCmdHdlrGID, 0 }, /* legacy: filegroup */
    92fbf8
    +	{ "filegroupnum", eCmdHdlrInt, 0 }, /* legacy: filegroupnum */
    92fbf8
     	{ "dircreatemode", eCmdHdlrFileCreateMode, 0 }, /* legacy: dircreatemode */
    92fbf8
     	{ "filecreatemode", eCmdHdlrFileCreateMode, 0 }, /* legacy: filecreatemode */
    92fbf8
     	{ "failonchownfailure", eCmdHdlrBinary, 0 }, /* legacy: failonchownfailure */
    92fbf8
    @@ -1139,12 +1143,20 @@ CODESTARTnewActInst
    92fbf8
     			pData->iIOBufSize = (int) pvals[i].val.d.n;
    92fbf8
     		} else if(!strcmp(actpblk.descr[i].name, "dirowner")) {
    92fbf8
     			pData->dirUID = (int) pvals[i].val.d.n;
    92fbf8
    +		} else if(!strcmp(actpblk.descr[i].name, "dirownernum")) {
    92fbf8
    +			pData->dirUID = (int) pvals[i].val.d.n;
    92fbf8
     		} else if(!strcmp(actpblk.descr[i].name, "dirgroup")) {
    92fbf8
     			pData->dirGID = (int) pvals[i].val.d.n;
    92fbf8
    +		} else if(!strcmp(actpblk.descr[i].name, "dirgroupnum")) {
    92fbf8
    +			pData->dirGID = (int) pvals[i].val.d.n;
    92fbf8
     		} else if(!strcmp(actpblk.descr[i].name, "fileowner")) {
    92fbf8
     			pData->fileUID = (int) pvals[i].val.d.n;
    92fbf8
    +		} else if(!strcmp(actpblk.descr[i].name, "fileownernum")) {
    92fbf8
    +			pData->fileUID = (int) pvals[i].val.d.n;
    92fbf8
     		} else if(!strcmp(actpblk.descr[i].name, "filegroup")) {
    92fbf8
     			pData->fileGID = (int) pvals[i].val.d.n;
    92fbf8
    +		} else if(!strcmp(actpblk.descr[i].name, "filegroupnum")) {
    92fbf8
    +			pData->fileGID = (int) pvals[i].val.d.n;
    92fbf8
     		} else if(!strcmp(actpblk.descr[i].name, "dircreatemode")) {
    92fbf8
     			pData->fDirCreateMode = (int) pvals[i].val.d.n;
    92fbf8
     		} else if(!strcmp(actpblk.descr[i].name, "filecreatemode")) {
    92fbf8
    @@ -1377,9 +1389,13 @@ INITLegCnfVars
    92fbf8
     	CHKiRet(omsdRegCFSLineHdlr((uchar *)"omfileflushontxend", 0, eCmdHdlrBinary, NULL, &cs.bFlushOnTXEnd, STD_LOADABLE_MODULE_ID));
    92fbf8
     	CHKiRet(omsdRegCFSLineHdlr((uchar *)"omfileiobuffersize", 0, eCmdHdlrSize, NULL, &cs.iIOBufSize, STD_LOADABLE_MODULE_ID));
    92fbf8
     	CHKiRet(omsdRegCFSLineHdlr((uchar *)"dirowner", 0, eCmdHdlrUID, NULL, &cs.dirUID, STD_LOADABLE_MODULE_ID));
    92fbf8
    +	CHKiRet(omsdRegCFSLineHdlr((uchar *)"dirownernum", 0, eCmdHdlrInt, NULL, &cs.dirUID, STD_LOADABLE_MODULE_ID));
    92fbf8
     	CHKiRet(omsdRegCFSLineHdlr((uchar *)"dirgroup", 0, eCmdHdlrGID, NULL, &cs.dirGID, STD_LOADABLE_MODULE_ID));
    92fbf8
    +	CHKiRet(omsdRegCFSLineHdlr((uchar *)"dirgroupnum", 0, eCmdHdlrInt, NULL, &cs.dirGID, STD_LOADABLE_MODULE_ID));
    92fbf8
     	CHKiRet(omsdRegCFSLineHdlr((uchar *)"fileowner", 0, eCmdHdlrUID, NULL, &cs.fileUID, STD_LOADABLE_MODULE_ID));
    92fbf8
    +	CHKiRet(omsdRegCFSLineHdlr((uchar *)"fileownernum", 0, eCmdHdlrInt, NULL, &cs.fileUID, STD_LOADABLE_MODULE_ID));
    92fbf8
     	CHKiRet(omsdRegCFSLineHdlr((uchar *)"filegroup", 0, eCmdHdlrGID, NULL, &cs.fileGID, STD_LOADABLE_MODULE_ID));
    92fbf8
    +	CHKiRet(omsdRegCFSLineHdlr((uchar *)"filegroupnum", 0, eCmdHdlrInt, NULL, &cs.fileGID, STD_LOADABLE_MODULE_ID));
    92fbf8
     	CHKiRet(omsdRegCFSLineHdlr((uchar *)"dircreatemode", 0, eCmdHdlrFileCreateMode, NULL, &cs.fDirCreateMode, STD_LOADABLE_MODULE_ID));
    92fbf8
     	CHKiRet(omsdRegCFSLineHdlr((uchar *)"filecreatemode", 0, eCmdHdlrFileCreateMode, NULL, &cs.fCreateMode, STD_LOADABLE_MODULE_ID));
    92fbf8
     	CHKiRet(omsdRegCFSLineHdlr((uchar *)"createdirs", 0, eCmdHdlrBinary, NULL, &cs.bCreateDirs, STD_LOADABLE_MODULE_ID));
    92fbf8
    -- 
    92fbf8
    1.8.4.3
    92fbf8