From dev-return-23631-apmail-apr-dev-archive=apr.apache.org@apr.apache.org Fri Dec 10 02:37:59 2010 Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 50414 invoked from network); 10 Dec 2010 02:37:59 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 10 Dec 2010 02:37:59 -0000 Received: (qmail 27938 invoked by uid 500); 10 Dec 2010 02:37:59 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 27765 invoked by uid 500); 10 Dec 2010 02:37:57 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 27756 invoked by uid 99); 10 Dec 2010 02:37:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Dec 2010 02:37:56 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of bill.speirs@gmail.com designates 209.85.216.50 as permitted sender) Received: from [209.85.216.50] (HELO mail-qw0-f50.google.com) (209.85.216.50) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Dec 2010 02:37:47 +0000 Received: by qwd6 with SMTP id 6so3484175qwd.37 for ; Thu, 09 Dec 2010 18:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=YU8l6eZRUb073fg4Edx9cGEhy9cL+o1j8qdsrkhngTY=; b=JGG+vEYE9Q2wWETii/yF4pfwe7QDKxqtYAqXcAwR57cRgpm0snIUWvzBCZFbuyEF56 K77dsCVqMk84CCaJT1rAU0fdcjMJzKnGIlWPwlo7d3s6cN1gTdacz5SQut/PNJF/sfo3 211RFQi4I4dT4WiLbK7ScgYG8LMTZYAXc3uiw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=jMkDpPZPE2fun9adsE0PGhiPTokNi4AJESvHNMkFo3ablGm2XvSVCTa6hkeL3/OFwB ppcNhX7T13FKn9BoKp+3TtJ2fMQiQlTchY+9Mg8CH+7zWuvAsAk/I+KFyAW823e27gMN P+ABO3EyVIU8TLIWa8CTPQeEiUse3xZ/M5SdI= Received: by 10.229.241.194 with SMTP id lf2mr91340qcb.164.1291948646816; Thu, 09 Dec 2010 18:37:26 -0800 (PST) Received: from [192.168.1.100] (c-71-235-103-23.hsd1.ct.comcast.net [71.235.103.23]) by mx.google.com with ESMTPS id mz11sm1648898qcb.15.2010.12.09.18.37.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 09 Dec 2010 18:37:26 -0800 (PST) Message-ID: <4D019264.3090606@gmail.com> Date: Thu, 09 Dec 2010 21:37:24 -0500 From: William R Speirs User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Thunderbird/3.0.10 MIME-Version: 1.0 To: dev@apr.apache.org Subject: Getting the groups a user belongs to Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I was looking through the APR and noticed that no function exists to get the groups (gid or char*) that a user belongs to. I started investigating how to implement such a thing on Unix/Linux and it doesn't seem hard; getgrouplist will return a gid list given a user. On Windows things are bit more tricky because the computer can either be a member of a domain, or on its own. I think the following basic flow will work, but I'd like a second opinion: - Call GetNetworkParams to see if there is a domain name - If no domain name, then call NetUserGetLocalGroups - If there is a domain name, then call NetUserGetGroups Does that seem right? The other issue is that on Windows I get back a char* for the groups; whereas, on Unix/Linux I get back a gid list. Is there a preference? Would people rather a function that returns a gid list or a char* list? Thanks... Bill-