Whamcloud - gitweb
LU-9336 utils: prevent key clobber and clarify lgss_sk usage 38/26838/2
authorChris Hanna <hannac@iu.edu>
Wed, 26 Apr 2017 13:43:55 +0000 (09:43 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 1 May 2017 17:50:10 +0000 (17:50 +0000)
Prevent lgss_sk from overwriting key value when modifying attributes.
Altered usage text to match, and clarified that the input source is
the key value, not a source of randomization for key generation.

Signed-off-by: Chris Hanna <hannac@iu.edu>
Change-Id: I87b9d59b65f3172b0425115441eaa1456489daeb
Reviewed-on: https://review.whamcloud.com/26838
Tested-by: Jenkins
Reviewed-by: Kit Westneat <kit.westneat@gmail.com>
Reviewed-by: Nathan Lavender <nblavend@iu.edu>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>

index 15ff3fc..825146e 100644 (file)
@@ -133,8 +133,9 @@ static void usage(FILE *fp, char *program)
        fprintf(fp, "-k|--key-bits   <len>      Shared key length in bits "
                "(Default: %d)\n", SK_DEFAULT_SK_KEYLEN);
-       fprintf(fp, "-d|--data       <file>     Key random data source "
-               "(Default: /dev/random)\n\n");
+       fprintf(fp, "-d|--data       <file>     Key data source for new keys "
+               "(Default: /dev/random)\n");
+       fprintf(fp, "                        Not a seed value.  This is the actual key value.\n\n");
        fprintf(fp, "Other Options:\n");
        fprintf(fp, "-v|--verbose           Increase verbosity for errors\n");
@@ -498,6 +499,10 @@ int main(int argc, char **argv)
                fprintf(stderr, "error: invalid HMAC algorithm specified\n");
                return EXIT_FAILURE;
+       if (modify && datafile) {
+               fprintf(stderr, "error: data file option not valid in key modify\n");
+               return EXIT_FAILURE;
+       }
        if (modify) {
                config = sk_read_file(modify);