Skip to content

Commit

Permalink
byte_isequal -> str_equaln
Browse files Browse the repository at this point in the history
  • Loading branch information
janmojzis committed Jul 26, 2016
1 parent 0469370 commit 61c3316
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tinyssh/packet_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Public domain.
#include "buf.h"
#include "ssh.h"
#include "e.h"
#include "byte.h"
#include "str.h"
#include "packetparser.h"
#include "subprocess.h"
Expand Down Expand Up @@ -40,9 +39,8 @@ int packet_auth(struct buf *b, struct buf *b2) {
pos = packetparser_uint8(b->buf, b->len, pos, &ch); /* SSH_MSG_SERVICE_REQUEST */
if (ch != SSH_MSG_SERVICE_REQUEST) bug_proto();
pos = packetparser_uint32(b->buf, b->len, pos, &len); /* "ssh-userauth" */
if (len != 12) bug_proto();
pos = packetparser_skip(b->buf, b->len, pos, len);
if (!byte_isequal(b->buf + pos - len, len, "ssh-userauth")) bug_proto();
if (!str_equaln((char *)b->buf + pos - len, len, "ssh-userauth")) bug_proto();
pos = packetparser_end(b->buf, b->len, pos);

/* send service accept */
Expand All @@ -64,9 +62,8 @@ int packet_auth(struct buf *b, struct buf *b2) {
pos = packetparser_copy(b->buf, b->len, pos, (unsigned char *)packet.name, len);
packet.name[len] = 0;
pos = packetparser_uint32(b->buf, b->len, pos, &len); /* "ssh-connection" */
if (len != 14) bug_proto();
pos = packetparser_skip(b->buf, b->len, pos, len);
if (!byte_isequal(b->buf + pos - len, len, "ssh-connection")) bug_proto();
if (!str_equaln((char *)b->buf + pos - len, len, "ssh-connection")) bug_proto();

pos = packetparser_uint32(b->buf, b->len, pos, &len); /* publickey/password/hostbased/none */
pos = packetparser_skip(b->buf, b->len, pos, len);
Expand Down

0 comments on commit 61c3316

Please # to comment.