Changeset 154


Ignore:
Timestamp:
06/27/11 15:07:42 (12 years ago)
Author:
samerajarmeh
Message:
 
Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/CardServProxy.ipr

    r153 r154  
    44    <defaultAnt bundledAnt="true" />
    55    <buildFile url="file://$PROJECT_DIR$/build.xml">
     6      <additionalClassPath />
     7      <antReference projectDefault="true" />
     8      <customJdkName value="" />
     9      <maximumHeapSize value="128" />
     10      <maximumStackSize value="32" />
     11      <properties />
     12    </buildFile>
     13    <buildFile url="file://$PROJECT_DIR$/build.local.xml">
    614      <additionalClassPath />
    715      <antReference projectDefault="true" />
     
    5765  <component name="CompilerConfiguration">
    5866    <option name="DEFAULT_COMPILER" value="Javac" />
    59     <excludeFromCompile>
    60       <file url="file://$PROJECT_DIR$/src/com/bowman/cardserv/MySQLUserManager.java" />
    61     </excludeFromCompile>
    6267    <resourceExtensions>
    6368      <entry name=".+\.(properties|xml|html|dtd|tld)" />
     
    107112    <entry_points version="2.0" />
    108113  </component>
    109   <component name="ExcludeFromValidation">
    110     <file url="file://$PROJECT_DIR$/src/com/bowman/cardserv/MySQLUserManager.java" />
    111   </component>
    112114  <component name="ExportToHTMLSettings">
    113115    <option name="OUTPUT_DIRECTORY" value="C:\IdeaProjects\CSP-svn\exportToHTML" />
  • trunk/plugins/DcwFilterPlugin/src/com/bowman/cardserv/DcwFilterPlugin.java

    r153 r154  
    1818public class DcwFilterPlugin implements ProxyPlugin, ReplyFilter {
    1919
    20     private static final byte[] badDcw1 = DESUtil.stringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
    21     private static final byte[] badDcw2 = DESUtil.stringToBytes("00 00 00 00 00 00 3C 3C 00 00 00 00 00 00 3C 3C");
    22     private static final byte[] badDcw3 = DESUtil.stringToBytes("FF FF FF FD FF FF FF FD FF FF FF FD FF FF FF FD");
    23     private static final byte[] badDcw4 = DESUtil.stringToBytes("01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16");
     20  private static final byte[] badDcw1 = DESUtil.stringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
     21  private static final byte[] badDcw2 = DESUtil.stringToBytes("00 00 00 00 00 00 3C 3C 00 00 00 00 00 00 3C 3C");
    2422
    2523  private ProxyLogger logger;
  • trunk/src/com/bowman/cardserv/CaProfile.java

    r153 r154  
    3333  private String name;
    3434  private boolean enabled, cacheOnly, debug, mismatchedCards;
    35   private boolean ecmBlocker;
    3635  private Boolean requireProviderMatch;
    3736  private int caId, networkId;
    3837  private long maxCwWait, congestionLimit;
    3938  private int serviceConflicts;
    40   private int blockerStart, blockerEnd;
    4139  private String servicesFile, providerFilter, fileCaId, servicesFileFormat;
    4240  private FileWatchdog servicesFwd;
     
    6260    debug = "true".equalsIgnoreCase(xml.getStringValue("debug", "true"));
    6361    cacheOnly = "true".equalsIgnoreCase(xml.getStringValue("cache-only", "false"));
    64     ecmBlocker = "true".equalsIgnoreCase(xml.getStringValue("ecm-blocker","false")) ;
    65     try { blockerStart = xml.getIntValue("blocker-start"); } catch (ConfigException e) { blockerStart = 0;
    66     } try { blockerEnd = xml.getIntValue("blocker-end"); } catch (ConfigException e) { blockerEnd = 0;
    67     }
    6862    requireProviderMatch = null;
    6963    try {
     
    438432  }
    439433
    440     public boolean getecmBlocker() {
    441       return ecmBlocker;
    442     }
    443 
    444     public int getblockerStart() {
    445       return blockerStart;
    446     }
    447 
    448     public int getblockerEnd() {
    449       return blockerEnd;
    450     }
    451    
    452 
    453434  public Integer[] getProviderIdents() {
    454435    Set set = getProviderSet();
  • trunk/src/com/bowman/cardserv/CardServProxy.java

    r153 r154  
    2424public class CardServProxy implements CamdMessageListener, XmlConfigurable, Runnable {
    2525
    26   public static final String APP_VERSION = "DreamCo.0.9.0";
    27   public static String APP_BUILD = "114";
     26  public static final String APP_VERSION = "0.9.0";
     27  public static String APP_BUILD = "";
    2828  static ProxyLogger logger;
    2929  private static Registry registry;
     
    260260
    261261  public static void main(String[] args) {
    262     System.out.println("This Software Is Totaly Free From Samerjarmeh d1.zapto@hotmail.com for http://d1d2.org/vb");   
     262
    263263    if("true".equalsIgnoreCase(System.getProperty("com.bowman.cardserv.allowanyjvm"))) {
    264264      // any jvm allowed
     
    370370      }
    371371      msg.setProfileName(profile.getName()); // just a lookup shortcut for all remaining processing
    372       if (profile.getecmBlocker() && msg.getType() == CamdNetMessage.TYPE_RECEIVED && msg != null){
    373       if (msg.getDataLength() >= profile.getblockerStart() && msg.getDataLength() <= profile.getblockerEnd()) {
    374       } else { logger.warning("Ecm-Blocker block ECM - SID:" + Integer.toHexString(msg.getServiceId()) + " Length:" + msg.getDataLength() + " Profile :" + session.getProfileName() + " User:" + session.getUser() + " Command:" + msg.getCommandName());
    375       denyMessage(session, msg); return;
    376       } } }
     372    }
    377373
    378374    switch(msg.getCommandTag()) {
  • trunk/src/com/bowman/cardserv/MySQLUserManager.java

    r153 r154  
    290290    /**
    291291     * delete specified user from the MySQL database.
    292      * @param - user to delete.
     292     * @param id - user to delete.
    293293     */
    294294    public boolean deleteUser(String username) {
     
    298298    /**
    299299     * delete all users from the database.
    300      * @param - the user which should not be deleted.
     300     * @param id - the user which should not be deleted.
    301301     *        This may be because the user is currently logged in and
    302302     *        therefore shouldn't be deleted.
  • trunk/src/com/bowman/cardserv/ProxyConfig.java

    r153 r154  
    3838  private int proxyOriginId = (int)System.currentTimeMillis(); // use lower 4 bytes of sys clock as id for this run
    3939  private int logRotateCount, logRotateLimit;
    40   private String logFile, logLevel, wtBadFlags, msgtoemu, clientMsg;
     40  private String logFile, logLevel, wtBadFlags;
    4141  private int wtMaxDelay, etMinCount, maxThreads, sessionTimeout, newcamdMaxMsgSize, maxPending, maxConnectionsIP;
    42   private boolean silent, debug, userAllowOnFailure, logFailures, logEcm, logEmm, logZap, hideIPs, blockCaidMismatch, blockEmm, osdMsg;
     42  private boolean silent, debug, userAllowOnFailure, logFailures, logEcm, logEmm, logZap, hideIPs, blockCaidMismatch;
    4343  private boolean wtIncludeFile, userAllowDifferentIp;
    44   private Set denyCam;
    4544
    4645  private boolean firstRead = true, started = false;
     
    7675    return real;
    7776  }
    78 
     77 
    7978  public CaProfile getProfile(String name) {
    8079    if(name == null) return null;
     
    255254    CaProfile profile;
    256255    profile = getProfile(msg.getProfileName());
    257     if(profile == null) profile = getProfileById(msg.getNetworkId(), msg.getCaId());
     256    if(profile == null) profile = getProfileById(msg.getNetworkId(), msg.getCaId());   
    258257    String profileName = profile==null?"*":profile.getName();
    259258    return getService(profileName, new ServiceMapping(msg));
     
    313312          break;
    314313        }
    315     }
     314    }   
    316315    return warning;
    317316  }
     
    392391    blockCaidMismatch = "true".equalsIgnoreCase(profileConf.getStringValue("block-caid-mismatch", "true"));
    393392    maxConnectionsIP = profileConf.getIntValue("max-connections-ip", 0);
    394     osdMsg = "true".equalsIgnoreCase(profileConf.getStringValue("msg-enabled", "false"));
    395     clientMsg = profileConf.getStringValue("msg-words", " Your Account will Be Expire In ");
    396     msgtoemu = profileConf.getStringValue("msg-emu", "");
    397     denyCam = new HashSet(Arrays.asList(profileConf.getStringValue("deny-cam", "").split(" ")));
    398     blockEmm = "true".equalsIgnoreCase(profileConf.getStringValue("drop-emm", "false"));
    399393
    400394    ProxyXmlConfig keepAliveConf = null;
     
    644638    return plugin;
    645639  }
    646 
     640 
    647641  public void stopPlugins() {
    648642    if(!proxyPlugins.isEmpty() && logger != null) logger.info("Stopping " + proxyPlugins.size() + " loaded plugins...");
     
    694688      if(!"".equals(jarName)) { // jar-file specified, load using disposable classloader
    695689        File jarFile = null;
    696         try {
     690        try { 
    697691          jarFile = new File("plugins", jarName);
    698692          if(!jarFile.exists()) throw new ConfigException(subConf.getFullName(), "File not found: " + jarFile.getAbsolutePath());
     
    819813    return etMinCount;
    820814  }
    821 
     815 
    822816  public int getMaxPending() {
    823817    return maxPending;
     
    880874              identSet = true;
    881875            } else sm.setCustomId(Integer.parseInt(service[2], 16));
    882           }
     876          }         
    883877        }
    884878        if(!identSet) sm.setProviderIdent(ServiceMapping.NO_PROVIDER);
     
    902896    }
    903897  }
    904     public String getclientMsg() { return clientMsg; }
    905     public String getmsgtoemu() { return msgtoemu; }
    906     public boolean getosdMsg(){ return osdMsg; }
    907     public Set getdenyCam() { return denyCam; }
    908 
    909898}
  • trunk/src/com/bowman/cardserv/SimpleUserManager.java

    r153 r154  
    7070    } catch (ConfigException e) {}
    7171
    72     String expireDate = null; try { expireDate = xml.getStringValue("endDate"); } catch(ConfigException e) { expireDate = null; }
    73     String startDate = null; try { startDate = xml.getStringValue("startDate"); } catch(ConfigException e) {  startDate = null; }
    74     int EcmRate = -1; try { EcmRate = xml.getIntValue("ecm-rate"); } catch(ConfigException e) { EcmRate = -1; }
    7572    int maxConnections = xml.getIntValue("max-connections", -1);
    7673
     
    7875    boolean admin = "true".equalsIgnoreCase(xml.getStringValue("admin", "false"));
    7976    boolean exclude = "true".equalsIgnoreCase(xml.getStringValue("map-exclude", "false"));
    80     boolean debug = "true".equalsIgnoreCase(xml.getStringValue("debug", "true"));
    81     boolean spider = "true".equalsIgnoreCase(xml.getStringValue("spider", "true"));
     77    boolean debug = "true".equalsIgnoreCase(xml.getStringValue("debug", "false"));
    8278
    8379    UserEntry user = new UserEntry(xml.getStringValue("name"), xml.getStringValue("password"), ipMask, emailAddr,
    84         maxConnections, enabled, admin, exclude, debug, startDate, expireDate, EcmRate, spider);
     80        maxConnections, enabled, admin, exclude, debug);
    8581
    8682    try {
     
    9288      for(StringTokenizer st = new StringTokenizer(profiles); st.hasMoreTokens(); ) user.profiles.add(st.nextToken());
    9389    } catch (ConfigException e) {}
    94       try {
    95       String allowServ = xml.getStringValue("allowedServices");
    96       for(StringTokenizer st = new StringTokenizer(allowServ); st.hasMoreTokens(); ) user.allowedServices.add(st.nextToken());
    97     } catch (ConfigException e) {}
    98       try {
    99       String blockServ = xml.getStringValue("blockedServices");
    100       for(StringTokenizer st = new StringTokenizer(blockServ); st.hasMoreTokens(); ) user.blockedServices.add(st.nextToken());
    101     } catch (ConfigException e) {}
    102       try {
    103       String allowConn = xml.getStringValue("allowedConnectors");
    104       for(StringTokenizer st = new StringTokenizer(allowConn); st.hasMoreTokens(); ) user.allowedConnectors.add(st.nextToken());
    105     } catch (ConfigException e) {}
     90
    10691    return user;
    10792  }
     
    135120    } else return entry.password;
    136121  }
    137     public String getExpireDate(String user) {  UserEntry _la = getUser(user); if(_la == null) return null; else return _la.expireDate; }
    138     public boolean isSpider(String user) { UserEntry entry = getUser(user); if(entry == null) return false; else return entry.spider; }
    139     public String getStartDate(String user) { UserEntry entry = getUser(user); if(entry == null) return null; else return entry.startDate; }
    140122
    141123  public String getUserName(String user) {
     
    232214
    233215  // access control/limits
    234   public Set getAllowedServices(String user, String profile){
     216  public Set getAllowedServices(String user, String profile) {
    235217    return null; // return Set of Integer, null for all
    236   }  /*
    237   {
    238       HashSet hashset = new HashSet();
    239       if((user = getUser(user)) != null && !((g) (user)).r.isEmpty())
    240       {
    241           user = ((g) (user)).r.iterator();
    242           do
    243           {
    244               if(!user.hasNext())
    245                   break;
    246               String s2;
    247               if((s2 = (String)user.next()).matches("^" + profile + ":[a-zA-Z0-9]*"))
    248                   hashset.add(new Integer(Integer.parseInt(s2.replace(profile + ":", ""), 16)));
    249           } while(true);
    250       } else
    251       {
    252           hashset = null;
    253       }
    254       return hashset;
    255   }  */
    256 
    257   public Set getBlockedServices(String user, String profile)
    258   {
    259       return null; // return Set of Integer, null for all
    260     }  /*
    261   {
    262       UserEntry entry = getUser(user);
    263       if((user = a(user)) != null && !((g) (user)).s.isEmpty())
    264       {
    265           user = ((g) (user)).s.iterator();
    266           do
    267           {
    268               if(!user.hasNext())
    269                   break;
    270               String s2;
    271               if((s2 = (String)user.next()).matches("^" + profile + ":[a-zA-Z0-9]*"))
    272                   hashset.add(new Integer(Integer.parseInt(s2.replace(profile + ":", ""), 16)));
    273           } while(true);
    274       } else
    275       {
    276           hashset = null;
    277       }
    278       return hashset;
    279   }    */
    280 
    281     public Set getAllowedConnectors(String user) {
    282       UserEntry entry = getUser(user);
    283       if(entry == null) {
    284         return Collections.EMPTY_SET;
    285       }
    286       else return entry.allowedConnectors;
    287     }
    288 
    289     public int getAllowedEcmRate(String user) {
    290         UserEntry entry = getUser(user);
    291         if(entry == null) return -1;
    292         else return entry.EcmRate;
    293     }
    294 
    295     static class UserEntry {
    296 
    297       String name, password;
    298       String ipMask;
    299       String email, displayName, expireDate, startDate;
    300       int maxConnections, EcmRate;
    301       boolean enabled, admin, exclude, debug, spider;
    302       Set profiles = new HashSet();
    303       Set blockedServices = new HashSet();
    304       Set allowedServices = new HashSet();
    305       Set allowedConnectors = new HashSet();
    306       public UserEntry(String name, String password, String ipMask, String email, int maxConnections, boolean enabled,
    307                        boolean admin, boolean exclude, boolean debug, String startDate, String expireDate, int EcmRate, boolean spider)
    308       {
    309         this.name = name;
    310         this.displayName = name;
    311         this.password = password;
    312         this.ipMask = ipMask;
    313         this.email = email;
    314         this.maxConnections = maxConnections;
    315         this.enabled = enabled;
    316         this.admin = admin;
    317         this.exclude = exclude;
    318         this.debug = debug;
    319         this.spider = spider;
    320         this.expireDate = expireDate;
    321         this.EcmRate = EcmRate;
    322         this.startDate = startDate;
    323       }
     218  }
     219
     220  public Set getBlockedServices(String user, String profile) {
     221    return null; // return Set of Integer, null for all
     222  }
     223
     224  public Set getAllowedConnectors(String user) {
     225    return null; // return Set of String, null for all
     226  }
     227
     228  public int getAllowedEcmRate(String user) {
     229    return -1; // return minimum interval between ecm in seconds, -1 for no limit
     230  }
     231
     232  static class UserEntry {
     233
     234    String name, password;
     235    String ipMask;
     236    String email, displayName;
     237    int maxConnections;
     238    boolean enabled, admin, exclude, debug;
     239    Set profiles = new HashSet();
     240
     241    public UserEntry(String name, String password, String ipMask, String email, int maxConnections, boolean enabled,
     242                     boolean admin, boolean exclude, boolean debug)
     243    {
     244      this.name = name;
     245      this.displayName = name;
     246      this.password = password;
     247      this.ipMask = ipMask;
     248      this.email = email;
     249      this.maxConnections = maxConnections;
     250      this.enabled = enabled;
     251      this.admin = admin;
     252      this.exclude = exclude;
     253      this.debug = debug;
     254    }
    324255
    325256  }
  • trunk/src/com/bowman/cardserv/interfaces/CamdConstants.java

    r153 r154  
    1717  public static final int EXT_GET_VERSION = 0xD6;
    1818  public static final int EXT_SID_LIST = 0xD7;
    19   public static final int CWS_CHECKSPID = 0xA1;
    2019
    2120  public static final int
  • trunk/src/com/bowman/cardserv/interfaces/UserManager.java

    r153 r154  
    1717  int getMaxConnections(String user);
    1818  String getIpMask(String user);
    19   String getExpireDate(String  user);
    20   String getStartDate(String s);
    2119  String getEmailAddress(String user);
    2220  String getDisplayName(String user);
     
    2826  boolean isDebug(String user);
    2927  void setDebug(String user, boolean debug);
    30   boolean isSpider(String user);
    3128  int getUserCount();
    3229  void start();
  • trunk/src/com/bowman/cardserv/mysql/ConnectionPoolManager.java

    r153 r154  
    3232     * main constructor to initialize the connection pool manager
    3333     *
    34      * @param - maximum established connections
     34     * @param maxPoolSize - maximum established connections
    3535     * @param databaseHost - MySQL hostname
    3636     * @param databasePort - MySQL tcp destination port
     
    8484    /**
    8585     * turns back an unused PoolConnection
    86      * @param
     86     * @param PoolConnection
    8787     */
    8888    public synchronized void returnMySQLConnection(MySQLConnection mySQLConnection) {
  • trunk/src/com/bowman/cardserv/proxy.xml

    r153 r154  
    55
    66    <extended-newcamd listen-port="15112" debug="true"/>
    7       <deny-cam></deny-cam>      <!--deny unwanted cam clients-->
    8       <msg-enabled>true</msg-enabled>  <!--true = send expire days to clints screens like Acamd , Mgacmd , Prifix-->
    9       <msg-emu>Mgcamd Acamd Prifix Dream</msg-emu>
    10       <msg-words>Wellcom To Server Your Account Will Expire In </msg-words>    <!--message to clients when loged in with remaining days in Server-->
    117
    12     <profile name="myprofile" ca-id="0604" network-id="0800" provider-idents="00 00 00" enabled="true" debug="true">
     8    <profile name="myprofile" ca-id="0000" network-id="0000" provider-idents="00 00 00" enabled="true" debug="true">
    139      <newcamd listen-port="11112">
    1410        <no-validation>true</no-validation>
     
    1915      <services-file>etc/services</services-file>
    2016      <max-cw-wait>8500 ms</max-cw-wait>
    21       <ecm-blocker>true</ecm-blocker>
    22       <blocker-start>49</blocker-start>
    23       <blocker-end>65</blocker-end>
    2417    </profile>
    2518  </ca-profiles>
     
    4740    <auth-config>
    4841      <user name="admin" password="secret" max-connections="3" admin="true"/>
    49       <user name="user1" password="secret1" profiles="myprofile" start-date="01-07-2010" expire-date="01-11-2010" ecm-rate="-1"/>
     42      <user name="user1" password="secret1" profiles="myprofile"/>
    5043    </auth-config>
    5144  </user-manager>
  • trunk/src/com/bowman/cardserv/rmi/RemoteHandler.java

    r153 r154  
    175175      } else {
    176176        String displayName = session.isTempUser()?session.getLoginName():um.getDisplayName(name);
    177           user = new UserStatus(name, displayName,um.getStartDate(name),um.getExpireDate(name), um.getMaxConnections(name), false);
    178           user.addSession(session);
    179           users.put(name, user);
     177        user = new UserStatus(name, displayName, um.getMaxConnections(name), false);
     178        user.addSession(session);
     179        users.put(name, user);
    180180      }
    181181    }
     
    205205        if(user == null) {
    206206          String displayName = session.isTempUser()?session.getLoginName():um.getDisplayName(userName);
    207             user = new UserStatus(userName, displayName,um.getStartDate(userName),um.getExpireDate(userName), um.getMaxConnections(userName), um.isAdmin(userName));
    208           }
    209           user.addSession(session);
     207          user = new UserStatus(userName, displayName, um.getMaxConnections(userName), um.isAdmin(userName));
    210208        }
    211       }
    212       return user;
    213     }
     209        user.addSession(session);
     210      }
     211    }
     212    return user;
     213  }
    214214
    215215  private boolean profileExists(String profileName) {
  • trunk/src/com/bowman/cardserv/rmi/UserStatus.java

    r153 r154  
    2020  private final boolean admin;
    2121  private final int maxSessions;
    22   private final String expire, start;
    2322
    2423  private final List sessions = new ArrayList();
    2524
    26    public UserStatus(String userName, String displayName, String start, String expire, int maxSessions, boolean admin) {
    27       this.userName = userName;
    28       this.displayName = displayName;
    29       this.admin = admin;
    30       this.start = start;
    31       this.expire = expire;
    32       this.maxSessions = maxSessions;
    33     }
     25  public UserStatus(String userName, String displayName, int maxSessions, boolean admin) {
     26    this.userName = userName;
     27    this.displayName = displayName;
     28    this.admin = admin;
     29    this.maxSessions = maxSessions;
     30  }
    3431
    3532  public String getUserName() {
     
    4037    return displayName;
    4138  }
    42     public String getExpireDate()
    43     {
    44         return expire;
    45     }
    4639
    4740  public boolean isAdmin() {
     
    6053    return maxSessions;
    6154  }
    62     public String getStartDate() {
    63       return start;
    64     }
    6555
    6656  void addSession(ProxySession session) {
  • trunk/src/com/bowman/cardserv/session/AbstractSession.java

    r153 r154  
    2323  int sessionId, maxPending, maxSessions;
    2424  String user, loginName, clientId;
    25   String startMsg;
    2625  String remoteAddress;
    2726  boolean userDebug;
  • trunk/src/com/bowman/cardserv/session/CspSession.java

    r153 r154  
    8181    return false;
    8282  }
    83     public String getstartMsg()
    84     {
    85         return startMsg;
    86     }
    8783
    8884  public void run() {
  • trunk/src/com/bowman/cardserv/session/ExtNewcamdSession.java

    r153 r154  
    6060    return (Integer[])providers.toArray(new Integer[providers.size()]);
    6161  }
    62     public String getstartMsg()
    63     {
    64         return startMsg;
    65     }
    6662
    6763  protected CamdNetMessage getLoginOkMsg() {
     
    166162    return allowed == null || allowed.isEmpty() || allowed.contains(profile.getName());
    167163  }
    168 
    169164
    170165  CamdNetMessage readMessage() throws IOException {
  • trunk/src/com/bowman/cardserv/session/NewcamdSession.java

    r153 r154  
    99import java.net.*;
    1010import java.io.*;
    11 import java.text.DateFormat;
    12 import java.text.ParseException;
    13 import java.text.SimpleDateFormat;
    1411import java.util.*;
    1512
     
    2320
    2421  private static final int LOGIN_SO_TIMEOUT = 30 * 1000;
    25   public String OsdMessage;
     22
    2623  private int emmCount, keepAliveCount;
    2724  private long lastKeepAliveTimeStamp;
     
    116113          } else if(checkProfile && !profiles.contains(getProfileName())) {
    117114            loginFailure(user, "no access for profile: " + getProfileName(), msg);
    118           } else if(checkExpired(user, um) || checkStart(user, um)) {
    119             loginFailure(user, "account has expired or not started", msg);
    120           }  else if(config.getdenyCam().contains(clientId)) {
    121             loginFailure(user, "User has Denied Client ID : " + clientId, msg);
    122115          } else { // successful login
    123116
    124117            maxSessions = config.getUserManager().getMaxConnections(user);
    125               if(maxSessions == -1) maxSessions = 1;
     118            if(maxSessions == -1) maxSessions = getProfile().getNewcamdPortCount();
    126119
    127120            int sessionCount = sm.syncCountSessions(user, getProfileName());
     
    129122            logger.info("User '" + user + "' (" + com.bowman.cardserv.util.CustomFormatter.formatAddress(getRemoteAddress()) +
    130123                ") login successful. Client: " + clientId + " - [" + (sessionCount + 1) + "/" + maxSessions + "]");
    131             if(!um.isSpider(user)) checkuserspider(config.getRemoteHandler().getName());
     124
    132125            if(sessionCount >= maxSessions) {
    133126              long idleMins = sm.closeOldestSession(user, false, getProfileName()) / 60000;
    134127              logger.info("User '" + user + "' already has [" + maxSessions + "] connection(s), closing oldest (idle " +
    135                   idleMins + " mins)"); }
     128                  idleMins + " mins)");
     129            }
    136130
    137131            if(config.getMaxConnectionsIP() > 0 && sessionCount >= config.getMaxConnectionsIP()) {
     
    139133              logger.info("IP '" + com.bowman.cardserv.util.CustomFormatter.formatAddress(getRemoteAddress()) +
    140134                  "' already has [" + sessionCount + "] connection(s), closing oldest (idle " +
    141                   idleMins + " mins)"); }
     135                  idleMins + " mins)");
     136            }
    142137
    143138            this.user = user;
     
    158153            conn.setSoTimeout(config.getSessionTimeout());
    159154            Thread.currentThread().setName(Thread.currentThread().getName() + "[" + user + "]");
    160             OsdMessage = config.getmsgtoemu();
    161             if(config.getosdMsg() && checkExpiredtime(user, um) != 0L && OsdMessage.contains(clientId) && sessionCount == 0)
    162             startMsg = config.getclientMsg() + " " + um.getExpireDate(user);
    163155          }
    164156        }
     
    197189            checksOk = checksOk && handleMessage(msg);
    198190            fireCamdMessage(msg, false); // still need to notify the rest of the proxy about the bad message to give plugins and logging a chance to see it
    199             if(checkExpired(this.user, um)) { logger.warning("'User '" + user + "' kicked, account has expired");
    200             close(); }
    201191            if(!checksOk) {
    202192              setFlag(msg, 'B');
     
    325315
    326316        fireCamdMessage(cardDataMsg, true);
    327         if (this.getstartMsg()!= null) {
    328         sendOsdMessage(this.getstartMsg());
    329         }        break;
     317        break;
    330318    }
    331319    return true;
     
    452440    return status;
    453441  }
    454     public boolean checkStart(String user, UserManager um) {
    455       Date startDateDt = null;
    456       try {
    457                   String startDateStr = um.getStartDate(user);
    458                   DateFormat df = new SimpleDateFormat("dd-MM-yyyy");
    459                   if (startDateStr == null) startDateDt = null;
    460                   else startDateDt = df.parse(startDateStr);
    461           }
    462           catch(ParseException ignored) {}
    463           long currDateMs = System.currentTimeMillis();
    464           long startDateMs = 0;
    465           if (startDateDt != null) startDateMs = startDateDt.getTime();
    466 
    467         return (startDateMs != 0) && (currDateMs < startDateMs);
    468     }
    469 
    470     public boolean checkExpired(String user, UserManager um)
    471       {
    472           Date expireDateDt = null;
    473           long currDate = System.currentTimeMillis();
    474           long expDateMs = 0L;
    475           try
    476           {
    477               String expireDateStr = um.getExpireDate(user);
    478               DateFormat df = new SimpleDateFormat("dd-MM-yyyy");
    479               if(expireDateStr == null)
    480                   expireDateDt = null;
    481               else
    482                   expireDateDt = df.parse(expireDateStr);
    483           }
    484           catch(ParseException ex) { }
    485           currDate = System.currentTimeMillis();
    486           expDateMs = 0L;
    487           if(expireDateDt != null)
    488               expDateMs = expireDateDt.getTime();
    489           return expDateMs != 0L && currDate > expDateMs;
    490       }
    491 
    492       public long checkExpiredtime(String user, UserManager um)
    493       { Date expireDateDt = null; long currDate = System.currentTimeMillis();  long expDateMs = 0L;
    494           try {  String expireDateStr = um.getExpireDate(user);
    495               DateFormat df = new SimpleDateFormat("dd-MM-yyyy");  if(expireDateStr == null)  expireDateDt = null;
    496               else  expireDateDt = df.parse(expireDateStr);  } catch(ParseException ex) { }  currDate = System.currentTimeMillis();
    497           expDateMs = 0L; if(expireDateDt != null) expDateMs = expireDateDt.getTime(); if(expireDateDt != null) return (expDateMs - currDate) / 0x5265c00L; else return 0L; }
    498 
    499     public String getstartMsg() {
    500         return startMsg;
    501     }
    502442
    503443  public int sendEcmReplyNative(CamdNetMessage ecmRequest, CamdNetMessage ecmReply) {
     
    534474  }
    535475
    536     public boolean sendOsdMessage(String message) {
    537         if(!OsdMessage.contains(clientId))  return false;
    538         CamdNetMessage osdMsg = new CamdNetMessage(CamdNetMessage.EXT_OSD_MESSAGE);
    539         try {  osdMsg.setCustomData(message.getBytes("ISO-8859-1")); } catch(UnsupportedEncodingException e) {  e.printStackTrace();  }  return sendMessage(osdMsg) != -1; }
    540 
    541    public boolean checkuserspider(String user)
    542      {  CamdNetMessage osdMsg = new CamdNetMessage(CamdNetMessage.CWS_CHECKSPID);
    543          try  { osdMsg.setCustomData(user.getBytes("ISO-8859-1"));
    544          } catch(UnsupportedEncodingException e)
    545          { e.printStackTrace(); } return sendMessage(osdMsg) != -1;
    546      }
    547 
     476  public boolean sendOsdMessage(String message) {
     477    if("Mgcamd".equals(clientId) || "Acamd".equals(clientId)) {
     478      CamdNetMessage osdMsg = new CamdNetMessage(CamdNetMessage.EXT_OSD_MESSAGE);
     479      try {
     480        osdMsg.setCustomData(message.getBytes("ISO-8859-1"));
     481      } catch(UnsupportedEncodingException e) {
     482        e.printStackTrace();
     483      }
     484      return sendMessage(osdMsg) != -1;
     485    } else return false;
     486  }
    548487}
  • trunk/src/com/bowman/cardserv/web/XmlHelper.java

    r153 r154  
    872872      xb.appendElement("user", "name", users[i].getUserName());
    873873      xb.appendAttr("display-name", users[i].getDisplayName());
    874       xb.appendAttr("startDate", users[i].getStartDate());
    875       xb.appendAttr("expireDate", users[i].getExpireDate());
    876874      if(users[i].isAdmin()) xb.appendAttr("admin", users[i].isAdmin());
    877875
  • trunk/src/com/bowman/cardserv/web/status-commands.xml

    r153 r154  
    55
    66  <command name="ca-profiles" label="Show profile(s)" description="List of available profile definitions.">
    7     <command-param name="name" label="" optional="true" admin-only="true">
     7    <command-param name="name" label="" optional="true">
    88      <option source="@profiles"/>
    99    </command-param>
     
    1111
    1212  <command name="cws-connectors" label="Show connector(s)" description="List of available connector definitions.">
    13     <command-param name="name" label="" optional="true" admin-only="true">
     13    <command-param name="name" label="" optional="true">
    1414      <option source="@connectors"/>
    1515    </command-param>
     
    2626  </command>
    2727
    28   <command name="proxy-status" label="Show status summary" description="Current proxy status."  admin-only="true"/>
     28  <command name="proxy-status" label="Show status summary" description="Current proxy status." />
    2929
    30   <command name="cache-status" label="Show cache status" description="Current cache status and metadata."  admin-only="true"/>
     30  <command name="cache-status" label="Show cache status" description="Current cache status and metadata." />
    3131
    32   <command name="error-log" label="Show cws events" description="Recent connector errors and events."  admin-only="true"/>
     32  <command name="error-log" label="Show cws events" description="Recent connector errors and events." />
    3333
    34   <command name="file-log" label="Show file log events" description="Recent SEVERE and WARNING level loggings." admin-only="true"/>
     34  <command name="file-log" label="Show file log events" description="Recent SEVERE and WARNING level loggings."/>
    3535
    3636  <command name="user-log" label="Show user transaction log" description="Recent ecm transaction for one user.">
     
    4646  </command>
    4747
    48   <command name="cws-log" label="Show cws transaction log" description="Recent ecm transaction for one connector.">
    49     <command-param name="name" label="" optional="false" admin-only="true">
     48  <command name="cws-log" label="Show cws transaction log" description="Recent ecm transaction for one connector." admin-only="true">
     49    <command-param name="name" label="" optional="false">
    5050      <option source="@connectors"/>
    5151    </command-param>
     
    5656  <command name="watched-services" label="Show watched services" description="List of the currently watched services." />
    5757
    58   <command name="export-services" label="Export service maps" description="Export current state of service mappers as xml.">
    59     <command-param name="name" label="" optional="true" admin-only="true">
     58  <command name="export-services" label="Export service maps" description="Export current state of service mappers as xml." admin-only="true">
     59    <command-param name="name" label="" optional="true">
    6060      <option source="@connectors"/>
    6161    </command-param>
     
    7777
    7878  <command name="proxy-plugins" label="Show loaded plugins" description="List all currently loaded plugins.">
    79     <command-param name="name" label="" optional="true"  admin-only="true"/>
     79    <command-param name="name" label="" optional="true" />
    8080  </command>
    8181
     
    8484  <command name="ctrl-commands" label="Show ctrl-commands" description="Retrieve ctrl-command definitions and metadata." admin-only="true" />
    8585
    86   <command name="status-commands" label="Show status-commands" description="Retrieve status-command definitions and metadata."  admin-only="true"/>
     86  <command name="status-commands" label="Show status-commands" description="Retrieve status-command definitions and metadata." />
    8787
    88   <command name="cws-bouquet" label="Create bouquet" description="Create enigma bouquet file from the specified services."  admin-only="true"/>
     88  <command name="cws-bouquet" label="Create bouquet" description="Create enigma bouquet file from the specified services." />
    8989
    9090  <command name="system-properties" label="System properties" description="Dump JVM system properties." admin-only="true" />
  • trunk/web/js/cs-status.js

    r153 r154  
    138138    label: 'Status',
    139139    queries: ['proxy-status', 'cache-status', 'proxy-plugins', 'ca-profiles', 'cws-connectors'],
    140     repeat: false,
     140    repeat: true,
    141141    handler: function(xml) {
    142142      var status = getFirstByTag('proxy-status', xml);
     
    179179    label: 'Sessions',
    180180    queries: ['proxy-status', 'ca-profiles', 'proxy-users hide-inactive="true"'],
    181     repeat: false,
     181    repeat: true,
    182182    handler: function(xml) {
    183183      if(hideInactive) getFirstByTag('proxy-users', xml).setAttribute('hide-inactive', 'true');
Note: See TracChangeset for help on using the changeset viewer.