Changeset 3403 for trunk/module-camd33.c
- Timestamp:
- 10/08/10 09:23:56 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-camd33.c
r3402 r3403 7 7 { 8 8 int l; 9 if (!c lient[cs_idx].pfd) return(-1);9 if (!cur_client()->pfd) return(-1); 10 10 l=boundary(4, ml); 11 11 memset(buf+ml, 0, l-ml); 12 12 cs_ddump(buf, l, "send %d bytes to client", l); 13 if (c lient[cs_idx].crypted)13 if (cur_client()->crypted) 14 14 aes_encrypt(buf, l); 15 return(send(c lient[cs_idx].pfd, buf, l, 0));15 return(send(cur_client()->pfd, buf, l, 0)); 16 16 } 17 17 … … 34 34 int au; 35 35 uchar mbuf[20]; 36 au=c lient[cs_idx].au;36 au=cur_client()->au; 37 37 if ((au<0) || (au>CS_MAXREADER)) return; // TODO 38 38 if (reader[au].hexserial[0]) … … 56 56 uchar mbuf[1024]; 57 57 58 c lient[cs_idx].crypted=cfg->c33_crypted;59 if (c lient[cs_idx].crypted)58 cur_client()->crypted=cfg->c33_crypted; 59 if (cur_client()->crypted) 60 60 { 61 61 struct s_ip *p_ip; 62 for (p_ip=cfg->c33_plain; (p_ip) && (c lient[cs_idx].crypted); p_ip=p_ip->next)63 if ((c lient[cs_idx].ip>=p_ip->ip[0]) && (client[cs_idx].ip<=p_ip->ip[1]))64 c lient[cs_idx].crypted=0;65 } 66 if (c lient[cs_idx].crypted)62 for (p_ip=cfg->c33_plain; (p_ip) && (cur_client()->crypted); p_ip=p_ip->next) 63 if ((cur_client()->ip>=p_ip->ip[0]) && (cur_client()->ip<=p_ip->ip[1])) 64 cur_client()->crypted=0; 65 } 66 if (cur_client()->crypted) 67 67 aes_set_key((char *) cfg->c33_key); 68 68 … … 70 70 camd33_send(mbuf, 1); // send login-request 71 71 72 for (rc=0, c lient[cs_idx].camdbug[0]=0, mbuf[0]=1; (rc<2) && (mbuf[0]); rc++)72 for (rc=0, cur_client()->camdbug[0]=0, mbuf[0]=1; (rc<2) && (mbuf[0]); rc++) 73 73 { 74 74 i=process_input(mbuf, sizeof(mbuf), 1); … … 79 79 } 80 80 else 81 memcpy(c lient[cs_idx].camdbug+1, mbuf, client[cs_idx].camdbug[0]=i);81 memcpy(cur_client()->camdbug+1, mbuf, cur_client()->camdbug[0]=i); 82 82 } 83 83 for (rc=-1, account=cfg->account; (usr) && (account) && (rc<0); account=account->next) 84 84 if ((!strcmp((char *)usr, account->usr)) && (!strcmp((char *)pwd, account->pwd))) 85 rc=cs_auth_client( &client[cs_idx], account, NULL);85 rc=cs_auth_client(cur_client(), account, NULL); 86 86 if (!rc) 87 87 camd33_request_emm(); 88 88 else 89 89 { 90 if (rc<0) cs_auth_client( &client[cs_idx], 0, usr ? "invalid account" : "no user given");90 if (rc<0) cs_auth_client(cur_client(), 0, usr ? "invalid account" : "no user given"); 91 91 cs_exit(0); 92 92 } … … 97 97 int rc, w; 98 98 99 if (c lient[cs_idx].camdbug[0])100 { 101 memcpy(buf, c lient[cs_idx].camdbug+1, rc=client[cs_idx].camdbug[0]);102 c lient[cs_idx].camdbug[0]=0;99 if (cur_client()->camdbug[0]) 100 { 101 memcpy(buf, cur_client()->camdbug+1, rc=cur_client()->camdbug[0]); 102 cur_client()->camdbug[0]=0; 103 103 return(rc); 104 104 } … … 121 121 break; 122 122 default: 123 if (!memcmp(buf+1, c lient[cs_idx].usr, strlen(client[cs_idx].usr)))123 if (!memcmp(buf+1, cur_client()->usr, strlen(cur_client()->usr))) 124 124 { 125 cs_log("%s still alive", cs_inet_ntoa(c lient[cs_idx].ip));125 cs_log("%s still alive", cs_inet_ntoa(cur_client()->ip)); 126 126 rc=w=0; 127 127 } … … 159 159 if (!(er=get_ecmtask())) 160 160 return; 161 memcpy(c lient[cs_idx].req+(er->cpti*REQ_SIZE), buf+3, 4); // save pin161 memcpy(cur_client()->req+(er->cpti*REQ_SIZE), buf+3, 4); // save pin 162 162 er->l=l-7; 163 163 er->caid=b2i(2, buf+1); 164 164 memcpy(er->ecm , buf+7, er->l); 165 get_cw( &client[cs_idx], er);165 get_cw(cur_client(), er); 166 166 } 167 167 … … 174 174 memcpy(epg.hexserial, buf+3, 4); 175 175 memcpy(epg.emm , buf+7, epg.l); 176 do_emm( &client[cs_idx], &epg);176 do_emm(cur_client(), &epg); 177 177 } 178 178
Note:
See TracChangeset
for help on using the changeset viewer.