summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-08-09 22:15:23 +0200
committerStefan Metzmacher <metze@samba.org>2011-08-10 11:14:55 +0200
commitc6a3dedd99b57345af1b51bad560709319ec8caa (patch)
tree2175d5aee3f7078eb080cff13032241f6121bc8c /source3
parenta7265675d5cd41f05a0ebaba43ad36a389419db2 (diff)
downloadsamba-c6a3dedd99b57345af1b51bad560709319ec8caa.tar.gz
samba-c6a3dedd99b57345af1b51bad560709319ec8caa.tar.bz2
samba-c6a3dedd99b57345af1b51bad560709319ec8caa.zip
s3:libsmb: store the remote_realm on the cli_state
metze
Diffstat (limited to 'source3')
-rw-r--r--source3/include/client.h1
-rw-r--r--source3/libsmb/cliconnect.c2
-rw-r--r--source3/libsmb/clientgen.c13
-rw-r--r--source3/libsmb/proto.h2
-rw-r--r--source3/winbindd/winbindd_cm.c4
5 files changed, 20 insertions, 2 deletions
diff --git a/source3/include/client.h b/source3/include/client.h
index a4d43218e6..f44e52f8f6 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -124,6 +124,7 @@ struct cli_state {
struct sockaddr_storage local_ss;
struct sockaddr_storage remote_ss;
const char *remote_name;
+ const char *remote_realm;
struct tevent_req *read_smb_req;
struct tevent_queue *outgoing;
struct tevent_req **pending;
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index d91d241eaf..f9e845d4e0 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -2871,7 +2871,7 @@ NTSTATUS cli_connect_nb(const char *host, const struct sockaddr_storage *dest_ss
goto fail;
}
- cli = cli_state_create(NULL, fd, desthost, signing_state);
+ cli = cli_state_create(NULL, fd, desthost, NULL, signing_state);
if (cli == NULL) {
goto fail;
}
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index f9bb781980..4689c7aa63 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -164,6 +164,7 @@ NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char
struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
int fd,
const char *remote_name,
+ const char *remote_realm,
int signing_state)
{
struct cli_state *cli = NULL;
@@ -243,6 +244,13 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
goto error;
}
+ if (remote_realm) {
+ cli->conn.remote_realm = talloc_strdup(cli, remote_realm);
+ if (cli->conn.remote_realm == NULL) {
+ goto error;
+ }
+ }
+
cli->conn.fd = fd;
ss_length = sizeof(cli->conn.local_ss);
@@ -381,6 +389,11 @@ const char *cli_state_remote_name(struct cli_state *cli)
return cli->conn.remote_name;
}
+const char *cli_state_remote_realm(struct cli_state *cli)
+{
+ return cli->conn.remote_realm;
+}
+
uint16_t cli_state_get_vc_num(struct cli_state *cli)
{
return cli->smb1.vc_num;
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index b38903aebb..b1ffb4ff39 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -162,6 +162,7 @@ NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char
struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
int fd,
const char *remote_name,
+ const char *remote_realm,
int signing_state);
bool cli_state_encryption_on(struct cli_state *cli);
void cli_nt_pipes_close(struct cli_state *cli);
@@ -170,6 +171,7 @@ void cli_sockopt(struct cli_state *cli, const char *options);
const struct sockaddr_storage *cli_state_local_sockaddr(struct cli_state *cli);
const struct sockaddr_storage *cli_state_remote_sockaddr(struct cli_state *cli);
const char *cli_state_remote_name(struct cli_state *cli);
+const char *cli_state_remote_realm(struct cli_state *cli);
uint16_t cli_state_get_vc_num(struct cli_state *cli);
uint16 cli_setpid(struct cli_state *cli, uint16 pid);
uint16_t cli_getpid(struct cli_state *cli);
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 26cd8bc0c2..00acc0ee20 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -806,7 +806,9 @@ static NTSTATUS cm_prepare_connection(const struct winbindd_domain *domain,
goto done;
}
- *cli = cli_state_create(NULL, sockfd, controller, Undefined);
+ *cli = cli_state_create(NULL, sockfd,
+ controller, domain->alt_name,
+ Undefined);
if (*cli == NULL) {
DEBUG(1, ("Could not cli_initialize\n"));
result = NT_STATUS_NO_MEMORY;