1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-07 12:23:51 +03:00

r3209: - Create directory for ncalrpc with correct mode

- Support binding strings like :

ncacn_np:[sign]
ncacn_np:myhost[seal,sign,endpoint]

again
This commit is contained in:
Jelmer Vernooij
2004-10-25 10:21:41 +00:00
committed by Gerald (Jerry) Carter
parent adbfd206f4
commit b53f4cd169
3 changed files with 17 additions and 10 deletions

View File

@@ -403,6 +403,7 @@ NTSTATUS dcerpc_pipe_open_unix_stream(struct dcerpc_pipe **p,
strncpy(sa.sun_path, path, sizeof(sa.sun_path)); strncpy(sa.sun_path, path, sizeof(sa.sun_path));
if (connect(fd, &sa, sizeof(sa)) < 0) { if (connect(fd, &sa, sizeof(sa)) < 0) {
DEBUG(0, ("Unable to connect to unix socket %s: %s\n", path, strerror(errno)));
return NT_STATUS_BAD_NETWORK_NAME; return NT_STATUS_BAD_NETWORK_NAME;
} }
@@ -487,6 +488,7 @@ NTSTATUS dcerpc_pipe_open_pipe(struct dcerpc_pipe **p,
strncpy(sa.sun_path, full_path, sizeof(sa.sun_path)); strncpy(sa.sun_path, full_path, sizeof(sa.sun_path));
if (connect(fd, &sa, sizeof(sa)) < 0) { if (connect(fd, &sa, sizeof(sa)) < 0) {
DEBUG(0, ("Unable to connect to unix socket %s (%s): %s\n", full_path, identifier, strerror(errno)));
return NT_STATUS_BAD_NETWORK_NAME; return NT_STATUS_BAD_NETWORK_NAME;
} }

View File

@@ -220,6 +220,7 @@ const char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_bindi
s = talloc_asprintf_append(s, ",%s", b->options[i]); s = talloc_asprintf_append(s, ",%s", b->options[i]);
if (!s) return NULL; if (!s) return NULL;
} }
for (i=0;i<ARRAY_SIZE(ncacn_options);i++) { for (i=0;i<ARRAY_SIZE(ncacn_options);i++) {
if (b->flags & ncacn_options[i].flag) { if (b->flags & ncacn_options[i].flag) {
s = talloc_asprintf_append(s, ",%s", ncacn_options[i].name); s = talloc_asprintf_append(s, ",%s", ncacn_options[i].name);
@@ -325,14 +326,6 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_
b->options[i] = options; b->options[i] = options;
b->options[i+1] = NULL; b->options[i+1] = NULL;
/* Endpoint is first option */
b->endpoint = b->options[0];
if (strlen(b->endpoint) == 0) b->endpoint = NULL;
for (i=0;b->options[i];i++) {
b->options[i] = b->options[i+1];
}
/* some options are pre-parsed for convenience */ /* some options are pre-parsed for convenience */
for (i=0;b->options[i];i++) { for (i=0;b->options[i];i++) {
for (j=0;j<ARRAY_SIZE(ncacn_options);j++) { for (j=0;j<ARRAY_SIZE(ncacn_options);j++) {
@@ -348,6 +341,16 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_
} }
} }
if (b->options[0]) {
/* Endpoint is first option */
b->endpoint = b->options[0];
if (strlen(b->endpoint) == 0) b->endpoint = NULL;
for (i=0;b->options[i];i++) {
b->options[i] = b->options[i+1];
}
}
if (b->options[0] == NULL) if (b->options[0] == NULL)
b->options = NULL; b->options = NULL;

View File

@@ -90,8 +90,10 @@ static void add_socket_rpc_ncalrpc(struct server_service *service,
char *full_path; char *full_path;
if (!e->ep_description.endpoint) { if (!e->ep_description.endpoint) {
/* No identifier specified: generate one */ /* No identifier specified: use DEFAULT.
e->ep_description.endpoint = generate_random_str(dce_ctx, 10); * DO NOT hardcode this value anywhere else. Rather, specify
* no endpoint and let the epmapper worry about it. */
e->ep_description.endpoint = talloc_strdup(dce_ctx, "DEFAULT");
} }
full_path = talloc_asprintf(dce_ctx, "%s/%s", lp_ncalrpc_dir(), e->ep_description.endpoint); full_path = talloc_asprintf(dce_ctx, "%s/%s", lp_ncalrpc_dir(), e->ep_description.endpoint);