From dafcfbc488f1e713ef6cfa9e86571a2b14e649d8 Mon Sep 17 00:00:00 2001 From: Michael Rash Date: Fri, 31 Aug 2012 23:00:45 -0400 Subject: [PATCH] bug fix to make sure to verify file permissions/ownership on files that actually exist --- client/fwknop.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/client/fwknop.c b/client/fwknop.c index 3c518da..d3096ad 100644 --- a/client/fwknop.c +++ b/client/fwknop.c @@ -558,14 +558,13 @@ show_last_command(void) exit(EXIT_FAILURE); #endif - verify_file_perms_ownership(args_save_file); - if (get_save_file(args_save_file)) { if ((args_file_ptr = fopen(args_save_file, "r")) == NULL) { fprintf(stderr, "Could not open args file: %s\n", args_save_file); exit(EXIT_FAILURE); } + verify_file_perms_ownership(args_save_file); if ((fgets(args_str, MAX_LINE_LEN, args_file_ptr)) != NULL) { printf("Last fwknop client command line: %s", args_str); } else { @@ -603,14 +602,13 @@ run_last_args(fko_cli_options_t *options) if (get_save_file(args_save_file)) { - verify_file_perms_ownership(args_save_file); - if ((args_file_ptr = fopen(args_save_file, "r")) == NULL) { fprintf(stderr, "Could not open args file: %s\n", args_save_file); exit(EXIT_FAILURE); } + verify_file_perms_ownership(args_save_file); if ((fgets(args_str, MAX_LINE_LEN, args_file_ptr)) != NULL) { args_str[MAX_LINE_LEN-1] = '\0'; -- 1.7.5.4