Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
sssd.2431
0003-SSH-Allow-newline-at-the-end-of-public-key...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-SSH-Allow-newline-at-the-end-of-public-key-values-in.patch of Package sssd.2431
From 26510727739c3e8d14f804568e496b7d7b073964 Mon Sep 17 00:00:00 2001 From: Jan Cholasta <jcholast@redhat.com> Date: Tue, 3 Jun 2014 14:49:56 +0200 Subject: [PATCH] SSH: Allow newline at the end of public key values in LDAP Resolves: https://fedorahosted.org/sssd/ticket/2349 Reviewed-by: Pavel Reichl <preichl@redhat.com> diff --git a/src/util/sss_ssh.c b/src/util/sss_ssh.c index 8690375..a670999 100644 --- a/src/util/sss_ssh.c +++ b/src/util/sss_ssh.c @@ -152,7 +152,7 @@ sss_ssh_format_pubkey(TALLOC_CTX *mem_ctx, char *blob; char *algo; char *out = NULL; - size_t i; + size_t i, len; tmp_ctx = talloc_new(NULL); if (!tmp_ctx) { @@ -182,21 +182,27 @@ sss_ssh_format_pubkey(TALLOC_CTX *mem_ctx, } else { /* Not a valid public key blob, so this must be a textual public key */ for (i = 0; i < pubkey->data_len; i++) { - if (!pubkey->data[i] || pubkey->data[i] == '\n' || + if (pubkey->data[i] == '\0' || + (pubkey->data[i] == '\n' && i != pubkey->data_len - 1) || pubkey->data[i] == '\r') { ret = EINVAL; goto done; } } - out = talloc_array(mem_ctx, char, pubkey->data_len + 1); - if (!out) { + len = pubkey->data_len; + if (pubkey->data[len - 1] == '\n') { + len--; + } + + out = talloc_array(mem_ctx, char, len + 1); + if (out == NULL) { ret = ENOMEM; goto done; } - memcpy(out, pubkey->data, pubkey->data_len); - out[pubkey->data_len] = 0; + memcpy(out, pubkey->data, len); + out[len] = '\0'; } *result = out; -- 2.5.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor