Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 32156 invoked from network); 17 Sep 2003 20:15:23 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 17 Sep 2003 20:15:23 -0000 Received: (qmail 56605 invoked by uid 500); 17 Sep 2003 20:15:10 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 56583 invoked by uid 500); 17 Sep 2003 20:15:10 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Delivered-To: moderator for dev@apr.apache.org Received: (qmail 54772 invoked from network); 17 Sep 2003 20:12:41 -0000 To: dev@apr.apache.org Subject: BeOS patch From: "Sander Stoks" Date: Wed, 17 Sep 2003 22:17:00 +0200 CEST Message-Id: <18866719428-BeMail@adam> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hello, While building Subversion, a source control system which uses APR, I found an issue which I could trace back to getpwnam_safe() on BeOS. The problem is that BeOS doesn't properly implement multi-user support, so the built-in getpwnam() always returns 0. One could say that it is up to the clients of the library to handle this, and I would agree that it is a bug of Subversion that it doesn't (in the getpwnam_safe() function in userinfo.c, I see a comment about FreeBSD 4.3 even leaving errno zero in that case, so it is something clients need to be aware of). On the other hand, BeOS _does_ implement getpwuid, and since the "current uid" is always "0" for all practical purposes, doing the following: #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) /* IRIX getpwnam_r() returns 0 and sets pwptr to NULL on failure */ if (!getpwnam_r(username, pw, pwbuf, PWBUF_SIZE, &pwptr) && pwptr) { /* nothing extra to do on success */ #elif __BEOS__ if ((pwptr = getpwuid(0)) != NULL) { memcpy(pw, pwptr, sizeof *pw); #else if ((pwptr = getpwnam(username)) != NULL) { memcpy(pw, pwptr, sizeof *pw); #endif makes things work on my system. It is (marginally) less-than-ideal, because a program _can_ call setuid() and have it work as expected, but there is no way to link a uid to a username on BeOS - it is essentially a single-user system. Any thoughts on this patch? Thanks in advance, Sander Stoks