summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafal Krypa <r.krypa@samsung.com>2016-10-20 18:32:04 +0200
committerChan Lee <chan45.lee@samsung.com>2016-10-27 11:19:59 +0900
commit7e3a5bea4556adbb77952c512093dc8097e99d2f (patch)
treecef9ad634cf3529db90c0e054db4a4fc8d6079d6
parente0a09e7f931f50b1b22af5b79e80bd35a2d73a25 (diff)
downloadsecurity-manager-sandbox/chanleebf/asan.tar.gz
security-manager-sandbox/chanleebf/asan.tar.bz2
security-manager-sandbox/chanleebf/asan.zip
Fix retrieving of current process credentials for off-line clientsandbox/chanleebf/asan
Try to work even if fetching Smack label of current process fails in off-line client mode. In most cases it won't be needed anyway. It is needed for proper image building by mic. When mic is run on system that doesn't support Smack natively (e.g. developer's workstation), fetching process Smack label will fail. Somehow it managed to work despite that problem until now, but libsmack 1.3.0 has better checks in function smack_new_label_from_self, validating the label before sending it to the caller. Change-Id: I3a96851cab5e71bde749c68413b967571690e162
-rw-r--r--src/common/credentials.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/credentials.cpp b/src/common/credentials.cpp
index 171326ea..9bf8d708 100644
--- a/src/common/credentials.cpp
+++ b/src/common/credentials.cpp
@@ -22,6 +22,7 @@
#include <unistd.h>
#include <sys/socket.h>
+#include "smack-check.h"
#include "smack-labels.h"
#include "credentials.h"
@@ -30,7 +31,7 @@ namespace SecurityManager {
Credentials Credentials::getCredentialsFromSelf(void)
{
return Credentials(getpid(), geteuid(), getegid(),
- SmackLabels::getSmackLabelFromSelf());
+ smack_check() ? SmackLabels::getSmackLabelFromSelf() : "");
}
Credentials Credentials::getCredentialsFromSocket(int sock)