Bug 806296 - Patch 1(v1): Cannot create an encrypted socket, r=echou
authorGina Yeh <gyeh@mozilla.com>
Wed, 31 Oct 2012 17:33:50 +0800
changeset 112016 de25c9c57c53
parent 112015 265f424378e8
child 112017 3393586a210b
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersechou
bugs806296
milestone19.0a1
Bug 806296 - Patch 1(v1): Cannot create an encrypted socket, r=echou
dom/bluetooth/BluetoothHfpManager.cpp
dom/bluetooth/BluetoothOppManager.cpp
dom/bluetooth/BluetoothScoManager.cpp
dom/bluetooth/BluetoothUnixSocketConnector.cpp
--- a/dom/bluetooth/BluetoothHfpManager.cpp
+++ b/dom/bluetooth/BluetoothHfpManager.cpp
@@ -601,17 +601,17 @@ BluetoothHfpManager::Connect(const nsASt
   }
 
   nsRefPtr<BluetoothReplyRunnable> runnable = aRunnable;
 
   nsresult rv = bs->GetSocketViaService(aDevicePath,
                                         serviceUuidStr,
                                         BluetoothSocketType::RFCOMM,
                                         true,
-                                        false,
+                                        true,
                                         this,
                                         runnable);
 
   runnable.forget();
   return NS_FAILED(rv) ? false : true;
 }
 
 bool
@@ -630,17 +630,17 @@ BluetoothHfpManager::Listen()
   if (!bs) {
     NS_WARNING("BluetoothService not available!");
     return false;
   }
 
   nsresult rv = bs->ListenSocketViaService(BluetoothReservedChannels::HANDSFREE_AG,
                                            BluetoothSocketType::RFCOMM,
                                            true,
-                                           false,
+                                           true,
                                            this);
 
   mSocketStatus = GetConnectionStatus();
 
   return NS_FAILED(rv) ? false : true;
 }
 
 void
--- a/dom/bluetooth/BluetoothOppManager.cpp
+++ b/dom/bluetooth/BluetoothOppManager.cpp
@@ -197,17 +197,17 @@ BluetoothOppManager::Connect(const nsASt
     NS_ConvertUTF8toUTF16(mozilla::dom::bluetooth::BluetoothServiceUuidStr::ObjectPush);
 
   nsRefPtr<BluetoothReplyRunnable> runnable = aRunnable;
 
   nsresult rv = bs->GetSocketViaService(aDeviceObjectPath,
                                         serviceUuidStr,
                                         BluetoothSocketType::RFCOMM,
                                         true,
-                                        false,
+                                        true,
                                         this,
                                         runnable);
 
   runnable.forget();
   return NS_FAILED(rv) ? false : true;
 }
 
 void
@@ -237,17 +237,17 @@ BluetoothOppManager::Listen()
   if (!bs) {
     NS_WARNING("BluetoothService not available!");
     return false;
   }
 
   nsresult rv = bs->ListenSocketViaService(BluetoothReservedChannels::OPUSH,
                                            BluetoothSocketType::RFCOMM,
                                            true,
-                                           false,
+                                           true,
                                            this);
   return NS_FAILED(rv) ? false : true;
 }
 
 bool
 BluetoothOppManager::SendFile(BlobParent* aActor,
                               BluetoothReplyRunnable* aRunnable)
 {
--- a/dom/bluetooth/BluetoothScoManager.cpp
+++ b/dom/bluetooth/BluetoothScoManager.cpp
@@ -239,17 +239,17 @@ BluetoothScoManager::Listen()
   if (!bs) {
     NS_WARNING("BluetoothService not available!");
     return false;
   }
 
   nsresult rv = bs->ListenSocketViaService(-1,
                                            BluetoothSocketType::SCO,
                                            true,
-                                           false,
+                                           true,
                                            this);
 
   mSocketStatus = GetConnectionStatus();
 
   return NS_FAILED(rv) ? false : true;
 }
 
 void
--- a/dom/bluetooth/BluetoothUnixSocketConnector.cpp
+++ b/dom/bluetooth/BluetoothUnixSocketConnector.cpp
@@ -83,22 +83,20 @@ BluetoothUnixSocketConnector::SetUp(int 
 {
   int lm = 0;
   int sndbuf;
   /* kernel does not yet support LM for SCO */
   switch (mType) {
   case BluetoothSocketType::RFCOMM:
     lm |= mAuth ? RFCOMM_LM_AUTH : 0;
     lm |= mEncrypt ? RFCOMM_LM_ENCRYPT : 0;
-    lm |= (mAuth && mEncrypt) ? RFCOMM_LM_SECURE : 0;
     break;
   case BluetoothSocketType::L2CAP:
     lm |= mAuth ? L2CAP_LM_AUTH : 0;
     lm |= mEncrypt ? L2CAP_LM_ENCRYPT : 0;
-    lm |= (mAuth && mEncrypt) ? L2CAP_LM_SECURE : 0;
     break;
   }
 
   if (lm) {
     if (setsockopt(aFd, SOL_RFCOMM, RFCOMM_LM, &lm, sizeof(lm))) {
       NS_WARNING("setsockopt(RFCOMM_LM) failed, throwing");
       return false;
     }