Code

sysdb: Added -K and -C options to specify SSL key and cert files.
authorSebastian Harl <sh@tokkee.org>
Fri, 30 Jan 2015 15:04:48 +0000 (16:04 +0100)
committerSebastian Harl <sh@tokkee.org>
Fri, 30 Jan 2015 15:04:48 +0000 (16:04 +0100)
src/tools/sysdb/main.c

index a8dbf27fa55a7e0315d4fa95c88383cd957d5695..228cd530b6098906ae5f709f84aabf91a0c49ee9 100644 (file)
@@ -120,18 +120,28 @@ exit_usage(char *name, int status)
        printf(
 "Usage: %s <options>\n"
 
        printf(
 "Usage: %s <options>\n"
 
-"\nOptions:\n"
-"  -H HOST   the host to connect to\n"
-"            default: "DEFAULT_SOCKET"\n"
-"  -U USER   the username to connect as\n"
-"            default: %s\n"
-"  -c CMD    execute the specified command and then exit\n"
+"Connection options:\n"
+"  -H HOST      the host to connect to\n"
+"               default: "DEFAULT_SOCKET"\n"
+"  -U USER      the username to connect as\n"
+"               default: %s\n"
+"  -c CMD       execute the specified command and then exit\n"
 "\n"
 "\n"
-"  -h        display this help and exit\n"
-"  -V        display the version number and copyright\n"
+"SSL options:\n"
+"  -K KEYFILE   private key file name\n"
+"               default: %s\n"
+"  -C CERTFILE  client certificate file name\n"
+"               default: %s\n"
+"\n"
+"General options:\n"
+"\n"
+"  -h           display this help and exit\n"
+"  -V           display the version number and copyright\n"
 
 "\nSysDB client "SDB_CLIENT_VERSION_STRING SDB_CLIENT_VERSION_EXTRA", "
 
 "\nSysDB client "SDB_CLIENT_VERSION_STRING SDB_CLIENT_VERSION_EXTRA", "
-PACKAGE_URL"\n", basename(name), user);
+PACKAGE_URL"\n", basename(name), user,
+                       ssl_options.key_file, ssl_options.cert_file);
+
        free(user);
        exit(status);
 } /* exit_usage */
        free(user);
        exit(status);
 } /* exit_usage */
@@ -217,7 +227,7 @@ main(int argc, char **argv)
        sdb_llist_t *commands = NULL;
 
        while (42) {
        sdb_llist_t *commands = NULL;
 
        while (42) {
-               int opt = getopt(argc, argv, "H:U:c:hV");
+               int opt = getopt(argc, argv, "H:U:c:C:K:hV");
 
                if (-1 == opt)
                        break;
 
                if (-1 == opt)
                        break;
@@ -254,6 +264,13 @@ main(int argc, char **argv)
                                }
                                break;
 
                                }
                                break;
 
+                       case 'C':
+                               ssl_options.cert_file = optarg;
+                               break;
+                       case 'K':
+                               ssl_options.key_file = optarg;
+                               break;
+
                        case 'h':
                                exit_usage(argv[0], 0);
                                break;
                        case 'h':
                                exit_usage(argv[0], 0);
                                break;