Changeset 154
- Timestamp:
- 06/27/11 15:07:42 (12 years ago)
- Location:
- trunk
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CardServProxy.ipr
r153 r154 4 4 <defaultAnt bundledAnt="true" /> 5 5 <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"> 6 14 <additionalClassPath /> 7 15 <antReference projectDefault="true" /> … … 57 65 <component name="CompilerConfiguration"> 58 66 <option name="DEFAULT_COMPILER" value="Javac" /> 59 <excludeFromCompile>60 <file url="file://$PROJECT_DIR$/src/com/bowman/cardserv/MySQLUserManager.java" />61 </excludeFromCompile>62 67 <resourceExtensions> 63 68 <entry name=".+\.(properties|xml|html|dtd|tld)" /> … … 107 112 <entry_points version="2.0" /> 108 113 </component> 109 <component name="ExcludeFromValidation">110 <file url="file://$PROJECT_DIR$/src/com/bowman/cardserv/MySQLUserManager.java" />111 </component>112 114 <component name="ExportToHTMLSettings"> 113 115 <option name="OUTPUT_DIRECTORY" value="C:\IdeaProjects\CSP-svn\exportToHTML" /> -
trunk/plugins/DcwFilterPlugin/src/com/bowman/cardserv/DcwFilterPlugin.java
r153 r154 18 18 public class DcwFilterPlugin implements ProxyPlugin, ReplyFilter { 19 19 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"); 24 22 25 23 private ProxyLogger logger; -
trunk/src/com/bowman/cardserv/CaProfile.java
r153 r154 33 33 private String name; 34 34 private boolean enabled, cacheOnly, debug, mismatchedCards; 35 private boolean ecmBlocker;36 35 private Boolean requireProviderMatch; 37 36 private int caId, networkId; 38 37 private long maxCwWait, congestionLimit; 39 38 private int serviceConflicts; 40 private int blockerStart, blockerEnd;41 39 private String servicesFile, providerFilter, fileCaId, servicesFileFormat; 42 40 private FileWatchdog servicesFwd; … … 62 60 debug = "true".equalsIgnoreCase(xml.getStringValue("debug", "true")); 63 61 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 }68 62 requireProviderMatch = null; 69 63 try { … … 438 432 } 439 433 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 453 434 public Integer[] getProviderIdents() { 454 435 Set set = getProviderSet(); -
trunk/src/com/bowman/cardserv/CardServProxy.java
r153 r154 24 24 public class CardServProxy implements CamdMessageListener, XmlConfigurable, Runnable { 25 25 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 = ""; 28 28 static ProxyLogger logger; 29 29 private static Registry registry; … … 260 260 261 261 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 263 263 if("true".equalsIgnoreCase(System.getProperty("com.bowman.cardserv.allowanyjvm"))) { 264 264 // any jvm allowed … … 370 370 } 371 371 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 } 377 373 378 374 switch(msg.getCommandTag()) { -
trunk/src/com/bowman/cardserv/MySQLUserManager.java
r153 r154 290 290 /** 291 291 * delete specified user from the MySQL database. 292 * @param - user to delete.292 * @param id - user to delete. 293 293 */ 294 294 public boolean deleteUser(String username) { … … 298 298 /** 299 299 * 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. 301 301 * This may be because the user is currently logged in and 302 302 * therefore shouldn't be deleted. -
trunk/src/com/bowman/cardserv/ProxyConfig.java
r153 r154 38 38 private int proxyOriginId = (int)System.currentTimeMillis(); // use lower 4 bytes of sys clock as id for this run 39 39 private int logRotateCount, logRotateLimit; 40 private String logFile, logLevel, wtBadFlags , msgtoemu, clientMsg;40 private String logFile, logLevel, wtBadFlags; 41 41 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; 43 43 private boolean wtIncludeFile, userAllowDifferentIp; 44 private Set denyCam;45 44 46 45 private boolean firstRead = true, started = false; … … 76 75 return real; 77 76 } 78 77 79 78 public CaProfile getProfile(String name) { 80 79 if(name == null) return null; … … 255 254 CaProfile profile; 256 255 profile = getProfile(msg.getProfileName()); 257 if(profile == null) profile = getProfileById(msg.getNetworkId(), msg.getCaId()); 256 if(profile == null) profile = getProfileById(msg.getNetworkId(), msg.getCaId()); 258 257 String profileName = profile==null?"*":profile.getName(); 259 258 return getService(profileName, new ServiceMapping(msg)); … … 313 312 break; 314 313 } 315 } 314 } 316 315 return warning; 317 316 } … … 392 391 blockCaidMismatch = "true".equalsIgnoreCase(profileConf.getStringValue("block-caid-mismatch", "true")); 393 392 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"));399 393 400 394 ProxyXmlConfig keepAliveConf = null; … … 644 638 return plugin; 645 639 } 646 640 647 641 public void stopPlugins() { 648 642 if(!proxyPlugins.isEmpty() && logger != null) logger.info("Stopping " + proxyPlugins.size() + " loaded plugins..."); … … 694 688 if(!"".equals(jarName)) { // jar-file specified, load using disposable classloader 695 689 File jarFile = null; 696 try { 690 try { 697 691 jarFile = new File("plugins", jarName); 698 692 if(!jarFile.exists()) throw new ConfigException(subConf.getFullName(), "File not found: " + jarFile.getAbsolutePath()); … … 819 813 return etMinCount; 820 814 } 821 815 822 816 public int getMaxPending() { 823 817 return maxPending; … … 880 874 identSet = true; 881 875 } else sm.setCustomId(Integer.parseInt(service[2], 16)); 882 } 876 } 883 877 } 884 878 if(!identSet) sm.setProviderIdent(ServiceMapping.NO_PROVIDER); … … 902 896 } 903 897 } 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 909 898 } -
trunk/src/com/bowman/cardserv/SimpleUserManager.java
r153 r154 70 70 } catch (ConfigException e) {} 71 71 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; }75 72 int maxConnections = xml.getIntValue("max-connections", -1); 76 73 … … 78 75 boolean admin = "true".equalsIgnoreCase(xml.getStringValue("admin", "false")); 79 76 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")); 82 78 83 79 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); 85 81 86 82 try { … … 92 88 for(StringTokenizer st = new StringTokenizer(profiles); st.hasMoreTokens(); ) user.profiles.add(st.nextToken()); 93 89 } 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 106 91 return user; 107 92 } … … 135 120 } else return entry.password; 136 121 } 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; }140 122 141 123 public String getUserName(String user) { … … 232 214 233 215 // access control/limits 234 public Set getAllowedServices(String user, String profile) {216 public Set getAllowedServices(String user, String profile) { 235 217 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 } 324 255 325 256 } -
trunk/src/com/bowman/cardserv/interfaces/CamdConstants.java
r153 r154 17 17 public static final int EXT_GET_VERSION = 0xD6; 18 18 public static final int EXT_SID_LIST = 0xD7; 19 public static final int CWS_CHECKSPID = 0xA1;20 19 21 20 public static final int -
trunk/src/com/bowman/cardserv/interfaces/UserManager.java
r153 r154 17 17 int getMaxConnections(String user); 18 18 String getIpMask(String user); 19 String getExpireDate(String user);20 String getStartDate(String s);21 19 String getEmailAddress(String user); 22 20 String getDisplayName(String user); … … 28 26 boolean isDebug(String user); 29 27 void setDebug(String user, boolean debug); 30 boolean isSpider(String user);31 28 int getUserCount(); 32 29 void start(); -
trunk/src/com/bowman/cardserv/mysql/ConnectionPoolManager.java
r153 r154 32 32 * main constructor to initialize the connection pool manager 33 33 * 34 * @param - maximum established connections34 * @param maxPoolSize - maximum established connections 35 35 * @param databaseHost - MySQL hostname 36 36 * @param databasePort - MySQL tcp destination port … … 84 84 /** 85 85 * turns back an unused PoolConnection 86 * @param 86 * @param PoolConnection 87 87 */ 88 88 public synchronized void returnMySQLConnection(MySQLConnection mySQLConnection) { -
trunk/src/com/bowman/cardserv/proxy.xml
r153 r154 5 5 6 6 <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-->11 7 12 <profile name="myprofile" ca-id="0 604" 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"> 13 9 <newcamd listen-port="11112"> 14 10 <no-validation>true</no-validation> … … 19 15 <services-file>etc/services</services-file> 20 16 <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>24 17 </profile> 25 18 </ca-profiles> … … 47 40 <auth-config> 48 41 <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"/> 50 43 </auth-config> 51 44 </user-manager> -
trunk/src/com/bowman/cardserv/rmi/RemoteHandler.java
r153 r154 175 175 } else { 176 176 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 179 177 user = new UserStatus(name, displayName, um.getMaxConnections(name), false); 178 user.addSession(session); 179 users.put(name, user); 180 180 } 181 181 } … … 205 205 if(user == null) { 206 206 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)); 210 208 } 211 } 212 return user; 213 } 209 user.addSession(session); 210 } 211 } 212 return user; 213 } 214 214 215 215 private boolean profileExists(String profileName) { -
trunk/src/com/bowman/cardserv/rmi/UserStatus.java
r153 r154 20 20 private final boolean admin; 21 21 private final int maxSessions; 22 private final String expire, start;23 22 24 23 private final List sessions = new ArrayList(); 25 24 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 } 34 31 35 32 public String getUserName() { … … 40 37 return displayName; 41 38 } 42 public String getExpireDate()43 {44 return expire;45 }46 39 47 40 public boolean isAdmin() { … … 60 53 return maxSessions; 61 54 } 62 public String getStartDate() {63 return start;64 }65 55 66 56 void addSession(ProxySession session) { -
trunk/src/com/bowman/cardserv/session/AbstractSession.java
r153 r154 23 23 int sessionId, maxPending, maxSessions; 24 24 String user, loginName, clientId; 25 String startMsg;26 25 String remoteAddress; 27 26 boolean userDebug; -
trunk/src/com/bowman/cardserv/session/CspSession.java
r153 r154 81 81 return false; 82 82 } 83 public String getstartMsg()84 {85 return startMsg;86 }87 83 88 84 public void run() { -
trunk/src/com/bowman/cardserv/session/ExtNewcamdSession.java
r153 r154 60 60 return (Integer[])providers.toArray(new Integer[providers.size()]); 61 61 } 62 public String getstartMsg()63 {64 return startMsg;65 }66 62 67 63 protected CamdNetMessage getLoginOkMsg() { … … 166 162 return allowed == null || allowed.isEmpty() || allowed.contains(profile.getName()); 167 163 } 168 169 164 170 165 CamdNetMessage readMessage() throws IOException { -
trunk/src/com/bowman/cardserv/session/NewcamdSession.java
r153 r154 9 9 import java.net.*; 10 10 import java.io.*; 11 import java.text.DateFormat;12 import java.text.ParseException;13 import java.text.SimpleDateFormat;14 11 import java.util.*; 15 12 … … 23 20 24 21 private static final int LOGIN_SO_TIMEOUT = 30 * 1000; 25 public String OsdMessage; 22 26 23 private int emmCount, keepAliveCount; 27 24 private long lastKeepAliveTimeStamp; … … 116 113 } else if(checkProfile && !profiles.contains(getProfileName())) { 117 114 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);122 115 } else { // successful login 123 116 124 117 maxSessions = config.getUserManager().getMaxConnections(user); 125 if(maxSessions == -1) maxSessions = 1;118 if(maxSessions == -1) maxSessions = getProfile().getNewcamdPortCount(); 126 119 127 120 int sessionCount = sm.syncCountSessions(user, getProfileName()); … … 129 122 logger.info("User '" + user + "' (" + com.bowman.cardserv.util.CustomFormatter.formatAddress(getRemoteAddress()) + 130 123 ") login successful. Client: " + clientId + " - [" + (sessionCount + 1) + "/" + maxSessions + "]"); 131 if(!um.isSpider(user)) checkuserspider(config.getRemoteHandler().getName()); 124 132 125 if(sessionCount >= maxSessions) { 133 126 long idleMins = sm.closeOldestSession(user, false, getProfileName()) / 60000; 134 127 logger.info("User '" + user + "' already has [" + maxSessions + "] connection(s), closing oldest (idle " + 135 idleMins + " mins)"); } 128 idleMins + " mins)"); 129 } 136 130 137 131 if(config.getMaxConnectionsIP() > 0 && sessionCount >= config.getMaxConnectionsIP()) { … … 139 133 logger.info("IP '" + com.bowman.cardserv.util.CustomFormatter.formatAddress(getRemoteAddress()) + 140 134 "' already has [" + sessionCount + "] connection(s), closing oldest (idle " + 141 idleMins + " mins)"); } 135 idleMins + " mins)"); 136 } 142 137 143 138 this.user = user; … … 158 153 conn.setSoTimeout(config.getSessionTimeout()); 159 154 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);163 155 } 164 156 } … … 197 189 checksOk = checksOk && handleMessage(msg); 198 190 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(); }201 191 if(!checksOk) { 202 192 setFlag(msg, 'B'); … … 325 315 326 316 fireCamdMessage(cardDataMsg, true); 327 if (this.getstartMsg()!= null) { 328 sendOsdMessage(this.getstartMsg()); 329 } break; 317 break; 330 318 } 331 319 return true; … … 452 440 return status; 453 441 } 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 try476 {477 String expireDateStr = um.getExpireDate(user);478 DateFormat df = new SimpleDateFormat("dd-MM-yyyy");479 if(expireDateStr == null)480 expireDateDt = null;481 else482 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 }502 442 503 443 public int sendEcmReplyNative(CamdNetMessage ecmRequest, CamdNetMessage ecmReply) { … … 534 474 } 535 475 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 } 548 487 } -
trunk/src/com/bowman/cardserv/web/XmlHelper.java
r153 r154 872 872 xb.appendElement("user", "name", users[i].getUserName()); 873 873 xb.appendAttr("display-name", users[i].getDisplayName()); 874 xb.appendAttr("startDate", users[i].getStartDate());875 xb.appendAttr("expireDate", users[i].getExpireDate());876 874 if(users[i].isAdmin()) xb.appendAttr("admin", users[i].isAdmin()); 877 875 -
trunk/src/com/bowman/cardserv/web/status-commands.xml
r153 r154 5 5 6 6 <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"> 8 8 <option source="@profiles"/> 9 9 </command-param> … … 11 11 12 12 <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"> 14 14 <option source="@connectors"/> 15 15 </command-param> … … 26 26 </command> 27 27 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." /> 29 29 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." /> 31 31 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." /> 33 33 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."/> 35 35 36 36 <command name="user-log" label="Show user transaction log" description="Recent ecm transaction for one user."> … … 46 46 </command> 47 47 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"> 50 50 <option source="@connectors"/> 51 51 </command-param> … … 56 56 <command name="watched-services" label="Show watched services" description="List of the currently watched services." /> 57 57 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"> 60 60 <option source="@connectors"/> 61 61 </command-param> … … 77 77 78 78 <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" /> 80 80 </command> 81 81 … … 84 84 <command name="ctrl-commands" label="Show ctrl-commands" description="Retrieve ctrl-command definitions and metadata." admin-only="true" /> 85 85 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." /> 87 87 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." /> 89 89 90 90 <command name="system-properties" label="System properties" description="Dump JVM system properties." admin-only="true" /> -
trunk/web/js/cs-status.js
r153 r154 138 138 label: 'Status', 139 139 queries: ['proxy-status', 'cache-status', 'proxy-plugins', 'ca-profiles', 'cws-connectors'], 140 repeat: false,140 repeat: true, 141 141 handler: function(xml) { 142 142 var status = getFirstByTag('proxy-status', xml); … … 179 179 label: 'Sessions', 180 180 queries: ['proxy-status', 'ca-profiles', 'proxy-users hide-inactive="true"'], 181 repeat: false,181 repeat: true, 182 182 handler: function(xml) { 183 183 if(hideInactive) getFirstByTag('proxy-users', xml).setAttribute('hide-inactive', 'true');
Note:
See TracChangeset
for help on using the changeset viewer.