From: jule Date: Mon, 6 Feb 2023 13:28:36 +0000 (+0000) Subject: s3:smbcontrol: improve destination resolution using names db X-Git-Tag: ldb-2.8.0~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bed915d098e27bb21249227e671146ef42f52129;p=thirdparty%2Fsamba.git s3:smbcontrol: improve destination resolution using names db With this change it's possible to use 'smbcontrol ldap_server ...' instead of 'smbcontrol prefork-master-ldap ...' Pair-Programmed-With: Stefan Metzmacher Signed-off-by: Jule Anger Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index ab57bd48042..b85dceca605 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -35,6 +35,7 @@ #include "util_tdb.h" #include "../lib/util/pidfile.h" #include "serverid.h" +#include "lib/util/server_id_db.h" #include "cmdline_contexts.h" #include "lib/util/string_wrappers.h" #include "lib/global_contexts.h" @@ -1642,6 +1643,8 @@ static struct server_id parse_dest(struct messaging_context *msg, .pid = (uint64_t)-1, }; pid_t pid; + struct server_id_db *names_db = NULL; + bool ok; /* Zero is a special return value for broadcast to all processes */ @@ -1674,6 +1677,16 @@ static struct server_id parse_dest(struct messaging_context *msg, return pid_to_procid(pid); } + names_db = messaging_names_db(msg); + if (names_db == NULL) { + goto fail; + } + ok = server_id_db_lookup_one(names_db, dest, &result); + if (ok) { + return result; + } + +fail: fprintf(stderr,"Can't find pid for destination '%s'\n", dest); return result;