Skip to content

Commit

Permalink
Fix sequence # bugs that impede single-connection mode sessions
Browse files Browse the repository at this point in the history
Don't check the sequence # as being 1.  Check it instead as being
a match for the associated session, and have the session start at
1 on a new connection.
  • Loading branch information
pprindeville committed Dec 13, 2016
1 parent da66077 commit b71502f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
9 changes: 5 additions & 4 deletions authen.c
Expand Up @@ -47,10 +47,11 @@ authen(u_char *pak)
return;
}

if ((hdr->seq_no != 1) ||
(ntohl(hdr->datalength) != (unsigned)(TAC_AUTHEN_START_FIXED_FIELDS_SIZE +
start->user_len + start->port_len + start->rem_addr_len +
start->data_len))) {
/* don't need to check seq_no because read_packet() does that */

if (ntohl(hdr->datalength) != (unsigned)(TAC_AUTHEN_START_FIXED_FIELDS_SIZE +
start->user_len + start->port_len + start->rem_addr_len +
start->data_len)) {
send_authen_error("Invalid AUTHEN/START packet (check keys)");
return;
}
Expand Down
6 changes: 1 addition & 5 deletions author.c
Expand Up @@ -45,11 +45,7 @@ author(u_char *pak)
hdr = (HDR *)pak;
apak = (struct author *)(pak + TAC_PLUS_HDR_SIZE);

/* Do some sanity checks */
if (hdr->seq_no != 1) {
send_error_reply(TAC_PLUS_AUTHOR, NULL);
return;
}
/* don't need to check seq_no because read_packet() does that */

/* Check if there's at least sizeof(struct author) of useful data */
if (ntohl(hdr->datalength) < TAC_AUTHOR_REQ_FIXED_FIELDS_SIZE) {
Expand Down
7 changes: 6 additions & 1 deletion tac_plus.c
Expand Up @@ -823,8 +823,13 @@ start_session(void)
u_char *pak;
HDR *hdr;

/* if the session has TAC_PLUS_SINGLE_CONNECT_FLAG set, then
* we'll see the sequence # increase monotonically with each
* transaction until the session terminates.
*/
session.seq_no = 0;

do {
session.seq_no = 0;
session.aborted = 0;
session.version = 0;

Expand Down

0 comments on commit b71502f

Please sign in to comment.