Changeset 70 for trunk/module-camd35.c


Ignore:
Timestamp:
05/12/09 05:25:27 (12 years ago)
Author:
rorothetroll
Message:

csctapi/io_serial.c : fix the serial port read/write wait routine to use select instead of poll

This make them compatible with Mac OS X and now oscamd works on OS X. The same code off course
still works on linux and other unix platforms. I let that code ran for 24h before commiting this code.
If you have any issue let me know and I'llr evert to poll for non compatible machines.

all the others : fix all the warning due to sign difference (mostly uchar versus char). This make the code compile

with -Werror on the more strict version of gcc (which is the case on OS X). I also noticed that in a lot of places
the code use a buffer defined as an uchar * ... and use strings functions (strnXXXX) where some memcpy/memcmp .. function
would have been preferable as we're suposedly manipulation a binary buffer. Anyway I fixed all of them and it now compile
without any warning or error on linux and OS X (and also probably on all the other unices but we will have to try before
adding -Werror on the other platform).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/module-camd35.c

    r56 r70  
    4040  crc=(ucrc[0]<<24) | (ucrc[1]<<16) | (ucrc[2]<<8) | ucrc[3];
    4141  for (account=cfg->account; (account) && (!upwd[0]); account=account->next)
    42     if (crc==crc32(0L, MD5(account->usr, strlen(account->usr), NULL), 16))
     42    if (crc==crc32(0L, MD5((unsigned char *)account->usr, strlen(account->usr), NULL), 16))
    4343    {
    4444      memcpy(client[cs_idx].ucrc, ucrc, 4);
    45       strcpy(upwd, account->pwd);
    46       aes_set_key(MD5(upwd, strlen(upwd), NULL));
     45      strcpy((char *)upwd, account->pwd);
     46      aes_set_key((char *) MD5(upwd, strlen((char *)upwd), NULL));
    4747      rc=cs_auth_client(account, NULL);
    4848    }
     
    288288static void casc_set_account()
    289289{
    290   strcpy(upwd, reader[ridx].r_pwd);
    291   memcpy(client[cs_idx].ucrc, i2b(4, crc32(0L, MD5(reader[ridx].r_usr, strlen(reader[ridx].r_usr), NULL), 16)), 4);
    292   aes_set_key(MD5(upwd, strlen(upwd), NULL));
     290  strcpy((char *)upwd, reader[ridx].r_pwd);
     291  memcpy(client[cs_idx].ucrc, i2b(4, crc32(0L, MD5((unsigned char *)reader[ridx].r_usr, strlen(reader[ridx].r_usr), NULL), 16)), 4);
     292  aes_set_key((char *)MD5(upwd, strlen((char *)upwd), NULL));
    293293  client[cs_idx].crypted=1;
    294294}
     
    464464  buf[i]=0;
    465465
    466   if (!(ptr=strstr(buf, " -> "))) return(-1);
     466  if (!(ptr=(uchar *)strstr((char *)buf, " -> "))) return(-1);
    467467  ptr+=4;
    468   if (strstr(ptr, " decoded ")) return(-1); // skip "found"s
    469   if (!(ptr2=strchr(ptr, ' '))) return(-1); // corrupt
     468  if (strstr((char *)ptr, " decoded ")) return(-1); // skip "found"s
     469  if (!(ptr2=(uchar *)strchr((char *)ptr, ' '))) return(-1);    // corrupt
    470470  *ptr2=0;
    471471 
    472   for (i=0, ptr2=strtok(ptr, ":"); ptr2; i++, ptr2=strtok(NULL, ":"))
    473   {
    474     trim(ptr2);
     472  for (i=0, ptr2=(uchar *)strtok((char *)ptr, ":"); ptr2; i++, ptr2=(uchar *)strtok(NULL, ":"))
     473  {
     474    trim((char *)ptr2);
    475475    switch(i)
    476476    {
    477       case 0: *caid  =cs_atoi(ptr2, strlen(ptr2)>>1, 0); break;
    478       case 1: *provid=cs_atoi(ptr2, strlen(ptr2)>>1, 0); break;
    479       case 2: *srvid =cs_atoi(ptr2, strlen(ptr2)>>1, 0); break;
    480       case 3: idx    =cs_atoi(ptr2, strlen(ptr2)>>1, 0); break;
     477      case 0: *caid  =cs_atoi((char *)ptr2, strlen((char *)ptr2)>>1, 0); break;
     478      case 1: *provid=cs_atoi((char *)ptr2, strlen((char *)ptr2)>>1, 0); break;
     479      case 2: *srvid =cs_atoi((char *)ptr2, strlen((char *)ptr2)>>1, 0); break;
     480      case 3: idx    =cs_atoi((char *)ptr2, strlen((char *)ptr2)>>1, 0); break;
    481481    }
    482482    if (errno) return(-1);
Note: See TracChangeset for help on using the changeset viewer.