int sys_acl_get_entry | ( | SMB_ACL_T | acl_d, | |
int | entry_id, | |||
SMB_ACL_ENTRY_T * | entry_p | |||
) |
参照先 smb_acl_t::acl・smb_acl_t::count・errno・smb_acl_t::next.
参照元 vfswrap_sys_acl_get_entry().
00044 { 00045 if (entry_id != SMB_ACL_FIRST_ENTRY && entry_id != SMB_ACL_NEXT_ENTRY) { 00046 errno = EINVAL; 00047 return -1; 00048 } 00049 00050 if (entry_p == NULL) { 00051 errno = EINVAL; 00052 return -1; 00053 } 00054 00055 if (entry_id == SMB_ACL_FIRST_ENTRY) { 00056 acl_d->next = 0; 00057 } 00058 00059 if (acl_d->next < 0) { 00060 errno = EINVAL; 00061 return -1; 00062 } 00063 00064 if (acl_d->next >= acl_d->count) { 00065 return 0; 00066 } 00067 00068 *entry_p = &acl_d->acl[acl_d->next++]; 00069 00070 return 1; 00071 }
int sys_acl_get_tag_type | ( | SMB_ACL_ENTRY_T | entry_d, | |
SMB_ACL_TAG_T * | type_p | |||
) |
参照元 vfswrap_sys_acl_get_tag_type().
00074 { 00075 *type_p = entry_d->a_type; 00076 00077 return 0; 00078 }
int sys_acl_get_permset | ( | SMB_ACL_ENTRY_T | entry_d, | |
SMB_ACL_PERMSET_T * | permset_p | |||
) |
参照元 vfswrap_sys_acl_get_permset().
00081 { 00082 *permset_p = &entry_d->a_perm; 00083 00084 return 0; 00085 }
void* sys_acl_get_qualifier | ( | SMB_ACL_ENTRY_T | entry_d | ) |
参照先 smb_acl_entry::a_type・errno・smb_acl_entry::gid・SMB_ACL_GROUP・SMB_ACL_USER・smb_acl_entry::uid.
参照元 vfswrap_sys_acl_get_qualifier().
00088 { 00089 if (entry_d->a_type == SMB_ACL_USER) { 00090 return &entry_d->uid; 00091 } 00092 00093 if (entry_d->a_type == SMB_ACL_GROUP) { 00094 return &entry_d->gid; 00095 } 00096 00097 errno = EINVAL; 00098 return NULL; 00099 }
int sys_acl_clear_perms | ( | SMB_ACL_PERMSET_T | permset_d | ) |
int sys_acl_add_perm | ( | SMB_ACL_PERMSET_T | permset_d, | |
SMB_ACL_PERM_T | perm | |||
) |
参照先 errno.
参照元 vfswrap_sys_acl_add_perm().
00109 { 00110 if (perm != SMB_ACL_READ && perm != SMB_ACL_WRITE 00111 && perm != SMB_ACL_EXECUTE) { 00112 errno = EINVAL; 00113 return -1; 00114 } 00115 00116 if (permset_d == NULL) { 00117 errno = EINVAL; 00118 return -1; 00119 } 00120 00121 *permset_d |= perm; 00122 00123 return 0; 00124 }
int sys_acl_get_perm | ( | SMB_ACL_PERMSET_T | permset_d, | |
SMB_ACL_PERM_T | perm | |||
) |
char* sys_acl_to_text | ( | SMB_ACL_T | acl_d, | |
ssize_t * | len_p | |||
) |
参照先 smb_acl_t::acl・smb_acl_t::count・errno・len・perms・SMB_ACL_GROUP・SMB_ACL_GROUP_OBJ・SMB_ACL_MASK・SMB_ACL_OTHER・SMB_ACL_USER・SMB_ACL_USER_OBJ・uidtoname().
参照元 vfswrap_sys_acl_to_text().
00132 { 00133 int i; 00134 int len, maxlen; 00135 char *text; 00136 00137 /* 00138 * use an initial estimate of 20 bytes per ACL entry 00139 * when allocating memory for the text representation 00140 * of the ACL 00141 */ 00142 len = 0; 00143 maxlen = 20 * acl_d->count; 00144 if ((text = (char *)SMB_MALLOC(maxlen)) == NULL) { 00145 errno = ENOMEM; 00146 return NULL; 00147 } 00148 00149 for (i = 0; i < acl_d->count; i++) { 00150 struct smb_acl_entry *ap = &acl_d->acl[i]; 00151 struct group *gr; 00152 char tagbuf[12]; 00153 char idbuf[12]; 00154 const char *tag; 00155 const char *id = ""; 00156 char perms[4]; 00157 int nbytes; 00158 00159 switch (ap->a_type) { 00160 /* 00161 * for debugging purposes it's probably more 00162 * useful to dump unknown tag types rather 00163 * than just returning an error 00164 */ 00165 default: 00166 slprintf(tagbuf, sizeof(tagbuf)-1, "0x%x", 00167 ap->a_type); 00168 tag = tagbuf; 00169 break; 00170 00171 case SMB_ACL_USER: 00172 id = uidtoname(ap->uid); 00173 case SMB_ACL_USER_OBJ: 00174 tag = "user"; 00175 break; 00176 00177 case SMB_ACL_GROUP: 00178 if ((gr = getgrgid(ap->gid)) == NULL) { 00179 slprintf(idbuf, sizeof(idbuf)-1, "%ld", 00180 (long)ap->gid); 00181 id = idbuf; 00182 } else { 00183 id = gr->gr_name; 00184 } 00185 case SMB_ACL_GROUP_OBJ: 00186 tag = "group"; 00187 break; 00188 00189 case SMB_ACL_OTHER: 00190 tag = "other"; 00191 break; 00192 00193 case SMB_ACL_MASK: 00194 tag = "mask"; 00195 break; 00196 00197 } 00198 00199 perms[0] = (ap->a_perm & SMB_ACL_READ) ? 'r' : '-'; 00200 perms[1] = (ap->a_perm & SMB_ACL_WRITE) ? 'w' : '-'; 00201 perms[2] = (ap->a_perm & SMB_ACL_EXECUTE) ? 'x' : '-'; 00202 perms[3] = '\0'; 00203 00204 /* <tag> : <qualifier> : rwx \n \0 */ 00205 nbytes = strlen(tag) + 1 + strlen(id) + 1 + 3 + 1 + 1; 00206 00207 /* 00208 * If this entry would overflow the buffer 00209 * allocate enough additional memory for this 00210 * entry and an estimate of another 20 bytes 00211 * for each entry still to be processed 00212 */ 00213 if ((len + nbytes) > maxlen) { 00214 maxlen += nbytes + 20 * (acl_d->count - i); 00215 if ((text = (char *)SMB_REALLOC(text, maxlen)) == NULL) { 00216 errno = ENOMEM; 00217 return NULL; 00218 } 00219 } 00220 00221 slprintf(&text[len], nbytes-1, "%s:%s:%s\n", tag, id, perms); 00222 len += nbytes - 1; 00223 } 00224 00225 if (len_p) 00226 *len_p = len; 00227 00228 return text; 00229 }
SMB_ACL_T sys_acl_init | ( | int | count | ) |
参照先 smb_acl_t::count・errno・smb_acl_t::next・smb_acl_t::size.
参照元 gpfs2smb_acl()・hpux_acl_to_smb_acl()・solaris_acl_to_smb_acl()・vfswrap_sys_acl_init().
00232 { 00233 SMB_ACL_T a; 00234 00235 if (count < 0) { 00236 errno = EINVAL; 00237 return NULL; 00238 } 00239 00240 /* 00241 * note that since the definition of the structure pointed 00242 * to by the SMB_ACL_T includes the first element of the 00243 * acl[] array, this actually allocates an ACL with room 00244 * for (count+1) entries 00245 */ 00246 if ((a = (struct smb_acl_t *)SMB_MALLOC( 00247 sizeof(struct smb_acl_t) + 00248 count * sizeof(struct smb_acl_entry))) == NULL) { 00249 errno = ENOMEM; 00250 return NULL; 00251 } 00252 00253 a->size = count + 1; 00254 a->count = 0; 00255 a->next = -1; 00256 00257 return a; 00258 }
int sys_acl_create_entry | ( | SMB_ACL_T * | acl_p, | |
SMB_ACL_ENTRY_T * | entry_p | |||
) |
参照先 smb_acl_entry::a_perm・smb_acl_entry::a_type・smb_acl_t::acl・smb_acl_t::count・errno・smb_acl_entry::gid・smb_acl_t::size・SMB_ACL_TAG_INVALID・smb_acl_entry::uid.
参照元 vfswrap_sys_acl_create_entry().
00261 { 00262 SMB_ACL_T acl_d; 00263 SMB_ACL_ENTRY_T entry_d; 00264 00265 if (acl_p == NULL || entry_p == NULL || (acl_d = *acl_p) == NULL) { 00266 errno = EINVAL; 00267 return -1; 00268 } 00269 00270 if (acl_d->count >= acl_d->size) { 00271 errno = ENOSPC; 00272 return -1; 00273 } 00274 00275 entry_d = &acl_d->acl[acl_d->count++]; 00276 entry_d->a_type = SMB_ACL_TAG_INVALID; 00277 entry_d->uid = -1; 00278 entry_d->gid = -1; 00279 entry_d->a_perm = 0; 00280 *entry_p = entry_d; 00281 00282 return 0; 00283 }
int sys_acl_set_tag_type | ( | SMB_ACL_ENTRY_T | entry_d, | |
SMB_ACL_TAG_T | tag_type | |||
) |
参照先 smb_acl_entry::a_type・errno・SMB_ACL_GROUP・SMB_ACL_GROUP_OBJ・SMB_ACL_MASK・SMB_ACL_OTHER・SMB_ACL_USER・SMB_ACL_USER_OBJ.
参照元 hpux_acl_to_smb_acl()・solaris_acl_to_smb_acl()・tru64_ace_to_smb_ace()・vfswrap_sys_acl_set_tag_type().
00286 { 00287 switch (tag_type) { 00288 case SMB_ACL_USER: 00289 case SMB_ACL_USER_OBJ: 00290 case SMB_ACL_GROUP: 00291 case SMB_ACL_GROUP_OBJ: 00292 case SMB_ACL_OTHER: 00293 case SMB_ACL_MASK: 00294 entry_d->a_type = tag_type; 00295 break; 00296 default: 00297 errno = EINVAL; 00298 return -1; 00299 } 00300 00301 return 0; 00302 }
int sys_acl_set_qualifier | ( | SMB_ACL_ENTRY_T | entry_d, | |
void * | qual_p | |||
) |
参照先 smb_acl_entry::a_type・errno・smb_acl_entry::gid・SMB_ACL_GROUP・SMB_ACL_USER・smb_acl_entry::uid.
参照元 hpux_acl_to_smb_acl()・solaris_acl_to_smb_acl()・tru64_ace_to_smb_ace()・vfswrap_sys_acl_set_qualifier().
00305 { 00306 if (entry_d->a_type == SMB_ACL_USER) { 00307 entry_d->uid = *((uid_t *)qual_p); 00308 return 0; 00309 } 00310 if (entry_d->a_type == SMB_ACL_GROUP) { 00311 entry_d->gid = *((gid_t *)qual_p); 00312 return 0; 00313 } 00314 00315 errno = EINVAL; 00316 return -1; 00317 }
int sys_acl_set_permset | ( | SMB_ACL_ENTRY_T | entry_d, | |
SMB_ACL_PERMSET_T | permset_d | |||
) |
参照先 smb_acl_entry::a_perm・errno.
参照元 hpux_acl_to_smb_acl()・solaris_acl_to_smb_acl()・tru64_ace_to_smb_ace()・vfswrap_sys_acl_set_permset().
00320 { 00321 if (*permset_d & ~(SMB_ACL_READ|SMB_ACL_WRITE|SMB_ACL_EXECUTE)) { 00322 errno = EINVAL; 00323 return -1; 00324 } 00325 00326 entry_d->a_perm = *permset_d; 00327 00328 return 0; 00329 }
int sys_acl_free_text | ( | char * | text | ) |
int sys_acl_free_acl | ( | SMB_ACL_T | acl_d | ) |
int sys_acl_free_qualifier | ( | void * | qual, | |
SMB_ACL_TAG_T | tagtype | |||
) |
int sys_acl_valid | ( | SMB_ACL_T | acl_d | ) |
SMB_ACL_T sys_acl_get_file | ( | vfs_handle_struct * | handle, | |
const char * | path_p, | |||
SMB_ACL_TYPE_T | type | |||
) |
参照先 handle・posixacl_sys_acl_get_file().
参照元 vfswrap_sys_acl_get_file().
00364 { 00365 return posixacl_sys_acl_get_file(handle, path_p, type); 00366 }
SMB_ACL_T sys_acl_get_fd | ( | vfs_handle_struct * | handle, | |
files_struct * | fsp, | |||
int | fd | |||
) |
参照先 handle・posixacl_sys_acl_get_fd().
00369 { 00370 return posixacl_sys_acl_get_fd(handle, fsp, fd); 00371 }
int sys_acl_set_file | ( | vfs_handle_struct * | handle, | |
const char * | name, | |||
SMB_ACL_TYPE_T | type, | |||
SMB_ACL_T | acl_d | |||
) |
参照先 handle・posixacl_sys_acl_set_file().
参照元 vfswrap_sys_acl_set_file().
00375 { 00376 return posixacl_sys_acl_set_file(handle, name, type, acl_d); 00377 }
int sys_acl_set_fd | ( | vfs_handle_struct * | handle, | |
files_struct * | fsp, | |||
int | fd, | |||
SMB_ACL_T | acl_d | |||
) |
参照先 handle・posixacl_sys_acl_set_fd().
00381 { 00382 return posixacl_sys_acl_set_fd(handle, fsp, fd, acl_d); 00383 }
int sys_acl_delete_def_file | ( | vfs_handle_struct * | handle, | |
const char * | path | |||
) |
参照先 handle・posixacl_sys_acl_delete_def_file().
参照元 vfswrap_sys_acl_delete_def_file().
00387 { 00388 return posixacl_sys_acl_delete_def_file(handle, path); 00389 }
int no_acl_syscall_error | ( | int | err | ) |
参照元 call_trans2qfilepathinfo()・set_canon_ace_list()・store_inheritance_attributes().
00610 { 00611 #if defined(ENOSYS) 00612 if (err == ENOSYS) { 00613 return 1; 00614 } 00615 #endif 00616 #if defined(ENOTSUP) 00617 if (err == ENOTSUP) { 00618 return 1; 00619 } 00620 #endif 00621 return 0; 00622 }