summaryrefslogtreecommitdiffstats
path: root/tdmlib/tdmtsak.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-04-27 13:26:04 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-04-27 13:26:04 -0500
commit22d0a673d7d6049d388847b476df1e5b6f3d6b70 (patch)
treeb6fc0fe18603cf23bfbcf480a169081b11a99beb /tdmlib/tdmtsak.cpp
parente899b7beb6b0f2db8c08dfdc14c29efb99046086 (diff)
downloadtdebase-22d0a673d7d6049d388847b476df1e5b6f3d6b70.tar.gz
tdebase-22d0a673d7d6049d388847b476df1e5b6f3d6b70.zip
Check for tsak presence on lock engage
Fix tsak not exiting on request Clean up build warnings
Diffstat (limited to 'tdmlib/tdmtsak.cpp')
-rw-r--r--tdmlib/tdmtsak.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/tdmlib/tdmtsak.cpp b/tdmlib/tdmtsak.cpp
index a7cc802f9..b3ff08cc1 100644
--- a/tdmlib/tdmtsak.cpp
+++ b/tdmlib/tdmtsak.cpp
@@ -121,10 +121,14 @@ int main (int argc, char *argv[])
int verifier_result = tde_sak_verify_calling_process();
bool isdm = false;
+ bool checkonly = false;
if (argc == 2) {
if (strcmp(argv[1], "dm") == 0) {
isdm = true;
}
+ if (strcmp(argv[1], "check") == 0) {
+ checkonly = true;
+ }
}
if (!isdm) {
@@ -139,6 +143,14 @@ int main (int argc, char *argv[])
// OK, the calling process is authorized to retrieve SAK data
// First, flush the buffer
mPipe_fd = open(FIFO_FILE, O_RDONLY | O_NONBLOCK);
+ if (checkonly) {
+ if (mPipe_fd < 0) {
+ return 6; // SAK not available
+ }
+ else {
+ return 0;
+ }
+ }
numread = 1;
while (numread > 0) {
numread = read(mPipe_fd, readbuf, 6);
@@ -177,4 +189,4 @@ int main (int argc, char *argv[])
else {
return verifier_result;
}
-} \ No newline at end of file
+}