diff options
author | Jan Cholasta <jcholast@redhat.com> | 2012-02-27 04:43:34 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-02-27 11:52:34 -0500 |
commit | e5359baeac6e2d49769aceddbdbc606833b1ec69 (patch) | |
tree | e7d995a0c6c63f3121d99e45557a9034ce2729a7 | |
parent | 7aaf963f23158789a0f6fe3631608e274dd4238f (diff) | |
download | sssd-e5359baeac6e2d49769aceddbdbc606833b1ec69.tar.gz sssd-e5359baeac6e2d49769aceddbdbc606833b1ec69.tar.bz2 sssd-e5359baeac6e2d49769aceddbdbc606833b1ec69.zip |
SSH: Add more debugging messages
-rw-r--r-- | src/db/sysdb_ssh.c | 15 | ||||
-rw-r--r-- | src/responder/ssh/sshsrv_cmd.c | 8 | ||||
-rw-r--r-- | src/sss_client/ssh/sss_ssh_authorizedkeys.c | 4 | ||||
-rw-r--r-- | src/sss_client/ssh/sss_ssh_knownhostsproxy.c | 18 | ||||
-rw-r--r-- | src/util/sss_ssh.c | 1 |
5 files changed, 38 insertions, 8 deletions
diff --git a/src/db/sysdb_ssh.c b/src/db/sysdb_ssh.c index d83ad966..a4d4345b 100644 --- a/src/db/sysdb_ssh.c +++ b/src/db/sysdb_ssh.c @@ -55,8 +55,7 @@ sysdb_store_ssh_host(struct sysdb_ctx *sysdb, ret = sysdb_transaction_start(sysdb); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, - ("Failed to start update transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to start transaction\n")); goto done; } @@ -70,11 +69,15 @@ sysdb_store_ssh_host(struct sysdb_ctx *sysdb, if (num_hosts > 1) { ret = EINVAL; + DEBUG(SSSDBG_CRIT_FAILURE, + ("Found more than one host with name [%s].\n", name)); goto done; } ret = sysdb_delete_ssh_host(sysdb, name); if (ret != EOK && ret != ENOENT) { + DEBUG(SSSDBG_OP_FAILURE, + ("Failed to delete host [%s].\n", name)); goto done; } @@ -90,7 +93,9 @@ sysdb_store_ssh_host(struct sysdb_ctx *sysdb, ret = sysdb_attrs_add_val(attrs, SYSDB_NAME_ALIAS, &el->values[i]); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Could not add name alias\n")); + DEBUG(SSSDBG_OP_FAILURE, + ("Could not add name alias [%s]\n", + el->values[i].data)); goto done; } } @@ -100,7 +105,8 @@ sysdb_store_ssh_host(struct sysdb_ctx *sysdb, if (alias) { ret = sysdb_attrs_add_string(attrs, SYSDB_NAME_ALIAS, alias); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Could not add name alias\n")); + DEBUG(SSSDBG_OP_FAILURE, + ("Could not add name alias [%s]\n", alias)); goto done; } } @@ -114,6 +120,7 @@ sysdb_store_ssh_host(struct sysdb_ctx *sysdb, ret = sysdb_transaction_commit(sysdb); if (ret != EOK) { + DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to commit transaction\n")); goto done; } diff --git a/src/responder/ssh/sshsrv_cmd.c b/src/responder/ssh/sshsrv_cmd.c index 4768d547..40d9c520 100644 --- a/src/responder/ssh/sshsrv_cmd.c +++ b/src/responder/ssh/sshsrv_cmd.c @@ -492,12 +492,18 @@ ssh_host_pubkeys_update_known_hosts(struct ssh_cmd_ctx *cmd_ctx) ret = sysdb_search_ssh_hosts(tmp_ctx, sysdb, "*", attrs, &hosts, &num_hosts); if (ret != EOK) { + if (ret != ENOENT) { + DEBUG(SSSDBG_OP_FAILURE, + ("Host search failed for domain [%s]\n", dom->name)); + } continue; } for (i = 0; i < num_hosts; i++) { ret = sss_ssh_make_ent(tmp_ctx, hosts[i], &ent); if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, + ("Failed to get SSH host public keys\n")); continue; } @@ -505,6 +511,8 @@ ssh_host_pubkeys_update_known_hosts(struct ssh_cmd_ctx *cmd_ctx) pubkey = sss_ssh_format_pubkey(tmp_ctx, ent, &ent->pubkeys[j], SSS_SSH_FORMAT_OPENSSH); if (!pubkey) { + DEBUG(SSSDBG_OP_FAILURE, + ("Out of memory formatting SSH public key\n")); continue; } diff --git a/src/sss_client/ssh/sss_ssh_authorizedkeys.c b/src/sss_client/ssh/sss_ssh_authorizedkeys.c index bc3cdf47..de945422 100644 --- a/src/sss_client/ssh/sss_ssh_authorizedkeys.c +++ b/src/sss_client/ssh/sss_ssh_authorizedkeys.c @@ -99,6 +99,8 @@ int main(int argc, const char **argv) /* look up public keys */ ret = sss_ssh_get_ent(mem_ctx, SSS_SSH_GET_USER_PUBKEYS, user, &ent); if (ret != EOK) { + DEBUG(SSSDBG_CRIT_FAILURE, + ("sss_ssh_get_ent() failed (%d): %s\n", ret, strerror(ret))); ERROR("Error looking up public keys\n"); ret = EXIT_FAILURE; goto fini; @@ -109,6 +111,8 @@ int main(int argc, const char **argv) repr = sss_ssh_format_pubkey(mem_ctx, ent, &ent->pubkeys[i], SSS_SSH_FORMAT_OPENSSH); if (!repr) { + DEBUG(SSSDBG_OP_FAILURE, + ("Out of memory formatting SSH public key\n")); continue; } diff --git a/src/sss_client/ssh/sss_ssh_knownhostsproxy.c b/src/sss_client/ssh/sss_ssh_knownhostsproxy.c index 544ea719..1cfdf24d 100644 --- a/src/sss_client/ssh/sss_ssh_knownhostsproxy.c +++ b/src/sss_client/ssh/sss_ssh_knownhostsproxy.c @@ -136,6 +136,8 @@ connect_socket(const char *host, if (ret == EINTR || ret == EAGAIN) { continue; } + DEBUG(SSSDBG_OP_FAILURE, + ("poll() failed (%d): %s\n", ret, strerror(ret))); goto done; } @@ -149,25 +151,31 @@ connect_socket(const char *host, if (ret == EAGAIN || ret == EINTR || ret == EWOULDBLOCK) { continue; } + DEBUG(SSSDBG_OP_FAILURE, + ("read() failed (%d): %s\n", ret, strerror(ret))); goto done; } else if (res == 0) { - ret = EOK; - goto done; + break; } res = sss_atomic_write(i == 0 ? sock : 1, buffer, res); if (res == -1) { ret = errno; + DEBUG(SSSDBG_OP_FAILURE, + ("sss_atomic_write() failed (%d): %s\n", + ret, strerror(ret))); goto done; } } if (fds[i].revents & POLLHUP) { - ret = EOK; - goto done; + break; } } } + ret = EOK; + DEBUG(SSSDBG_TRACE_FUNC, ("Connection closed\n")); + done: if (ai) freeaddrinfo(ai); if (sock >= 0) close(sock); @@ -274,6 +282,8 @@ int main(int argc, const char **argv) /* look up public keys */ ret = sss_ssh_get_ent(mem_ctx, SSS_SSH_GET_HOST_PUBKEYS, host, &ent); if (ret != EOK) { + DEBUG(SSSDBG_CRIT_FAILURE, + ("sss_ssh_get_ent() failed (%d): %s\n", ret, strerror(ret))); ERROR("Error looking up public keys\n"); } diff --git a/src/util/sss_ssh.c b/src/util/sss_ssh.c index 83c1ec15..0c62d6e4 100644 --- a/src/util/sss_ssh.c +++ b/src/util/sss_ssh.c @@ -45,6 +45,7 @@ sss_ssh_make_ent(TALLOC_CTX *mem_ctx, name = ldb_msg_find_attr_as_string(msg, SYSDB_NAME, NULL); if (!name) { ret = EINVAL; + DEBUG(SSSDBG_CRIT_FAILURE, ("Host is missing name attribute\n")); goto done; } |