OLD | NEW |
| (Empty) |
1 /* | |
2 * Licensed to the Apache Software Foundation (ASF) under one or more | |
3 * contributor license agreements. See the NOTICE file distributed with | |
4 * this work for additional information regarding copyright ownership. | |
5 * The ASF licenses this file to You under the Apache License, Version 2.0 | |
6 * (the "License"); you may not use this file except in compliance with | |
7 * the License. You may obtain a copy of the License at | |
8 * | |
9 * http://www.apache.org/licenses/LICENSE-2.0 | |
10 * | |
11 * Unless required by applicable law or agreed to in writing, software | |
12 * distributed under the License is distributed on an "AS IS" BASIS, | |
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 * See the License for the specific language governing permissions and | |
15 * limitations under the License. | |
16 */ | |
17 | |
18 package org.apache.tomcat.jni; | |
19 | |
20 /** User | |
21 * | |
22 * @author Mladen Turk | |
23 */ | |
24 public class User { | |
25 | |
26 /** | |
27 * Get the userid (and groupid) of the calling process | |
28 * This function is available only if APR_HAS_USER is defined. | |
29 * @param p The pool from which to allocate working space | |
30 * @return Returns the user id | |
31 */ | |
32 public static native long uidCurrent(long p) | |
33 throws Error; | |
34 | |
35 /** | |
36 * Get the groupid of the calling process | |
37 * This function is available only if APR_HAS_USER is defined. | |
38 * @param p The pool from which to allocate working space | |
39 * @return Returns the group id | |
40 */ | |
41 public static native long gidCurrent(long p) | |
42 throws Error; | |
43 | |
44 | |
45 /** | |
46 * Get the userid for the specified username | |
47 * This function is available only if APR_HAS_USER is defined. | |
48 * @param username The username to lookup | |
49 * @param p The pool from which to allocate working space | |
50 * @return Returns the user id | |
51 */ | |
52 public static native long uid(String username, long p) | |
53 throws Error; | |
54 | |
55 /** | |
56 * Get the groupid for the specified username | |
57 * This function is available only if APR_HAS_USER is defined. | |
58 * @param username The username to lookup | |
59 * @param p The pool from which to allocate working space | |
60 * @return Returns the user's group id | |
61 */ | |
62 public static native long usergid(String username, long p) | |
63 throws Error; | |
64 | |
65 /** | |
66 * Get the groupid for a specified group name | |
67 * This function is available only if APR_HAS_USER is defined. | |
68 * @param groupname The group name to look up | |
69 * @param p The pool from which to allocate working space | |
70 * @return Returns the user's group id | |
71 */ | |
72 public static native long gid(String groupname, long p) | |
73 throws Error; | |
74 | |
75 /** | |
76 * Get the user name for a specified userid | |
77 * This function is available only if APR_HAS_USER is defined. | |
78 * @param userid The userid | |
79 * @param p The pool from which to allocate the string | |
80 * @return New string containing user name | |
81 */ | |
82 public static native String username(long userid, long p) | |
83 throws Error; | |
84 | |
85 /** | |
86 * Get the group name for a specified groupid | |
87 * This function is available only if APR_HAS_USER is defined. | |
88 * @param groupid The groupid | |
89 * @param p The pool from which to allocate the string | |
90 * @return New string containing group name | |
91 */ | |
92 public static native String groupname(long groupid, long p) | |
93 throws Error; | |
94 | |
95 /** | |
96 * Compare two user identifiers for equality. | |
97 * This function is available only if APR_HAS_USER is defined. | |
98 * @param left One uid to test | |
99 * @param right Another uid to test | |
100 * @return APR_SUCCESS if the apr_uid_t structures identify the same user, | |
101 * APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid. | |
102 */ | |
103 public static native int uidcompare(long left, long right); | |
104 | |
105 /** | |
106 * Compare two group identifiers for equality. | |
107 * This function is available only if APR_HAS_USER is defined. | |
108 * @param left One gid to test | |
109 * @param right Another gid to test | |
110 * @return APR_SUCCESS if the apr_gid_t structures identify the same group, | |
111 * APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid. | |
112 */ | |
113 public static native int gidcompare(long left, long right); | |
114 | |
115 /** | |
116 * Get the home directory for the named user | |
117 * This function is available only if APR_HAS_USER is defined. | |
118 * @param username The named user | |
119 * @param p The pool from which to allocate the string | |
120 * @return New string containing directory name | |
121 */ | |
122 public static native String homepath(String username, long p) | |
123 throws Error; | |
124 | |
125 } | |
OLD | NEW |