summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/sss_ssh.c36
-rw-r--r--src/util/sss_ssh.h13
2 files changed, 9 insertions, 40 deletions
diff --git a/src/util/sss_ssh.c b/src/util/sss_ssh.c
index a713eab0..d36e3c62 100644
--- a/src/util/sss_ssh.c
+++ b/src/util/sss_ssh.c
@@ -111,7 +111,7 @@ done:
return ret;
}
-errno_t
+static errno_t
sss_ssh_get_pubkey_algorithm(TALLOC_CTX *mem_ctx,
struct sss_ssh_pubkey *pubkey,
char **result)
@@ -144,10 +144,7 @@ sss_ssh_get_pubkey_algorithm(TALLOC_CTX *mem_ctx,
errno_t
sss_ssh_format_pubkey(TALLOC_CTX *mem_ctx,
- struct sss_ssh_ent *ent,
struct sss_ssh_pubkey *pubkey,
- enum sss_ssh_pubkey_format format,
- const char *comment,
char **result)
{
TALLOC_CTX *tmp_ctx;
@@ -156,10 +153,6 @@ sss_ssh_format_pubkey(TALLOC_CTX *mem_ctx,
char *algo;
char *out = NULL;
- if (!comment) {
- comment = ent->name;
- }
-
tmp_ctx = talloc_new(NULL);
if (!tmp_ctx) {
return ENOMEM;
@@ -171,26 +164,15 @@ sss_ssh_format_pubkey(TALLOC_CTX *mem_ctx,
goto done;
}
- switch (format) {
- case SSS_SSH_FORMAT_RAW:
- /* base64-encoded key blob */
- out = talloc_steal(mem_ctx, blob);
- break;
-
- case SSS_SSH_FORMAT_OPENSSH:
- /* OpenSSH authorized_keys/known_hosts format */
- ret = sss_ssh_get_pubkey_algorithm(tmp_ctx, pubkey, &algo);
- if (ret != EOK) {
- goto done;
- }
-
- out = talloc_asprintf(mem_ctx, "%s %s %s", algo, blob, comment);
- if (!out) {
- ret = ENOMEM;
- goto done;
- }
+ ret = sss_ssh_get_pubkey_algorithm(tmp_ctx, pubkey, &algo);
+ if (ret != EOK) {
+ goto done;
+ }
- break;
+ out = talloc_asprintf(mem_ctx, "%s %s", algo, blob);
+ if (!out) {
+ ret = ENOMEM;
+ goto done;
}
*result = out;
diff --git a/src/util/sss_ssh.h b/src/util/sss_ssh.h
index ef663d9a..fec7c732 100644
--- a/src/util/sss_ssh.h
+++ b/src/util/sss_ssh.h
@@ -42,21 +42,8 @@ sss_ssh_make_ent(TALLOC_CTX *mem_ctx,
struct sss_ssh_ent **result);
errno_t
-sss_ssh_get_pubkey_algorithm(TALLOC_CTX *mem_ctx,
- struct sss_ssh_pubkey *pubkey,
- char **result);
-
-enum sss_ssh_pubkey_format {
- SSS_SSH_FORMAT_RAW,
- SSS_SSH_FORMAT_OPENSSH
-};
-
-errno_t
sss_ssh_format_pubkey(TALLOC_CTX *mem_ctx,
- struct sss_ssh_ent *ent,
struct sss_ssh_pubkey *pubkey,
- enum sss_ssh_pubkey_format format,
- const char *comment,
char **result);
#endif /* _SSS_SSH_H_ */