diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-09 14:24:49 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-09 14:24:49 +0000 |
commit | 38d88750211a71551a3a922385790832d6a3510b (patch) | |
tree | aadafad3eed536bc6b624cd05ace556c8ba80016 | |
parent | e5b7e8fdfc6e31121a992b6dd0912d2f46ffda70 (diff) | |
download | libssh-38d88750211a71551a3a922385790832d6a3510b.tar.gz libssh-38d88750211a71551a3a922385790832d6a3510b.tar.xz libssh-38d88750211a71551a3a922385790832d6a3510b.zip |
Add error checking to ssh_message_auth_reply_success().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@444 7dcaeef0-15fb-0310-b436-a5af3365683c
-rw-r--r-- | libssh/messages.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/libssh/messages.c b/libssh/messages.c index 4f0a4b4..8b32cdf 100644 --- a/libssh/messages.c +++ b/libssh/messages.c @@ -298,11 +298,20 @@ error: return rc; } -int ssh_message_auth_reply_success(SSH_MESSAGE *msg,int partial){ - if(partial) - return ssh_message_auth_reply_default(msg,partial); - buffer_add_u8(msg->session->out_buffer,SSH2_MSG_USERAUTH_SUCCESS); - return packet_send(msg->session); +int ssh_message_auth_reply_success(SSH_MESSAGE *msg, int partial) { + if (msg == NULL) { + return SSH_ERROR; + } + + if (partial) { + return ssh_message_auth_reply_default(msg, partial); + } + + if (buffer_add_u8(msg->session->out_buffer,SSH2_MSG_USERAUTH_SUCCESS) < 0) { + return SSH_ERROR; + } + + return packet_send(msg->session); } static SSH_MESSAGE *handle_channel_request_open(SSH_SESSION *session){ |