diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/serverid.h | 14 | ||||
-rw-r--r-- | source3/lib/serverid.c | 26 | ||||
-rw-r--r-- | source3/nmbd/nmbd.c | 5 | ||||
-rw-r--r-- | source3/printing/printing.c | 5 | ||||
-rw-r--r-- | source3/smbd/negprot.c | 5 | ||||
-rw-r--r-- | source3/smbd/server.c | 14 | ||||
-rw-r--r-- | source3/smbd/server_exit.c | 2 | ||||
-rw-r--r-- | source3/winbindd/winbindd.c | 5 |
8 files changed, 28 insertions, 48 deletions
diff --git a/source3/include/serverid.h b/source3/include/serverid.h index e60fc47afe..db2ce5ab87 100644 --- a/source3/include/serverid.h +++ b/source3/include/serverid.h @@ -25,22 +25,12 @@ /* * 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 diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c index dc4834b8da..f92c8cfd58 100644 --- a/source3/lib/serverid.c +++ b/source3/lib/serverid.c @@ -76,7 +76,7 @@ static void serverid_fill_key(const struct server_id *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; @@ -91,7 +91,7 @@ bool serverid_register(const struct server_id *id, uint32_t msg_flags) 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); @@ -101,7 +101,7 @@ bool serverid_register(const struct server_id *id, uint32_t msg_flags) } 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)); @@ -117,15 +117,7 @@ done: 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; @@ -139,7 +131,7 @@ bool serverid_deregister(const struct server_id *id) 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); @@ -160,14 +152,6 @@ done: 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; diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index fa106a9499..f211d6c671 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -84,7 +84,7 @@ static void terminate(void) kill_async_dns_child(); gencache_stabilize(); - serverid_deregister_self(); + serverid_deregister(procid_self()); pidfile_unlink(); @@ -933,7 +933,8 @@ static bool open_sockets(bool isdaemon, int port) /* 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); } diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 6bf037a817..b69350496a 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -1446,8 +1446,9 @@ void start_background_queue(void) 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); } diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index 0a928a23d6..e6fc23adee 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -665,8 +665,9 @@ void reply_negprot(struct smb_request *req) 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++) { diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 1b00f2ca4e..65db77c0b9 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -242,7 +242,7 @@ static void remove_child_pid(pid_t pid, bool unclean_shutdown) 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)); } @@ -424,9 +424,10 @@ static void smbd_accept_connection(struct tevent_context *ev, 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"); } @@ -662,8 +663,9 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent, 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; diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c index b69eb4aab3..6c46a522d4 100644 --- a/source3/smbd/server_exit.c +++ b/source3/smbd/server_exit.c @@ -97,7 +97,7 @@ static void exit_server_common(enum server_exit_reason how, /* * For children the parent takes care of cleaning up */ - serverid_deregister_self(); + serverid_deregister(procid_self()); } #ifdef WITH_DFS diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 87a8be64c9..34fd271194 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -176,7 +176,7 @@ static void terminate(bool is_parent) #endif if (is_parent) { - serverid_deregister_self(); + serverid_deregister(procid_self()); pidfile_unlink(); } @@ -1031,7 +1031,8 @@ void winbindd_register_handlers(void) /* 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); } |