[PATCH] Ensure notifyd doesn't return from smbd_notifyd_init

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] Ensure notifyd doesn't return from smbd_notifyd_init

Samba - samba-technical mailing list
Hi all,

recently diagnosed a strange issue where notifyd was executing parent smbd code.
That happened because notifyd failed early in the init stage, causing a return
from smbd_notifyd_init.

Please review & push if ok. Thanks!

Cheerio!
-slow

bug12910-master.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] Ensure notifyd doesn't return from smbd_notifyd_init

Samba - samba-technical mailing list
On Fri, Jul 14, 2017 at 04:41:31PM +0200, Ralph Böhme via samba-technical wrote:
> Hi all,
>
> recently diagnosed a strange issue where notifyd was executing parent smbd code.
> That happened because notifyd failed early in the init stage, causing a return
> from smbd_notifyd_init.
>
> Please review & push if ok. Thanks!

RB+. LGTM. Pushed.

> From 662aa2a2132963bafa95d5569ac61ea4ddc5581b Mon Sep 17 00:00:00 2001
> From: Ralph Boehme <[hidden email]>
> Date: Fri, 14 Jul 2017 16:38:36 +0200
> Subject: [PATCH] s3/notifyd: ensure notifyd doesn't return from
>  smbd_notifyd_init
>
> Bug: https://bugzilla.samba.org/show_bug.cgi?id=12910
>
> Signed-off-by: Ralph Boehme <[hidden email]>
> ---
>  source3/smbd/server.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/source3/smbd/server.c b/source3/smbd/server.c
> index e18a4e5..181bcd1 100644
> --- a/source3/smbd/server.c
> +++ b/source3/smbd/server.c
> @@ -390,6 +390,7 @@ static bool smbd_notifyd_init(struct messaging_context *msg, bool interactive,
>   struct tevent_req *req;
>   pid_t pid;
>   NTSTATUS status;
> + bool ok;
>  
>   if (interactive) {
>   req = notifyd_req(msg, ev);
> @@ -431,7 +432,12 @@ static bool smbd_notifyd_init(struct messaging_context *msg, bool interactive,
>   messaging_send(msg, pid_to_procid(getppid()), MSG_SMB_NOTIFY_STARTED,
>         NULL);
>  
> - return tevent_req_poll(req, ev);
> + ok = tevent_req_poll(req, ev);
> + if (!ok) {
> + DBG_WARNING("tevent_req_poll returned %s\n", strerror(errno));
> + exit(1);
> + }
> + exit(0);
>  }
>  
>  static void notifyd_init_trigger(struct tevent_req *req);
> --
> 2.9.4
>


Loading...