lib/sysacls.c

ソースコードを見る。

関数

int sys_acl_get_entry (SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p)
int sys_acl_get_tag_type (SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p)
int sys_acl_get_permset (SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p)
void * sys_acl_get_qualifier (SMB_ACL_ENTRY_T entry_d)
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)
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 sys_acl_init (int count)
int sys_acl_create_entry (SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p)
int sys_acl_set_tag_type (SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type)
int sys_acl_set_qualifier (SMB_ACL_ENTRY_T entry_d, void *qual_p)
int sys_acl_set_permset (SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d)
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)
SMB_ACL_T sys_acl_get_fd (vfs_handle_struct *handle, files_struct *fsp, int fd)
int sys_acl_set_file (vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
int sys_acl_set_fd (vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T acl_d)
int sys_acl_delete_def_file (vfs_handle_struct *handle, const char *path)
int no_acl_syscall_error (int err)


関数

int sys_acl_get_entry ( SMB_ACL_T  acl_d,
int  entry_id,
SMB_ACL_ENTRY_T entry_p 
)

sysacls.c43 行で定義されています。

参照先 smb_acl_t::aclsmb_acl_t::counterrnosmb_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 
)

sysacls.c73 行で定義されています。

参照先 smb_acl_entry::a_type.

参照元 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 
)

sysacls.c80 行で定義されています。

参照先 smb_acl_entry::a_perm.

参照元 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  ) 

sysacls.c87 行で定義されています。

参照先 smb_acl_entry::a_typeerrnosmb_acl_entry::gidSMB_ACL_GROUPSMB_ACL_USERsmb_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  ) 

sysacls.c101 行で定義されています。

参照元 vfswrap_sys_acl_clear_perms().

00102 {
00103         *permset_d = 0;
00104 
00105         return 0;
00106 }

int sys_acl_add_perm ( SMB_ACL_PERMSET_T  permset_d,
SMB_ACL_PERM_T  perm 
)

sysacls.c108 行で定義されています。

参照先 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 
)

sysacls.c126 行で定義されています。

参照元 vfswrap_sys_acl_get_perm().

00127 {
00128         return *permset_d & perm;
00129 }

char* sys_acl_to_text ( SMB_ACL_T  acl_d,
ssize_t *  len_p 
)

sysacls.c131 行で定義されています。

参照先 smb_acl_t::aclsmb_acl_t::counterrnolenpermsSMB_ACL_GROUPSMB_ACL_GROUP_OBJSMB_ACL_MASKSMB_ACL_OTHERSMB_ACL_USERSMB_ACL_USER_OBJuidtoname().

参照元 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  ) 

sysacls.c231 行で定義されています。

参照先 smb_acl_t::counterrnosmb_acl_t::nextsmb_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 
)

sysacls.c260 行で定義されています。

参照先 smb_acl_entry::a_permsmb_acl_entry::a_typesmb_acl_t::aclsmb_acl_t::counterrnosmb_acl_entry::gidsmb_acl_t::sizeSMB_ACL_TAG_INVALIDsmb_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 
)

sysacls.c285 行で定義されています。

参照先 smb_acl_entry::a_typeerrnoSMB_ACL_GROUPSMB_ACL_GROUP_OBJSMB_ACL_MASKSMB_ACL_OTHERSMB_ACL_USERSMB_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 
)

sysacls.c304 行で定義されています。

参照先 smb_acl_entry::a_typeerrnosmb_acl_entry::gidSMB_ACL_GROUPSMB_ACL_USERsmb_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 
)

sysacls.c319 行で定義されています。

参照先 smb_acl_entry::a_permerrno.

参照元 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  ) 

sysacls.c331 行で定義されています。

参照元 vfswrap_sys_acl_free_text().

00332 {
00333         SAFE_FREE(text);
00334         return 0;
00335 }

int sys_acl_free_acl ( SMB_ACL_T  acl_d  ) 

sysacls.c337 行で定義されています。

参照元 vfswrap_sys_acl_free_acl().

00338 {
00339         SAFE_FREE(acl_d);
00340         return 0;
00341 }

int sys_acl_free_qualifier ( void *  qual,
SMB_ACL_TAG_T  tagtype 
)

sysacls.c343 行で定義されています。

参照元 vfswrap_sys_acl_free_qualifier().

00344 {
00345         return 0;
00346 }

int sys_acl_valid ( SMB_ACL_T  acl_d  ) 

sysacls.c348 行で定義されています。

参照先 errno.

参照元 vfswrap_sys_acl_valid().

00349 {
00350         errno = EINVAL;
00351         return -1;
00352 }

SMB_ACL_T sys_acl_get_file ( vfs_handle_struct handle,
const char *  path_p,
SMB_ACL_TYPE_T  type 
)

sysacls.c362 行で定義されています。

参照先 handleposixacl_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 
)

sysacls.c368 行で定義されています。

参照先 handleposixacl_sys_acl_get_fd().

参照元 vfswrap_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 
)

sysacls.c373 行で定義されています。

参照先 handleposixacl_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 
)

sysacls.c379 行で定義されています。

参照先 handleposixacl_sys_acl_set_fd().

参照元 vfswrap_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 
)

sysacls.c385 行で定義されています。

参照先 handleposixacl_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  ) 

sysacls.c609 行で定義されています。

参照元 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 }


Sambaに対してSat Aug 29 21:23:38 2009に生成されました。  doxygen 1.4.7