diff options
author | Gregor Beck <gbeck@sernet.de> | 2011-10-06 15:26:32 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-10-12 22:45:53 +0200 |
commit | 6648d906525cf27228145c8723e3dbef67dd77bd (patch) | |
tree | c0f1996dde8dab25d7037e78c45d0b98da3fb656 | |
parent | da85f5a43ea427ce49f9eb5abc1aef3c3491b059 (diff) | |
download | samba-6648d906525cf27228145c8723e3dbef67dd77bd.tar.gz samba-6648d906525cf27228145c8723e3dbef67dd77bd.tar.bz2 samba-6648d906525cf27228145c8723e3dbef67dd77bd.zip |
s3:smbcontrol: let smbd pass the idmap msg to its children for convenience
Signed-off-by: Michael Adam <obnox@samba.org>
-rw-r--r-- | source3/lib/id_cache.c | 24 | ||||
-rw-r--r-- | source3/lib/id_cache.h | 12 | ||||
-rw-r--r-- | source3/smbd/msg_idmap.c | 35 | ||||
-rw-r--r-- | source3/smbd/proto.h | 2 | ||||
-rw-r--r-- | source3/smbd/server.c | 3 |
5 files changed, 60 insertions, 16 deletions
diff --git a/source3/lib/id_cache.c b/source3/lib/id_cache.c index e71934d6e3..23dcce1eb4 100644 --- a/source3/lib/id_cache.c +++ b/source3/lib/id_cache.c @@ -161,11 +161,11 @@ void id_cache_delete_from_cache(const struct id_cache_ref* id) } -static void id_cache_flush(struct messaging_context *msg_ctx, - void* private_data, - uint32_t msg_type, - struct server_id server_id, - DATA_BLOB* data) +void id_cache_flush_message(struct messaging_context *msg_ctx, + void* private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB* data) { const char *msg = data ? (const char *)data->data : NULL; @@ -181,11 +181,11 @@ static void id_cache_flush(struct messaging_context *msg_ctx, } } -static void id_cache_delete(struct messaging_context *msg_ctx, - void *private_data, - uint32_t msg_type, - struct server_id server_id, - DATA_BLOB* data) +void id_cache_delete_message(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB* data) { const char *msg = (data && data->data) ? (const char *)data->data : "<NULL>"; struct id_cache_ref id; @@ -200,6 +200,6 @@ static void id_cache_delete(struct messaging_context *msg_ctx, void id_cache_register_msgs(struct messaging_context *ctx) { - messaging_register(ctx, NULL, ID_CACHE_FLUSH, id_cache_flush); - messaging_register(ctx, NULL, ID_CACHE_DELETE, id_cache_delete); + messaging_register(ctx, NULL, ID_CACHE_FLUSH, id_cache_flush_message); + messaging_register(ctx, NULL, ID_CACHE_DELETE, id_cache_delete_message); } diff --git a/source3/lib/id_cache.h b/source3/lib/id_cache.h index 00fd2853c9..53731b55f5 100644 --- a/source3/lib/id_cache.h +++ b/source3/lib/id_cache.h @@ -32,3 +32,15 @@ bool id_cache_ref_parse(const char* str, struct id_cache_ref* id); void id_cache_delete_from_cache(const struct id_cache_ref* id); void id_cache_register_msgs(struct messaging_context *ctx); + +void id_cache_delete_message(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB* data); + +void id_cache_flush_message(struct messaging_context *msg_ctx, + void* private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB* data); diff --git a/source3/smbd/msg_idmap.c b/source3/smbd/msg_idmap.c index cb8fbcd42f..757cac0e3f 100644 --- a/source3/smbd/msg_idmap.c +++ b/source3/smbd/msg_idmap.c @@ -129,13 +129,46 @@ static void id_cache_kill(struct messaging_context *msg_ctx, return; } + if (am_parent) { + messaging_send_to_children(msg_ctx, msg_type, data); + } + if (id_in_use(validated_users, &id)) { exit_server_cleanly(msg); } id_cache_delete_from_cache(&id); } -void id_cache_register_kill_msg(struct messaging_context *ctx) +static void id_cache_flush(struct messaging_context *ctx, + void* data, + uint32_t msg_type, + struct server_id srv_id, + DATA_BLOB* msg_data) +{ + id_cache_flush_message(ctx, data, msg_type, srv_id, msg_data); + + if (am_parent) { + messaging_send_to_children(ctx, msg_type, msg_data); + } +} + +static void id_cache_delete(struct messaging_context *ctx, + void* data, + uint32_t msg_type, + struct server_id srv_id, + DATA_BLOB* msg_data) +{ + id_cache_delete_message(ctx, data, msg_type, srv_id, msg_data); + + if (am_parent) { + messaging_send_to_children(ctx, msg_type, msg_data); + } +} + + +void msg_idmap_register_msg(struct messaging_context *ctx) { + messaging_register(ctx, NULL, ID_CACHE_FLUSH, id_cache_flush); + messaging_register(ctx, NULL, ID_CACHE_DELETE, id_cache_delete); messaging_register(ctx, NULL, ID_CACHE_KILL, id_cache_kill); } diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 40281804cc..b3183d778d 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -1189,6 +1189,6 @@ void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev, /* The following definitions come from smbd/msg_idmap.c */ -void id_cache_register_kill_msg(struct messaging_context *ctx); +void msg_idmap_register_msg(struct messaging_context *ctx); #endif /* _SMBD_PROTO_H_ */ diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 7771c85784..e47187a697 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -759,8 +759,7 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent, smb_pcap_updated); brl_register_msgs(msg_ctx); - id_cache_register_msgs(msg_ctx); - id_cache_register_kill_msg(msg_ctx); + msg_idmap_register_msg(msg_ctx); #ifdef CLUSTER_SUPPORT if (lp_clustering()) { |