< prev index next >

src/jdk.security.auth/unix/native/libjaas/Unix.c

Print this page
rev 12879 : 8136556: Add the ability to perform static builds of MacOSX x64 binaries
Reviewed-by: ihse, bdelsart, gadams, lfoltan, rriggs, hseigel, twisti
   1 /*
   2  * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #ifdef __solaris__
  27 #define _POSIX_C_SOURCE 199506L
  28 #endif
  29 
  30 #include <jni.h>

  31 #include "com_sun_security_auth_module_UnixSystem.h"
  32 #include <stdio.h>
  33 #include <pwd.h>
  34 #include <sys/types.h>
  35 #include <unistd.h>
  36 #include <stdlib.h>
  37 #include <string.h>





  38 
  39 JNIEXPORT void JNICALL
  40 Java_com_sun_security_auth_module_UnixSystem_getUnixInfo
  41                                                 (JNIEnv *env, jobject obj) {
  42 
  43     int i;
  44     char pwd_buf[1024];
  45     struct passwd *pwd;
  46     struct passwd resbuf;
  47     jfieldID userNameID;
  48     jfieldID userID;
  49     jfieldID groupID;
  50     jfieldID supplementaryGroupID;
  51 
  52     jstring jstr;
  53     jlongArray jgroups;
  54     jlong *jgroupsAsArray;
  55     jsize numSuppGroups;
  56     gid_t *groups;
  57     jclass cls;


   1 /*
   2  * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #ifdef __solaris__
  27 #define _POSIX_C_SOURCE 199506L
  28 #endif
  29 
  30 #include <jni.h>
  31 #include "jni_util.h"
  32 #include "com_sun_security_auth_module_UnixSystem.h"
  33 #include <stdio.h>
  34 #include <pwd.h>
  35 #include <sys/types.h>
  36 #include <unistd.h>
  37 #include <stdlib.h>
  38 #include <string.h>
  39 
  40 /*
  41  * Declare library specific JNI_Onload entry if static build
  42  */
  43 DEF_STATIC_JNI_OnLoad
  44 
  45 JNIEXPORT void JNICALL
  46 Java_com_sun_security_auth_module_UnixSystem_getUnixInfo
  47                                                 (JNIEnv *env, jobject obj) {
  48 
  49     int i;
  50     char pwd_buf[1024];
  51     struct passwd *pwd;
  52     struct passwd resbuf;
  53     jfieldID userNameID;
  54     jfieldID userID;
  55     jfieldID groupID;
  56     jfieldID supplementaryGroupID;
  57 
  58     jstring jstr;
  59     jlongArray jgroups;
  60     jlong *jgroupsAsArray;
  61     jsize numSuppGroups;
  62     gid_t *groups;
  63     jclass cls;


< prev index next >