Skip to content
Snippets Groups Projects
Commit b0ba9a55 authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

add command to ssh key when using PUT

parent 5028ba30
No related branches found
No related tags found
No related merge requests found
...@@ -41,13 +41,12 @@ int callback_ssh_keys_post(const struct _u_request * request, ...@@ -41,13 +41,12 @@ int callback_ssh_keys_post(const struct _u_request * request,
return send_simple_response(response, 400, "error", "missing ssh-key"); return send_simple_response(response, 400, "error", "missing ssh-key");
} }
// add cryptops-client command to ssh-key
char * ssh_key_with_command; char * ssh_key_with_command;
add_ssh_command(&ssh_key_with_command, ssh_key); add_ssh_command(&ssh_key_with_command, ssh_key);
asprintf(&ssh_key_with_command, "%s\n", ssh_key_with_command);
// Write SSH key to file // Write SSH key to file
asprintf(&ssh_key_with_command, "%s\n", ssh_key_with_command);
fprintf(authorized_keys, ssh_key_with_command); fprintf(authorized_keys, ssh_key_with_command);
fclose(authorized_keys); fclose(authorized_keys);
......
...@@ -50,7 +50,12 @@ int callback_ssh_keys_put(const struct _u_request * request, ...@@ -50,7 +50,12 @@ int callback_ssh_keys_put(const struct _u_request * request,
return send_simple_response(response, 400, "error", "missing ssh-key"); return send_simple_response(response, 400, "error", "missing ssh-key");
} }
r = replace_ssh_key(id, ssh_key); // add cryptops-client command to ssh-key
char * ssh_key_with_command;
add_ssh_command(&ssh_key_with_command, ssh_key);
r = replace_ssh_key(id, ssh_key_with_command);
if (r < 0) if (r < 0)
{ {
if (r == -1) if (r == -1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment