Mercurial > trustbridge
comparison cinst/main.c @ 302:fac7e1b0e558
Add nss store calling function and use it in cinst
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 03 Apr 2014 14:28:23 +0200 |
parents | ccb00bf48b75 |
children | f17226aa2e09 |
comparison
equal
deleted
inserted
replaced
301:aec9008c3b30 | 302:fac7e1b0e558 |
---|---|
38 #include "strhelp.h" | 38 #include "strhelp.h" |
39 #include "listutil.h" | 39 #include "listutil.h" |
40 #include "logging.h" | 40 #include "logging.h" |
41 #include "errorcodes.h" | 41 #include "errorcodes.h" |
42 #include "windowsstore.h" | 42 #include "windowsstore.h" |
43 #include "nssstore.h" | |
43 | 44 |
44 /* The certificate list + instructions may only be so long as | 45 /* The certificate list + instructions may only be so long as |
45 * twice the accepted certificatelist size */ | 46 * twice the accepted certificatelist size */ |
46 #define MAX_INPUT_SIZE MAX_LINE_LENGTH * MAX_LINES * 2 | 47 #define MAX_INPUT_SIZE MAX_LINE_LENGTH * MAX_LINES * 2 |
47 | 48 |
198 *instruction_file_name = NULL; | 199 *instruction_file_name = NULL; |
199 size_t list_len = 0; | 200 size_t list_len = 0; |
200 list_status_t list_status; | 201 list_status_t list_status; |
201 bool do_uninstall = false; | 202 bool do_uninstall = false; |
202 | 203 |
203 for (ret = 0; ret < argc; ret++) | |
204 { | |
205 printf("Arg %i : %s \n", ret, argv[ret]); | |
206 } | |
207 | |
208 /* Some very static argument parsing. list= and instructions= is only | 204 /* Some very static argument parsing. list= and instructions= is only |
209 added to make it more transparent how this programm is called if | 205 added to make it more transparent how this programm is called if |
210 a user looks at the detailed uac dialog. */ | 206 a user looks at the detailed uac dialog. */ |
211 if (argc != 3 || strncmp(argv[1], "list=", 5) != 0 || | 207 if (argc != 3 || strncmp(argv[1], "list=", 5) != 0 || |
212 strncmp(argv[2], "instructions=", 13) != 0) | 208 strncmp(argv[2], "instructions=", 13) != 0) |
258 | 254 |
259 /* For uninstall we are done now */ | 255 /* For uninstall we are done now */ |
260 if (do_uninstall) | 256 if (do_uninstall) |
261 { | 257 { |
262 #ifdef WIN32 | 258 #ifdef WIN32 |
263 return write_stores_win (NULL, all_valid_certs); | 259 ret = write_stores_win (NULL, all_valid_certs); |
264 #else | 260 if (ret != 0) |
265 /*TODO*/ | 261 { |
266 return 0; | 262 ERRORPRINTF ("Failed to write windows stores retval: %i\n", ret); |
263 } | |
267 #endif | 264 #endif |
265 ret = write_stores_nss (NULL, all_valid_certs); | |
266 return ret; | |
268 } | 267 } |
269 | 268 |
270 ret = read_instructions_file (instruction_file_name, &to_install, | 269 ret = read_instructions_file (instruction_file_name, &to_install, |
271 &to_remove); | 270 &to_remove); |
272 | 271 |
298 return ret; | 297 return ret; |
299 } | 298 } |
300 } | 299 } |
301 | 300 |
302 #ifdef WIN32 | 301 #ifdef WIN32 |
303 return write_stores_win (to_install, to_remove); | 302 ret = write_stores_win (to_install, to_remove); |
303 if (ret != 0) | |
304 { | |
305 ERRORPRINTF ("Failed to write windows stores retval: %i\n", ret); | |
306 } | |
304 #endif | 307 #endif |
308 ret = write_stores_nss (to_install, to_remove); | |
309 | |
310 if (ret != 0) | |
311 { | |
312 ERRORPRINTF ("Failed to write nss stores"); | |
313 } | |
305 | 314 |
306 /* Make valgrind happy */ | 315 /* Make valgrind happy */ |
307 strv_free (to_install); | 316 strv_free (to_install); |
308 strv_free (to_remove); | 317 strv_free (to_remove); |
309 free (certificate_list); | 318 free (certificate_list); |