s3:winbind: Move imessaging context init function to winbindd-lib subsystem
authorSamuel Cabrero <scabrero@samba.org>
Wed, 2 Mar 2022 17:00:56 +0000 (18:00 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 8 Apr 2022 20:13:37 +0000 (20:13 +0000)
The source3/winbindd/winbindd.c file does not belong to 'winbindd-lib'
subsystem. Funtions called from winbindd-lib must be part of it.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/winbindd.c
source3/winbindd/winbindd_irpc.c

index e4c75ead93f843aa7e706fd1f4573f2a7289d798..a226be5c48eed65f541b7fe01259a18607ba4dfc 100644 (file)
@@ -64,41 +64,6 @@ static void winbindd_setup_max_fds(void);
 
 static bool interactive = False;
 
-struct imessaging_context *winbind_imessaging_context(void)
-{
-       static struct imessaging_context *msg = NULL;
-       struct messaging_context *msg_ctx;
-       struct server_id myself;
-       struct loadparm_context *lp_ctx;
-
-       if (msg != NULL) {
-               return msg;
-       }
-
-       msg_ctx = global_messaging_context();
-       if (msg_ctx == NULL) {
-               smb_panic("global_messaging_context failed\n");
-       }
-       myself = messaging_server_id(msg_ctx);
-
-       lp_ctx = loadparm_init_s3(NULL, loadparm_s3_helpers());
-       if (lp_ctx == NULL) {
-               smb_panic("Could not load smb.conf to init winbindd's imessaging context.\n");
-       }
-
-       /*
-        * Note we MUST use the NULL context here, not the autofree context,
-        * to avoid side effects in forked children exiting.
-        */
-       msg = imessaging_init(NULL, lp_ctx, myself, global_event_context());
-       talloc_unlink(NULL, lp_ctx);
-
-       if (msg == NULL) {
-               smb_panic("Could not init winbindd's messaging context.\n");
-       }
-       return msg;
-}
-
 /* Reload configuration */
 
 bool winbindd_reload_services_file(const char *lfile)
index 918393c0827749f44fe7c4c6ebdc259ce369cff4..232772dc56921913982aaf107f6b3596606d3eb4 100644 (file)
 #include "librpc/gen_ndr/ndr_irpc.h"
 #include "librpc/gen_ndr/ndr_netlogon.h"
 #include "lib/global_contexts.h"
+#include "lib/param/param.h"
+#include "messages.h"
+
+struct imessaging_context *winbind_imessaging_context(void)
+{
+       static struct imessaging_context *msg = NULL;
+       struct messaging_context *msg_ctx;
+       struct server_id myself;
+       struct loadparm_context *lp_ctx;
+
+       if (msg != NULL) {
+               return msg;
+       }
+
+       msg_ctx = global_messaging_context();
+       if (msg_ctx == NULL) {
+               smb_panic("global_messaging_context failed\n");
+       }
+       myself = messaging_server_id(msg_ctx);
+
+       lp_ctx = loadparm_init_s3(NULL, loadparm_s3_helpers());
+       if (lp_ctx == NULL) {
+               smb_panic("Could not load smb.conf to init winbindd's imessaging context.\n");
+       }
+
+       /*
+        * Note we MUST use the NULL context here, not the autofree context,
+        * to avoid side effects in forked children exiting.
+        */
+       msg = imessaging_init(NULL, lp_ctx, myself, global_event_context());
+       talloc_unlink(NULL, lp_ctx);
+
+       if (msg == NULL) {
+               smb_panic("Could not init winbindd's messaging context.\n");
+       }
+       return msg;
+}
 
 struct wb_irpc_forward_state {
        struct irpc_message *msg;