Minor logging improvement / code cleanup
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
C/C++ CI MacOS / ${{ matrix.target }} (macos-15) (push) Has been cancelled
C/C++ CI Windows / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Has been cancelled

This commit is contained in:
Vladimir Dubrovin committed 2026-05-12 21:21:59 +03:00
1 parent 1de06c5059
commit 381ef993a7
4 files changed
+51 -24

No files matched your search

+14 -3
View File
@@ -77,11 +77,17 @@ void * sockschild(struct clientparam* param) {
if ((i = sockgetcharcli(param, conf.timeouts[SINGLEBYTE_S], 0)) == EOF) {RETURN(451);}
if (i && (unsigned)(res = sockgetlinebuf(param, CLIENT, buf, i, 0, conf.timeouts[STRING_S])) != i){RETURN(441);};
buf[i] = 0;
if(!param->username)param->username = (unsigned char *)strdup((char *)buf);
if(!param->username) {
param->username = (unsigned char *)strdup((char *)buf);
if(!param->username){RETURN(21);}
}
if ((i = sockgetcharcli(param, conf.timeouts[SINGLEBYTE_S], 0)) == EOF) {RETURN(445);}
if (i && (unsigned)(res = sockgetlinebuf(param, CLIENT, buf, i, 0, conf.timeouts[STRING_S])) != i){RETURN(441);};
buf[i] = 0;
if(!param->password)param->password = (unsigned char *)strdup((char *)buf);
if(!param->password) {
param->password = (unsigned char *)strdup((char *)buf);
if(!param->password){RETURN(21);}
}
buf[0] = 1;
buf[1] = 0;
if(socksend(param, param->clisock, buf, 2, conf.timeouts[STRING_S])!=2){RETURN(481);}
@@ -155,6 +161,7 @@ void * sockschild(struct clientparam* param) {
}
if(param->hostname)free(param->hostname);
param->hostname = (unsigned char *)strdup((char *)buf);
if(!param->hostname){RETURN(21);}
if (ver == 5) {
if ((res = sockgetcharcli(param, conf.timeouts[SINGLEBYTE_S], 0)) == EOF) {RETURN(441);}
buf[0] = (unsigned char) res;
@@ -166,13 +173,17 @@ void * sockschild(struct clientparam* param) {
else {
if(sockgetlinebuf(param, CLIENT, buf, BUFSIZE - 1, 0, conf.timeouts[STRING_S]) < 0) {RETURN(441);}
buf[127] = 0;
if(param->srv->needuser && *buf && !param->username)param->username = (unsigned char *)strdup((char *)buf);
if(param->srv->needuser && *buf && !param->username) {
param->username = (unsigned char *)strdup((char *)buf);
if(!param->username){RETURN(21);}
}
if(!memcmp(SAADDR(&param->req), "\0\0\0", 3)){
param->service = S_SOCKS45;
if(sockgetlinebuf(param, CLIENT, buf, BUFSIZE - 1, 0, conf.timeouts[STRING_S]) < 0) {RETURN(441);}
buf[127] = 0;
if(param->hostname)free(param->hostname);
param->hostname = (unsigned char *)strdup((char *)buf);
if(!param->hostname){RETURN(21);}
if(!getip46(param->srv->family, buf, (struct sockaddr *) &param->req)) RETURN(100);
param->sinsr = param->req;
}