OLD | NEW |
1 /* Software-based Trusted Platform Module (TPM) Emulator | 1 /* Software-based Trusted Platform Module (TPM) Emulator |
2 * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net> | 2 * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net> |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or modify | 4 * This program is free software; you can redistribute it and/or modify |
5 * it under the terms of the GNU General Public License as published | 5 * it under the terms of the GNU General Public License as published |
6 * by the Free Software Foundation; either version 2 of the License, | 6 * by the Free Software Foundation; either version 2 of the License, |
7 * or (at your option) any later version. | 7 * or (at your option) any later version. |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 printf(" u : unix socket name to use (default: %s)\n", opt_socket_name); | 164 printf(" u : unix socket name to use (default: %s)\n", opt_socket_name); |
165 printf(" o : effective user the application should run as\n"); | 165 printf(" o : effective user the application should run as\n"); |
166 printf(" g : effective group the application should run as\n"); | 166 printf(" g : effective group the application should run as\n"); |
167 printf(" h : print this help message\n"); | 167 printf(" h : print this help message\n"); |
168 printf(" startup mode : must be 'clear', " | 168 printf(" startup mode : must be 'clear', " |
169 "'save' (default) or 'deactivated\n"); | 169 "'save' (default) or 'deactivated\n"); |
170 } | 170 } |
171 | 171 |
172 static void parse_options(int argc, char **argv) | 172 static void parse_options(int argc, char **argv) |
173 { | 173 { |
174 char c; | 174 int c; |
175 struct passwd *pwd; | 175 struct passwd *pwd; |
176 struct group *grp; | 176 struct group *grp; |
177 opt_uid = getuid(); | 177 opt_uid = getuid(); |
178 opt_gid = getgid(); | 178 opt_gid = getgid(); |
179 info("parsing options"); | 179 info("parsing options"); |
180 while ((c = getopt (argc, argv, "dfs:u:o:g:c:h")) != -1) { | 180 while ((c = getopt (argc, argv, "dfs:u:o:g:c:h")) != -1) { |
181 debug("handling option '-%c'", c); | 181 debug("handling option '-%c'", c); |
182 switch (c) { | 182 switch (c) { |
183 case 'd': | 183 case 'd': |
184 opt_debug = 1; | 184 opt_debug = 1; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 if (!opt_foreground) daemonize(); | 487 if (!opt_foreground) daemonize(); |
488 /* open random device */ | 488 /* open random device */ |
489 init_random(); | 489 init_random(); |
490 /* start main processing loop */ | 490 /* start main processing loop */ |
491 main_loop(); | 491 main_loop(); |
492 info("stopping TPM Emulator daemon"); | 492 info("stopping TPM Emulator daemon"); |
493 close(rand_fh); | 493 close(rand_fh); |
494 closelog(); | 494 closelog(); |
495 return EXIT_SUCCESS; | 495 return EXIT_SUCCESS; |
496 } | 496 } |
OLD | NEW |