librpc/rpc: allow "assoc_group_id" in dcerpc_binding_[g|s]et_string()
authorStefan Metzmacher <metze@samba.org>
Tue, 11 Feb 2014 18:33:09 +0000 (19:33 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 13 Feb 2014 10:54:15 +0000 (11:54 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
librpc/rpc/binding.c
librpc/rpc/rpc_common.h

index 132739cae784eecea45d10fcf8ce3ff4fb9a61d8..65cdb36a0e6ed96d8bda9a5dd0a1c0489ae3b73f 100644 (file)
@@ -567,6 +567,19 @@ _PUBLIC_ const char *dcerpc_binding_get_string_option(const struct dcerpc_bindin
                return derpc_transport_string_by_transport(b->transport);
        }
 
+       ret = strcmp(name, "assoc_group_id");
+       if (ret == 0) {
+               char *tmp = discard_const_p(char, b->assoc_group_string);
+
+               if (b->assoc_group_id == 0) {
+                       return NULL;
+               }
+
+               snprintf(tmp, sizeof(b->assoc_group_string),
+                        "0x%08x", b->assoc_group_id);
+               return (const char *)b->assoc_group_string;
+       }
+
        for (i=0; i < ARRAY_SIZE(specials); i++) {
                ret = strcmp(specials[i].name, name);
                if (ret != 0) {
@@ -690,6 +703,22 @@ _PUBLIC_ NTSTATUS dcerpc_binding_set_string_option(struct dcerpc_binding *b,
                return dcerpc_binding_set_object(b, uuid);
        }
 
+       ret = strcmp(name, "assoc_group_id");
+       if (ret == 0) {
+               uint32_t assoc_group_id = 0;
+
+               if (value != NULL) {
+                       char c;
+
+                       ret = sscanf(value, "0x%08x%c", &assoc_group_id, &c);
+                       if (ret != 1) {
+                               return NT_STATUS_INVALID_PARAMETER_MIX;
+                       }
+               }
+
+               return dcerpc_binding_set_assoc_group_id(b, assoc_group_id);
+       }
+
        for (i=0; i < ARRAY_SIZE(specials); i++) {
                ret = strcmp(specials[i].name, name);
                if (ret != 0) {
index 4dfc46a98db94978842b81f74dc963c3c1f712db..428acfeea3fd997d1269fb3374534626bb61e2d0 100644 (file)
@@ -51,6 +51,7 @@ struct dcerpc_binding {
        const char **options;
        uint32_t flags;
        uint32_t assoc_group_id;
+       char assoc_group_string[11]; /* 0x3456789a + '\0' */
 };
 
 /* dcerpc pipe flags */