Changeset 70 for trunk/module-newcamd.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-newcamd.c

    r66 r70  
    337337  // 1. Connect
    338338  //
    339   handle = network_tcp_connection_open(reader[ridx].device, reader[ridx].r_port);
     339  handle = network_tcp_connection_open((uint8 *)reader[ridx].device, reader[ridx].r_port);
    340340  if(handle < 0) return -1;
    341341 
     
    356356  buf[0] = MSG_CLIENT_2_SERVER_LOGIN;
    357357  buf[1] = 0;
    358   strcpy(buf+index, reader[ridx].r_usr);
     358  strcpy((char *)buf+index, reader[ridx].r_usr);
    359359  passwdcrypt = (uint8*)__md5_crypt(reader[ridx].r_pwd, "$1$abcdefgh$");
    360360  index += strlen(reader[ridx].r_usr)+1;
    361   strcpy(buf+index, passwdcrypt);
     361  strcpy((char *)buf+index, (const char *)passwdcrypt);
    362362
    363363  //cs_debug("login to server %s:%d user=%s, pwd=%s, len=%d", reader[ridx].device,
    364364  //          reader[ridx].r_port, reader[ridx].r_usr, reader[ridx].r_pwd,
    365365  //          index+strlen(passwdcrypt)+1);
    366   network_message_send(handle, 0, buf, index+strlen(passwdcrypt)+1, key,
     366  network_message_send(handle, 0, buf, index+strlen((char *)passwdcrypt)+1, key,
    367367                       COMMTYPE_CLIENT, 0x8888);
    368368
     
    387387  // 4. Send MSG_CARD_DATE_REQ
    388388  //
    389   key = des_login_key_get(reader[ridx].ncd_key, passwdcrypt, strlen(passwdcrypt));
     389  key = des_login_key_get(reader[ridx].ncd_key, passwdcrypt, strlen((char *)passwdcrypt));
    390390
    391391  network_cmd_no_data_send(handle, &reader[ridx].ncd_msgid, MSG_CARD_DATA_REQ,
     
    666666            }
    667667        usr=mbuf+5;
    668         pwd=usr+strlen(usr)+1;
     668        pwd=usr+strlen((char *)usr)+1;
    669669        //cs_debug("usr=%s,pwd=%s", usr, pwd);
    670670        }
     
    683683        {
    684684        cs_debug("account->usr=%s", account->usr);
    685         if (strcmp(usr, account->usr) == 0)
     685        if (strcmp((char *)usr, account->usr) == 0)
    686686            {
    687687            passwdcrypt = (uint8*)__md5_crypt(account->pwd, "$1$abcdefgh$");
    688688            cs_debug("account->pwd=%s", passwdcrypt);
    689             if (strcmp(pwd, passwdcrypt) == 0)
     689            if (strcmp((char *)pwd, (const char *)passwdcrypt) == 0)
    690690                {
    691691                client[cs_idx].crypted=1;
     
    751751        FILTER *pufilt = 0;
    752752
    753         key = des_login_key_get(cfg->ncd_key, passwdcrypt, strlen(passwdcrypt));
     753        key = des_login_key_get(cfg->ncd_key, passwdcrypt, strlen((char *)passwdcrypt));
    754754        memcpy(client[cs_idx].ncd_skey, key, 16);
    755755
Note: See TracChangeset for help on using the changeset viewer.