Compare commits

..

5 Commits

Author SHA1 Message Date
Vladimir Dubrovin
0d7f05b05b set hostname in proxy if hostname is numeric
Some checks are pending
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI MacOS / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI Windows / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Waiting to run
2026-05-07 19:10:36 +03:00
Vladimir Dubrovin
750bb38907 Do not fail on -n 2026-05-07 19:10:13 +03:00
Vladimir Dubrovin
46cff56cf4 Use EVP_MD_CTX_reset instead of free/new 2026-05-07 18:47:06 +03:00
Vladimir Dubrovin
d0d3b90226 Fix $1$ crypt 2026-05-07 18:34:38 +03:00
Vladimir Dubrovin
7a139e59a5 Use UDPMAP request address to limit client, not server 2026-05-07 16:07:59 +03:00
5 changed files with 13 additions and 18 deletions

View File

@ -118,7 +118,6 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
EVP_DigestUpdate(ctx1,sp,sl);
EVP_DigestUpdate(ctx1,pw,strlen((char *)pw));
EVP_DigestFinal_ex(ctx1,final,&len);
EVP_MD_CTX_free(ctx1);
for(pl = (int)strlen((char *)pw); pl > 0; pl -= MD5_SIZE)
EVP_DigestUpdate(ctx,final,pl>MD5_SIZE ? MD5_SIZE : pl);
@ -142,7 +141,7 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
* need 30 seconds to build a 1000 entry dictionary...
*/
for(i=0;i<1000;i++) {
ctx1 = EVP_MD_CTX_new();
EVP_MD_CTX_reset(ctx1);
EVP_DigestInit_ex(ctx1, md5, NULL);
if(i & 1)
EVP_DigestUpdate(ctx1,pw,strlen((char *)pw));
@ -160,12 +159,8 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
else
EVP_DigestUpdate(ctx1,pw,strlen((char *)pw));
EVP_DigestFinal_ex(ctx1,final,&len);
EVP_MD_CTX_free(ctx1);
}
/* Don't leave anything around in vm they could use. */
memset(final,0,sizeof final);
EVP_MD_CTX_free(ctx1);
}
else
#endif

View File

@ -194,7 +194,6 @@ static int h_proxy(int argc, unsigned char ** argv){
childdef.port = 3128;
childdef.isudp = 0;
childdef.service = S_PROXY;
childdef.helpmessage = " -n - no NTLM support\n";
#ifdef NOIPV6
if(!resolvfunc || (resolvfunc == myresolver && !dns_table.poolsize)){
fprintf(stderr, "[line %d] Warning: no nserver/nscache configured, proxy may run very slow\n", linenum);
@ -227,7 +226,6 @@ static int h_proxy(int argc, unsigned char ** argv){
childdef.port = 1080;
childdef.isudp = 0;
childdef.service = S_SOCKS;
childdef.helpmessage = " -n - no NTLM support\n";
#ifdef NOIPV6
if(!resolvfunc || (resolvfunc == myresolver && !dns_table.poolsize)){
fprintf(stderr, "[line %d] Warning: no nserver/nscache configured, socks may run very slow\n", linenum);

View File

@ -417,6 +417,10 @@ for(;;){
c = *se;
*se = 0;
}
if(param->hostname && (!*param->hostname || isnumber(param->hostname[strlen((char *)param->hostname) - 1]))){
free(param->hostname);
param->hostname = NULL;
}
if(!param->hostname){
if(parsehostname((char *)sb, param, 80)) RETURN(100);
}

View File

@ -456,12 +456,12 @@ int MODULEMAINFUNC (int argc, char** argv){
else if(argv[i][3] == 'i') getip46(46, (unsigned char *)argv[i]+3, (struct sockaddr *)&srv.intNat);
else getip46(46, (unsigned char *)argv[i]+2, (struct sockaddr *)&srv.extNat);
break;
#ifdef __linux__
case 'n':
#ifdef __linux__
if(argv[i][2] == 'i') { if(srv.inetns) free(srv.inetns); srv.inetns = strdup(argv[i] + 3); }
else if(argv[i][2] == 'e') { if(srv.onetns) free(srv.onetns); srv.onetns = strdup(argv[i] + 3); }
break;
#endif
break;
case 'p':
*SAPORT(&srv.intsa) = htons(atoi(argv[i]+2));
break;

View File

@ -111,6 +111,11 @@ int udpsockmap(struct clientparam *param, int timeo)
memcmp(SAADDR(&sin), SAADDR(&param->sincr), SAADDRLEN(&sin)))
continue;
if (firstpacket) {
if (!SAISNULL(&param->req) && *SAPORT(&param->req) &&
SAADDRLEN(&param->req) == SAADDRLEN(&sin) &&
!memcmp(SAADDR(&param->req), SAADDR(&sin), SAADDRLEN(&param->req)) &&
memcmp(SAPORT(&param->req), SAPORT(&sin), 2))
continue;
param->sincr = sin;
firstpacket = 0;
} else if (memcmp(SAPORT(&sin), SAPORT(&param->sincr), 2)) {
@ -184,13 +189,6 @@ int udpsockmap(struct clientparam *param, int timeo)
memcmp(SAPORT(&from), SAPORT(&param->sinsr), 2))
continue;
}
} else {
if (!SAISNULL(&param->req) && *SAPORT(&param->req)) {
if (SAADDRLEN(&from) != SAADDRLEN(&param->req) ||
memcmp(SAADDR(&from), SAADDR(&param->req), SAADDRLEN(&from)) ||
memcmp(SAPORT(&from), SAPORT(&param->req), 2))
continue;
}
}
param->statssrv64 += len;
param->nreads++;