diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-11-01 22:42:09 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-11-01 22:42:09 +0100 |
commit | 9293c59e25195b0d84b13a2a7adc1974adab98a6 (patch) | |
tree | bd6f5207860b260cc15d1d82ad2bb7acbbd12cb3 | |
parent | 57a60f0920e77e26a3ce7f5d43540904ee4cbd8e (diff) | |
download | samba-9293c59e25195b0d84b13a2a7adc1974adab98a6.tar.gz |
Move calls to lp_* higher up in the call stack.
-rw-r--r-- | source4/libcli/smb2/connect.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c index 67d98cfeaf2..757a816f9b6 100644 --- a/source4/libcli/smb2/connect.c +++ b/source4/libcli/smb2/connect.c @@ -33,6 +33,8 @@ struct smb2_connect_state { struct resolve_context *resolve_ctx; const char *host; const char *share; + const char **ports; + const char *socket_options; struct smbcli_options options; struct smb2_negprot negprot; struct smb2_tree_connect tcon; @@ -208,15 +210,16 @@ static void continue_resolve(struct composite_context *creq) const char **ports; const char *default_ports[] = { "445", NULL }; - ports = lp_parm_string_list(state, global_loadparm, NULL, "smb2", "ports", NULL); - if (ports == NULL) { - ports = default_ports; - } - c->status = resolve_name_recv(creq, state, &addr); if (!composite_is_ok(c)) return; - creq = smbcli_sock_connect_send(state, addr, ports, state->host, state->resolve_ctx, c->event_ctx, lp_socket_options(global_loadparm)); + if (state->ports == NULL) { + ports = default_ports; + } else { + ports = state->ports; + } + + creq = smbcli_sock_connect_send(state, addr, ports, state->host, state->resolve_ctx, c->event_ctx, state->socket_options); composite_continue(c, creq, continue_socket, c); } @@ -237,6 +240,7 @@ struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx, struct smb2_connect_state *state; struct nbt_name name; struct composite_context *creq; + const char **ports; c = composite_create(mem_ctx, ev); if (c == NULL) return NULL; @@ -249,9 +253,14 @@ struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx, state->options = *options; state->host = talloc_strdup(c, host); if (composite_nomem(state->host, c)) return c; + state->ports = lp_parm_string_list(state, global_loadparm, + NULL, "smb2", "ports", NULL); + if (composite_nomem(state->ports, c)) return c; state->share = talloc_strdup(c, share); if (composite_nomem(state->share, c)) return c; state->resolve_ctx = talloc_reference(state, resolve_ctx); + state->socket_options = lp_socket_options(global_loadparm); + if (composite_nomem(state->socket_options, c)) return c; ZERO_STRUCT(name); name.name = host; |