annotate cinst/main.c @ 67:1bf41957418f

Update notes in build.sh script
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 18 Mar 2014 18:26:14 +0000
parents e4088afd5281
children 8ffbb48528ae
rev   line source
25
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
1 /** @brief Main entry point for the cinst process.
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
2 *
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
3 * The cinst process may or may not be run with elevated
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
4 * privileges. When run with elevated privileges this
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
5 * process will modify system wide certificate stores.
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
6 * Otherwise only the users certificate stores are modified.
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
7 *
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
8 * It expects a certificatelist on stdin enclosed in a
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
9 * -----BEGIN CERTIFICATE LIST-----
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
10 * ...
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
11 * -----END CERTIFICATE LIST-----
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
12 *
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
13 * Followed by additional instruction lines of:
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
14 * I:<certificate>
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
15 * R:<certificate>
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
16 *
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
17 * It will only execute the instructions if the
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
18 * I and R instructions are also part of the signed
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
19 * certificate list. The signature is validated with the
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
20 * built in key.
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
21 *
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
22 * The special instruction "UNINSTALL" will cause the installer
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
23 * to remove all certificates (Even those marked with I) that
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
24 * are part of the list to be removed.
25
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
25 *
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
26 **/
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
27 #define MAX_LINE_LENGTH 1000
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
28 #define MAX_LINES 1000
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
29 #define MAX_INPUT_SIZE 2000000 /* MAX_LINE_LENGTH * (MAX_LINES *2) */
25
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
30
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
31 #include <stdio.h>
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
32 #include <stdlib.h>
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
33 #include <string.h>
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
34 #include <assert.h>
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
35
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
36 #include "strhelp.h"
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
37 #include "listutil.h"
60
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
38 #include "errorcodes.h"
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
39
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
40 /* @brief Read stdin into data structures.
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
41 *
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
42 * Reads from stdin and sorts the input into the respective
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
43 * variables. The pointers returned need to be freed by the caller.
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
44 * Terminates in OOM conditions.
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
45 *
60
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
46 * The caller needs to free the memory allocated by this function
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
47 * even when an error is returned.
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
48 *
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
49 * @returns: 0 on success. An error code otherwise.
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
50 */
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
51 int readInput(char **certificate_list, char ***to_install,
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
52 char ***to_remove)
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
53 {
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
54 int lines_read = 0;
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
55 int readingList = 0;
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
56 char buf[MAX_LINE_LENGTH + 1];
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
57
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
58 while (fgets(buf, MAX_LINE_LENGTH + 1, stdin)) {
60
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
59 size_t len = strlen(buf); /* fgets ensures buf is terminated */
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
60 if (lines_read ++ > MAX_LINES) {
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
61 printf("Too many lines\n");
60
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
62 return ERR_TOO_MUCH_INPUT;
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
63 }
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
64 if (strcmp("-----BEGIN CERTIFICATE LIST-----\r\n", buf) == 0){
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
65 readingList = 1;
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
66 continue;
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
67 }
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
68 if (strcmp("-----END CERTIFICATE LIST-----\r\n", buf) == 0){
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
69 readingList = 0;
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
70 continue;
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
71 }
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
72 if (readingList) {
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
73 str_append_str(certificate_list, buf, len);
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
74 continue;
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
75 }
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
76 if (*buf == 'I') {
60
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
77 array_append_str(to_install, buf+2, len - 2);
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
78 continue;
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
79 }
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
80 if (*buf == 'R') {
60
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
81 array_append_str(to_remove, buf+2, len - 2);
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
82 continue;
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
83 }
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
84 if (strcmp("UNINSTALL", buf) == 0) {
60
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
85 array_append_str(to_remove, buf, len - 2);
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
86 }
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
87 }
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
88
60
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
89 return 0;
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
90 }
65
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
91 /*
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
92 int validate_instructions(const char *certificate_list,
65
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
93 const size_t list_len,
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
94 const char **to_install,
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
95 const char **to_remove)
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
96 {
65
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
97 TODO
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
98 (void *) certificate_list;
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
99 (void **) to_install;
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
100 (void **) to_remove;
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
101 (void) list_len;
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
102
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
103 return 0;
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
104 }
65
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
105 */
26
cbd57d767dfa Move layout around. Restructure CMakeLists
Andre Heinecke <andre.heinecke@intevation.de>
parents: 25
diff changeset
106 int main() {
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
107 char **to_install = NULL;
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
108 char **to_remove = NULL;
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
109 char *certificate_list = NULL;
65
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
110 size_t list_len = 0;
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
111 int ret = -1;
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
112
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
113 ret = readInput(&certificate_list, &to_install, &to_remove);
60
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
114
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
115 if (ret != 0) {
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
116 return ret;
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
117 }
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
118
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
119 if (!certificate_list) {
60
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
120 return ERR_INVALID_INPUT_NO_LIST;
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
121 }
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
122
65
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
123 list_len = strnlen(certificate_list, MAX_INPUT_SIZE);
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
124
65
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
125 ret = verify_list(certificate_list, list_len);
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
126
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
127 if (ret != 0) {
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
128 return ERR_INVALID_SIGNATURE;
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
129 }
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
130
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
131 if (!strv_length(to_install) && !strv_length(to_remove)) {
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
132 return ERR_NO_INSTRUCTIONS;
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
133 }
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
134
65
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
135 /* Check that the instructions are ok to execute
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
136 ret = validate_instructions(certificate_list, list_len, to_install,
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
137 to_remove);
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
138
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
139 if (ret != 0) {
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
140 return ERR_INVALID_INSTRUCTIONS;
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
141 }
65
e4088afd5281 Comment out validate instructions for now to avoid unused warnings
Andre Heinecke <aheinecke@intevation.de>
parents: 64
diff changeset
142 */
64
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
143 /* Make valgrind happy */
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
144 strfreev (to_install);
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
145 strfreev (to_remove);
fb9f78f7ab2f Improve error handling free memory before exiting. Include line endings in Marker lines
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
146 free (certificate_list);
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents: 26
diff changeset
147
25
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
148 return 0;
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
149 }

http://wald.intevation.org/projects/trustbridge/