Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmgzz-0005IS-At for pgsql-bugs@arkaria.postgresql.org; Wed, 21 Sep 2016 12:51:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bmgzy-0000kv-UI for pgsql-bugs@arkaria.postgresql.org; Wed, 21 Sep 2016 12:51:38 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bmgzK-0008Sr-Js for pgsql-bugs@postgresql.org; Wed, 21 Sep 2016 12:50:58 +0000 Received: from mail-lf0-x231.google.com ([2a00:1450:4010:c07::231]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bmgzH-0000az-C1 for pgsql-bugs@postgresql.org; Wed, 21 Sep 2016 12:50:57 +0000 Received: by mail-lf0-x231.google.com with SMTP id g62so39610496lfe.3 for ; Wed, 21 Sep 2016 05:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=/fOFJLlc7KltmjhSLwM8GUBU9xyBdPl0iX3H4/ofRVg=; b=0hqVfL5Vt4421QWboa3CgznldtS0m/VPn8rSnqB0gHr2Y8a02+/0vHe3UugcEdWVtq TAvl7otkoWgyMCn0lXj2VTnSomeWfQJWn4UUTrK1cmHB4f3f1t+Mit3RW7J65A/5srHP iqX4OtvDWKxxd69YWyCXNGxb3UF3MLvyQ7mnN8WZvWlw5c3YSDeuDnBIbkGx6vgxRNKv rx8lVbrYIzNq6rUWWFUHaJiKeTdOupQyjtri4YNhx9oI0NAlDWPAwS3vNGjLS6y+CBkv Ms2aOKjTjHpFoeWhjw6eYxxEk2z5bMO5nY3ZrX9u4OBH8n9StDyJRmtGiD6PlRsA2Wcb 7/1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=/fOFJLlc7KltmjhSLwM8GUBU9xyBdPl0iX3H4/ofRVg=; b=nBmaXIEteuA6cboBpwNDmNQ35Kw4AmZSZj+Fi7eo/aGDqzntuLEuvyxmg1czAKgREx L5qENlI+8eWLThVcp/oEsVx4oxQ337cGHo3WqyW7CDEhAQVm9T6Vf7gSmUm/fqFjMpAs HaV9BOaQeu6PCwROBxpGXpT5HXwtwdj+bc/SbSfoxm8sVbzdGVt89j4dVgpk29uQTQZF Zgv0rK3cenwTlmlnS31le6EiVvTwoI9vVx/5Hj03tcBpOO5zRNpCSkWSgNRu0ICtyG8b /4q+DVl3nBKhYmjMsZhvSr2hHsaimgKIRAbyNKF725SAbdQMAO/E/FckWp1M1R78ieiM IL9g== X-Gm-Message-State: AE9vXwMUIImL4OKNRlkOO2mUWymFCu+z/Z4ObCpw2tb7SkzlEe3YmUgr6i2R8OF8BlvodA== X-Received: by 10.25.211.199 with SMTP id k190mr15359448lfg.71.1474462253319; Wed, 21 Sep 2016 05:50:53 -0700 (PDT) Received: from [192.168.1.111] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by smtp.gmail.com with ESMTPSA id 204sm2336316ljj.2.2016.09.21.05.50.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Sep 2016 05:50:52 -0700 (PDT) Subject: Re: BUG #13755: pgwin32_is_service not checking if SECURITY_SERVICE_SID is disabled To: Michael Paquier , Breen Hagan References: <20160404160801.GA186687@alvherre.pgsql> Cc: Alvaro Herrera , PostgreSQL mailing lists From: Heikki Linnakangas Message-ID: <64a0ee81-2e30-c9b1-97b6-312772f89a2e@iki.fi> Date: Wed, 21 Sep 2016 15:50:51 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 04/08/2016 09:48 AM, Michael Paquier wrote: > So I have been looking at this issue again and finished with the patch > attached. I think that it makes the most sense to browse the whole > list of groups, and choose if Postgres is running as a service if > service SID matches with one of the group SIDs listed, on top of which > this group SID should be enabled via SE_GROUP_ENABLED. Checking for > SE_GROUP_USE_FOR_DENY_ONLY would not make much sense, because it would > mean that SE_GROUP_ENABLED is not set, and that's what we are > interested in. That was in short the point of Breen, and it looks to > be the saner way to go. Yeah, seems like the right way. pgwin32_is_admin() also checks for SE_GROUP_ENABLED. I think this is ready to be committed, except that I don't have an easy way to reproduce the original problem to test this. I suppose I could write a test program to call CreateRestrictedToken() and CreateProcessAsUser(), but would rather avoid the work. Breen, if I push a fix for this, can you build from sources and verify that it fixes your original problem? Or alternatively, can you provide a test program that I can use to verify it? - Heikki -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs