From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mail.toke.dk; dkim=pass header.d=irif.fr header.i=@irif.fr header.a=rsa-sha256 header.s=dkim-irif header.b=cGqacCZ6; arc=none (Message is not ARC signed); dmarc=none Received: from korolev.univ-paris7.fr (korolev.univ-paris7.fr [IPv6:2001:660:3301:8000::1:2]) by mail.toke.dk (Postfix) with ESMTPS id 9BDE018C9BC7 for ; Thu, 22 Oct 2026 01:49:00 +0200 (CEST) Received: from potemkin.univ-paris7.fr (potemkin.univ-paris7.fr [IPv6:2001:660:3301:8000::1:1]) by korolev.univ-paris7.fr (8.14.4/8.14.4/relay1/82085) with ESMTP id 69LNn0G5020995 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 Oct 2026 01:49:00 +0200 Received: from mailhub.math.univ-paris-diderot.fr (mailhub.math.univ-paris-diderot.fr [81.194.30.253]) by potemkin.univ-paris7.fr (8.14.4/8.14.4/relay2/82085) with ESMTP id 69LNn05v024357; Thu, 22 Oct 2026 01:49:00 +0200 Received: from mailhub.math.univ-paris-diderot.fr (unknown [127.0.0.1]) by mailhub.math.univ-paris-diderot.fr (Postfix) with ESMTP id 037D0CAF67; Thu, 22 Oct 2026 01:48:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=irif.fr; h= content-type:content-type:mime-version:user-agent:references :in-reply-to:subject:subject:from:from:message-id:date:date :received:received; s=dkim-irif; t=1792626538; x=1793490539; bh= BvO1YiDY4wFfHutPoBn9OCMN2wr/GvAM45u9PTgz/+A=; b=cGqacCZ6zLCfKRUs UWtCqZ6MUKsxWGmd0UfAxsANo0jc9keZ9YK0b7ojLKp/+2q/xsHHBooEHYc/nyNL 5tk3YvbY7jhKZPq6khHfGhbO93CWEOlTZFfpixLuCkcCF9QSa75NxLUWnj8XVr7R yW0SFCuMK9yC3BZ6aB+qhLLIHy5u3ytESeqOeVBpazV7cc2y24Ntu9HcjFvFjyzS m+sgEMAKupO+lv0lqP4Z/m3+g2bNmuiE9oKWwAkJD/4Suu5HTkModBTfsrLD2n1W gCpobjREnOXv7NLYJVm7zbNSq1QuEIE+zd+QPIKSN0bhLJEItRilUZIzVDA5BzHb oZj2mQ== X-Virus-Scanned: amavisd-new at math.univ-paris-diderot.fr Received: from mailhub.math.univ-paris-diderot.fr ([127.0.0.1]) by mailhub.math.univ-paris-diderot.fr (mailhub.math.univ-paris-diderot.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 632buMwnnUuL; Thu, 22 Oct 2026 01:48:58 +0200 (CEST) Received: from trurl.irif.fr (unknown [82.64.191.149]) (Authenticated sender: jch) by mailhub.math.univ-paris-diderot.fr (Postfix) with ESMTPSA id DA3BECAF65; Thu, 22 Oct 2026 01:48:58 +0200 (CEST) Date: Thu, 22 Oct 2026 01:48:58 +0200 Message-ID: <87wlraty1h.wl-jch@irif.fr> From: Juliusz Chroboczek To: Z0T CC: galene@lists.galene.org In-Reply-To: <179258447150.1137.1616866743788355246@gauss> References: <179258447150.1137.1616866743788355246@gauss> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/30.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (korolev.univ-paris7.fr [IPv6:2001:660:3301:8000::1:2]); Thu, 22 Oct 2026 01:49:00 +0200 (CEST) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (potemkin.univ-paris7.fr [194.254.61.141]); Thu, 22 Oct 2026 01:49:00 +0200 (CEST) X-Miltered: at korolev with ID 6AD94F6C.000 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-Miltered: at potemkin with ID 6AD94F6C.000 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Enveloppe: 6AD94F6C.000 from potemkin.univ-paris7.fr/potemkin.univ-paris7.fr/null/potemkin.univ-paris7.fr/ X-j-chkmail-Enveloppe: 6AD94F6C.000 from mailhub.math.univ-paris-diderot.fr/mailhub.math.univ-paris-diderot.fr/null/mailhub.math.univ-paris-diderot.fr/ X-j-chkmail-Score: MSGID : 6AD94F6C.000 on korolev.univ-paris7.fr : j-chkmail score : . : R=. U=. O=. B=0.000 -> S=0.000 X-j-chkmail-Score: MSGID : 6AD94F6C.000 on potemkin.univ-paris7.fr : j-chkmail score : . : R=. U=. O=. B=0.000 -> S=0.000 X-j-chkmail-Status: Ham X-j-chkmail-Status: Ham Message-ID-Hash: SWX6NBKM7IOLIBGWDGFZB3OYLCE5CUYG X-Message-ID-Hash: SWX6NBKM7IOLIBGWDGFZB3OYLCE5CUYG X-MailFrom: jch@irif.fr X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Subject: [Galene] Re: forbid presenting probably bug List-Id: =?utf-8?q?Gal=C3=A8ne_videoconferencing_server_discussion_list?= Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: > Cause: remove() in rtpconn/webclient.go does append(l[:i], l[i+1:]...), > which modifies the backing array in place. But c.permissions is not always > a private slice Good catch. What do you think of the following? diff --git a/rtpconn/webclient.go b/rtpconn/webclient.go index ed22403..ad40095 100644 --- a/rtpconn/webclient.go +++ b/rtpconn/webclient.go @@ -939,22 +939,25 @@ type kickAction struct { var errEmptyId = group.ProtocolError("empty id") -func remove(v string, l []string) []string { - for i, w := range l { - if v == w { - l = append(l[:i], l[i+1:]...) - return l - } +// remove removes an element from a slice. In order to avoid sharing +// issues, it performs a deep copy if the list changes. +func remove(l *[]string, v string) { + if !slices.Contains(*l, v) { + return } - return l + ll := slices.Clone(*l) + ll = slices.DeleteFunc(ll, func(w string) bool { return v == w }) + *l = ll } -func addnew(v string, l []string) []string { - if slices.Contains(l, v) { - return l +// addnew is like remove, but it adds an element. +func addnew(l *[]string, v string) { + if slices.Contains(*l, v) { + return } - l = append(l, v) - return l + ll := slices.Clone(*l) + ll = append(ll, v) + *l = ll } func clientLoop(c *webClient, ws *websocket.Conn, versionError bool) error { @@ -1218,22 +1221,22 @@ func handleAction(c *webClient, a any) error { case changePermissionsAction: switch a.kind { case "op": - c.permissions = addnew("op", c.permissions) + addnew(&c.permissions, "op") g := c.Group() if g != nil && g.Description().AllowRecording { - c.permissions = addnew("record", c.permissions) + addnew(&c.permissions, "record") } case "unop": - c.permissions = remove("op", c.permissions) - c.permissions = remove("record", c.permissions) + remove(&c.permissions, "op") + remove(&c.permissions, "record") case "present": - c.permissions = addnew("present", c.permissions) + addnew(&c.permissions, "present") case "unpresent": - c.permissions = remove("present", c.permissions) + remove(&c.permissions, "present") case "shutup": - c.permissions = remove("message", c.permissions) + remove(&c.permissions, "message") case "unshutup": - c.permissions = addnew("message", c.permissions) + addnew(&c.permissions, "message") default: return group.UserError("unknown permission") }