summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2013-07-31 14:12:48 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-08-05 16:48:23 +0200
commit1d45113cd45f8509d1088f941da932c29dd8ab2a (patch)
tree147495f1929bb7d4e579549f8932dd4c3d5d7e6d /src
parentb410c7a9a80b0e44e3740f17d36574d3421626b7 (diff)
downloadsssd-1d45113cd45f8509d1088f941da932c29dd8ab2a.tar.gz
sssd-1d45113cd45f8509d1088f941da932c29dd8ab2a.tar.bz2
sssd-1d45113cd45f8509d1088f941da932c29dd8ab2a.zip
SSH: Ensure that cmd_ctx->name will not be NULL.
If cmd_ctx->name was not initialized by sss_parse_name then copy of name will be used. https://fedorahosted.org/sssd/ticket/1970 Coverity ID: 11647
Diffstat (limited to 'src')
-rw-r--r--src/responder/ssh/sshsrv_cmd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/responder/ssh/sshsrv_cmd.c b/src/responder/ssh/sshsrv_cmd.c
index 76c36435..efa45134 100644
--- a/src/responder/ssh/sshsrv_cmd.c
+++ b/src/responder/ssh/sshsrv_cmd.c
@@ -765,11 +765,13 @@ ssh_cmd_parse_request(struct ssh_cmd_ctx *cmd_ctx)
("Invalid name received [%s]\n", name));
return ENOENT;
}
- } else if (cmd_ctx->name == NULL && cmd_ctx->domname == NULL) {
- cmd_ctx->name = talloc_strdup(cmd_ctx, name);
- if (!cmd_ctx->name) return ENOMEM;
+ } else {
+ if (cmd_ctx->name == NULL) {
+ cmd_ctx->name = talloc_strdup(cmd_ctx, name);
+ if (!cmd_ctx->name) return ENOMEM;
+ }
- if (domain != NULL) {
+ if (cmd_ctx->domname == NULL && domain != NULL) {
cmd_ctx->domname = talloc_strdup(cmd_ctx, domain);
if (!cmd_ctx->domname) return ENOMEM;
}