/*
* Register a server with its unique id
*/
-bool serverid_register(const struct server_id *id, uint32_t msg_flags);
-
-/*
- * Register ourselves with a unique id
- */
-bool serverid_register_self(uint32_t msg_flags);
+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);
-
-/*
- * De-register ourself
- */
-bool serverid_deregister_self(void);
+bool serverid_deregister(const struct server_id id);
/*
* Check existence of a server id
#endif
}
-bool serverid_register(const struct server_id *id, uint32_t msg_flags)
+bool serverid_register(const struct server_id id, uint32_t msg_flags)
{
struct db_context *db;
struct serverid_key key;
return false;
}
- serverid_fill_key(id, &key);
+ serverid_fill_key(&id, &key);
tdbkey = make_tdb_data((uint8_t *)&key, sizeof(key));
rec = db->fetch_locked(db, talloc_tos(), tdbkey);
}
ZERO_STRUCT(data);
- data.unique_id = id->unique_id;
+ data.unique_id = id.unique_id;
data.msg_flags = msg_flags;
tdbdata = make_tdb_data((uint8_t *)&data, sizeof(data));
return ret;
}
-bool serverid_register_self(uint32_t msg_flags)
-{
- struct server_id pid;
-
- pid = procid_self();
- return serverid_register(&pid, msg_flags);
-}
-
-bool serverid_deregister(const struct server_id *id)
+bool serverid_deregister(struct server_id id)
{
struct db_context *db;
struct serverid_key key;
return false;
}
- serverid_fill_key(id, &key);
+ serverid_fill_key(&id, &key);
tdbkey = make_tdb_data((uint8_t *)&key, sizeof(key));
rec = db->fetch_locked(db, talloc_tos(), tdbkey);
return ret;
}
-bool serverid_deregister_self(void)
-{
- struct server_id pid;
-
- pid = procid_self();
- return serverid_deregister(&pid);
-}
-
struct serverid_exists_state {
const struct server_id *id;
bool exists;
kill_async_dns_child();
gencache_stabilize();
- serverid_deregister_self();
+ serverid_deregister(procid_self());
pidfile_unlink();
/* get broadcast messages */
- if (!serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) {
+ if (!serverid_register(procid_self(),
+ FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) {
DEBUG(1, ("Could not register myself in serverid.tdb\n"));
exit(1);
}
smbd_setup_sig_term_handler();
smbd_setup_sig_hup_handler();
- if (!serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_SMBD
- |FLAG_MSG_PRINT_GENERAL)) {
+ if (!serverid_register(procid_self(),
+ FLAG_MSG_GENERAL|FLAG_MSG_SMBD
+ |FLAG_MSG_PRINT_GENERAL)) {
exit(1);
}
when the client connects to port 445. Of course there is a small
window where we are listening to messages -- jerry */
- serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_SMBD
- |FLAG_MSG_PRINT_GENERAL);
+ serverid_register(procid_self(),
+ FLAG_MSG_GENERAL|FLAG_MSG_SMBD
+ |FLAG_MSG_PRINT_GENERAL);
/* Check for protocols, most desirable first */
for (protocol = 0; supported_protocols[protocol].proto_name; protocol++) {
child_id = procid_self(); /* Just initialize pid and potentially vnn */
child_id.pid = pid;
- if (!serverid_deregister(&child_id)) {
+ if (!serverid_deregister(child_id)) {
DEBUG(1, ("Could not remove pid %d from serverid.tdb\n",
(int)pid));
}
smbd_setup_sig_term_handler();
smbd_setup_sig_hup_handler();
- if (!serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_SMBD
- |FLAG_MSG_DBWRAP
- |FLAG_MSG_PRINT_GENERAL)) {
+ if (!serverid_register(procid_self(),
+ FLAG_MSG_GENERAL|FLAG_MSG_SMBD
+ |FLAG_MSG_DBWRAP
+ |FLAG_MSG_PRINT_GENERAL)) {
exit_server_cleanly("Could not register myself in "
"serverid.tdb");
}
operations until it has gone thru a full startup, which
includes checking to see that smbd is listening. */
- if (!serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_SMBD
- |FLAG_MSG_DBWRAP)) {
+ if (!serverid_register(procid_self(),
+ FLAG_MSG_GENERAL|FLAG_MSG_SMBD
+ |FLAG_MSG_DBWRAP)) {
DEBUG(0, ("open_sockets_smbd: Failed to register "
"myself in serverid.tdb\n"));
return false;
/*
* For children the parent takes care of cleaning up
*/
- serverid_deregister_self();
+ serverid_deregister(procid_self());
}
#ifdef WITH_DFS
#endif
if (is_parent) {
- serverid_deregister_self();
+ serverid_deregister(procid_self());
pidfile_unlink();
}
/* get broadcast messages */
- if (!serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) {
+ if (!serverid_register(procid_self(),
+ FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) {
DEBUG(1, ("Could not register myself in serverid.tdb\n"));
exit(1);
}