comparison th_network.c @ 130:32dcabfc2644

Add some informative messages to SOCKS 5 authentication steps.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 23 Jun 2014 16:14:12 +0300
parents 8efebf863404
children 6624893ad528
comparison
equal deleted inserted replaced
129:aa2d608fb3f3 130:32dcabfc2644
445 } 445 }
446 else 446 else
447 if (auth == SOCKS5_AUTH_USER) 447 if (auth == SOCKS5_AUTH_USER)
448 { 448 {
449 // Attempt user/pass authentication (RFC 1929) 449 // Attempt user/pass authentication (RFC 1929)
450 th_conn_msg(conn, THLOG_INFO, "Attempting SOCKS 5 user/pass authentication.\n");
450 th_growbuf_clear(&buf); 451 th_growbuf_clear(&buf);
451 452
452 th_growbuf_put_u8(&buf, 0x01); 453 th_growbuf_put_u8(&buf, 0x01);
453 th_growbuf_put_u8(&buf, strlen(conn->proxy.userid)); 454 th_growbuf_put_u8(&buf, strlen(conn->proxy.userid));
454 th_growbuf_puts(&buf, conn->proxy.userid, FALSE); 455 th_growbuf_puts(&buf, conn->proxy.userid, FALSE);
474 ptr++; 475 ptr++;
475 if (*ptr != 0) 476 if (*ptr != 0)
476 { 477 {
477 err = THERR_AUTH_FAILED; 478 err = THERR_AUTH_FAILED;
478 th_conn_err(conn, err, 479 th_conn_err(conn, err,
479 "SOCKS 5 proxy user/pass authentication failed! Code %d.\n", *ptr); 480 "SOCKS 5 proxy user/pass authentication failed! Code 0x%02x.\n", *ptr);
480 goto out; 481 goto out;
481 } 482 }
482 } 483 }
483 else 484 else
484 if (auth != SOCKS5_AUTH_NONE) 485 if (auth == SOCKS5_AUTH_NONE)
486 {
487 th_conn_msg(conn, THLOG_INFO, "Using no authentication for SOCKS 5.\n");
488 }
489 else
485 { 490 {
486 err = THERR_NOT_SUPPORTED; 491 err = THERR_NOT_SUPPORTED;
487 th_conn_err(conn, err, 492 th_conn_err(conn, err,
488 "Proxy server chose an unsupported SOCKS 5 authentication method %d.\n", 493 "Proxy server chose an unsupported SOCKS 5 authentication method 0x%02x.\n",
489 auth); 494 auth);
490 goto out; 495 goto out;
491 } 496 }
492 497
493 498