char uuid_file[PATH_MAX];
char *homeDir = getenv("HOME");
+ /* check */
+ if (conf == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
+
snprintf(dirpath, PATH_MAX, "%s/.openpts", homeDir);
snprintf(conf_file, PATH_MAX, "%s/.openpts/openpts.conf", homeDir);
snprintf(uuid_file, PATH_MAX, "%s/.openpts/uuid", homeDir);
*currentRmOutOfDate = 0;
*notifiedOfPendingRm = 0;
- /**/
+ /* check */
+ if (ctx == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
conf = ctx->conf;
- verifier_uuid = ctx->conf->uuid;
+ if (conf == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
+ verifier_uuid = conf->uuid;
+ if (verifier_uuid == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
/* collector UUID */
if (ctx->collector_uuid != NULL) {
*/
int verifierHandleRimmSet(
OPENPTS_CONTEXT *ctx,
- BYTE *value) {
+ BYTE *value)
+{
int rc = PTS_SUCCESS;
OPENPTS_CONFIG *target_conf;
int i;
struct stat st;
char buf[BUF_SIZE];
-
-
int num;
int len;
/* check */
- ASSERT(NULL != ctx, "verifierHandleRimmSet() - ctx is NULL\n");
- ASSERT(NULL != ctx->target_conf, "verifierHandleRimmSet() - target_conf is NULL\n");
+ if (ctx == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
target_conf = ctx->target_conf;
-
- ASSERT(NULL != value, "verifierHandleRimmSet() - value is NULL\n");
+ if (target_conf == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
+ if (value == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
/* num */
num = getUint32(value);
DEBUG("writePolicyConf : %s\n", filename);
+ /* check */
+ if (ctx == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
+ if (filename == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
+
if ((fp = fopen(filename, "w")) == NULL) {
fprintf(stderr, NLS(MS_OPENPTS, OPENPTS_VERIFIER_OPEN_FAILED, "Failed to open policy file '%s'\n"), filename);
return -1;
DEBUG("writeAideIgnoreList : %s\n", filename);
+ /* check */
+ if (ctx == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
+ if (filename == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
+
if ((fp = fopen(filename, "w")) == NULL) {
fprintf(stderr, NLS(MS_OPENPTS, OPENPTS_VERIFIER_OPEN_FAILED_2,
"Failed to open AIDE ignore list '%s'\n"), filename);
int i;
/* check */
- ASSERT(NULL != ctx, "verifierHandleRimmSet() - ctx is NULL\n");
- ASSERT(NULL != ctx->target_conf, "verifierHandleRimmSet() - target_conf is NULL\n");
+ if (ctx == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
target_conf = ctx->target_conf;
-
- ASSERT(NULL != value, "verifierHandleRimmSet() - value is NULL\n");
+ if (target_conf == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
+ if (value == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
/* save IR to file */
if (length > 0) {
OPENPTS_IF_M_Capability *cap;
OPENPTS_TARGET *target;
- /* check */
- // TODO
-
DEBUG("enroll() - start, force = %d (1:overwite) --------------------------------------\n", force);
+ /* check */
+ if (ctx == NULL) {
+ ERROR("null input");
+ return PTS_INTERNAL_ERROR;
+ }
if (ctx->conf == NULL) {
- ERROR("ctx->conf\n");
+ ERROR("null input");
return PTS_INTERNAL_ERROR;
}
char *conf_dir,
int mode) {
const int MINIMUM_NONCE_LENGTH = 16;
- int rc = PTS_VERIFY_FAILED; /* guilty until proven innocent */
+ int rc = PTS_VERIFY_FAILED; /* guilty until proven innocent */
int result = OPENPTS_RESULT_INVALID;
int len;
/* sock */
/* TLV/PTS */
PTS_IF_M_Attribute *read_tlv = NULL;
OPENPTS_CONFIG *conf;
- // char * collector_dir = NULL;
- // char * rm_dir = NULL;
OPENPTS_IF_M_Capability *cap;
int notifiedOfPendingRm = 0;
int currentRmOutOfDate = 0;
DEBUG(" mode : %d (0:just verify, 1:update the policy)\n", mode);
/* check */
- ASSERT(ctx != NULL, "ctx is null\n");
- ASSERT(ctx->conf != NULL, "conf is null\n");
-
+ if (ctx == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
conf = ctx->conf;
+ if (conf == NULL) {
+ ERROR("null input");
+ return PTS_FATAL;
+ }
/* connect to the target collector */
ssh_pid = ssh_connect(host,
rc = PTS_INTERNAL_ERROR;
goto close;
} else if (read_tlv->type != INTEGRITY_REPORT) {
+ ERROR("read_tlv->type != INTEGRITY_REPORT, but 0x%X (0x0F:OPENPTS_ERROR)", read_tlv->type);
rc = PTS_INTERNAL_ERROR;
goto close;
}
/* V->C template RIMM req */
rc = writePtsTlv(ctx, sock, REQUEST_NEW_RIMM_SET);
if (rc < 0) {
+ ERROR("writePtsTlv() fail");
rc = PTS_INTERNAL_ERROR;
goto close;
}
/* V->C VR */
len = writePtsTlv(ctx, sock, VERIFICATION_RESULT);
if (len < 0) {
+ ERROR("writePtsTlv() fail");
rc = PTS_INTERNAL_ERROR;
goto close;
}