summaryrefslogtreecommitdiff
path: root/source3/smbd/sesssetup.c
diff options
context:
space:
mode:
authorGregor Beck <gbeck@sernet.de>2012-08-28 14:29:51 +0200
committerMichael Adam <obnox@samba.org>2012-10-19 12:15:00 +0200
commitf588704640868a003d901b57045511623e6a1f69 (patch)
tree4056d7413cc96a64c39100aeb13f990c7c84e7d2 /source3/smbd/sesssetup.c
parentbcfa721a36269d4390ae5ce747cfd3dff6a255ac (diff)
downloadsamba-f588704640868a003d901b57045511623e6a1f69.tar.gz
samba-f588704640868a003d901b57045511623e6a1f69.tar.bz2
samba-f588704640868a003d901b57045511623e6a1f69.zip
s3:smbd:setup_new_vc_session: traverse sessions instead of connections to shutdown other smbds
Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/smbd/sesssetup.c')
-rw-r--r--source3/smbd/sesssetup.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index aad122cbc5..890189cb34 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -488,36 +488,43 @@ struct shutdown_state {
struct messaging_context *msg_ctx;
};
-static int shutdown_other_smbds(const struct connections_key *key,
- const struct connections_data *crec,
+static int shutdown_other_smbds(struct smbXsrv_session_global0 *session,
void *private_data)
{
struct shutdown_state *state = (struct shutdown_state *)private_data;
struct server_id self_pid = messaging_server_id(state->msg_ctx);
+ struct server_id pid = session->channels[0].server_id;
+ const char *addr = session->channels[0].remote_address;
DEBUG(10, ("shutdown_other_smbds: %s, %s\n",
- server_id_str(talloc_tos(), &crec->pid), crec->addr));
+ server_id_str(talloc_tos(), &pid), addr));
- if (!process_exists(crec->pid)) {
+ if (!process_exists(pid)) {
DEBUG(10, ("process does not exist\n"));
return 0;
}
- if (serverid_equal(&crec->pid, &self_pid)) {
+ if (serverid_equal(&pid, &self_pid)) {
DEBUG(10, ("It's me\n"));
return 0;
}
- if (strcmp(state->ip, crec->addr) != 0) {
- DEBUG(10, ("%s does not match %s\n", state->ip, crec->addr));
+ /*
+ * here we use strstr() because 'addr'
+ * (session->channels[0].remote_address)
+ * contains a string like:
+ * 'ipv4:127.0.0.1:48163'
+ */
+ if (strstr(addr, state->ip) == NULL) {
+ DEBUG(10, ("%s does not match %s\n", state->ip, addr));
return 0;
}
DEBUG(1, ("shutdown_other_smbds: shutting down pid %u "
- "(IP %s)\n", (unsigned int)procid_to_pid(&crec->pid),
+ "(IP %s)\n", (unsigned int)procid_to_pid(&pid),
state->ip));
- messaging_send(state->msg_ctx, crec->pid, MSG_SHUTDOWN,
+ messaging_send(state->msg_ctx, pid, MSG_SHUTDOWN,
&data_blob_null);
return 0;
}
@@ -541,7 +548,7 @@ static void setup_new_vc_session(struct smbd_server_connection *sconn)
}
state.ip = addr;
state.msg_ctx = sconn->msg_ctx;
- connections_forall_read(shutdown_other_smbds, &state);
+ smbXsrv_session_global_traverse(shutdown_other_smbds, &state);
TALLOC_FREE(addr);
}
}