wrowe 01/01/27 17:34:27
Modified: . CHANGES apr.dsp libapr.dsp
Added: user/win32 groupinfo.c userinfo.c
Log:
Some win32 user and group handling functions
Revision Changes Path
1.47 +25 -1 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- CHANGES 2001/01/27 17:57:02 1.46
+++ CHANGES 2001/01/28 01:34:25 1.47
@@ -1,5 +1,29 @@
-Changes with APR b1
+Changes with APR b1
+ *) Abstracted apr_get_username and apr_get_groupname for unix and win32.
+ Modified Win32 apr_uid_t and apr_gid_t to use PSIDs, and elimintated
+ the uid_t and gid_t definitions.
+
+ *) Radically refactored apr_stat/lstat/getfileinfo/dir_read for Win32
+ to assure we are retrieving what we expect to retrieve, and reporting
+ the correct result (APR_SUCCESS or APR_INCOMPLETE). The potential
+ for a bit more optimization still remains. [William Rowe]
+
+ *) While we have the future opportunity to cache the apr_stat'ed file
+ handle for a very fast open (dup handle) on Win32, patched to close
+ that file after a stat always. Needs a new semantic before we leave
+ handles dangling when the user intends to rm. [William Rowe]
+
+ *) Correct Win32 apr_stat/lstat/getfileinfo/dir_read to all zero out
+ the finfo buffer on success (or incomplete success). [William Rowe]
+
+ *) Fix Win32/Unix apr_lstat to throw the .valid bit APR_FINFO_LINK to
+ indicate we attempted to open the link. Only the .filetype APR_LNK
+ reflects if the file found was, in fact, a link. [William Rowe]
+
+ *) Fixed apr_open and apr_rename to function on Win9x.
+ [Mike Pilato <[EMAIL PROTECTED]>]
+
*) Add apr_open_stdout. This mirrors apr_open_stderr, except it works
on stdout. [EMAIL PROTECTED]
1.62 +12 -0 apr/apr.dsp
Index: apr.dsp
===================================================================
RCS file: /home/cvs/apr/apr.dsp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- apr.dsp 2001/01/20 00:56:10 1.61
+++ apr.dsp 2001/01/28 01:34:26 1.62
@@ -380,6 +380,18 @@
SOURCE=.\mmap\win32\mmap.c
# End Source File
# End Group
+# Begin Group "user"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\user\win32\userinfo.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\user\win32\groupinfo.c
+# End Source File
+# End Group
# End Group
# Begin Group "Generated Header Files"
1.20 +12 -0 apr/libapr.dsp
Index: libapr.dsp
===================================================================
RCS file: /home/cvs/apr/libapr.dsp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- libapr.dsp 2001/01/20 00:56:10 1.19
+++ libapr.dsp 2001/01/28 01:34:26 1.20
@@ -386,6 +386,18 @@
SOURCE=.\mmap\win32\mmap.c
# End Source File
# End Group
+# Begin Group "user"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\user\win32\userinfo.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\user\win32\groupinfo.c
+# End Source File
+# End Group
# End Group
# Begin Group "Generated Header Files"
1.1 apr/user/win32/groupinfo.c
Index: groupinfo.c
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "apr_strings.h"
#include "apr_portable.h"
#include "apr_user.h"
#include "apr_private.h"
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
#if APR_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
APR_DECLARE(apr_status_t) apr_get_groupname(char **groupname, apr_gid_t
groupid, apr_pool_t *p)
{
SID_NAME_USE type;
char name[MAX_PATH], domain[MAX_PATH];
DWORD cbname = sizeof(name), cbdomain = sizeof(domain);
if (!groupid)
return APR_BADARG;
if (!LookupAccountSid(NULL, groupid, name, &cbname, domain, &cbdomain,
&type))
return apr_get_os_error();
if (type != SidTypeGroup && type != SidTypeWellKnownGroup)
return APR_BADARG;
*groupname = apr_pstrdup(p, name);
return APR_SUCCESS;
}
1.1 apr/user/win32/userinfo.c
Index: userinfo.c
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "apr_strings.h"
#include "apr_portable.h"
#include "apr_user.h"
#include "apr_private.h"
#if APR_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, const char
*userid, apr_pool_t *p)
{
return APR_ENOTIMPL;
}
APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid,
apr_pool_t *p)
{
SID_NAME_USE type;
char name[MAX_PATH], domain[MAX_PATH];
DWORD cbname = sizeof(name), cbdomain = sizeof(domain);
if (!userid)
return APR_BADARG;
if (!LookupAccountSid(NULL, userid, name, &cbname, domain, &cbdomain,
&type))
return apr_get_os_error();
if (type != SidTypeUser)
return APR_BADARG;
*username = apr_pstrdup(p, name);
return APR_SUCCESS;
}