r5037: got rid of all of the TALLOC_DEPRECATED stuff. My apologies for the
[gd/samba-autobuild/.git] / source4 / torture / local / binding_string.c
index 7ec9a30d249e4e06c1978091a9020fb9508c9b0f..66e8a5350f739619fe7f60a25cb4d3f482e1da54 100644 (file)
 */
 
 #include "includes.h"
+#include "librpc/gen_ndr/ndr_epmapper.h"
 
 static BOOL test_BindingString(TALLOC_CTX *mem_ctx, const char *binding)
 {
        struct dcerpc_binding b, b2;
        const char *s, *s2;
-       struct epm_tower *tower;
+       struct epm_tower tower;
        NTSTATUS status;
 
        /* Parse */
@@ -56,7 +57,7 @@ static BOOL test_BindingString(TALLOC_CTX *mem_ctx, const char *binding)
 
        /* Convert back to binding and then back to string and compare */
 
-       status = dcerpc_binding_from_tower(mem_ctx, tower, &b2);
+       status = dcerpc_binding_from_tower(mem_ctx, &tower, &b2);
        if (NT_STATUS_IS_ERR(status)) {
                DEBUG(0, ("Error generating binding from tower for original binding '%s': %s\n", binding, nt_errstr(status)));
                return False;
@@ -64,9 +65,7 @@ static BOOL test_BindingString(TALLOC_CTX *mem_ctx, const char *binding)
 
        /* Compare to a stripped down version of the binding string because 
         * the protocol tower doesn't contain the extra option data */
-       if (b.options && b.options[0]) {
-               b.options[1] = NULL; 
-       }
+       b.options = NULL;
 
        b.flags = 0;
        
@@ -94,10 +93,16 @@ static BOOL test_BindingString(TALLOC_CTX *mem_ctx, const char *binding)
 static const char *test_strings[] = {
        "ncacn_np:", 
        "ncalrpc:", 
-       "ncalrpc:[Security=Sane]", 
+       "ncalrpc:[,Security=Sane]", 
        "ncacn_np:[rpcecho]",
        "ncacn_np:127.0.0.1[rpcecho]",
        "ncacn_ip_tcp:127.0.0.1",
+       "ncacn_ip_tcp:127.0.0.1[20]",
+       "ncacn_ip_tcp:127.0.0.1[20,sign]",
+       "ncacn_ip_tcp:127.0.0.1[20,Security=Foobar,sign]",
+       "ncacn_http:127.0.0.1",
+       "ncacn_http:127.0.0.1[78]",
+       "ncacn_http:127.0.0.1[78,ProxyServer=myproxy:3128]",
        "ncacn_np:localhost[rpcecho]",
        "ncacn_np:[/pipe/rpcecho]",
        "ncacn_np:localhost[/pipe/rpcecho,sign,seal]",
@@ -105,9 +110,12 @@ static const char *test_strings[] = {
        "ncadg_ip_udp:",
        "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_np:localhost",
        "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_ip_tcp:127.0.0.1",
+       "ncacn_unix_stream:[/tmp/epmapper]",
+       "ncalrpc:[IDENTIFIER]",
+       "ncacn_unix_stream:[/tmp/epmapper,sign]",
 };
 
-BOOL torture_local_binding_string(int dummy
+BOOL torture_local_binding_string(void
 {
        BOOL ret = True;
        TALLOC_CTX *mem_ctx = talloc_init("test_BindingString");
@@ -117,7 +125,7 @@ BOOL torture_local_binding_string(int dummy)
                ret &= test_BindingString(mem_ctx, test_strings[i]);
        }
 
-       talloc_destroy(mem_ctx);
+       talloc_free(mem_ctx);
 
        return ret;
 }