Changeset 36339 in osm for applications/editors/josm/plugins
- Timestamp:
- 2024-09-19T17:42:45+02:00 (4 months ago)
- Location:
- applications/editors/josm/plugins/native-password-manager
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/native-password-manager/build.xml
r36211 r36339 5 5 <property name="commit.message" value="Commit message"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="1 8991"/>7 <property name="plugin.main.version" value="19044"/> 8 8 <property name="plugin.author" value="Paul Hartmann"/> 9 9 <property name="plugin.class" value="org.openstreetmap.josm.plugins.npm.NPMPlugin"/> -
applications/editors/josm/plugins/native-password-manager/pom.xml
r36325 r36339 17 17 <properties> 18 18 <plugin.src.dir>src</plugin.src.dir> 19 <plugin.main.version>1 8991</plugin.main.version>19 <plugin.main.version>19044</plugin.main.version> 20 20 <plugin.author>Paul Hartmann</plugin.author> 21 21 <plugin.class>org.openstreetmap.josm.plugins.npm.NPMPlugin</plugin.class> -
applications/editors/josm/plugins/native-password-manager/src/org/netbeans/modules/keyring/kde/KWalletProvider.java
r35665 r36339 62 62 private char[] handler = "0".toCharArray(); 63 63 private boolean timeoutHappened = false; 64 private char[] defaultLocalWallet = "kdewallet".toCharArray(); 64 private final char[] defaultLocalWallet = "kdewallet".toCharArray(); 65 65 66 66 @Override … … 100 100 warning("save action failed"); 101 101 } 102 return;103 102 } 104 103 //throw new KwalletException("save"); … … 113 112 warning("delete action failed"); 114 113 } 115 return;116 114 } 117 115 //throw new KwalletException("delete"); … … 122 120 return false; 123 121 } 124 handler = new String(handler). equals("")? "0".toCharArray() : handler;122 handler = new String(handler).isEmpty() ? "0".toCharArray() : handler; 125 123 CommandResult result = runCommand("isOpen",handler); 126 124 if(new String(result.retVal).equals("true")){ … … 157 155 158 156 private CommandResult runCommand(String command,char[]... commandArgs) { 157 CommandResult result = null; 158 for (int i : new int[] {6, 5, 0}) { 159 result = runCommandKdeVersion(i, command, commandArgs); 160 if (result.exitCode == 0 && !result.errVal.equals("Service 'org.kde.kwalletd" + (i != 0 ? i : "") + "' does not exist.")) { 161 break; 162 } 163 } 164 return result; 165 } 166 167 private CommandResult runCommandKdeVersion(int kdeVersion, String command, char[]... commandArgs) { 159 168 String[] argv = new String[commandArgs.length+4]; 160 169 argv[0] = "qdbus"; 161 argv[1] = "org.kde.kwalletd"; 162 argv[2] = "/modules/kwalletd"; 170 argv[1] = "org.kde.kwalletd" + (kdeVersion != 0 ? kdeVersion : ""); 171 argv[2] = "/modules/kwalletd" + (kdeVersion != 0 ? kdeVersion : ""); 163 172 argv[3] = "org.kde.KWallet."+command; 164 173 for (int i = 0; i < commandArgs.length; i++) { 165 //unfortunatel ly I cannot pass char[] to the exec in any way - so this poses a security issue with passwords in String() !174 //unfortunately I cannot pass char[] to the exec in any way - so this poses a security issue with passwords in String() ! 166 175 //TODO: find a way to avoid changing char[] into String 167 176 argv[i+4] = new String(commandArgs[i]); … … 181 190 String line; 182 191 while((line = input.readLine()) != null) { 183 if (!retVal. equals("")){192 if (!retVal.isEmpty()){ 184 193 retVal = retVal.concat("\n"); 185 194 } … … 191 200 String line; 192 201 while((line = input.readLine()) != null) { 193 if (!errVal. equals("")){202 if (!errVal.isEmpty()){ 194 203 errVal = errVal.concat("\n"); 195 204 } … … 204 213 } 205 214 } catch (InterruptedException ex) { 215 Thread.currentThread().interrupt(); 206 216 logger.log(Level.FINE, 207 217 "exception thrown while invoking the command \""+Arrays.toString(argv)+"\"", … … 224 234 225 235 private static class CommandResult { 226 private int exitCode; 227 private char[] retVal; 236 private final int exitCode; 237 private final char[] retVal; 238 private final String errVal; 228 239 229 240 public CommandResult(int exitCode, char[] retVal, String errVal) { 230 241 this.exitCode = exitCode; 231 242 this.retVal = retVal; 243 this.errVal = errVal; 232 244 } 233 245 }
Note:
See TracChangeset
for help on using the changeset viewer.