Branch: master

30b251b0 2015-09-04 02:30:28 Timothy Pearson
Clean up revoked certificates when done updating CRL
M src/libtdeldap.cpp
diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp
index 63ff769..ea67fd6 100644
--- a/src/libtdeldap.cpp
+++ b/src/libtdeldap.cpp
@@ -4418,6 +4418,13 @@
 			return -1;
 		}
 
+		if (fileExists(revoked_certfile.ascii())) {
+			if (unlink(revoked_certfile.ascii()) < 0) {
+				if (errstr) *errstr = TQString("Unable to unlink \"%1\"").arg(revoked_certfile);
+				return -1;
+			}
+		}
+
 		LDAPUserInfoList::Iterator it;
 		for (it = userList.begin(); it != userList.end(); ++it) {
 			LDAPUserInfo user = *it;
@@ -4451,6 +4458,13 @@
 							if (errstr) *errstr = TQString("Execution of \"%s\" failed").arg(command);
 							return -1;
 						}
+
+						if (fileExists(revoked_certfile.ascii())) {
+							if (unlink(revoked_certfile.ascii()) < 0) {
+								if (errstr) *errstr = TQString("Unable to unlink \"%1\"").arg(revoked_certfile);
+								return -1;
+							}
+						}
 					}
 				}
 			}