fixes
Authored by
mfwolffe <wolffemf@dukes.jmu.edu>
- SHA
29ed60ffbc4f35887174b2700454002f87749af9- Parents
-
5d5a0ca - Tree
d8388f5
29ed60f
29ed60ffbc4f35887174b2700454002f87749af95d5a0ca
d8388f5| Status | File | + | - |
|---|---|---|---|
| M |
src/accounts.c
|
13 | 3 |
| M |
src/display.c
|
8 | 5 |
src/accounts.cmodified@@ -724,10 +724,20 @@ static int validate_ssh_key_security(const char *ssh_key_path) { | ||
| 724 | 724 | return -1; |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | + /* Check if it's a private key (should be 600) or public key (can be 644) */ | |
| 728 | + if (strstr(ssh_key_path, ".pub") == NULL) { | |
| 729 | + /* Private key - should be 600 */ | |
| 727 | 730 | if ((file_mode & 077) != 0) { |
| 728 | - log_warning("SSH key file has insecure permissions: %o", file_mode & 0777); | |
| 731 | + log_warning("SSH private key file has insecure permissions: %o", file_mode & 0777); | |
| 729 | 732 | return -1; |
| 730 | 733 | } |
| 734 | + } else { | |
| 735 | + /* Public key - 644 is acceptable */ | |
| 736 | + if ((file_mode & 022) != 0 && (file_mode & 044) == 0) { | |
| 737 | + log_warning("SSH public key file has unusual permissions: %o", file_mode & 0777); | |
| 738 | + /* Continue anyway for public keys */ | |
| 739 | + } | |
| 740 | + } | |
| 731 | 741 | |
| 732 | 742 | /* Check if it looks like a valid SSH key */ |
| 733 | 743 | key_file = fopen(ssh_key_path, "r"); |
src/display.cmodified@@ -135,8 +135,7 @@ void display_header(const char *title) { | ||
| 135 | 135 | printf("┐\n"); |
| 136 | 136 | |
| 137 | 137 | /* Title line */ |
| 138 | - printf("│%s%*s%s%s%*s│\n", | |
| 139 | - display_colorize("", "header"), | |
| 138 | + printf("│%*s%s%s%*s│\n", | |
| 140 | 139 | padding, "", |
| 141 | 140 | display_colorize(title, "header"), |
| 142 | 141 | COLOR_RESET, |
@@ -182,9 +181,13 @@ void display_status(const char *level, const char *message, ...) { | ||
| 182 | 181 | color_type = "info"; |
| 183 | 182 | } |
| 184 | 183 | |
| 184 | + if (strlen(formatted_message) > 0) { | |
| 185 | 185 | printf("%s %s\n", |
| 186 | 186 | display_colorize(icon, color_type), |
| 187 | 187 | display_colorize(formatted_message, color_type)); |
| 188 | + } else { | |
| 189 | + printf("%s\n", display_colorize(icon, color_type)); | |
| 190 | + } | |
| 188 | 191 | } |
| 189 | 192 | |
| 190 | 193 | /* Print error message with context */ |