Skip to content

Commit 146a381

Browse files
committed
exmdb: put local procedure callability check in the right spot
Fixes: gromox-3.1-145-gc52e4da7e
1 parent 93db8eb commit 146a381

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

exch/exmdb/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ BOOL SVC_exmdb_provider(enum plugin_op reason, const struct dlfuncs &ppdata)
149149
}
150150
if (!exmdb_provider_reload(nullptr, pconfig))
151151
return false;
152-
g_exmdb_client_only = strcasecmp(get_prog_id(), "istore") != 0;
153-
if (g_exmdb_client_only)
152+
g_exmdb_disallow_lpc = strcasecmp(get_prog_id(), "istore") != 0;
153+
if (g_exmdb_disallow_lpc)
154154
return TRUE;
155155

156156
auto listen_ip = pconfig->get_value("listen_ip");
@@ -228,7 +228,7 @@ BOOL SVC_exmdb_provider(enum plugin_op reason, const struct dlfuncs &ppdata)
228228
db_engine_stop();
229229
return FALSE;
230230
}
231-
if (!g_exmdb_client_only && exmdb_listener_trigger_accept() != 0) {
231+
if (!g_exmdb_disallow_lpc && exmdb_listener_trigger_accept() != 0) {
232232
mlog(LV_ERR, "exmdb_provider: failed to start exmdb listener");
233233
exmdb_listener_stop();
234234
exmdb_parser_stop();

exch/exmdb/parser.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ static std::vector<EXMDB_ITEM> g_local_list;
4848
static std::unordered_set<std::shared_ptr<ROUTER_CONNECTION>> g_router_list;
4949
static std::unordered_set<std::shared_ptr<EXMDB_CONNECTION>> g_connection_list;
5050
static std::mutex g_router_lock, g_connection_lock;
51-
bool g_exmdb_client_only;
5251
unsigned int g_enable_dam;
5352

5453
ROUTER_CONNECTION::~ROUTER_CONNECTION()
@@ -81,8 +80,6 @@ std::unique_ptr<EXMDB_CONNECTION> exmdb_parser_make_conn()
8180

8281
static bool exmdb_parser_is_local(const char *prefix, BOOL *pb_private)
8382
{
84-
if (g_exmdb_client_only)
85-
return false;
8683
if (*prefix == '\0')
8784
return true;
8885
auto i = std::find_if(g_local_list.cbegin(), g_local_list.cend(),

exch/exmdb/parser.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,3 @@ extern void exmdb_parser_insert_router(std::shared_ptr<ROUTER_CONNECTION> &&);
4444
extern BOOL exmdb_parser_erase_router(const std::shared_ptr<ROUTER_CONNECTION> &);
4545

4646
extern unsigned int g_exrpc_debug, g_enable_dam;
47-
extern bool g_exmdb_client_only;

include/gromox/exmdb_client.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,6 @@ class GX_EXPORT exmdb_client_remote {
9999
};
100100

101101
extern GX_EXPORT std::optional<exmdb_client_remote> exmdb_client;
102+
extern GX_EXPORT bool g_exmdb_disallow_lpc;
102103

103104
}

lib/exmdb_client.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
namespace gromox {
3535

3636
std::optional<exmdb_client_remote> exmdb_client;
37+
bool g_exmdb_disallow_lpc;
3738

3839
static int mdcl_rpc_timeout = -1;
3940
static constexpr unsigned int mdcl_ping_timeout = 2;
@@ -436,6 +437,8 @@ int exmdb_client_run(const char *cfgdir, unsigned int flags,
436437

437438
bool exmdb_client_is_local(const char *prefix, BOOL *pvt)
438439
{
440+
if (g_exmdb_disallow_lpc)
441+
return false;
439442
if (*prefix == '\0')
440443
return true;
441444
auto i = std::find_if(mdcl_server_list.cbegin(), mdcl_server_list.cend(),

0 commit comments

Comments
 (0)