Changeset 178
- Timestamp:
- 07/01/11 00:13:31 (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/README.txt
r50 r178 60 60 The proxy prefers a sun JRE (1.4.2 or later) but others like JamVM _may_ work. If you're interested in getting the 61 61 proxy to run properly under gcj/gij or any other non-sun jre, contact me on efnet (be prepared to make source changes). 62 As of 0.9.0 the proxy will not start with non-sun jvms, unless you explicit force it to by adding the cmd line argument:62 As of 0.9.0 the proxy will not start with non-sun jvms, unless you explicitly force it to by adding the cmd line argument: 63 63 -Dcom.bowman.cardserv.allowanyjvm=true 64 64 -
trunk/changelog.txt
r175 r178 16 16 - Fixed: Closing of old sessions (on new login) wasn't working for ExtNewcamd. 17 17 - Fixed: Debug mode for the "*" pseudo profile (Csp, ExtNewcamd) couldn't be turned off via config (attribute ignored). 18 - Fixed: Removing a profile from a user that had used csp-connect had no effect, as it remained locally cached at the 19 client proxy, and no mechanism existed for removing it or blocking the now disallowed requests. 18 20 - Changed: Two ecms (or dcw replies) with the same payload data but different dvb table ids (even/0x80 vs odd/0x81) are 19 21 now considered identical by the proxy. Implications unknown. … … 29 31 - Added: DreamboxPlugin (csp-agent) support for more/older dm500 images. Basic (unsecured) file upload support. 30 32 - Added: proxy-reference.html updated with highlighting for important elements and additional examples. 31 - Added: Ability to set start and expiration date for user accounts (only Simple and XmlUsermanager). 32 - Added: Ability to set minimum interval between ecm's in seconds (only Simple and XmlUsermanager). 33 - Added: New TestUserManager to show how to add um-specific functionality without changing the core or existing um's. 33 34 34 35 - Changes to proxy.xml: -
trunk/config/proxy-reference.html
r174 r178 804 804 - <strong class='bold'>enabled</strong>: true/false (default: true). Allows disabling of accounts without deleting them.<br /> 805 805 - <strong class='bold'>map-exclude</strong>: true/false (default: false). Set to true to prevent the user from causing changes to the service maps. If a particular user is sending bad ecms or is otherwise misbehaving, this will protect the service mappings and ensure no other users are affected. Only use this if you are sure a particular client is misbehaving, the service mapping can't work if no clients are allowed to update the map.<br /> 806 - <strong class='bold'>start-date</strong>: (dd-mm-yyyy) Start date for the user account.<br />807 - <strong class='bold'>expiration-date</strong>: (dd-mm-yyyy) Expiration date for the user account.<br />808 - <strong class='bold'>ecm-rate</strong>: Minimum interval between ecm's in seconds (disabled by default).<br />809 806 - <strong class='bold'>debug</strong>: true/false (default: false). Set to true to enable ecm/emm/zap logging for this user only (has no effect if these are already enabled globally).<br /> 810 807 <br /> -
trunk/src/com/bowman/cardserv/SimpleUserManager.java
r173 r178 70 70 } catch (ConfigException e) {} 71 71 72 String startDate = null;73 try {74 startDate = xml.getStringValue("start-date");75 } catch (ConfigException e) {}76 77 String expirationDate = null;78 try {79 expirationDate = xml.getStringValue("expiration-date");80 } catch (ConfigException e) {}81 82 int EcmRate = -1;83 try {84 EcmRate = xml.getIntValue("ecm-rate");85 } catch (ConfigException e) {}86 87 72 int maxConnections = xml.getIntValue("max-connections", -1); 88 73 … … 93 78 94 79 UserEntry user = new UserEntry(xml.getStringValue("name"), xml.getStringValue("password"), ipMask, emailAddr, 95 maxConnections, enabled, admin, exclude, startDate, expirationDate, EcmRate,debug);80 maxConnections, enabled, admin, exclude, debug); 96 81 97 82 try { … … 179 164 } 180 165 181 public String getStartDate(String user) {182 UserEntry entry = getUser(user);183 if(entry == null) return null;184 else return entry.startDate;185 }186 187 public String getExpirationDate(String user) {188 UserEntry entry = getUser(user);189 if(entry == null) return null;190 else return entry.expirationDate;191 }192 193 166 public Set getAllowedProfiles(String user) { 194 167 UserEntry entry = getUser(user); … … 254 227 255 228 public int getAllowedEcmRate(String user) { 256 UserEntry entry = getUser(user); 257 if(entry == null) return -1; // return minimum interval between ecm in seconds, -1 for no limit 258 else return entry.EcmRate; 229 return -1; // return minimum interval between ecm in seconds, -1 for no limit 259 230 } 260 231 … … 264 235 String ipMask; 265 236 String email, displayName; 266 String startDate, expirationDate; 267 int maxConnections, EcmRate; 237 int maxConnections; 268 238 boolean enabled, admin, exclude, debug; 269 239 Set profiles = new HashSet(); 270 240 271 241 public UserEntry(String name, String password, String ipMask, String email, int maxConnections, boolean enabled, 272 boolean admin, boolean exclude, String startDate, String expirationDate, int EcmRate,boolean debug)242 boolean admin, boolean exclude, boolean debug) 273 243 { 274 244 this.name = name; … … 281 251 this.admin = admin; 282 252 this.exclude = exclude; 283 this.startDate = startDate;284 this.expirationDate = expirationDate;285 this.EcmRate = EcmRate;286 253 this.debug = debug; 287 254 } -
trunk/src/com/bowman/cardserv/interfaces/UserManager.java
r172 r178 34 34 Set getAllowedConnectors(String user); // return Set of String, null for all 35 35 int getAllowedEcmRate(String user); // return minimum interval between ecm in seconds, -1 for no limit 36 String getStartDate(String user);37 String getExpirationDate(String user);38 36 39 37 } -
trunk/src/com/bowman/cardserv/rmi/RemoteHandler.java
r172 r178 175 175 } else { 176 176 String displayName = session.isTempUser()?session.getLoginName():um.getDisplayName(name); 177 user = new UserStatus(name, displayName, um.get StartDate(name), um.getExpirationDate(name), um.getMaxConnections(name), false);177 user = new UserStatus(name, displayName, um.getMaxConnections(name), false); 178 178 user.addSession(session); 179 179 users.put(name, user); … … 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.getExpirationDate(userName),um.getMaxConnections(userName), um.isAdmin(userName));207 user = new UserStatus(userName, displayName,um.getMaxConnections(userName), um.isAdmin(userName)); 208 208 } 209 209 user.addSession(session); -
trunk/src/com/bowman/cardserv/rmi/UserStatus.java
r172 r178 17 17 private static final long serialVersionUID = -4091190186183181716L; 18 18 19 private final String userName, displayName , startDate, expirationDate;19 private final String userName, displayName; 20 20 private final boolean admin; 21 21 private final int maxSessions; … … 23 23 private final List sessions = new ArrayList(); 24 24 25 public UserStatus(String userName, String displayName, String startDate, String expirationDate,int maxSessions, boolean admin) {25 public UserStatus(String userName, String displayName, int maxSessions, boolean admin) { 26 26 this.userName = userName; 27 27 this.displayName = displayName; 28 28 this.admin = admin; 29 this.startDate = startDate;30 this.expirationDate = expirationDate;31 29 this.maxSessions = maxSessions; 32 30 } … … 42 40 public boolean isAdmin() { 43 41 return admin; 44 }45 46 public String getStartDate() {47 return startDate;48 }49 50 public String getExpirationDate() {51 return expirationDate;52 42 } 53 43 -
trunk/src/com/bowman/cardserv/session/NewcamdSession.java
r172 r178 1 1 package com.bowman.cardserv.session; 2 2 3 import com.bowman.cardserv.*; 3 4 import com.bowman.cardserv.crypto.DESUtil; 5 import com.bowman.cardserv.cws.CwsConnectorManager; 4 6 import com.bowman.cardserv.interfaces.*; 5 import com.bowman.cardserv.*;6 import com.bowman.cardserv.cws.CwsConnectorManager;7 7 import com.bowman.util.Globber; 8 8 9 import java.io.*; 9 10 import java.net.*; 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 … … 116 113 } else if(checkProfile && !profiles.contains(getProfileName())) { 117 114 loginFailure(user, "no access for profile: " + getProfileName(), msg); 118 } else if(checkAccountExpired(user, um) || checkAccountStarted(user, um)) {119 loginFailure(user, "account has expired or has not reached start date yet", msg);120 115 } else { // successful login 121 116 … … 194 189 checksOk = checksOk && handleMessage(msg); 195 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 196 if(checkAccountExpired(this.user, um)) {197 logger.warning("'User '" + user + "' kicked, account has expired");198 close();199 }200 191 if(!checksOk) { 201 192 setFlag(msg, 'B'); … … 220 211 protected boolean checkClientId(String id) { 221 212 return true; 222 }223 224 public boolean checkAccountStarted(String user, UserManager um) {225 Date startedDateDt = null;226 try {227 String startedDateStr = um.getStartDate(user);228 DateFormat df = new SimpleDateFormat("dd-MM-yyyy");229 if (startedDateStr == null)230 startedDateDt = null;231 else232 startedDateDt = df.parse(startedDateStr);233 }234 catch(ParseException ignored) {}235 long currDateMs = System.currentTimeMillis();236 long startedDateMs = 0;237 238 if (startedDateDt != null)239 startedDateMs = startedDateDt.getTime();240 241 return (startedDateMs != 0) && (currDateMs < startedDateMs);242 }243 244 public boolean checkAccountExpired(String user, UserManager um) {245 Date expirationDateDt = null;246 long currDate = System.currentTimeMillis();247 long expirationDateMs = 0L;248 try249 {250 String expirationDateStr = um.getExpirationDate(user);251 DateFormat df = new SimpleDateFormat("dd-MM-yyyy");252 253 if(expirationDateStr == null)254 expirationDateDt = null;255 else256 expirationDateDt = df.parse(expirationDateStr);257 }258 catch(ParseException ex) { }259 currDate = System.currentTimeMillis();260 expirationDateMs = 0L;261 262 if(expirationDateDt != null)263 expirationDateMs = expirationDateDt.getTime();264 265 return expirationDateMs != 0L && currDate > expirationDateMs;266 213 } 267 214 -
trunk/src/com/bowman/cardserv/web/XmlHelper.java
r172 r178 872 872 xb.appendElement("user", "name", users[i].getUserName()); 873 873 xb.appendAttr("display-name", users[i].getDisplayName()); 874 xb.appendAttr("start-date", users[i].getStartDate());875 xb.appendAttr("expiration-date", users[i].getExpirationDate());876 874 if(users[i].isAdmin()) xb.appendAttr("admin", users[i].isAdmin()); 877 875
Note:
See TracChangeset
for help on using the changeset viewer.