Secure logs, inherited from security-server are no longer needed.
Replace calls to Secure* logs with their non-secure equivalents.
This is an initial commit in logging adaptation series. It should be
verified by successful build.
Change-Id: I908851f8927c46474489a6bf5053f480d65ac22d
Signed-off-by: Marcin Lis <m.lis@samsung.com>
const char *fileName,
int line,
const char *function) = 0;
- virtual void SecureDebug(const char *message,
- const char *fileName,
- int line,
- const char *function) = 0;
- virtual void SecureInfo(const char *message,
- const char *fileName,
- int line,
- const char *function) = 0;
- virtual void SecureWarning(const char *message,
- const char *fileName,
- int line,
- const char *function) = 0;
- virtual void SecureError(const char *message,
- const char *fileName,
- int line,
- const char *function) = 0;
protected:
static const char *LocateSourceFileName(const char *filename);
const char *fileName,
int line,
const char *function);
- virtual void SecureDebug(const char *message,
- const char *fileName,
- int line,
- const char *function);
- virtual void SecureInfo(const char *message,
- const char *fileName,
- int line,
- const char *function);
- virtual void SecureWarning(const char *message,
- const char *fileName,
- int line,
- const char *function);
- virtual void SecureError(const char *message,
- const char *fileName,
- int line,
- const char *function);
// Set global Tag according to DLOG
void SetTag(const char *tag);
const char *function);
/**
- * Log pedantic message with secure macro
- */
- void SecureDebug(const char *message,
- const char *filename,
- int line,
- const char *function);
-
- /**
- * Log info message with secure macro
- */
- void SecureInfo(const char *message,
- const char *filename,
- int line,
- const char *function);
-
- /**
- * Log warning message with secure macro
- */
- void SecureWarning(const char *message,
- const char *filename,
- int line,
- const char *function);
-
- /**
- * Log error message with secure macro
- */
- void SecureError(const char *message,
- const char *filename,
- int line,
- const char *function);
-
- /**
* Set default's DLOG provider Tag
*/
void SetTag(const char *tag);
/* Errors must be always logged. */
#define LogError(message) DPL_MACRO_FOR_LOGGING(message, Error)
-#define LogSecureError(message) DPL_MACRO_FOR_LOGGING(message, SecureError)
#ifdef BUILD_TYPE_DEBUG
#define LogDebug(message) DPL_MACRO_FOR_LOGGING(message, Debug)
#define LogInfo(message) DPL_MACRO_FOR_LOGGING(message, Info)
#define LogWarning(message) DPL_MACRO_FOR_LOGGING(message, Warning)
#define LogPedantic(message) DPL_MACRO_FOR_LOGGING(message, Pedantic)
- #define LogSecureDebug(message) DPL_MACRO_FOR_LOGGING(message, SecureDebug)
- #define LogSecureInfo(message) DPL_MACRO_FOR_LOGGING(message, SecureInfo)
- #define LogSecureWarning(message) DPL_MACRO_FOR_LOGGING(message, SecureWarning)
#else
#define LogDebug(message) DPL_MACRO_DUMMY_LOGGING(message, Debug)
#define LogInfo(message) DPL_MACRO_DUMMY_LOGGING(message, Info)
#define LogWarning(message) DPL_MACRO_DUMMY_LOGGING(message, Warning)
#define LogPedantic(message) DPL_MACRO_DUMMY_LOGGING(message, Pedantic)
- #define LogSecureDebug(message) DPL_MACRO_DUMMY_LOGGING(message, SecureDebug)
- #define LogSecureInfo(message) DPL_MACRO_DUMMY_LOGGING(message, SecureInfo)
- #define LogSecureWarning(message) DPL_MACRO_DUMMY_LOGGING(message, SecureWarning)
#endif // BUILD_TYPE_DEBUG
#endif // SECURITYMANAGER_LOG_H
const char *fileName,
int line,
const char *function);
- virtual void SecureDebug(const char *message,
- const char *fileName,
- int line,
- const char *function);
- virtual void SecureInfo(const char *message,
- const char *fileName,
- int line,
- const char *function);
- virtual void SecureWarning(const char *message,
- const char *fileName,
- int line,
- const char *function);
- virtual void SecureError(const char *message,
- const char *fileName,
- int line,
- const char *function);
};
}
} // namespace SecurityManager
function).c_str());
}
-void DLOGLogProvider::SecureDebug(const char *message UNUSED,
- const char *filename UNUSED,
- int line UNUSED,
- const char *function UNUSED)
-{
- SECURE_SLOG(LOG_DEBUG, m_tag.get(), "%s",
- FormatMessage(message, filename, line, function).c_str());
-}
-
-void DLOGLogProvider::SecureInfo(const char *message UNUSED,
- const char *filename UNUSED,
- int line UNUSED,
- const char *function UNUSED)
-{
- SECURE_SLOG(LOG_INFO, m_tag.get(), "%s",
- FormatMessage(message, filename, line, function).c_str());
-}
-
-void DLOGLogProvider::SecureWarning(const char *message UNUSED,
- const char *filename UNUSED,
- int line UNUSED,
- const char *function UNUSED)
-{
- SECURE_SLOG(LOG_WARN, m_tag.get(), "%s",
- FormatMessage(message, filename, line, function).c_str());
-}
-
-void DLOGLogProvider::SecureError(const char *message UNUSED,
- const char *filename UNUSED,
- int line UNUSED,
- const char *function UNUSED)
-{
- SECURE_SLOG(LOG_ERROR, m_tag.get(), "%s",
- FormatMessage(message, filename, line, function).c_str());
-}
-
} // nemespace Log
} // namespace SecurityManager
}
}
-void LogSystem::SecureInfo(const char *message,
- const char *filename,
- int line,
- const char *function)
-{
- for (AbstractLogProviderPtrList::iterator iterator = m_providers.begin();
- iterator != m_providers.end();
- ++iterator)
- {
- (*iterator)->SecureInfo(message, filename, line, function);
- }
-}
-
-void LogSystem::SecureDebug(const char *message,
- const char *filename,
- int line,
- const char *function)
-{
- for (AbstractLogProviderPtrList::iterator iterator = m_providers.begin();
- iterator != m_providers.end();
- ++iterator)
- {
- (*iterator)->SecureDebug(message, filename, line, function);
- }
-}
-
-void LogSystem::SecureError(const char *message,
- const char *filename,
- int line,
- const char *function)
-{
- for (AbstractLogProviderPtrList::iterator iterator = m_providers.begin();
- iterator != m_providers.end();
- ++iterator)
- {
- (*iterator)->SecureError(message, filename, line, function);
- }
-}
-
-void LogSystem::SecureWarning(const char *message,
- const char *filename,
- int line,
- const char *function)
-{
- for (AbstractLogProviderPtrList::iterator iterator = m_providers.begin();
- iterator != m_providers.end();
- ++iterator)
- {
- (*iterator)->SecureWarning(message, filename, line, function);
- }
-}
-
}
} // namespace SecurityManager
}
}
-void OldStyleLogProvider::SecureDebug(const char *message,
- const char *filename,
- int line,
- const char *function)
-{
-#ifdef _SECURE_LOG
- if (m_showDebug) {
- if (m_printStdErr) {
- fprintf(stderr, "%s%s%s\n", DEBUG_BEGIN,
- FormatMessage(message, filename, line,
- function).c_str(), DEBUG_END);
- } else {
- fprintf(stdout, "%s%s%s\n", DEBUG_BEGIN,
- FormatMessage(message, filename, line,
- function).c_str(), DEBUG_END);
- }
- }
-#else
- (void)message;
- (void)filename;
- (void)line;
- (void)function;
-#endif
-}
-
-void OldStyleLogProvider::SecureInfo(const char *message,
- const char *filename,
- int line,
- const char *function)
-{
-#ifdef _SECURE_LOG
- if (m_showInfo) {
- if (m_printStdErr) {
- fprintf(stderr, "%s%s%s\n", INFO_BEGIN,
- FormatMessage(message, filename, line,
- function).c_str(), INFO_END);
- } else {
- fprintf(stdout, "%s%s%s\n", INFO_BEGIN,
- FormatMessage(message, filename, line,
- function).c_str(), INFO_END);
- }
- }
-#else
- (void)message;
- (void)filename;
- (void)line;
- (void)function;
-#endif
-}
-
-void OldStyleLogProvider::SecureWarning(const char *message,
- const char *filename,
- int line,
- const char *function)
-{
-#ifdef _SECURE_LOG
- if (m_showWarning) {
- if (m_printStdErr) {
- fprintf(stderr, "%s%s%s\n", WARNING_BEGIN,
- FormatMessage(message, filename, line,
- function).c_str(), WARNING_END);
- } else {
- fprintf(stdout, "%s%s%s\n", WARNING_BEGIN,
- FormatMessage(message, filename, line,
- function).c_str(), WARNING_END);
- }
- }
-#else
- (void)message;
- (void)filename;
- (void)line;
- (void)function;
-#endif
-}
-
-void OldStyleLogProvider::SecureError(const char *message,
- const char *filename,
- int line,
- const char *function)
-{
-#ifdef _SECURE_LOG
- if (m_showError) {
- if (m_printStdErr) {
- fprintf(stderr, "%s%s%s\n", ERROR_BEGIN,
- FormatMessage(message, filename, line,
- function).c_str(), ERROR_END);
- } else {
- fprintf(stdout, "%s%s%s\n", ERROR_BEGIN,
- FormatMessage(message, filename, line,
- function).c_str(), ERROR_END);
- }
- }
-#else
- (void)message;
- (void)filename;
- (void)line;
- (void)function;
-#endif
-}
-
}
} // namespace SecurityManager
FileDecision labelAll(const FTSENT *ftsent __attribute__((unused)))
{
- LogSecureDebug("Entering function: " << __func__);
+ LogDebug("Entering function: " << __func__);
return FileDecision::LABEL;
}
FileDecision labelDirs(const FTSENT *ftsent)
{
- LogSecureDebug("Entering function: " << __func__);
+ LogDebug("Entering function: " << __func__);
// label only directories
if (S_ISDIR(ftsent->fts_statp->st_mode))
FileDecision labelExecs(const FTSENT *ftsent)
{
- LogSecureDebug("Entering function: " << __func__);
+ LogDebug("Entering function: " << __func__);
LogDebug("Mode = " << ftsent->fts_statp->st_mode);
// label only regular executable files
FileDecision labelLinksToExecs(const FTSENT *ftsent)
{
- LogSecureDebug("Entering function: " << __func__);
+ LogDebug("Entering function: " << __func__);
struct stat buf;
std::unique_ptr<char, std::function<void(void*)>> target(realpath(ftsent->fts_path, NULL), free);
if (!target.get()) {
- LogSecureError("Getting link target for " << ftsent->fts_path << " failed (Error = " << strerror(errno) << ")");
+ LogError("Getting link target for " << ftsent->fts_path << " failed (Error = " << strerror(errno) << ")");
return FileDecision::ERROR;
}
if (-1 == stat(target.get(), &buf)) {
- LogSecureError("stat failed for " << target.get() << " (Error = " << strerror(errno) << ")");
+ LogError("stat failed for " << target.get() << " (Error = " << strerror(errno) << ")");
return FileDecision::ERROR;
}
// skip if link target is not a regular executable file
if (buf.st_mode != (buf.st_mode | S_IXUSR | S_IFREG)) {
- LogSecureDebug(target.get() << "is not a regular executable file. Skipping.");
+ LogDebug(target.get() << "is not a regular executable file. Skipping.");
return FileDecision::SKIP;
}
bool dirSetSmack(const std::string &path, const std::string &label,
const char *xattr_name, LabelDecisionFn fn)
{
- LogSecureDebug("Entering function: "<< __func__ <<". Params:"
+ LogDebug("Entering function: "<< __func__ <<". Params:"
" path=" << path << ", label=" << label << ", xattr=" << xattr_name);
bool labelDir(const std::string &path, const std::string &label,
bool set_transmutable, bool set_executables)
{
- LogSecureDebug("Entering function: "<< __func__ <<". Params:"
+ LogDebug("Entering function: "<< __func__ <<". Params:"
" path=" << path << " label= " << label
<< " set_transmutable= " << set_transmutable
<< " set_executables= " << set_executables);