annotate cinst/mozilla.c @ 116:c602d8cfa619

Refactoring: unified naming of string vector functions.
author Sascha Wilde <wilde@intevation.de>
date Fri, 21 Mar 2014 17:42:00 +0100
parents 02ad0922c01f
children 24ca8e2ceecf
rev   line source
99
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
1 /* @file Mozilla installation process
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
2 *
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
3 * Reads from stdin a list of instructions in the form:
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
4 *
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
5 * I:<base64 DER econded certificate>\r\n
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
6 * R:<base64 DER econded certificate>\r\n
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
7 * ...
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
8 *
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
9 * The maximum size of an input line is 1000 characters
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
10 * (including the \r\n) at the end of the line.
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
11 *
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
12 * Certificates marked with I: will be installed and the ones
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
13 * marked with R: will be searched and if available removed from
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
14 * the databases.
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
15 *
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
16 * This tool tries to find all NSS databases the user has
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
17 * access to and to execute the instructions on all of them.
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
18 *
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
19 * If there are other processes accessing the databases the caller
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
20 * has to ensure that those are terminated before this process is
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
21 * executed.
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
22 *
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
23 * Returns 0 on success (Even when no stores where found) an error value
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
24 * as defined in errorcodes.h otherwise.
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
25 *
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
26 * Success messages are written to stdout. Errors to stderr. For logging
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
27 * purposes each installation / removal of a certificate will be reported
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
28 * with the profile name that it modified.
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
29 *
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
30 */
bc1e6732f43c Add specification and some cleanups
Andre Heinecke <aheinecke@intevation.de>
parents: 44
diff changeset
31
44
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
32 /* @brief IniParser for mozilla profiles.ini
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
33 *
110
0c8ea71a89cd fixed whitespace.
Sascha Wilde <wilde@intevation.de>
parents: 99
diff changeset
34 * Parse data to find values formed in
44
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
35 *
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
36 * [Profile99]
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
37 * IsRelative=1
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
38 * Path=Profiles/fooo.bar
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
39 *
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
40 * or
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
41 * [Profile0]
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
42 * IsRelative=0
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
43 * Path=c:\foo\bar\baz
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
44 *
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
45 * Mozilla also accepts the ini file on Windows even if it is UTF-16
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
46 * encoded.
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
47 * */
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
48
113
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
49 #include <errorcodes.h>
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
50 #include <stdlib.h>
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
51
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
52 #ifndef _WIN32
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
53 #define UNIX 1
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
54 #else
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
55 #define UNIX 0
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
56 #endif
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
57
44
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
58
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
59 /**
113
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
60 * @brief Get a list of all mozilla profile directories
44
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
61 *
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
62 * Read the profiles.ini and extract all profile paths from that.
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
63 *
113
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
64 * @param[inifile] path of the profile.ini to read.
44
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
65 * @return NULL terminated array of strings containing containing the
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
66 * absolute path of the profile directories. The array needs to
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
67 * be freed by the caller.
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
68 */
113
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
69 //char**
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
70 //get_profile_dirs(char* inifile)
44
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
71
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
72
113
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
73 int
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
74 main()
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
75 {
02ad0922c01f Start over (only leave comments).
Sascha Wilde <wilde@intevation.de>
parents: 110
diff changeset
76 exit(0);
44
b3e8e047bc2c Commit first scratch of mozilla installer
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
77 }

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