diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2004-10-22 10:52:57 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:02:25 -0500 |
commit | 8debe5a6b88c9625826e191b04244ae3e4b42590 (patch) | |
tree | f7a9bf2a71e2217ca3052a048f2c5cdf67168885 /source4 | |
parent | 020b38656016d3adeeaa9b09d41ea0c29f686ed4 (diff) | |
download | samba-8debe5a6b88c9625826e191b04244ae3e4b42590.tar.gz samba-8debe5a6b88c9625826e191b04244ae3e4b42590.tar.bz2 samba-8debe5a6b88c9625826e191b04244ae3e4b42590.zip |
r3136: - Allow specifying socket type when adding smbd service
- Make sure a epm_tower struct is completely initialized
- Some more minor fixes
(This used to be commit d560dcbdb85cb2c6915bdb9e2f82f1872b0f5a52)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/ldap_server/ldap_server.c | 4 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.h | 1 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_util.c | 38 | ||||
-rw-r--r-- | source4/rpc_server/dcerpc_tcp.c | 2 | ||||
-rw-r--r-- | source4/smb_server/smb_server.c | 2 | ||||
-rw-r--r-- | source4/smbd/service.c | 3 | ||||
-rw-r--r-- | source4/torture/local/binding_string.c | 4 | ||||
-rw-r--r-- | source4/torture/rpc/epmapper.c | 2 |
8 files changed, 29 insertions, 27 deletions
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c index 9065647e01..dcce32874d 100644 --- a/source4/ldap_server/ldap_server.c +++ b/source4/ldap_server/ldap_server.c @@ -40,10 +40,10 @@ static void add_socket(struct server_service *service, uint16_t port = 389; char *ip_str = talloc_strdup(service, inet_ntoa(*ifip)); - srv_sock = service_setup_socket(service, model_ops, ip_str, &port); + srv_sock = service_setup_socket(service, model_ops, "ipv4", ip_str, &port); port = 3268; - srv_sock = service_setup_socket(service, model_ops, ip_str, &port); + srv_sock = service_setup_socket(service, model_ops, "ipv4", ip_str, &port); talloc_free(ip_str); } diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index e7b520d0ad..85f4da6820 100644 --- a/source4/librpc/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h @@ -145,6 +145,7 @@ struct dcerpc_interface_table { struct dcerpc_binding { enum dcerpc_transport_t transport; struct GUID object; + int object_version; const char *host; const char **options; uint32_t flags; diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index a951f782c3..1adcac8eab 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -359,6 +359,8 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_ ZERO_STRUCT(b->object); } + b->object_version = 0; + p = strchr(s, ':'); if (!p) { return NT_STATUS_INVALID_PARAMETER; @@ -641,6 +643,7 @@ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, struct epm_tower *tower, /* Set object uuid */ binding->object = tower->floors[0].lhs.info.uuid.uuid; + binding->object_version = tower->floors[0].lhs.info.uuid.version; /* Ignore floor 1, it contains the NDR version info */ @@ -661,18 +664,12 @@ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, struct epm_tower *tower, return NT_STATUS_OK; } -NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower **tower) +NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower) { const enum epm_protocols *protseq; int num_protocols = -1, i; NTSTATUS status; - *tower = talloc_p(mem_ctx, struct epm_tower); - - if (!(*tower)) { - return NT_STATUS_NO_MEMORY; - } - /* Find transport */ for (i=0;i<ARRAY_SIZE(transports);i++) { if (transports[i].transport == binding->transport) { @@ -687,31 +684,34 @@ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding * return NT_STATUS_UNSUCCESSFUL; } - (*tower)->num_floors = 2 + num_protocols; - (*tower)->floors = talloc_array_p(mem_ctx, struct epm_floor, (*tower)->num_floors); + tower->num_floors = 2 + num_protocols; + tower->floors = talloc_array_p(mem_ctx, struct epm_floor, tower->num_floors); /* Floor 0 */ - (*tower)->floors[0].lhs.protocol = EPM_PROTOCOL_UUID; - (*tower)->floors[0].lhs.info.uuid.uuid = binding->object; - (*tower)->floors[0].lhs.info.uuid.version = 0; + tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID; + tower->floors[0].lhs.info.uuid.uuid = binding->object; + tower->floors[0].lhs.info.uuid.version = binding->object_version; + tower->floors[0].rhs.uuid.unknown = 0; /* Floor 1 */ - (*tower)->floors[1].lhs.protocol = EPM_PROTOCOL_UUID; - (*tower)->floors[1].lhs.info.uuid.version = NDR_GUID_VERSION; - status = GUID_from_string(NDR_GUID, &(*tower)->floors[1].lhs.info.uuid.uuid); + tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID; + tower->floors[1].lhs.info.uuid.version = NDR_GUID_VERSION; + tower->floors[1].rhs.uuid.unknown = 0; + status = GUID_from_string(NDR_GUID, &tower->floors[1].lhs.info.uuid.uuid); if (NT_STATUS_IS_ERR(status)) { return status; } /* Floor 2 to num_protocols */ for (i = 0; i < num_protocols; i++) { - (*tower)->floors[2 + i].lhs.protocol = protseq[i]; - ZERO_STRUCT((*tower)->floors[2 + i].rhs); + tower->floors[2 + i].lhs.protocol = protseq[i]; + tower->floors[2 + i].lhs.info.lhs_data = data_blob_talloc(mem_ctx, NULL, 0); + ZERO_STRUCT(tower->floors[2 + i].rhs); } /* The top floor contains the endpoint */ if (num_protocols >= 1 && binding->options && binding->options[0]) { - status = floor_set_rhs_data(mem_ctx, &(*tower)->floors[2 + num_protocols - 1], binding->options[0]); + status = floor_set_rhs_data(mem_ctx, &tower->floors[2 + num_protocols - 1], binding->options[0]); if (NT_STATUS_IS_ERR(status)) { return status; } @@ -719,7 +719,7 @@ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding * /* The second-to-top floor contains the network address */ if (num_protocols >= 2 && binding->host) { - status = floor_set_rhs_data(mem_ctx, &(*tower)->floors[2 + num_protocols - 2], binding->host); + status = floor_set_rhs_data(mem_ctx, &tower->floors[2 + num_protocols - 2], binding->host); if (NT_STATUS_IS_ERR(status)) { return status; } diff --git a/source4/rpc_server/dcerpc_tcp.c b/source4/rpc_server/dcerpc_tcp.c index de8b5bc069..adfddae14f 100644 --- a/source4/rpc_server/dcerpc_tcp.c +++ b/source4/rpc_server/dcerpc_tcp.c @@ -70,7 +70,7 @@ static void add_socket_rpc(struct server_service *service, if (e->ep_description.options && e->ep_description.options[0]) port = atoi(e->ep_description.options[0]); - sock = service_setup_socket(service,model_ops, ip_str, &port); + sock = service_setup_socket(service,model_ops, "ipv4", ip_str, &port); if (!sock) { DEBUG(0,("service_setup_socket(port=%u) failed\n",port)); continue; diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index 28ca4d880a..97df603517 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -693,7 +693,7 @@ static void add_socket(struct server_service *service, for (i=0;ports[i];i++) { uint16_t port = atoi(ports[i]); if (port == 0) continue; - service_setup_socket(service, model_ops, ip_str, &port); + service_setup_socket(service, model_ops, "ipv4", ip_str, &port); } talloc_free(ip_str); diff --git a/source4/smbd/service.c b/source4/smbd/service.c index d4ba9c990c..ac46992261 100644 --- a/source4/smbd/service.c +++ b/source4/smbd/service.c @@ -88,6 +88,7 @@ struct server_context *server_service_startup(const char *model) */ struct server_socket *service_setup_socket(struct server_service *service, const struct model_ops *model_ops, + const char *family, const char *sock_addr, uint16_t *port) { @@ -97,7 +98,7 @@ struct server_socket *service_setup_socket(struct server_service *service, struct fd_event fde; int i; - status = socket_create("ipv4", SOCKET_TYPE_STREAM, &socket_ctx, 0); + status = socket_create(family, SOCKET_TYPE_STREAM, &socket_ctx, 0); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to open socket on %s:%u - %s\n", sock_addr, *port, nt_errstr(status))); diff --git a/source4/torture/local/binding_string.c b/source4/torture/local/binding_string.c index 7ec9a30d24..6522449e64 100644 --- a/source4/torture/local/binding_string.c +++ b/source4/torture/local/binding_string.c @@ -26,7 +26,7 @@ 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 +56,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; diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c index db372f85bb..3fbee64da1 100644 --- a/source4/torture/rpc/epmapper.c +++ b/source4/torture/rpc/epmapper.c @@ -78,7 +78,7 @@ static void display_tower(TALLOC_CTX *mem_ctx, struct epm_tower *twr) break; case EPM_PROTOCOL_UNIX_DS: - printf(" Unix Domain Socket:%s", rhs->unix_ds.path); + printf(" Unix:%s", rhs->unix_ds.path); break; case EPM_PROTOCOL_NETBIOS: |