Changeset 88


Ignore:
Timestamp:
05/29/09 17:29:08 (12 years ago)
Author:
smurzch2
Message:

Extend the Uniq= parameter to accept many connections from the same IP.

Based on a patch from merek.

  • Uniq = 1 only one connection per user,
  • Uniq = 2 set user only to fake if source ip is different (e.g. for newcamd clients with different CAID's -> Ports)
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Distribution/doc/oscam-user.txt

    r41 r88  
    88User          = username. muss gesetzt sein !
    99Pwd           = passwort. muss gesetzt sein !
    10 Uniq          = uniq kann 0 oder 1 sein, wobei 1 bedeutet, dass dieser benutzer
     10Uniq          = uniq kann 0, 1 oder 2 sein, wobei 1 bedeutet, dass dieser benutzer
    1111                sich nicht zweimal zur gleichen zeit anmelden kann.
    1212                dieser parameter ist optional (default: Uniq=0)
     13                uniq=2: same IP is OK
    1314MonLevel      = individuelle einstellung des zugangs zur monitor-funktion.
    1415                dieser wert ueberschreibt die standard-einstellung
  • trunk/oscam.c

    r71 r88  
    10411041}
    10421042
    1043 static void cs_fake_client(char *usr)
    1044 {
    1045   int i;
    1046   for (i=cdiff+1; i<CS_MAXPID; i++)
    1047     if ((client[i].pid) && (client[i].typ=='c') &&
    1048         (!client[i].dup) && (!strcmp(client[i].usr, usr)))
    1049     {
    1050       client[i].dup=1;
    1051       client[i].au=(-1);
    1052       cs_log("client %d duplicate user '%s', set to fake", i-cdiff, usr);
     1043static void cs_fake_client(char *usr, int uniq, in_addr_t ip)
     1044{
     1045    /* - Uniq = 1: only one connection per user
     1046     * - Uniq = 2: set user only to fake if source ip is different (e.g. for
     1047     *             newcamd clients with different CAID's -> Ports)
     1048    */
     1049
     1050    int i;
     1051
     1052    for (i=cdiff+1; i<CS_MAXPID; i++) {
     1053        if (client[i].pid
     1054                && (client[i].typ == 'c')
     1055                && !client[i].dup
     1056                && !strcmp(client[i].usr, usr)
     1057                && ((uniq == 1)  || (client[i].ip != ip)))
     1058        {
     1059            client[cs_idx].dup = 1;
     1060            client[cs_idx].au = -1;
     1061            cs_log("client(%d) duplicate user '%s' from %s set to fake (uniq=%d)", cs_idx-cdiff, usr, cs_inet_ntoa(ip), uniq);
     1062            break;
     1063        }
    10531064    }
    10541065}
     
    10931104          memcpy(&client[cs_idx].ctab, &account->ctab, sizeof(client[cs_idx].ctab));
    10941105          if (account->uniq)
    1095             cs_fake_client(account->usr);
     1106            cs_fake_client(account->usr, account->uniq, client[cs_idx].ip);
    10961107          client[cs_idx].ftab  = account->ftab;   // IDENT filter
    10971108          client[cs_idx].cltab = account->cltab;  // CLASS filter
Note: See TracChangeset for help on using the changeset viewer.