mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
lib: Remove unused serverid.tdb
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Dec 5 04:58:26 CET 2017 on sn-devel-144
This commit is contained in:
parent
6423ca4bf2
commit
41cfc737df
@ -21,60 +21,11 @@
|
||||
#define __SERVERID_H__
|
||||
|
||||
#include "replace.h"
|
||||
#include "lib/dbwrap/dbwrap.h"
|
||||
#include "librpc/gen_ndr/server_id.h"
|
||||
|
||||
/* Flags to classify messages - used in message_send_all() */
|
||||
/* Sender will filter by flag. */
|
||||
|
||||
#define FLAG_MSG_GENERAL 0x0001
|
||||
#define FLAG_MSG_SMBD 0x0002
|
||||
#define FLAG_MSG_NMBD 0x0004
|
||||
#define FLAG_MSG_WINBIND 0x0008
|
||||
#define FLAG_MSG_PRINT_GENERAL 0x0010
|
||||
/* dbwrap messages 4001-4999 */
|
||||
#define FLAG_MSG_DBWRAP 0x0020
|
||||
|
||||
/*
|
||||
* Register a server with its unique id
|
||||
*/
|
||||
bool serverid_register(const struct server_id id, uint32_t msg_flags);
|
||||
|
||||
/*
|
||||
* De-register a server with its unique id
|
||||
*/
|
||||
bool serverid_deregister(const struct server_id id);
|
||||
|
||||
/*
|
||||
* Check existence of a server id
|
||||
*/
|
||||
bool serverid_exists(const struct server_id *id);
|
||||
|
||||
/*
|
||||
* Walk the list of server_ids registered
|
||||
*/
|
||||
bool serverid_traverse(int (*fn)(struct db_record *rec,
|
||||
const struct server_id *id,
|
||||
uint32_t msg_flags,
|
||||
void *private_data),
|
||||
void *private_data);
|
||||
|
||||
/*
|
||||
* Walk the list of server_ids registered read-only
|
||||
*/
|
||||
bool serverid_traverse_read(int (*fn)(const struct server_id *id,
|
||||
uint32_t msg_flags,
|
||||
void *private_data),
|
||||
void *private_data);
|
||||
/*
|
||||
* Ensure CLEAR_IF_FIRST works fine, to be called from the parent smbd
|
||||
*/
|
||||
bool serverid_parent_init(TALLOC_CTX *mem_ctx);
|
||||
|
||||
struct messaging_context;
|
||||
|
||||
bool message_send_all(struct messaging_context *msg_ctx,
|
||||
int msg_type,
|
||||
const void *buf, size_t len);
|
||||
|
||||
#endif
|
||||
|
@ -18,157 +18,13 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "system/filesys.h"
|
||||
#include "lib/util/server_id.h"
|
||||
#include "serverid.h"
|
||||
#include "util_tdb.h"
|
||||
#include "dbwrap/dbwrap.h"
|
||||
#include "dbwrap/dbwrap_open.h"
|
||||
#include "lib/tdb_wrap/tdb_wrap.h"
|
||||
#include "lib/param/param.h"
|
||||
#include "ctdbd_conn.h"
|
||||
#include "messages.h"
|
||||
#include "lib/messages_ctdb.h"
|
||||
#include "lib/messages_dgm.h"
|
||||
|
||||
struct serverid_key {
|
||||
pid_t pid;
|
||||
uint32_t task_id;
|
||||
uint32_t vnn;
|
||||
};
|
||||
|
||||
struct serverid_data {
|
||||
uint64_t unique_id;
|
||||
uint32_t msg_flags;
|
||||
};
|
||||
|
||||
static struct db_context *serverid_db(void)
|
||||
{
|
||||
static struct db_context *db;
|
||||
char *db_path;
|
||||
|
||||
if (db != NULL) {
|
||||
return db;
|
||||
}
|
||||
|
||||
db_path = lock_path("serverid.tdb");
|
||||
if (db_path == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
db = db_open(NULL, db_path, 0,
|
||||
TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
|
||||
O_RDWR|O_CREAT, 0644, DBWRAP_LOCK_ORDER_2,
|
||||
DBWRAP_FLAG_NONE);
|
||||
TALLOC_FREE(db_path);
|
||||
return db;
|
||||
}
|
||||
|
||||
bool serverid_parent_init(TALLOC_CTX *mem_ctx)
|
||||
{
|
||||
struct db_context *db;
|
||||
|
||||
db = serverid_db();
|
||||
if (db == NULL) {
|
||||
DEBUG(1, ("could not open serverid.tdb: %s\n",
|
||||
strerror(errno)));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void serverid_fill_key(const struct server_id *id,
|
||||
struct serverid_key *key)
|
||||
{
|
||||
ZERO_STRUCTP(key);
|
||||
key->pid = id->pid;
|
||||
key->task_id = id->task_id;
|
||||
key->vnn = id->vnn;
|
||||
}
|
||||
|
||||
bool serverid_register(const struct server_id id, uint32_t msg_flags)
|
||||
{
|
||||
struct db_context *db;
|
||||
struct serverid_key key;
|
||||
struct serverid_data data;
|
||||
struct db_record *rec;
|
||||
TDB_DATA tdbkey, tdbdata;
|
||||
NTSTATUS status;
|
||||
bool ret = false;
|
||||
|
||||
db = serverid_db();
|
||||
if (db == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
serverid_fill_key(&id, &key);
|
||||
tdbkey = make_tdb_data((uint8_t *)&key, sizeof(key));
|
||||
|
||||
rec = dbwrap_fetch_locked(db, talloc_tos(), tdbkey);
|
||||
if (rec == NULL) {
|
||||
DEBUG(1, ("Could not fetch_lock serverid.tdb record\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
ZERO_STRUCT(data);
|
||||
data.unique_id = id.unique_id;
|
||||
data.msg_flags = msg_flags;
|
||||
|
||||
tdbdata = make_tdb_data((uint8_t *)&data, sizeof(data));
|
||||
status = dbwrap_record_store(rec, tdbdata, 0);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(1, ("Storing serverid.tdb record failed: %s\n",
|
||||
nt_errstr(status)));
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (lp_clustering()) {
|
||||
register_with_ctdbd(messaging_ctdb_connection(), id.unique_id,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
ret = true;
|
||||
done:
|
||||
TALLOC_FREE(rec);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool serverid_deregister(struct server_id id)
|
||||
{
|
||||
struct db_context *db;
|
||||
struct serverid_key key;
|
||||
struct db_record *rec;
|
||||
TDB_DATA tdbkey;
|
||||
NTSTATUS status;
|
||||
bool ret = false;
|
||||
|
||||
db = serverid_db();
|
||||
if (db == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
serverid_fill_key(&id, &key);
|
||||
tdbkey = make_tdb_data((uint8_t *)&key, sizeof(key));
|
||||
|
||||
rec = dbwrap_fetch_locked(db, talloc_tos(), tdbkey);
|
||||
if (rec == NULL) {
|
||||
DEBUG(1, ("Could not fetch_lock serverid.tdb record\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
status = dbwrap_record_delete(rec);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(1, ("Deleting serverid.tdb record failed: %s\n",
|
||||
nt_errstr(status)));
|
||||
goto done;
|
||||
}
|
||||
ret = true;
|
||||
done:
|
||||
TALLOC_FREE(rec);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool serverid_exists_local(const struct server_id *id)
|
||||
{
|
||||
bool exists = process_exists_by_pid(id->pid);
|
||||
@ -204,203 +60,3 @@ bool serverid_exists(const struct server_id *id)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool serverid_rec_parse(const struct db_record *rec,
|
||||
struct server_id *id, uint32_t *msg_flags)
|
||||
{
|
||||
struct serverid_key key;
|
||||
struct serverid_data data;
|
||||
TDB_DATA tdbkey;
|
||||
TDB_DATA tdbdata;
|
||||
|
||||
tdbkey = dbwrap_record_get_key(rec);
|
||||
tdbdata = dbwrap_record_get_value(rec);
|
||||
|
||||
if (tdbkey.dsize != sizeof(key)) {
|
||||
DEBUG(1, ("Found invalid key length %d in serverid.tdb\n",
|
||||
(int)tdbkey.dsize));
|
||||
return false;
|
||||
}
|
||||
if (tdbdata.dsize != sizeof(data)) {
|
||||
DEBUG(1, ("Found invalid value length %d in serverid.tdb\n",
|
||||
(int)tdbdata.dsize));
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(&key, tdbkey.dptr, sizeof(key));
|
||||
memcpy(&data, tdbdata.dptr, sizeof(data));
|
||||
|
||||
id->pid = key.pid;
|
||||
id->task_id = key.task_id;
|
||||
id->vnn = key.vnn;
|
||||
id->unique_id = data.unique_id;
|
||||
*msg_flags = data.msg_flags;
|
||||
return true;
|
||||
}
|
||||
|
||||
struct serverid_traverse_read_state {
|
||||
int (*fn)(const struct server_id *id, uint32_t msg_flags,
|
||||
void *private_data);
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
static int serverid_traverse_read_fn(struct db_record *rec, void *private_data)
|
||||
{
|
||||
struct serverid_traverse_read_state *state =
|
||||
(struct serverid_traverse_read_state *)private_data;
|
||||
struct server_id id;
|
||||
uint32_t msg_flags;
|
||||
|
||||
if (!serverid_rec_parse(rec, &id, &msg_flags)) {
|
||||
return 0;
|
||||
}
|
||||
return state->fn(&id, msg_flags,state->private_data);
|
||||
}
|
||||
|
||||
bool serverid_traverse_read(int (*fn)(const struct server_id *id,
|
||||
uint32_t msg_flags, void *private_data),
|
||||
void *private_data)
|
||||
{
|
||||
struct db_context *db;
|
||||
struct serverid_traverse_read_state state;
|
||||
NTSTATUS status;
|
||||
|
||||
db = serverid_db();
|
||||
if (db == NULL) {
|
||||
return false;
|
||||
}
|
||||
state.fn = fn;
|
||||
state.private_data = private_data;
|
||||
|
||||
status = dbwrap_traverse_read(db, serverid_traverse_read_fn, &state,
|
||||
NULL);
|
||||
return NT_STATUS_IS_OK(status);
|
||||
}
|
||||
|
||||
struct serverid_traverse_state {
|
||||
int (*fn)(struct db_record *rec, const struct server_id *id,
|
||||
uint32_t msg_flags, void *private_data);
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
static int serverid_traverse_fn(struct db_record *rec, void *private_data)
|
||||
{
|
||||
struct serverid_traverse_state *state =
|
||||
(struct serverid_traverse_state *)private_data;
|
||||
struct server_id id;
|
||||
uint32_t msg_flags;
|
||||
|
||||
if (!serverid_rec_parse(rec, &id, &msg_flags)) {
|
||||
return 0;
|
||||
}
|
||||
return state->fn(rec, &id, msg_flags, state->private_data);
|
||||
}
|
||||
|
||||
bool serverid_traverse(int (*fn)(struct db_record *rec,
|
||||
const struct server_id *id,
|
||||
uint32_t msg_flags, void *private_data),
|
||||
void *private_data)
|
||||
{
|
||||
struct db_context *db;
|
||||
struct serverid_traverse_state state;
|
||||
NTSTATUS status;
|
||||
|
||||
db = serverid_db();
|
||||
if (db == NULL) {
|
||||
return false;
|
||||
}
|
||||
state.fn = fn;
|
||||
state.private_data = private_data;
|
||||
|
||||
status = dbwrap_traverse(db, serverid_traverse_fn, &state, NULL);
|
||||
return NT_STATUS_IS_OK(status);
|
||||
}
|
||||
|
||||
struct msg_all {
|
||||
struct messaging_context *msg_ctx;
|
||||
int msg_type;
|
||||
uint32_t msg_flag;
|
||||
const void *buf;
|
||||
size_t len;
|
||||
int n_sent;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
Send one of the messages for the broadcast.
|
||||
****************************************************************************/
|
||||
|
||||
static int traverse_fn(struct db_record *rec, const struct server_id *id,
|
||||
uint32_t msg_flags, void *state)
|
||||
{
|
||||
struct msg_all *msg_all = (struct msg_all *)state;
|
||||
NTSTATUS status;
|
||||
|
||||
/* Don't send if the receiver hasn't registered an interest. */
|
||||
|
||||
if((msg_flags & msg_all->msg_flag) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If the msg send fails because the pid was not found (i.e. smbd died),
|
||||
* the msg has already been deleted from the messages.tdb.*/
|
||||
|
||||
status = messaging_send_buf(msg_all->msg_ctx, *id, msg_all->msg_type,
|
||||
(const uint8_t *)msg_all->buf, msg_all->len);
|
||||
|
||||
if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
|
||||
struct server_id_buf idbuf;
|
||||
|
||||
/*
|
||||
* If the pid was not found delete the entry from
|
||||
* serverid.tdb
|
||||
*/
|
||||
|
||||
DEBUG(2, ("pid %s doesn't exist\n",
|
||||
server_id_str_buf(*id, &idbuf)));
|
||||
|
||||
dbwrap_record_delete(rec);
|
||||
}
|
||||
msg_all->n_sent++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to all smbd processes.
|
||||
*
|
||||
* It isn't very efficient, but should be OK for the sorts of
|
||||
* applications that use it. When we need efficient broadcast we can add
|
||||
* it.
|
||||
*
|
||||
* @retval True for success.
|
||||
**/
|
||||
bool message_send_all(struct messaging_context *msg_ctx,
|
||||
int msg_type,
|
||||
const void *buf, size_t len)
|
||||
{
|
||||
struct msg_all msg_all;
|
||||
|
||||
msg_all.msg_type = msg_type;
|
||||
if (msg_type < 0x100) {
|
||||
msg_all.msg_flag = FLAG_MSG_GENERAL;
|
||||
} else if (msg_type > 0x100 && msg_type < 0x200) {
|
||||
msg_all.msg_flag = FLAG_MSG_NMBD;
|
||||
} else if (msg_type > 0x200 && msg_type < 0x300) {
|
||||
msg_all.msg_flag = FLAG_MSG_PRINT_GENERAL;
|
||||
} else if (msg_type > 0x300 && msg_type < 0x400) {
|
||||
msg_all.msg_flag = FLAG_MSG_SMBD;
|
||||
} else if (msg_type > 0x400 && msg_type < 0x600) {
|
||||
msg_all.msg_flag = FLAG_MSG_WINBIND;
|
||||
} else if (msg_type > 4000 && msg_type < 5000) {
|
||||
msg_all.msg_flag = FLAG_MSG_DBWRAP;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
msg_all.buf = buf;
|
||||
msg_all.len = len;
|
||||
msg_all.n_sent = 0;
|
||||
msg_all.msg_ctx = msg_ctx;
|
||||
|
||||
serverid_traverse(traverse_fn, &msg_all);
|
||||
return true;
|
||||
}
|
||||
|
@ -70,7 +70,6 @@ static void terminate(struct messaging_context *msg)
|
||||
kill_async_dns_child();
|
||||
|
||||
gencache_stabilize();
|
||||
serverid_deregister(messaging_server_id(msg));
|
||||
|
||||
pidfile_unlink(lp_pid_directory(), "nmbd");
|
||||
|
||||
@ -1015,15 +1014,6 @@ static bool open_sockets(bool isdaemon, int port)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* get broadcast messages */
|
||||
|
||||
if (!serverid_register(messaging_server_id(msg),
|
||||
FLAG_MSG_GENERAL |
|
||||
FLAG_MSG_NMBD |
|
||||
FLAG_MSG_DBWRAP)) {
|
||||
exit_daemon("Could not register NMBD process in serverid.tdb", EACCES);
|
||||
}
|
||||
|
||||
messaging_register(msg, NULL, MSG_FORCE_ELECTION,
|
||||
nmbd_message_election);
|
||||
#if 0
|
||||
|
@ -243,10 +243,6 @@ bool nt_printing_init(struct messaging_context *msg_ctx)
|
||||
messaging_register(msg_ctx, NULL, MSG_PRINTER_DRVUPGRADE,
|
||||
forward_drv_upgrade_printer_msg);
|
||||
|
||||
/* of course, none of the message callbacks matter if you don't
|
||||
tell messages.c that you interested in receiving PRINT_GENERAL
|
||||
msgs. This is done in serverid_register() */
|
||||
|
||||
if ( lp_security() == SEC_ADS ) {
|
||||
win_rc = check_published_printers(msg_ctx);
|
||||
if (!W_ERROR_IS_OK(win_rc))
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "printing.h"
|
||||
#include "printing/pcap.h"
|
||||
#include "printing/queue_process.h"
|
||||
#include "serverid.h"
|
||||
#include "locking/proto.h"
|
||||
#include "smbd/smbd.h"
|
||||
#include "rpc_server/rpc_config.h"
|
||||
@ -392,12 +391,6 @@ pid_t start_background_queue(struct tevent_context *ev,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!serverid_register(messaging_server_id(msg_ctx),
|
||||
FLAG_MSG_GENERAL |
|
||||
FLAG_MSG_PRINT_GENERAL)) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!locking_init()) {
|
||||
exit(1);
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "includes.h"
|
||||
#include "serverid.h"
|
||||
#include "smbd/smbd.h"
|
||||
|
||||
#include "messages.h"
|
||||
@ -280,12 +279,6 @@ static bool spoolss_child_init(struct tevent_context *ev_ctx,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!serverid_register(messaging_server_id(msg_ctx),
|
||||
FLAG_MSG_GENERAL |
|
||||
FLAG_MSG_PRINT_GENERAL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!locking_init()) {
|
||||
return false;
|
||||
}
|
||||
@ -694,12 +687,6 @@ pid_t start_spoolssd(struct tevent_context *ev_ctx,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!serverid_register(messaging_server_id(msg_ctx),
|
||||
FLAG_MSG_GENERAL |
|
||||
FLAG_MSG_PRINT_GENERAL)) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!locking_init()) {
|
||||
exit(1);
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
#include "serverid.h"
|
||||
#include "ntdomain.h"
|
||||
#include "messages.h"
|
||||
|
||||
@ -171,14 +170,6 @@ void start_epmd(struct tevent_context *ev_ctx,
|
||||
epmd_setup_sig_term_handler(ev_ctx);
|
||||
epmd_setup_sig_hup_handler(ev_ctx, msg_ctx);
|
||||
|
||||
ok = serverid_register(messaging_server_id(msg_ctx),
|
||||
FLAG_MSG_GENERAL |
|
||||
FLAG_MSG_PRINT_GENERAL);
|
||||
if (!ok) {
|
||||
DEBUG(0, ("Failed to register serverid in epmd!\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
messaging_register(msg_ctx,
|
||||
ev_ctx,
|
||||
MSG_SMB_CONF_UPDATED,
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
#include "serverid.h"
|
||||
#include "ntdomain.h"
|
||||
#include "messages.h"
|
||||
|
||||
@ -182,14 +181,6 @@ void start_fssd(struct tevent_context *ev_ctx,
|
||||
fssd_setup_sig_term_handler(ev_ctx);
|
||||
fssd_setup_sig_hup_handler(ev_ctx, msg_ctx);
|
||||
|
||||
ok = serverid_register(messaging_server_id(msg_ctx),
|
||||
FLAG_MSG_GENERAL |
|
||||
FLAG_MSG_PRINT_GENERAL);
|
||||
if (!ok) {
|
||||
DEBUG(0, ("Failed to register serverid in fssd!\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
messaging_register(msg_ctx,
|
||||
ev_ctx,
|
||||
MSG_SMB_CONF_UPDATED,
|
||||
|
@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "serverid.h"
|
||||
#include "messages.h"
|
||||
#include "ntdomain.h"
|
||||
|
||||
@ -261,11 +260,6 @@ static bool lsasd_child_init(struct tevent_context *ev_ctx,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!serverid_register(messaging_server_id(msg_ctx),
|
||||
FLAG_MSG_GENERAL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
messaging_register(msg_ctx, ev_ctx,
|
||||
MSG_SMB_CONF_UPDATED, lsasd_smb_conf_updated);
|
||||
messaging_register(msg_ctx, ev_ctx,
|
||||
@ -897,11 +891,6 @@ void start_lsasd(struct tevent_context *ev_ctx,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!serverid_register(messaging_server_id(msg_ctx),
|
||||
FLAG_MSG_GENERAL)) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
messaging_register(msg_ctx,
|
||||
ev_ctx,
|
||||
MSG_SMB_CONF_UPDATED,
|
||||
|
@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "serverid.h"
|
||||
#include "messages.h"
|
||||
#include "ntdomain.h"
|
||||
|
||||
@ -219,11 +218,6 @@ static bool mdssd_child_init(struct tevent_context *ev_ctx,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!serverid_register(messaging_server_id(msg_ctx),
|
||||
FLAG_MSG_GENERAL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
messaging_register(msg_ctx, ev_ctx,
|
||||
MSG_SMB_CONF_UPDATED, mdssd_smb_conf_updated);
|
||||
messaging_register(msg_ctx, ev_ctx,
|
||||
@ -686,11 +680,6 @@ void start_mdssd(struct tevent_context *ev_ctx,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!serverid_register(messaging_server_id(msg_ctx),
|
||||
FLAG_MSG_GENERAL)) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
messaging_register(msg_ctx,
|
||||
ev_ctx,
|
||||
MSG_SMB_CONF_UPDATED,
|
||||
|
@ -691,14 +691,6 @@ void reply_negprot(struct smb_request *req)
|
||||
/* possibly reload - change of architecture */
|
||||
reload_services(sconn, conn_snum_used, true);
|
||||
|
||||
/* moved from the netbios session setup code since we don't have that
|
||||
when the client connects to port 445. Of course there is a small
|
||||
window where we are listening to messages -- jerry */
|
||||
|
||||
serverid_register(messaging_server_id(sconn->msg_ctx),
|
||||
FLAG_MSG_GENERAL|FLAG_MSG_SMBD
|
||||
|FLAG_MSG_PRINT_GENERAL);
|
||||
|
||||
/*
|
||||
* Anything higher than PROTOCOL_SMB2_10 still
|
||||
* needs to go via "SMB 2.???", which is marked
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "../libcli/security/security_token.h"
|
||||
#include "lib/id_cache.h"
|
||||
#include "lib/util/sys_rw_data.h"
|
||||
#include "serverid.h"
|
||||
#include "system/threads.h"
|
||||
|
||||
/* Internal message queue for deferred opens. */
|
||||
@ -3947,14 +3946,6 @@ void smbd_process(struct tevent_context *ev_ctx,
|
||||
if (!interactive) {
|
||||
smbd_setup_sig_term_handler(sconn);
|
||||
smbd_setup_sig_hup_handler(sconn);
|
||||
|
||||
if (!serverid_register(messaging_server_id(msg_ctx),
|
||||
FLAG_MSG_GENERAL|FLAG_MSG_SMBD
|
||||
|FLAG_MSG_DBWRAP
|
||||
|FLAG_MSG_PRINT_GENERAL)) {
|
||||
exit_server_cleanly("Could not register myself in "
|
||||
"serverid.tdb");
|
||||
}
|
||||
}
|
||||
|
||||
status = smbd_add_connection(client, sock_fd, &xconn);
|
||||
|
@ -138,7 +138,6 @@ static bool smbd_scavenger_running(struct smbd_scavenger_state *state)
|
||||
|
||||
static int smbd_scavenger_server_id_destructor(struct server_id *id)
|
||||
{
|
||||
serverid_deregister(*id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -256,13 +255,6 @@ static bool smbd_scavenger_start(struct smbd_scavenger_state *state)
|
||||
|
||||
scavenger_setup_sig_term_handler(state->ev);
|
||||
|
||||
if (!serverid_register(*state->scavenger_id,
|
||||
FLAG_MSG_GENERAL)) {
|
||||
DBG_WARNING("serverid_register failed");
|
||||
exit_server("serverid_register failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
ok = scavenger_say_hello(fds[1], *state->scavenger_id);
|
||||
if (!ok) {
|
||||
DEBUG(2, ("scavenger_say_hello failed\n"));
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "printing/queue_process.h"
|
||||
#include "rpc_server/rpc_service_setup.h"
|
||||
#include "rpc_server/rpc_config.h"
|
||||
#include "serverid.h"
|
||||
#include "passdb.h"
|
||||
#include "auth.h"
|
||||
#include "messages.h"
|
||||
@ -1263,21 +1262,6 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Setup the main smbd so that we can get messages. Note that
|
||||
do this after starting listening. This is needed as when in
|
||||
clustered mode, ctdb won't allow us to start doing database
|
||||
operations until it has gone thru a full startup, which
|
||||
includes checking to see that smbd is listening. */
|
||||
|
||||
if (!serverid_register(messaging_server_id(msg_ctx),
|
||||
FLAG_MSG_GENERAL|FLAG_MSG_SMBD
|
||||
|FLAG_MSG_PRINT_GENERAL
|
||||
|FLAG_MSG_DBWRAP)) {
|
||||
DEBUG(0, ("open_sockets_smbd: Failed to register "
|
||||
"myself in serverid.tdb\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Listen to messages */
|
||||
|
||||
messaging_register(msg_ctx, NULL, MSG_SHUTDOWN, msg_exit_server);
|
||||
@ -1986,10 +1970,6 @@ extern void build_options(bool screen);
|
||||
exit_daemon("Samba cannot init scavenging", EACCES);
|
||||
}
|
||||
|
||||
if (!serverid_parent_init(ev_ctx)) {
|
||||
exit_daemon("Samba cannot init server id", EACCES);
|
||||
}
|
||||
|
||||
if (!W_ERROR_IS_OK(registry_init_full()))
|
||||
exit_daemon("Samba cannot init registry", EACCES);
|
||||
|
||||
|
@ -171,14 +171,6 @@ static void exit_server_common(enum server_exit_reason how,
|
||||
/* 3 second timeout. */
|
||||
print_notify_send_messages(msg_ctx, 3);
|
||||
|
||||
/* delete our entry in the serverid database. */
|
||||
if (am_parent) {
|
||||
/*
|
||||
* For children the parent takes care of cleaning up
|
||||
*/
|
||||
serverid_deregister(messaging_server_id(msg_ctx));
|
||||
}
|
||||
|
||||
#ifdef USE_DMAPI
|
||||
/* Destroy Samba DMAPI session only if we are master smbd process */
|
||||
if (am_parent) {
|
||||
|
@ -177,7 +177,6 @@ static void smbd_cleanupd_process_exited(struct messaging_context *msg,
|
||||
child != NULL;
|
||||
child = child->next)
|
||||
{
|
||||
struct server_id child_id;
|
||||
bool ok;
|
||||
|
||||
ok = cleanupdb_delete_child(child->pid);
|
||||
@ -185,14 +184,6 @@ static void smbd_cleanupd_process_exited(struct messaging_context *msg,
|
||||
DBG_ERR("failed to delete pid %d\n", (int)child->pid);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get child_id before messaging_cleanup which wipes
|
||||
* the unique_id. Not that it really matters here for
|
||||
* functionality (the child should have properly
|
||||
* cleaned up :-)) though, but it looks nicer.
|
||||
*/
|
||||
child_id = pid_to_procid(child->pid);
|
||||
|
||||
smbprofile_cleanup(child->pid, state->parent_pid);
|
||||
|
||||
ret = messaging_cleanup(msg, child->pid);
|
||||
@ -202,11 +193,6 @@ static void smbd_cleanupd_process_exited(struct messaging_context *msg,
|
||||
strerror(ret));
|
||||
}
|
||||
|
||||
if (!serverid_deregister(child_id)) {
|
||||
DBG_ERR("Could not remove pid %d from serverid.tdb\n",
|
||||
(int)child->pid);
|
||||
}
|
||||
|
||||
DBG_DEBUG("cleaned up pid %d\n", (int)child->pid);
|
||||
}
|
||||
|
||||
|
@ -527,7 +527,6 @@ int main(int argc, const char *argv[])
|
||||
sec_init();
|
||||
init_guest_info();
|
||||
locking_init();
|
||||
serverid_parent_init(NULL);
|
||||
vfs = talloc_zero(NULL, struct vfs_state);
|
||||
if (vfs == NULL) {
|
||||
return 1;
|
||||
@ -553,7 +552,6 @@ int main(int argc, const char *argv[])
|
||||
vfs->conn->share_access = FILE_GENERIC_ALL;
|
||||
vfs->conn->read_only = false;
|
||||
|
||||
serverid_register(messaging_server_id(vfs->conn->sconn->msg_ctx), 0);
|
||||
file_init(vfs->conn->sconn);
|
||||
for (i=0; i < 1024; i++)
|
||||
vfs->files[i] = NULL;
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "rpc_client/cli_netlogon.h"
|
||||
#include "idmap.h"
|
||||
#include "lib/addrchange.h"
|
||||
#include "serverid.h"
|
||||
#include "auth.h"
|
||||
#include "messages.h"
|
||||
#include "../lib/util/pidfile.h"
|
||||
@ -221,9 +220,6 @@ static void terminate(bool is_parent)
|
||||
#endif
|
||||
|
||||
if (is_parent) {
|
||||
struct messaging_context *msg = server_messaging_context();
|
||||
struct server_id self = messaging_server_id(msg);
|
||||
serverid_deregister(self);
|
||||
pidfile_unlink(lp_pid_directory(), "winbindd");
|
||||
}
|
||||
|
||||
@ -1305,16 +1301,6 @@ static void winbindd_register_handlers(struct messaging_context *msg_ctx,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* get broadcast messages */
|
||||
|
||||
if (!serverid_register(messaging_server_id(msg_ctx),
|
||||
FLAG_MSG_GENERAL |
|
||||
FLAG_MSG_WINBIND |
|
||||
FLAG_MSG_DBWRAP)) {
|
||||
DEBUG(1, ("Could not register myself in serverid.tdb\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* React on 'smbcontrol winbindd reload-config' in the same way
|
||||
as to SIGHUP signal */
|
||||
messaging_register(msg_ctx, NULL,
|
||||
|
Loading…
x
Reference in New Issue
Block a user