Changeset 5237 for trunk/oscam.c
- Timestamp:
- 05/15/11 12:48:43 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/oscam.c
r5233 r5237 14 14 extern void cs_statistics(struct s_client * client); 15 15 extern int32_t ICC_Async_Close (struct s_reader *reader); 16 static void cs_fake_client(struct s_client *client, char *usr, int32_t uniq, in_addr_t ip); 16 17 17 18 /***************************************************************************** … … 39 40 pthread_mutex_t system_lock; 40 41 pthread_mutex_t clientlist_lock; 42 pthread_mutex_t fakeuser_lock; 41 43 pthread_key_t getclient; 42 44 … … 677 679 // this is very important - do not remove 678 680 if (cl->typ != 's') { 679 if(cl->typ != 'i')cs_log("thread %8X ended!", pthread_self());681 cs_log("thread %8X ended!", pthread_self()); 680 682 #ifdef NO_PTHREAD_CLEANUP_PUSH 681 683 cleanup_thread(cl); … … 744 746 cl->cwlastresptimes[i] = 0; 745 747 cl->cwlastresptimes_last = 0; 746 748 if (account->uniq) 749 cs_fake_client(cl, account->usr, (account->uniq == 1 || account->uniq == 2)?account->uniq+2:account->uniq, cl->ip); 747 750 #ifdef CS_ANTICASC 748 751 cl->ac_limit = (account->ac_users * 100 + 80) * cfg.ac_stime; … … 931 934 } 932 935 933 pthread_mutex_init(&gethostbyname_lock, NULL); 934 pthread_mutex_init(&get_cw_lock, NULL); 935 pthread_mutex_init(&system_lock, NULL); 936 pthread_mutex_init(&clientlist_lock, NULL); 937 pthread_mutex_init(&sc8in1_lock, NULL); 936 int8_t ok = 1; 937 if(pthread_mutex_init(&gethostbyname_lock, NULL)) ok = 0; 938 if(pthread_mutex_init(&get_cw_lock, NULL)) ok = 0; 939 if(pthread_mutex_init(&system_lock, NULL)) ok = 0; 940 if(pthread_mutex_init(&clientlist_lock, NULL)) ok = 0; 941 if(pthread_mutex_init(&fakeuser_lock, NULL)) ok = 0; 942 if(pthread_mutex_init(&sc8in1_lock, NULL)) ok = 0; 943 if(!ok){ 944 fprintf(stderr, "Could not init locks, exiting..."); 945 exit(1); 946 } 938 947 939 948 #ifdef COOL … … 1360 1369 1361 1370 struct s_client *cl; 1371 struct s_auth *account; 1372 pthread_mutex_lock(&fakeuser_lock); 1362 1373 for (cl=first_client->next; cl ; cl=cl->next) 1363 1374 { 1364 if (cl != client && (cl->typ == 'c') && !cl->dup && !strcmp(cl->account->usr, usr) 1375 account = cl->account; 1376 if (cl != client && (cl->typ == 'c') && !cl->dup && account && !strcmp(account->usr, usr) 1365 1377 && (uniq < 5) && ((uniq % 2) || (cl->ip != ip))) 1366 1378 { … … 1389 1401 cs_add_violation(ip); 1390 1402 } 1391 if (cfg.dropdups) 1403 if (cfg.dropdups){ 1404 pthread_mutex_unlock(&fakeuser_lock); // we need to unlock here as cs_disconnect_client kills the current thread! 1392 1405 cs_disconnect_client(client); 1406 } 1393 1407 break; 1394 1408 } 1395 1396 } 1397 } 1398 1409 } 1410 } 1411 pthread_mutex_unlock(&fakeuser_lock); 1399 1412 } 1400 1413 … … 1444 1457 } 1445 1458 1459 client->monlvl=account->monlvl; 1460 client->account = account; 1446 1461 if (!rc) 1447 1462 { … … 1480 1495 } 1481 1496 } 1482 client->monlvl=account->monlvl;1483 client->account = account;1484 1497 case -1: // anonymous grant access 1485 1498 if (rc)
Note:
See TracChangeset
for help on using the changeset viewer.