summaryrefslogtreecommitdiff
path: root/org
diff options
context:
space:
mode:
authorMatthew Johnson <mjj29@hecate.trinhall.cam.ac.uk>2007-01-02 16:26:15 +0000
committerMatthew Johnson <mjj29@hecate.trinhall.cam.ac.uk>2007-01-02 16:26:15 +0000
commitd7d4105e5f21bd454e7b5a785493ea36f5f702aa (patch)
tree0bdded4df9c133577595f99d60c714ccab04dbae /org
parent9587624b311ca4fd272dea4415c57192dc469f2d (diff)
add windows files
Diffstat (limited to 'org')
-rw-r--r--org/freedesktop/dbus/AbstractConnection.java3
-rw-r--r--org/freedesktop/dbus/MessageWriter.java5
-rw-r--r--org/freedesktop/dbus/Transport.java16
3 files changed, 20 insertions, 4 deletions
diff --git a/org/freedesktop/dbus/AbstractConnection.java b/org/freedesktop/dbus/AbstractConnection.java
index 571c3b5..a7dfc08 100644
--- a/org/freedesktop/dbus/AbstractConnection.java
+++ b/org/freedesktop/dbus/AbstractConnection.java
@@ -160,6 +160,7 @@ public abstract class AbstractConnection
}
if (null != m)
sendMessage(m);
+ m = null;
}
if (Debug.debug) Debug.print(Debug.INFO, "Flushing outbound queue and quitting");
@@ -172,6 +173,8 @@ public abstract class AbstractConnection
}
sendMessage(m);
} while (null != m);
+
+ // close the underlying streams
}
}
/**
diff --git a/org/freedesktop/dbus/MessageWriter.java b/org/freedesktop/dbus/MessageWriter.java
index 97dde99..ad7e2af 100644
--- a/org/freedesktop/dbus/MessageWriter.java
+++ b/org/freedesktop/dbus/MessageWriter.java
@@ -29,6 +29,11 @@ public class MessageWriter
if (Debug.debug) {
Debug.print(Debug.INFO, "<= "+m);
}
+ if (null == m) return;
+ if (null == m.getWireData()) {
+ if (Debug.debug) Debug.print(Debug.WARN, "Message "+m+" wire-data was null!");
+ return;
+ }
for (byte[] buf: m.getWireData()) {
if (Debug.debug)
Debug.print(Debug.VERBOSE, "("+buf+"):"+ (null==buf? "": Hexdump.format(buf)));
diff --git a/org/freedesktop/dbus/Transport.java b/org/freedesktop/dbus/Transport.java
index ed9e976..536a28d 100644
--- a/org/freedesktop/dbus/Transport.java
+++ b/org/freedesktop/dbus/Transport.java
@@ -20,6 +20,7 @@ import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
+import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
@@ -34,7 +35,6 @@ import cx.ath.matthew.unix.UnixServerSocket;
import cx.ath.matthew.unix.UnixSocketAddress;
import cx.ath.matthew.utils.Hexdump;
import cx.ath.matthew.debug.Debug;
-import com.sun.security.auth.module.UnixSystem;
public class Transport
{
@@ -438,9 +438,17 @@ public class Transport
*/
public boolean auth(int mode, int types, String guid, OutputStream out, InputStream in) throws IOException
{
- UnixSystem uns = new UnixSystem();
- long uid = uns.getUid();
- String Uid = stupidlyEncode(""+uid);
+ String username = System.getProperty("user.name");
+ String Uid = null;
+ try {
+ Class c = Class.forName("com.sun.security.auth.module.UnixSystem");
+ Method m = c.getMethod("getUid");
+ Object o = c.newInstance();
+ long uid = (Long) m.invoke(o);
+ Uid = stupidlyEncode(""+uid);
+ } catch (Exception e) {
+ Uid = stupidlyEncode(username);
+ }
Command c;
int failed = 0;
int current = 0;