Changeset 9567


Ignore:
Timestamp:
Mar 14, 2014, 10:56:45 PM (6 years ago)
Author:
Eggy123
Message:

gbx: Fix auth function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/module-gbox.c

    r9566 r9567  
    474474    uint16_t gbox_id = gbox_convert_password_to_id(gbox_password);
    475475    struct s_client *cl = switch_client_proxy(cli, gbox_id);
    476     if (cl->gbox)
     476
     477    if(cl->typ == 'p' && cl->gbox && cl->reader)
    477478    {
    478479        struct gbox_peer *peer = cl->gbox;
    479         if (!gbox_compare_pw(&peer->gbox.password[0],gbox_password))
    480             { return -1; }
    481     }
    482     if(cl->typ == 'p' && cl->gbox && cl->reader)
    483     {
    484         cli->crypted = 1; //display as crypted
    485         cli->gbox = cl->gbox; //point to the same gbox as proxy
    486         cli->reader = cl->reader; //point to the same reader as proxy
    487         cli->gbox_peer_id = cl->gbox_peer_id; //signal authenticated
    488 
    489480        struct s_auth *account = get_account_by_name(gbox_username(cl));
    490         if(account)
    491         {
     481
     482        if (gbox_compare_pw(&peer->gbox.password[0],gbox_password) && account)
     483        {
     484            cli->crypted = 1; //display as crypted
     485            cli->gbox = cl->gbox; //point to the same gbox as proxy
     486            cli->reader = cl->reader; //point to the same reader as proxy
     487            cli->gbox_peer_id = cl->gbox_peer_id; //signal authenticated
    492488            gbox_disconnect_double_peers(cli);
    493489            cs_auth_client(cli, account, NULL);
     
    912908            {
    913909                if (gbox_auth_client(cli, &data[6]) < 0)
    914                     { return -1; }
     910                {
     911                    cs_debug_mask(D_READER, "gbox: Authentication failed. Please check user in oscam.server and oscam.user");
     912                    return -1;
     913                }
    915914                //NEEDFIX: Pretty sure this should not be done here
    916915                gbox_local_cards(cli); 
Note: See TracChangeset for help on using the changeset viewer.