[telepathy-gabble/master] check_unix_params: check the credentials param

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Tue May 5 02:12:00 PDT 2009


---
 src/tube-stream.c |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/tube-stream.c b/src/tube-stream.c
index 055c949..0fb5be8 100644
--- a/src/tube-stream.c
+++ b/src/tube-stream.c
@@ -1776,15 +1776,28 @@ check_unix_params (TpSocketAddressType address_type,
       g_string_free (socket_address, TRUE);
     }
 
-  if (access_control != TP_SOCKET_ACCESS_CONTROL_LOCALHOST)
+  if (access_control == TP_SOCKET_ACCESS_CONTROL_LOCALHOST)
   {
-    g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
-        "Only the Localhost access control method is supported for Unix"
-        " sockets");
-    return FALSE;
+    return TRUE;
   }
+  else if (access_control == TP_SOCKET_ACCESS_CONTROL_CREDENTIALS)
+    {
+      if (access_control_param != NULL)
+        {
+          if (G_VALUE_TYPE (access_control_param) !=
+              G_TYPE_UCHAR)
+            {
+              g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+                  "Credentials access param is supposed to be y");
+              return FALSE;
+            }
+        }
+      return TRUE;
+    }
 
-  return TRUE;
+  g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+      "%u socket access control is not supported", access_control);
+  return FALSE;
 }
 
 static gboolean
-- 
1.5.6.5




More information about the telepathy-commits mailing list