Advertisement
Guest User

Untitled

a guest
Oct 12th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.69 KB | None | 0 0
  1. diff --git a/module-cccam.c b/module-cccam.c
  2. index 7a2d860..6ac91f1 100644
  3. --- a/module-cccam.c
  4. +++ b/module-cccam.c
  5. @@ -3753,7 +3753,7 @@ int32_t cc_srv_connect(struct s_client *cl)
  6.         { cs_log_dbg(D_CLIENT, "%s 2.1.x compatibility mode", getprefix()); }
  7.  
  8.     cs_log_dbg(D_TRACE, "ccc send cards %s", usr);
  9. -   if(!cc_srv_report_cards(cl))
  10. +   if(!cc_srv_report_cards(cl, 0))
  11.         { return -1; }
  12.     cs_ftime(&cc->ecm_time);
  13.  
  14. diff --git a/module-cccshare.c b/module-cccshare.c
  15. index 1dd953e..106c5f9 100644
  16. --- a/module-cccshare.c
  17. +++ b/module-cccshare.c
  18. @@ -350,6 +350,36 @@ static int32_t send_card_to_client(struct cc_card *card, struct s_client *cl)
  19.     return 1;
  20.  }
  21.  
  22. +static int32_t remove_card_to_client(struct cc_card *card, struct s_client *cl)
  23. +{
  24. +   if(!card || !card->id)
  25. +       { return 0; }
  26. +
  27. +   uint8_t buf[4];
  28. +   buf[0] = card->id >> 24;
  29. +   buf[1] = card->id >> 16;
  30. +   buf[2] = card->id >> 8;
  31. +   buf[3] = card->id & 0xFF;
  32. +
  33. +   struct s_clientmsg *clientmsg;
  34. +   struct cc_data *cc = cl->cc;
  35. +   if(cc && cl->typ == 'c' && !cl->kill && get_module(cl)->num == R_CCCAM)  //CCCam-Client!
  36. +   {
  37. +       if(card_valid_for_client(cl, card))
  38. +       {
  39. +           if(cs_malloc(&clientmsg, sizeof(struct s_clientmsg)))
  40. +           {
  41. +               memcpy(clientmsg->msg, buf, sizeof(buf));
  42. +               clientmsg->len = sizeof(buf);
  43. +               clientmsg->cmd = MSG_CARD_REMOVED;
  44. +               add_job(cl, ACTION_CLIENT_SEND_MSG, clientmsg, sizeof(struct s_clientmsg));
  45. +               return 1;
  46. +           }
  47. +       }
  48. +   }
  49. +   return 0;
  50. +}
  51. +
  52.  int32_t send_card_to_all_clients(struct cc_card *card)
  53.  {
  54.     int32_t count = 0;
  55. @@ -1483,7 +1513,7 @@ void update_card_list(void)
  56.                   card_added_count, card_removed_count, card_dup_count, card_count);
  57.  }
  58.  
  59. -int32_t cc_srv_report_cards(struct s_client *cl)
  60. +int32_t cc_srv_report_cards(struct s_client *cl, int8_t hide)
  61.  {
  62.  
  63.     struct cc_card *card;
  64. @@ -1497,12 +1527,26 @@ int32_t cc_srv_report_cards(struct s_client *cl)
  65.             it = ll_iter_create(reported_carddatas_list[i]);
  66.             while(cl->cc && !cl->kill && (card = ll_iter_next(&it)))
  67.             {
  68. -               count += send_card_to_client(card, cl);
  69. +               if(hide)
  70. +               {
  71. +                   count += remove_card_to_client(card, cl);
  72. +               }
  73. +               else
  74. +               {
  75. +                   count += send_card_to_client(card, cl);
  76. +               }
  77.             }
  78.         }
  79.     }
  80.     cs_readunlock(__func__, &cc_shares_lock);
  81. -   cs_log_dbg(D_TRACE, "reported %d cards for %s", count, username(cl));
  82. +   if(hide)
  83. +   {
  84. +       cs_log_dbg(D_TRACE, "reported %d removed cards from %s", count, username(cl));
  85. +   }
  86. +   else
  87. +   {
  88. +       cs_log_dbg(D_TRACE, "reported %d cards for %s", count, username(cl));
  89. +   }
  90.  
  91.     return cl->cc && !cl->kill;
  92.  }
  93. diff --git a/module-cccshare.h b/module-cccshare.h
  94. index 0c2aa25..1925db4 100644
  95. --- a/module-cccshare.h
  96. +++ b/module-cccshare.h
  97. @@ -10,7 +10,7 @@
  98.  // In this file put functions that are shared between module-cccam.c and module-cccshare.c
  99.  
  100.  int32_t chk_ident(FTAB *ftab, struct cc_card *card);
  101. -int32_t cc_srv_report_cards(struct s_client *cl);
  102. +int32_t cc_srv_report_cards(struct s_client *cl, int8_t hide);
  103.  LLIST *get_cardlist(uint16_t caid, LLIST **list);
  104.  
  105.  void cc_free_card(struct cc_card *card);
  106. diff --git a/oscam-ecm.c b/oscam-ecm.c
  107. index d5fdab1..4d4e628 100644
  108. --- a/oscam-ecm.c
  109. +++ b/oscam-ecm.c
  110. @@ -660,6 +660,8 @@ void distribute_ea(struct s_ecm_answer *ea)
  111.     }
  112.  }
  113.  
  114. +extern int32_t cc_srv_report_cards(struct s_client *cl, int8_t hide);
  115. +
  116.  int32_t send_dcw(struct s_client *client, ECM_REQUEST *er)
  117.  {
  118.     if(!check_client(client) || client->typ != 'c')
  119. @@ -945,6 +947,7 @@ int32_t send_dcw(struct s_client *client, ECM_REQUEST *er)
  120.             {
  121.                 client->account->acosc_penalty_active = 0;
  122.                 client->account->acosc_penalty_until = 0;
  123. +               cc_srv_report_cards(client, 0);
  124.             }
  125.  
  126.             if(client->account->acosc_penalty_active == 0 && max_active_sids > 0)
  127. @@ -1005,13 +1008,16 @@ int32_t send_dcw(struct s_client *client, ECM_REQUEST *er)
  128.                                 { cs_log("[zaplist] ACoSC for Client: %s  zap_limit reached: %i:%i(%s) penalty: 2(%s) BAN Client - Kill and set Client to failban list for %i sec.", username(client), client->account->acosc_user_zap_count, zap_limit, info5, info2, penalty_duration); }
  129.  
  130.                             cs_add_violation_acosc(client, client->account->usr, penalty_duration);
  131. -                           add_job(client, ACTION_CLIENT_KILL, NULL, 0);
  132. +                           //add_job(client, ACTION_CLIENT_KILL, NULL, 0);
  133. +
  134. +                           cc_srv_report_cards(client, 1);
  135. +
  136.                         }
  137.                         else
  138.                         {
  139.                             cs_log("[zaplist] ACoSC for Client: %s  %i:%i(%s) penalty: 2(%s) BAN Client - don't Ban dvbapi user only stop decoding", username(client), active_sid_count, max_active_sids, info1, info2);
  140.                         }
  141. -                       er->rc = E_DISABLED;
  142. +                       //er->rc = E_DISABLED;
  143.                         break;
  144.                     case 3: // delay
  145.                         if(client->account->acosc_penalty_active == 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement