~ubuntu-branches/ubuntu/karmic/dante/karmic

« back to all changes in this revision

Viewing changes to sockd/sockd_protocol.c

  • Committer: Bazaar Package Importer
  • Author(s): Thijs Kinkhorst
  • Date: 2006-10-19 12:09:39 UTC
  • mfrom: (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20061019120939-t818x24e2tn8be5k
Tags: 1.1.18-2.1
* Non-maintainer upload for RC bug.
* Make sure changelogs are installed into all packages (Closes: #393568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#include "common.h"
45
45
 
46
46
static const char rcsid[] =
47
 
"$Id: sockd_protocol.c,v 1.95 2003/07/01 13:21:47 michaels Exp $";
 
47
"$Id: sockd_protocol.c,v 1.98 2005/09/02 14:33:55 michaels Exp $";
48
48
 
49
49
__BEGIN_DECLS
50
50
 
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.
519
519
                         */
520
520
 
521
521
                        state->mem[state->reqread - 1] = NUL;
522
522
 
523
 
                        slog(LOG_WARNING, "%s: too long username (> %d): \"%s\"",
524
 
                        function, strlen(username),
525
 
                        strcheck(username = str2vis(username, strlen(username))));
526
 
                        free(username);
 
523
                        swarnx("%s: username too long (> %d): \"%s\"",
 
524
                        function, strlen(username), username);
527
525
 
528
526
                        return -1;
529
527
                }
530
528
 
531
529
                CHECK(&state->mem[start], request->auth, NULL);
 
530
 
 
531
                /*
 
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.
 
537
                 */
 
538
                state->rcurrent = recv_username;
532
539
        } while (state->mem[state->reqread - 1] != 0);
533
540
        state->mem[state->reqread - 1] = NUL;   /* style. */
534
541
 
535
 
        slog(LOG_DEBUG, "%s: got socks v4 username: %s",
536
 
        function, strcheck(username = str2vis(username, strlen(username))));
537
 
        free(username);
 
542
        slog(LOG_DEBUG, "%s: got socks v4 username: %s", function, username);
538
543
 
 
544
        state->rcurrent = NULL;
539
545
        return 1;       /* end of request. */
540
546
}
541
547