summaryrefslogtreecommitdiffstats
path: root/libssh/auth.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-29 10:09:16 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-29 10:09:16 +0000
commitddd1d624294ea05e84a6ab9fa25070938b63f249 (patch)
tree625de34db0c7fb3a23258cfb630a4081b8d2a6fe /libssh/auth.c
parent84629a394e635e38c063af291857a9f25a78b633 (diff)
downloadlibssh-ddd1d624294ea05e84a6ab9fa25070938b63f249.tar.gz
libssh-ddd1d624294ea05e84a6ab9fa25070938b63f249.tar.xz
libssh-ddd1d624294ea05e84a6ab9fa25070938b63f249.zip
Improve kbdauth_init.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@640 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/auth.c')
-rw-r--r--libssh/auth.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/libssh/auth.c b/libssh/auth.c
index 83956cb..b0245d9 100644
--- a/libssh/auth.c
+++ b/libssh/auth.c
@@ -1005,10 +1005,10 @@ static void kbdint_clean(struct ssh_kbdint *kbd) {
* of the draft */
static int kbdauth_init(SSH_SESSION *session, const char *user,
const char *submethods) {
- STRING *usr = NULL;
- STRING *sub = NULL;
- STRING *service = NULL;
- STRING *method = NULL;
+ STRING *usr;
+ STRING *sub;
+ STRING *service;
+ STRING *method;
int rc = SSH_AUTH_ERROR;
enter_function();
@@ -1030,22 +1030,12 @@ static int kbdauth_init(SSH_SESSION *session, const char *user,
goto error;
}
- if (buffer_add_u8(session->out_buffer, SSH2_MSG_USERAUTH_REQUEST) < 0) {
- goto error;
- }
- if (buffer_add_ssh_string(session->out_buffer, usr) < 0) {
- goto error;
- }
- if (buffer_add_ssh_string(session->out_buffer, service) < 0) {
- goto error;
- }
- if (buffer_add_ssh_string(session->out_buffer, method) < 0) {
- goto error;
- }
- if (buffer_add_u32(session->out_buffer, 0) < 0) {
- goto error;
- }
- if (buffer_add_ssh_string(session->out_buffer, sub) < 0) {
+ if (buffer_add_u8(session->out_buffer, SSH2_MSG_USERAUTH_REQUEST) < 0 ||
+ buffer_add_ssh_string(session->out_buffer, usr) < 0 ||
+ buffer_add_ssh_string(session->out_buffer, service) < 0 ||
+ buffer_add_ssh_string(session->out_buffer, method) < 0 ||
+ buffer_add_u32(session->out_buffer, 0) < 0 ||
+ buffer_add_ssh_string(session->out_buffer, sub) < 0) {
goto error;
}