Author: mturk Date: Mon Apr 27 18:34:42 2009 New Revision: 769091 URL: http://svn.apache.org/viewvc?rev=769091&view=rev Log: Add skeleton win32 user and group
Added: commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c (with props) commons/sandbox/runtime/trunk/src/main/native/os/win32/user.c (with props) Added: commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c?rev=769091&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c (added) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c Mon Apr 27 18:34:42 2009 @@ -0,0 +1,112 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "acr.h" +#include "acr_private.h" +#include "acr_arch.h" +#include "acr_clazz.h" +#include "acr_error.h" +#include "acr_memory.h" +#include "acr_string.h" +#include "acr_descriptor.h" + +J_DECLARE_CLAZZ = { + NULL, + NULL, + ACR_CLASS_PATH "Group" +}; + +J_DECLARE_M_ID(0000) = { + NULL, + "<init>", + "(L" ACR_CLASS_PATH "Descriptor;)V" +}; + +J_DECLARE_F_ID(0000) = { + NULL, + "Name", + "Ljava/lang/String;" +}; + +J_DECLARE_F_ID(0001) = { + NULL, + "Comment", + "Ljava/lang/String;" +}; + +J_DECLARE_F_ID(0002) = { + NULL, + "GroupId", + "Ljava/lang/String;" +}; + + +J_DECLARE_F_ID(0003) = { + NULL, + "isLocal", + "Z" +}; + +ACR_CLASS_LDEF(Group) +{ + int rv; + + if ((rv = ACR_LoadClass(_E, &_clazzn, 0)) != ACR_SUCCESS) + return rv; + J_LOAD_METHOD(0000); + J_LOAD_IFIELD(0000); + J_LOAD_IFIELD(0001); + J_LOAD_IFIELD(0002); + J_LOAD_IFIELD(0003); + + return ACR_SUCCESS; +} + +ACR_CLASS_UDEF(Group) +{ + ACR_UnloadClass(_E, &_clazzn); +} + +ACR_DECLARE(jobjectArray) ACR_NewGroupArray(JNIEnv *_E, jsize len) +{ + if (_clazzn.i) + return (*_E)->NewObjectArray(_E, len, _clazzn.i, NULL); + else + return NULL; +} + +ACR_JNI_EXPORT_DECLARE(jobject, Hroup, get0)(ACR_JNISTDARGS, + jstring name) +{ + jobject grp = NULL; + UNREFERENCED_O; + + WITH_WSTR(name) { + int rc; + + } END_WITH_WSTR(name); + + return grp; +} + +ACR_JNI_EXPORT_DECLARE(jboolean, Group, equals0)(ACR_JNISTDARGS, + jobject a, jobject b) +{ + PSID gida = ACR_DescriptorGetPtr(_E, a); + PSID gidb = ACR_DescriptorGetPtr(_E, b); + + return V2Z(EqualSid(gida, gidb)); +} Propchange: commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c ------------------------------------------------------------------------------ svn:eol-style = native Added: commons/sandbox/runtime/trunk/src/main/native/os/win32/user.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/user.c?rev=769091&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/win32/user.c (added) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/user.c Mon Apr 27 18:34:42 2009 @@ -0,0 +1,126 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "acr.h" +#include "acr_private.h" +#include "acr_arch.h" +#include "acr_clazz.h" +#include "acr_error.h" +#include "acr_memory.h" +#include "acr_string.h" +#include "acr_descriptor.h" + +J_DECLARE_CLAZZ = { + NULL, + NULL, + ACR_CLASS_PATH "User" +}; + +J_DECLARE_M_ID(0000) = { + NULL, + "<init>", + "(L" ACR_CLASS_PATH "Descriptor;)V" +}; + +J_DECLARE_F_ID(0000) = { + NULL, + "Name", + "Ljava/lang/String;" +}; + +J_DECLARE_F_ID(0001) = { + NULL, + "FullName", + "Ljava/lang/String;" +}; + +J_DECLARE_F_ID(0002) = { + NULL, + "Comment", + "Ljava/lang/String;" +}; + +J_DECLARE_F_ID(0003) = { + NULL, + "Home", + "Ljava/lang/String;" +}; + +J_DECLARE_F_ID(0004) = { + NULL, + "Shell", + "Ljava/lang/String;" +}; + +J_DECLARE_F_ID(0005) = { + NULL, + "UserId", + "Ljava/lang/String;" +}; + +ACR_CLASS_LDEF(User) +{ + int rv; + + if ((rv = ACR_LoadClass(_E, &_clazzn, 0)) != ACR_SUCCESS) + return rv; + J_LOAD_METHOD(0000); + J_LOAD_IFIELD(0000); + J_LOAD_IFIELD(0001); + J_LOAD_IFIELD(0002); + J_LOAD_IFIELD(0003); + J_LOAD_IFIELD(0004); + J_LOAD_IFIELD(0005); + + return ACR_SUCCESS; +} + +ACR_CLASS_UDEF(User) +{ + ACR_UnloadClass(_E, &_clazzn); +} + +ACR_DECLARE(jobjectArray) ACR_NewUserArray(JNIEnv *_E, jsize len) +{ + if (_clazzn.i) + return (*_E)->NewObjectArray(_E, len, _clazzn.i, NULL); + else + return NULL; +} + + +ACR_JNI_EXPORT_DECLARE(jobject, User, get0)(ACR_JNISTDARGS, + jstring name) +{ + jobject usr = NULL; + UNREFERENCED_O; + + WITH_WSTR(name) { + int rc; + + } END_WITH_WSTR(name); + + return usr; +} + +ACR_JNI_EXPORT_DECLARE(jboolean, User, equals0)(ACR_JNISTDARGS, + jobject a, jobject b) +{ + PSID uida = ACR_DescriptorGetInt(_E, a); + PSID uidb = ACR_DescriptorGetInt(_E, b); + + return V2Z(EqualSid(uida, uidb)); +} Propchange: commons/sandbox/runtime/trunk/src/main/native/os/win32/user.c ------------------------------------------------------------------------------ svn:eol-style = native