515
515
* Normally this would indicate an internal error and thus
516
516
* be caught in CHECK(), but for the v4 case it could be
517
517
* someone sending a really long username, which is strange
518
* enough to log a warning about but not an internal error.
518
* enough to log a warning about, but not an internal error.
521
521
state->mem[state->reqread - 1] = NUL;
523
slog(LOG_WARNING, "%s: too long username (> %d): \"%s\"",
524
function, strlen(username),
525
strcheck(username = str2vis(username, strlen(username))));
523
swarnx("%s: username too long (> %d): \"%s\"",
524
function, strlen(username), username);
531
529
CHECK(&state->mem[start], request->auth, NULL);
532
* Since we don't know how long the username is, we can only read one
533
* byte at a time. We don't want CHECK() to set state->rcurrent to
534
* NULL after each successfull read of that one byte, since
535
* recv_request() will then think we are starting from the begining
536
* next time we call it.
538
state->rcurrent = recv_username;
532
539
} while (state->mem[state->reqread - 1] != 0);
533
540
state->mem[state->reqread - 1] = NUL; /* style. */
535
slog(LOG_DEBUG, "%s: got socks v4 username: %s",
536
function, strcheck(username = str2vis(username, strlen(username))));
542
slog(LOG_DEBUG, "%s: got socks v4 username: %s", function, username);
544
state->rcurrent = NULL;
539
545
return 1; /* end of request. */