2 * This file is part of the OpenPTS project.
4 * The Initial Developer of the Original Code is International
5 * Business Machines Corporation. Portions created by IBM
6 * Corporation are Copyright (C) 2011 International Business
7 * Machines Corporation. All Rights Reserved.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the Common Public License as published by
11 * IBM Corporation; either version 1 of the License, or (at your option)
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * Common Public License for more details.
19 * You should have received a copy of the Common Public License
20 * along with this program; if not, a copy can be viewed at
21 * http://www.opensource.org/licenses/cpl1.0.php.
26 * \brief PTS collector command
27 * @author Seiji Munetoh <munetoh@users.sourceforge.jp>
28 * @author Olivier Valentin <olivier.valentin@us.ibm.com>
29 * @author Alexandre Ratchov <alexandre.ratchov@bull.net>
31 * cleanup 2011-07-06 SM
36 #include <sys/lockf.h>
39 #include <sys/types.h>
40 #include <sys/socket.h>
42 #include <sys/socketvar.h>
50 #include <sys/stat.h> // chmod
57 OPENPTS_PROPERTY *start = NULL;
58 OPENPTS_PROPERTY *end = NULL;
63 * TODO support single connection.
64 * TODO for multiple conenction, multiple ctxs are required.
65 * TODO disable remote connection
67 int collector2(OPENPTS_CONFIG *conf) {
70 OPENPTS_CONTEXT *ctx = NULL;
71 PTS_IF_M_Attribute *read_tlv = NULL;
74 rc = getRmSetDir(conf);
75 if (rc != PTS_SUCCESS) {
76 ERROR("collector() - getRmSetDir() was failed\n");
77 return PTS_INTERNAL_ERROR;
80 rc = getNewRmSetDir(conf);
81 if (rc != PTS_SUCCESS) {
83 DEBUG("collector() - getNewRmSetDir() was failed - never mind\n");
87 INFO("start collector (System UUID=%s, RM UUID = %s)\n",
88 conf->uuid->str, conf->rm_uuid->str);
90 /* Collector <-> Verifier - handshake loop */
92 ctx = newPtsContext(conf);
94 addPropertiesFromConfig(conf, ctx);
100 /* read() will block forever unless STDIN was explicitly set to
101 be non-blocking or we receive an interrupt. even then wrapRead() will
102 ignore EAGAIN and EINTR and keep attempting to call read(). the only way
103 this could fail is if the other end of the connection closed, in which case
104 we should exit. if timeouts are required then poll() or select() can be
105 used on blocking file descriptors to listen for input. */
106 read_tlv = readPtsTlv(STDIN_FILENO); // ifm.c, malloc tlv
107 if (read_tlv == NULL) {
108 DEBUG("close IF-M PTS connection\n");
113 if (read_tlv->type == 0) {
114 ERROR("Bad TLV type received - quit");
118 if (read_tlv->length > 0 && read_tlv->value == NULL) {
119 ERROR("Malformed TLV message (ghost body) - quit");
123 INFO("IF-M read type = 0x%X, len %d\n",
128 switch (read_tlv->type) {
129 case OPENPTS_CAPABILITIES:
130 // TODO define CAPABILITIES structure
131 DEBUG("IF-M OPENPTS_CAPABILITIES\n");
133 if (read_tlv->length != sizeof(OPENPTS_IF_M_Capability)) { // TODO use defined name
134 ERROR("Bad PTS_CAPABILITIES, len = %d != %d\n",
135 read_tlv->length, sizeof(OPENPTS_IF_M_Capability));
139 OPENPTS_IF_M_Capability *cap;
140 cap = (OPENPTS_IF_M_Capability *) read_tlv->value;
143 /* get verifier's UUID */
144 ctx->uuid = xmalloc_assert(sizeof(PTS_UUID));
145 memcpy(ctx->uuid, &cap->platform_uuid, 16);
146 ctx->str_uuid = getStringOfUuid(ctx->uuid);
149 INFO("verifier (UUID=%s)\n", ctx->str_uuid);
151 /* send PTS_CAPABILITIES msg. to verifier (=UUID) */
152 rc = writePtsTlv(ctx, STDOUT_FILENO, OPENPTS_CAPABILITIES);
154 ERROR("Send CAPABILITY answer failed - quit");
160 case DH_NONCE_PARAMETERS_REQUEST:
161 DEBUG("IF-M DH_NONCE_PARAMETERS_REQUEST\n");
163 if (read_tlv->length != 4) {
164 ERROR("Bad DH_NONCE_PARAMETERS_REQUEST, len = %d != 4\n", read_tlv->length);
168 ctx->nonce->req->reserved = read_tlv->value[0];
169 ctx->nonce->req->min_nonce_len = read_tlv->value[1];
171 ctx->nonce->req->dh_group_set = (read_tlv->value[2]<<8) | read_tlv->value[3];
173 rc = getDhResponce(ctx->nonce);
177 ctx, STDOUT_FILENO, DH_NONCE_PARAMETORS_RESPONSE);
179 ERROR("Send NONCE answer failed - quit");
184 case DH_NONCE_FINISH:
185 DEBUG("IF-M DH_NONCE_FINISH\n");
187 if (read_tlv->length != 152) { // TODO how to calc this size?
188 ERROR("Bad DH_NONCE_FINISH, len = %d != 152\n", read_tlv->length);
192 ctx->nonce->fin->reserved = read_tlv->value[0];
193 ctx->nonce->fin->nonce_length = read_tlv->value[1];
195 ctx->nonce->fin->selected_hash_alg = (read_tlv->value[2]<<8) | read_tlv->value[3];
198 ctx->nonce->fin->dh_initiator_public = xmalloc_assert(ctx->nonce->pubkey_length);
200 ctx->nonce->fin->dh_initiator_public,
202 ctx->nonce->pubkey_length);
205 ctx->nonce->fin->dh_initiator_nonce = xmalloc_assert(ctx->nonce->fin->nonce_length);
207 ctx->nonce->fin->dh_initiator_nonce,
208 &read_tlv->value[4 + ctx->nonce->pubkey_length],
209 ctx->nonce->fin->nonce_length);
211 rc = calcDhFin(ctx->nonce);
216 case REQUEST_RIMM_SET: // 5
217 DEBUG("IF-M REQUEST_RIMM_SET\n");
219 if (read_tlv->length != 0) {
220 ERROR("Bad REQUEST__RIMM_SET, len = %d != 0\n", read_tlv->length);
224 ctx, STDOUT_FILENO, RIMM_SET);
226 ERROR("Send RIMM_SET answer failed - quit");
231 case REQUEST_NEW_RIMM_SET:
232 DEBUG("IF-M REQUEST_NEW_RIMM_SET\n");
234 if (read_tlv->length != 0) {
235 ERROR("Bad REQUEST_NEW_RIMM_SET, len = %d != 0\n", read_tlv->length);
239 ctx, STDOUT_FILENO, NEW_RIMM_SET);
241 ERROR("Send NEW_RIMM_SET answer failed - quit");
246 case REQUEST_INTEGRITY_REPORT:
247 DEBUG("IF-M REQUEST_INTEGRITY_REPORT\n");
249 if (read_tlv->length != 0) {
250 ERROR("Bad REQUEST_INTEGRITY_REPORT, len = %d != 0\n", read_tlv->length);
253 rc = writePtsTlv(ctx, STDOUT_FILENO, INTEGRITY_REPORT);
255 ERROR("Send INTEGRITY_REPORT answer failed - quit");
260 case VERIFICATION_RESULT:
262 INFO("IF-M VERIFICATION_RESULT => terminate\n");
263 DEBUG_IFM("finish\n");
264 terminate = 1; // TODO add TERMINATE MSG
267 case REQUEST_AIDE_DATABASE:
268 INFO("IF-M REQUEST_AIDE_DATABASE\n");
270 if (read_tlv->length != 0) {
271 ERROR("Bad REQUEST_AIDE_DATABASE, len = %d != 0\n", read_tlv->length);
274 rc = writePtsTlv(ctx, STDOUT_FILENO, AIDE_DATABASE);
276 ERROR("Send REQUEST_AIDE_DATABASE answer failed - quit");
282 case REQUEST_TPM_PUBKEY:
284 if (read_tlv->length != 0) {
285 ERROR("Bad REQUEST_TPM_PUBKEY, len = %d != 0\n", read_tlv->length);
288 rc = writePtsTlv(ctx, STDOUT_FILENO, TPM_PUBKEY); // ifm.c
290 ERROR("Send TPM_PUBKEY answer failed - quit");
297 if (read_tlv->length != 20) {
298 ERROR("Bad NONCE, len = %d != 20\n", read_tlv->length);
302 ctx->nonce->nonce_length = 20;
303 if (ctx->nonce->nonce != NULL) {
304 xfree(ctx->nonce->nonce);
306 ctx->nonce->nonce = xmalloc_assert(20);
307 memcpy(ctx->nonce->nonce, read_tlv->value, 20);
308 DEBUG_IFM("nonce[%d] : \n", ctx->nonce->nonce_length);
312 ERROR("verifier returns error, termnate\n");
316 ERROR("PTS IF-M type 0x%08x is not supported\n", read_tlv->type);
317 INFO("send OPENPTS_ERROR msg to verifier, then terminate the conenction");
318 ctx->ifm_errno = PTS_UNRECOGNIZED_COMMAND;
319 if (ctx->ifm_strerror != NULL) {
320 xfree(ctx->ifm_strerror);
322 ctx->ifm_strerror = smalloc_assert("Unknown message type");
323 rc = writePtsTlv(ctx, STDOUT_FILENO, OPENPTS_ERROR); // ifm.c
329 if (read_tlv != NULL) {
330 freePtsTlv(read_tlv);
344 fprintf(stderr, NLS(MS_OPENPTS, OPENPTS_COLLECTOR_USAGE_1, "OpenPTS Collector\n\n"
345 "Usage: ptsc [options] [command]\n\n"
346 "Commands: (foreground)\n"
347 " -i Initialize PTS collector\n"
348 " -t Self test (attestation)\n"
349 " -s Startup (selftest + timestamp)\n"
350 " -u Update the RM\n"
351 " -e Clear PTS collector\n"));
352 #ifdef CONFIG_AUTO_RM_UPDATE
353 fprintf(stderr, NLS(MS_OPENPTS, OPENPTS_COLLECTOR_USAGE_2,
354 " -U Update the RM (auto)\n"));
356 fprintf(stderr, NLS(MS_OPENPTS, OPENPTS_COLLECTOR_USAGE_3,
357 " -D Display the configuration\n"
361 " -h Show this help message\n"
362 " -v Verbose mode. Multiple -v options increase the verbosity.\n"
365 " -c configfile Set configuration file. defalt is %s\n"
366 " -P name=value Set properties.\n"
368 " -z Set the SRK secret to all zeros (20 bytes of zeros)\n"), PTSC_CONFIG_FILE);
379 #ifdef CONFIG_AUTO_RM_UPDATE
387 OPENPTS_PROPERTY *getPropertyFromArg(char *arg) {
391 OPENPTS_PROPERTY *prop;
393 if ((eq = strstr(arg, "=")) != NULL) {
399 prop = newProperty(name, value);
402 ERROR("bad property %s\n", arg);
408 #define LOCK_DIR "/var/ptsc/"
410 #define LOCK_DIR "/var/lib/openpts/"
412 #define LOCK_FILE LOCK_DIR "ptsc.lock"
414 void ptsc_lock(void) {
415 int fd, oldmask, oldgrp = 0;
416 struct group *grpent = NULL;
422 if (geteuid() == 0) {
423 // grpent = getgrnam(PTSC_GROUP_NAME);
425 // oldgrp = getegid();
426 // setegid(grpent->gr_gid);
428 buf_len = sysconf(_SC_GETGR_R_SIZE_MAX);
432 buf = xmalloc(buf_len);
438 rc = getgrnam_r(PTSC_GROUP_NAME, &grp, buf, buf_len, &grpent);
443 if (grpent == NULL) {
452 if (mkdir(LOCK_DIR, 0775) < 0 && errno != EEXIST) {
457 chmod(LOCK_DIR, 02775);
460 fd = open(LOCK_FILE, O_RDWR | O_CREAT | O_TRUNC, 0660);
466 if (lockf(fd, F_LOCK, 0) < 0) {
471 if (buf != NULL) xfree(buf);
474 static int preparePriv() {
475 int rc = PTS_SUCCESS;
476 struct group *ptsc_grp = NULL;
483 if ((ptscd_pwd = getpwnam_r(PTSCD_USER_NAME)) == NULL) {
484 ERROR("Looking up for user %s", PTSCD_USER_NAME);
490 // ptsc_grp = getgrnam(PTSC_GROUP_NAME); // TODO use getgrnam_r
491 // if (ptsc_grp == NULL) {
492 // ERROR("Looking up for group (name=%s) fail", PTSC_GROUP_NAME);
495 buf_len = sysconf(_SC_GETGR_R_SIZE_MAX);
499 buf = xmalloc(buf_len);
505 rc = getgrnam_r(PTSC_GROUP_NAME, &grp, buf, buf_len, &ptsc_grp);
511 if (ptsc_grp == NULL) {
512 ERROR("ptsc_grp == NULL");
518 // rc = setgid(ptsc_grp->gr_gid);
519 rc = setgid(grp.gr_gid);
521 // TODO do not need for IF-M access (read only)
522 ERROR("Switching group (gid=%d) fail. %s\n", grp.gr_gid, strerror(errno));
523 // TODO 20110927 FAIL
529 if (setuid(ptscd_pwd->pw_uid) == -1) {
530 ERROR("Switching to user %s", PTSCD_USER_NAME);
537 if (buf != NULL) xfree(buf);
543 * dir group => PTSC_GROUP_NAME
545 * flag 0:read, 1:read/write
547 static int chmodDir(char *dirpath, int flag) {
548 int rc = PTS_SUCCESS;
549 struct group *ptsc_grp;
556 // ptsc_grp = getgrnam(PTSC_GROUP_NAME); // TODO use getgrnam_r
557 // if (ptsc_grp == NULL) {
558 // ERROR("Looking up for group %s", PTSC_GROUP_NAME);
561 buf_len = sysconf(_SC_GETGR_R_SIZE_MAX);
565 buf = xmalloc(buf_len);
571 rc = getgrnam_r(PTSC_GROUP_NAME, &grp, buf, buf_len, &ptsc_grp);
577 if (ptsc_grp == NULL) {
578 ERROR("ptsc_grp == NULL");
596 S_IRUSR | S_IWUSR | S_IXUSR |
605 S_IRUSR | S_IWUSR | S_IXUSR |
606 S_IRGRP | S_IWGRP | S_IXGRP);
614 if (buf != NULL) xfree(buf);
622 int main(int argc, char *argv[]) {
624 OPENPTS_CONFIG *conf = NULL;
625 char *config_filename = NULL;
626 int command = COMMAND_STATUS;
629 #ifdef CONFIG_AUTO_RM_UPDATE
632 // extern int logLocation;
633 // void setLogLocation(int ll);
635 /* properties by cmdline */
636 OPENPTS_PROPERTY *prop;
643 if (rc != PTS_SUCCESS) {
644 ERROR("preparePriv fail\n");
647 conf = newPtsConfig();
649 ERROR("internal error\n"); // TODO(munetoh)
655 while ((c = getopt(argc, argv, "ic:uUefDtsmvP:Rzh")) != EOF) {
658 command = COMMAND_INIT;
661 command = COMMAND_UPDATE;
664 #ifdef CONFIG_AUTO_RM_UPDATE
665 command = COMMAND_AUTO_UPDATE;
669 command = COMMAND_STATUS;
672 command = COMMAND_SELFTEST;
675 command = COMMAND_STARTUP;
678 command = COMMAND_CLEAR;
684 command = COMMAND_IFM;
685 /* not everything should go to syslog - on some systems
686 this could go to a log file - let default behaviour
687 in log.c decide this */
688 // setLogLocation(OPENPTS_LOG_SYSLOG, NULL);
689 // OK setLogLocation(OPENPTS_LOG_CONSOLE, NULL); // OK
690 // setLogLocation(OPENPTS_LOG_FILE, "/var/log/ptsc.log"); // OK call this before any out
693 config_filename = optarg;
699 #ifdef CONFIG_AUTO_RM_UPDATE
704 conf->srk_password_mode = 1;
707 prop = getPropertyFromArg(optarg);
735 if (command == COMMAND_IFM) {
736 setLogLocation(OPENPTS_LOG_SYSLOG, NULL);
738 setLogLocation(OPENPTS_LOG_CONSOLE, NULL);
745 if (rc != PTS_SUCCESS) {
746 ERROR("preparePriv fail\n");
749 conf = newPtsConfig();
751 ERROR("internal error\n"); // TODO(munetoh)
756 /* DEBUG level, 1,2,3 */
758 setDebugFlags(DEBUG_FLAG | DEBUG_FSM_FLAG | DEBUG_IFM_FLAG);
760 /* set the DEBUG level, 1,2,3 */
761 if (getVerbosity() > 2) {
762 setDebugFlags(DEBUG_FLAG | DEBUG_IFM_FLAG | DEBUG_FSM_FLAG | DEBUG_CAL_FLAG );
763 } else if (getVerbosity() > 1) {
764 setDebugFlags(DEBUG_FLAG | DEBUG_IFM_FLAG);
765 } else if (getVerbosity() > 0) {
766 setDebugFlags(DEBUG_FLAG);
770 DEBUG("VERBOSITY (%d), DEBUG mode (0x%x)\n", getVerbosity(), getDebugFlags());
775 if (config_filename == NULL) {
776 // this goto stdout and bad with "-m"
777 // VERBOSE(1, NLS(MS_OPENPTS, OPENPTS_COLLECTOR_CONFIG_FILE, "Config file: %s\n"), PTSC_CONFIG_FILE);
778 rc = readPtsConfig(conf, PTSC_CONFIG_FILE);
779 if (rc != PTS_SUCCESS) {
783 // VERBOSE(1, NLS(MS_OPENPTS, OPENPTS_COLLECTOR_CONFIG_FILE, "Config file: %s\n"), config_filename);
784 rc = readPtsConfig(conf, config_filename);
785 if (rc != PTS_SUCCESS) {
793 /* only do this when needed */
794 if (command != COMMAND_STATUS) {
796 if (checkDir(conf->ir_dir) != PTS_SUCCESS) {
797 rc = makeDir(conf->ir_dir);
798 if (rc != PTS_SUCCESS) {
799 ERROR("Can not create the dir to store IR, %s\n", conf->ir_dir);
802 rc = chmodDir(conf->ir_dir, 1);
803 if (rc != PTS_SUCCESS) {
804 ERROR("Can not create the dir to store IR, %s\n", conf->ir_dir);
810 /* initialize the PTS collector */
811 if (command == COMMAND_INIT) {
812 VERBOSE(1, NLS(MS_OPENPTS, OPENPTS_COLLECTOR_INIT_RM, "Initializing Reference Manifest\n"));
813 rc = init(conf, prop_num, start, end);
818 /* Clear the PTS collector */
819 if (command == COMMAND_CLEAR) {
820 VERBOSE(1, NLS(MS_OPENPTS, OPENPTS_COLLECTOR_CLEAR, "Clear PTS collector\n"));
821 rc = clear(conf, force);
828 rc = readOpenptsUuidFile(conf->rm_uuid);
829 if (rc != PTS_SUCCESS) {
830 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_FAILED_READ_RM_UUID,
831 "Failed to read the Reference Manifest UUID file '%s':\n"
832 "Please ensure on the target that:\n"
833 " * ptsc has been initialized (ptsc -i)\n"
834 " * you (uid==%d) are allowed to attest (i.e. a member of group '%s')"),
835 conf->rm_uuid->filename, getuid(), PTSC_GROUP_NAME);
838 DEBUG("conf->str_rm_uuid : %s\n", conf->rm_uuid->str);
842 rc = readOpenptsUuidFile(conf->newrm_uuid);
843 if (rc != PTS_SUCCESS) {
844 DEBUG("conf->str_newrm_uuid : missing (file:%s)\n", conf->newrm_uuid->filename);
847 DEBUG("conf->str_newrm_uuid : %s (for next boot)\n", conf->newrm_uuid->str);
850 /* load RSA PUB key */
851 // TODO single key => multiple keys?
853 TODO("CONFIG_NO_TSS, no TPM_PUBKEY\n");
854 conf->pubkey_length = 0;
857 /* only do this when needed */
858 if (command != COMMAND_STATUS) {
863 conf->srk_password_mode,
864 conf->tpm_resetdalock,
866 &conf->pubkey_length,
868 if (rc != TSS_SUCCESS) {
869 ERROR("getTssPubKey() fail rc=0x%x srk password mode=%d, key =%s\n",
870 rc, conf->srk_password_mode, conf->uuid->str);
871 OUTPUT(NLS(MS_OPENPTS, OPENPTS_TPM_TSS_COMMS_FAILURE,
872 "TSS communications failure. Is tcsd running?\n"));
880 #ifdef CONFIG_AUTO_RM_UPDATE
881 case COMMAND_AUTO_UPDATE:
882 /* update by command, but HUP is better */
883 VERBOSE(1, "Updating Reference Manifest\n");
884 //addDebugFlags(DEBUG_CAL_FLAG);
886 rc = update(conf, prop_num, start, end, remove);
887 if (rc != PTS_SUCCESS) {
888 ERROR("update was fail\n");
893 rc = printCollectorStatus(conf);
895 case COMMAND_SELFTEST:
896 rc = selftest(conf, prop_num, start, end);
897 if (rc == OPENPTS_SELFTEST_SUCCESS) {
898 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_SUCCESS, "selftest - OK\n"));
899 } else if (rc == OPENPTS_SELFTEST_RENEWED) {
900 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_RENEWED, "selftest - Renewed\n"));
901 } else if (rc == OPENPTS_SELFTEST_FALLBACK) {
902 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_FALLBACK, "selftest - fallback\n"));
903 } else if (rc == OPENPTS_SELFTEST_FAILED) {
904 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_FAIL, "selftest - fail\n"));
909 case COMMAND_STARTUP:
910 rc = selftest(conf, prop_num, start, end);
911 if (rc == OPENPTS_SELFTEST_SUCCESS) {
912 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_SUCCESS, "selftest - OK\n"));
914 extendEvCollectorStart(conf); // collector.c
915 } else if (rc == OPENPTS_SELFTEST_RENEWED) {
916 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_RENEWED, "selftest - Renewed\n"));
918 extendEvCollectorStart(conf);
919 } else if (rc == OPENPTS_SELFTEST_FALLBACK) {
920 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_FALLBACK, "selftest - fallback\n"));
922 extendEvCollectorStart(conf);
923 } else if (rc == OPENPTS_SELFTEST_FAILED) {
924 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_FAIL, "selftest - fail\n"));
925 if (conf->autoupdate == 1) {
926 ERROR("selftest failed, trying to generate a new manifest\n");
928 conf->rm_uuid->status = OPENPTS_UUID_FILENAME_ONLY;
929 if (conf->rm_uuid->uuid != NULL) freeUuid(conf->rm_uuid->uuid);
930 if (conf->rm_uuid->str != NULL) xfree(conf->rm_uuid->str);
931 if (conf->rm_uuid->time != NULL) xfree(conf->rm_uuid->time);
932 conf->rm_uuid->uuid = NULL;
933 conf->rm_uuid->str = NULL;
934 conf->rm_uuid->time = NULL;
936 /* gen new RM_UUID and RM */
937 rc = newrm(conf, prop_num, start, end);
938 if (rc != PTS_SUCCESS) {
939 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_UPDATE_RM_FAIL,
940 "Failed to generated a reference manifest\n"));
943 rc = selftest(conf, prop_num, start, end);
944 if (rc == OPENPTS_SELFTEST_SUCCESS) {
945 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_SUCCESS, "selftest - OK\n"));
946 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_UPDATE_RM_SUCCESS,
947 "Successfully generated the reference manifest\n"));
948 } else if (rc == OPENPTS_SELFTEST_RENEWED) {
949 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_RENEWED, "selftest - Renewed\n"));
954 OUTPUT(NLS(MS_OPENPTS, OPENPTS_COLLECTOR_UPDATE_RM_WONT,
955 "selftest failed, keeping existing manifests as requested by configuration\n"));
963 conf->rm_uuid->status = OPENPTS_UUID_FILENAME_ONLY;
964 if (conf->rm_uuid->uuid != NULL) freeUuid(conf->rm_uuid->uuid);
965 if (conf->rm_uuid->str != NULL) xfree(conf->rm_uuid->str);
966 if (conf->rm_uuid->time != NULL) xfree(conf->rm_uuid->time);
967 conf->rm_uuid->uuid = NULL;
968 conf->rm_uuid->str = NULL;
969 conf->rm_uuid->time = NULL;
971 /* gen new RM_UUID and RM */
972 rc = newrm(conf, prop_num, start, end);
973 if (rc != PTS_SUCCESS) {
974 ERROR("newrm() fail\n");
979 rc = selftest(conf, prop_num, start, end);
980 if (rc == OPENPTS_SELFTEST_SUCCESS) {
981 VERBOSE(1, NLS(MS_OPENPTS, OPENPTS_COLLECTOR_UPDATE_RM_SUCCESS,
982 "Successfully generated the reference manifest\n"));
983 } else if (rc == OPENPTS_SELFTEST_RENEWED) {
990 /* run colelctor IF-M */
991 rc = collector2(conf);
994 ERROR("bad command\n");