Loading cmds/keystore/netkeystore.c +3 −2 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,7 @@ #include "netkeystore.h" #include "netkeystore.h" #include "keymgmt.h" #include "keymgmt.h" #define DBG 1 #define CMD_PUT_WITH_FILE "putfile" #define CMD_PUT_WITH_FILE "putfile" typedef void CMD_FUNC(LPC_MARSHAL *cmd, LPC_MARSHAL *reply); typedef void CMD_FUNC(LPC_MARSHAL *cmd, LPC_MARSHAL *reply); Loading Loading @@ -397,12 +398,12 @@ int main(const int argc, const char *argv[]) // read the command, execute and send the result back. // read the command, execute and send the result back. if(read_marshal(s, &cmd)) goto err; if(read_marshal(s, &cmd)) goto err; LOGI("new connection\n"); if (DBG) LOGD("new connection\n"); execute(&cmd, &reply); execute(&cmd, &reply); write_marshal(s, &reply); write_marshal(s, &reply); err: err: memset(&reply, 0, sizeof(LPC_MARSHAL)); memset(&reply, 0, sizeof(LPC_MARSHAL)); LOGI("closing connection\n"); if (DBG) LOGD("closing connection\n"); close(s); close(s); } } Loading keystore/java/android/security/ServiceCommand.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -49,6 +49,8 @@ public class ServiceCommand { public static final int BUFFER_LENGTH = 4096; public static final int BUFFER_LENGTH = 4096; private static final boolean DBG = true; private String mServiceName; private String mServiceName; private String mTag; private String mTag; private InputStream mIn; private InputStream mIn; Loading @@ -59,7 +61,7 @@ public class ServiceCommand { if (mSocket != null) { if (mSocket != null) { return true; return true; } } Log.i(mTag, "connecting..."); if (DBG) Log.d(mTag, "connecting..."); try { try { mSocket = new LocalSocket(); mSocket = new LocalSocket(); Loading @@ -78,7 +80,7 @@ public class ServiceCommand { } } private void disconnect() { private void disconnect() { Log.i(mTag,"disconnecting..."); if (DBG) Log.d(mTag,"disconnecting..."); try { try { if (mSocket != null) mSocket.close(); if (mSocket != null) mSocket.close(); } catch (IOException ex) { } } catch (IOException ex) { } Loading @@ -105,7 +107,7 @@ public class ServiceCommand { } } off += count; off += count; } catch (IOException ex) { } catch (IOException ex) { Log.e(mTag,"read exception"); Log.e(mTag,"read exception", ex); break; break; } } } } Loading Loading @@ -156,7 +158,7 @@ public class ServiceCommand { mOut.write(buf, 0, 8); mOut.write(buf, 0, 8); mOut.write(data, 0, len); mOut.write(data, 0, len); } catch (IOException ex) { } catch (IOException ex) { Log.e(mTag,"write error"); Log.e(mTag,"write error", ex); disconnect(); disconnect(); return false; return false; } } Loading Loading
cmds/keystore/netkeystore.c +3 −2 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,7 @@ #include "netkeystore.h" #include "netkeystore.h" #include "keymgmt.h" #include "keymgmt.h" #define DBG 1 #define CMD_PUT_WITH_FILE "putfile" #define CMD_PUT_WITH_FILE "putfile" typedef void CMD_FUNC(LPC_MARSHAL *cmd, LPC_MARSHAL *reply); typedef void CMD_FUNC(LPC_MARSHAL *cmd, LPC_MARSHAL *reply); Loading Loading @@ -397,12 +398,12 @@ int main(const int argc, const char *argv[]) // read the command, execute and send the result back. // read the command, execute and send the result back. if(read_marshal(s, &cmd)) goto err; if(read_marshal(s, &cmd)) goto err; LOGI("new connection\n"); if (DBG) LOGD("new connection\n"); execute(&cmd, &reply); execute(&cmd, &reply); write_marshal(s, &reply); write_marshal(s, &reply); err: err: memset(&reply, 0, sizeof(LPC_MARSHAL)); memset(&reply, 0, sizeof(LPC_MARSHAL)); LOGI("closing connection\n"); if (DBG) LOGD("closing connection\n"); close(s); close(s); } } Loading
keystore/java/android/security/ServiceCommand.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -49,6 +49,8 @@ public class ServiceCommand { public static final int BUFFER_LENGTH = 4096; public static final int BUFFER_LENGTH = 4096; private static final boolean DBG = true; private String mServiceName; private String mServiceName; private String mTag; private String mTag; private InputStream mIn; private InputStream mIn; Loading @@ -59,7 +61,7 @@ public class ServiceCommand { if (mSocket != null) { if (mSocket != null) { return true; return true; } } Log.i(mTag, "connecting..."); if (DBG) Log.d(mTag, "connecting..."); try { try { mSocket = new LocalSocket(); mSocket = new LocalSocket(); Loading @@ -78,7 +80,7 @@ public class ServiceCommand { } } private void disconnect() { private void disconnect() { Log.i(mTag,"disconnecting..."); if (DBG) Log.d(mTag,"disconnecting..."); try { try { if (mSocket != null) mSocket.close(); if (mSocket != null) mSocket.close(); } catch (IOException ex) { } } catch (IOException ex) { } Loading @@ -105,7 +107,7 @@ public class ServiceCommand { } } off += count; off += count; } catch (IOException ex) { } catch (IOException ex) { Log.e(mTag,"read exception"); Log.e(mTag,"read exception", ex); break; break; } } } } Loading Loading @@ -156,7 +158,7 @@ public class ServiceCommand { mOut.write(buf, 0, 8); mOut.write(buf, 0, 8); mOut.write(data, 0, len); mOut.write(data, 0, len); } catch (IOException ex) { } catch (IOException ex) { Log.e(mTag,"write error"); Log.e(mTag,"write error", ex); disconnect(); disconnect(); return false; return false; } } Loading