diff --git a/src/api/ssh_keys_delete.c b/src/api/ssh_keys_delete.c index 27874e7583443d8159f03ac09987cadbc232ec1b..8cb97dbc28a85514c26a4f97aaf612ac9baa3734 100644 --- a/src/api/ssh_keys_delete.c +++ b/src/api/ssh_keys_delete.c @@ -39,12 +39,12 @@ int callback_ssh_keys_delete(const struct _u_request * request, // Replace the key at ID with "" r = replace_ssh_key(id, ""); - if(r < 0) + if (r < 0) { - if(r == -1) + if (r == -1) return send_simple_response(response, 500, "error", "error opening authorized_keys"); - if(r == -2) + if (r == -2) return send_simple_response(response, 500, "error", "error opening authorized_keys tmp file"); return send_simple_response(response, 500, "error", diff --git a/src/api/ssh_keys_get.c b/src/api/ssh_keys_get.c index 1bd595839ac60afd9de3d1b52740e0ddce1f904c..3818706297ada1c2e81f56eb61d211c16390ef40 100644 --- a/src/api/ssh_keys_get.c +++ b/src/api/ssh_keys_get.c @@ -24,7 +24,7 @@ json_t * readAuthorizedKeysToJson() while ((read = getline(&line, &line_length, authorized_keys)) != -1) { // Ignore empty lines, they do have IDs though. - if(strlen(line) > 1) + if (strlen(line) > 1) { asprintf(&field, "%d", index); // Remove trailing newline. diff --git a/src/api/ssh_keys_put.c b/src/api/ssh_keys_put.c index 4503e5dfd6b9a77e9d727052209d9d05204261d8..0af4782d6eef73eadd5eca0a5c185023333df769 100644 --- a/src/api/ssh_keys_put.c +++ b/src/api/ssh_keys_put.c @@ -51,12 +51,12 @@ int callback_ssh_keys_put(const struct _u_request * request, } r = replace_ssh_key(id, ssh_key); - if(r < 0) + if (r < 0) { - if(r == -1) + if (r == -1) return send_simple_response(response, 500, "error", "error opening authorized_keys"); - if(r == -2) + if (r == -2) return send_simple_response(response, 500, "error", "error opening authorized_keys tmp file"); return send_simple_response(response, 500, "error", diff --git a/src/auxiliary.c b/src/auxiliary.c index 90ab5ab253028c37bb66b2d4ca18a17594cda284..d586e45906fba18211bf84b99904b12bcd10efcb 100644 --- a/src/auxiliary.c +++ b/src/auxiliary.c @@ -263,7 +263,7 @@ int replace_ssh_key(int id, const char * ssh_key) { // Copy 1 line ch = getc(authorized_keys_in); - while(ch != EOF && ch != '\n') + while (ch != EOF && ch != '\n') { // Copy all lines that don't have id as line number putc(ch, authorized_keys_out); @@ -274,11 +274,11 @@ int replace_ssh_key(int id, const char * ssh_key) { // Insert an ssh key instead of a line ch = *ssh_key++; - while(ch != '\0') + while (ch != '\0') { // New line in ssh key is not allowed, because that will screw // up the indices - if(ch != '\n') + if (ch != '\n') putc(ch, authorized_keys_out); ch = *ssh_key++; } @@ -290,14 +290,14 @@ int replace_ssh_key(int id, const char * ssh_key) } while (ch != EOF && ch != '\n'); } - if(ch != EOF) + if (ch != EOF) { // Insert newline putc('\n', authorized_keys_out); // Increment line number line_number++; } - } while(ch != EOF); + } while (ch != EOF); fclose(authorized_keys_in); fclose(authorized_keys_out);