modules/vfs_tru64acl.c

ソースコードを見る。

関数

static struct smb_acl_ttru64_acl_to_smb_acl (const struct acl *tru64_acl)
static BOOL tru64_ace_to_smb_ace (acl_entry_t tru64_ace, struct smb_acl_entry *smb_ace)
static acl_t smb_acl_to_tru64_acl (const SMB_ACL_T smb_acl)
static acl_tag_t smb_tag_to_tru64 (SMB_ACL_TAG_T smb_tag)
static SMB_ACL_TAG_T tru64_tag_to_smb (acl_tag_t tru64_tag)
static acl_perm_t smb_permset_to_tru64 (SMB_ACL_PERM_T smb_permset)
static SMB_ACL_PERM_T tru64_permset_to_smb (const acl_perm_t tru64_permset)
SMB_ACL_T tru64acl_sys_acl_get_file (vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type)
SMB_ACL_T tru64acl_sys_acl_get_fd (vfs_handle_struct *handle, files_struct *fsp, int fd)
int tru64acl_sys_acl_set_file (vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T theacl)
int tru64acl_sys_acl_set_fd (vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl)
int tru64acl_sys_acl_delete_def_file (vfs_handle_struct *handle, const char *path)
NTSTATUS vfs_tru64acl_init (void)

変数

static vfs_op_tuple tru64acl_op_tuples []


関数

static struct smb_acl_t * tru64_acl_to_smb_acl ( const struct acl *  tru64_acl  )  [static]

vfs_tru64acl.c155 行で定義されています。

参照先 smb_acl_t::aclerrnoresultstrerror()tru64_ace_to_smb_ace().

参照元 tru64acl_sys_acl_get_fd()tru64acl_sys_acl_get_file().

00156 {
00157         struct smb_acl_t *result;
00158         acl_entry_t entry;
00159 
00160         DEBUG(10, ("Hi! This is tru64_acl_to_smb_acl.\n"));
00161         
00162         if ((result = SMB_MALLOC_P(struct smb_acl_t)) == NULL) {
00163                 DEBUG(0, ("SMB_MALLOC_P failed in tru64_acl_to_smb_acl\n"));
00164                 errno = ENOMEM;
00165                 goto fail;
00166         }
00167         ZERO_STRUCTP(result);
00168         if (acl_first_entry((struct acl *)tru64_acl) != 0) {
00169                 DEBUG(10, ("acl_first_entry failed: %s\n", strerror(errno)));
00170                 goto fail;
00171         }
00172         while ((entry = acl_get_entry((struct acl *)tru64_acl)) != NULL) {
00173                 result = SMB_REALLOC(result, sizeof(struct smb_acl_t) +
00174                                         (sizeof(struct smb_acl_entry) * 
00175                                          (result->count + 1)));
00176                 if (result == NULL) {
00177                         DEBUG(0, ("SMB_REALLOC failed in tru64_acl_to_smb_acl\n"));
00178                         errno = ENOMEM;
00179                         goto fail;
00180                 }
00181                 /* XYZ */
00182                 if (!tru64_ace_to_smb_ace(entry, &result->acl[result->count])) {
00183                         SAFE_FREE(result);
00184                         goto fail;
00185                 }
00186                 result->count += 1;
00187         }
00188         return result;
00189 
00190 fail:
00191         if (result != NULL) {
00192                 SAFE_FREE(result);
00193         }
00194         DEBUG(1, ("tru64_acl_to_smb_acl failed!\n"));
00195         return NULL;
00196 }

static BOOL tru64_ace_to_smb_ace ( acl_entry_t  tru64_ace,
struct smb_acl_entry smb_ace 
) [static]

vfs_tru64acl.c198 行で定義されています。

参照先 errnostrerror()sys_acl_set_permset()sys_acl_set_qualifier()sys_acl_set_tag_type()tru64_permset_to_smb()tru64_tag_to_smb().

参照元 tru64_acl_to_smb_acl().

00200 {
00201         acl_tag_t tru64_tag;
00202         acl_permset_t permset;
00203         SMB_ACL_TAG_T smb_tag_type;
00204         SMB_ACL_PERM_T smb_permset;
00205         void *qualifier;
00206 
00207         if (acl_get_tag_type(tru64_ace, &tru64_tag) != 0) {
00208                 DEBUG(0, ("acl_get_tag_type failed: %s\n", strerror(errno)));
00209                 return False;
00210         }
00211         
00212         /* On could set the tag type directly to save a function call, 
00213          * but I like this better... */
00214         smb_tag_type = tru64_tag_to_smb(tru64_tag);
00215         if (smb_tag_type == 0) {
00216                 DEBUG(3, ("invalid tag type given: %d\n", tru64_tag));
00217                 return False;
00218         }
00219         if (sys_acl_set_tag_type(smb_ace, smb_tag_type) != 0) {
00220                 DEBUG(3, ("sys_acl_set_tag_type failed: %s\n", 
00221                                 strerror(errno)));
00222                 return False;
00223         }
00224         qualifier = acl_get_qualifier(tru64_ace);
00225         if (qualifier != NULL) {
00226                 if (sys_acl_set_qualifier(smb_ace, qualifier) != 0) {
00227                         DEBUG(3, ("sys_acl_set_qualifier failed\n"));
00228                         return False;
00229                 }
00230         }
00231         if (acl_get_permset(tru64_ace, &permset) != 0) {
00232                 DEBUG(3, ("acl_get_permset failed: %s\n", strerror(errno)));
00233                 return False;
00234         }
00235         smb_permset = tru64_permset_to_smb(*permset);
00236         if (sys_acl_set_permset(smb_ace, &smb_permset) != 0) {
00237                 DEBUG(3, ("sys_acl_set_permset failed: %s\n", strerror(errno)));
00238                 return False;
00239         }
00240         return True;
00241 }

static acl_t smb_acl_to_tru64_acl ( const SMB_ACL_T  smb_acl  )  [static]

vfs_tru64acl.c243 行で定義されています。

参照先 smb_acl_t::aclsmb_acl_t::counterrnoresultSMB_ACL_GROUPSMB_ACL_USERsmb_permset_to_tru64()smb_tag_to_tru64()strerror().

参照元 tru64acl_sys_acl_set_fd()tru64acl_sys_acl_set_file().

00244 {
00245         acl_t result;
00246         acl_entry_t tru64_entry;
00247         int i;
00248         char *acl_text;
00249         ssize_t acl_text_len;
00250         
00251         /* The tru64 acl_init function takes a size_t value
00252          * instead of a count of entries (as with posix). 
00253          * the size parameter "Specifies the size of the working
00254          * storage in bytes" (according to the man page). 
00255          * But it is unclear to me, how this size is to be 
00256          * calculated. 
00257          *
00258          * It should not matter, since acl_create_entry enlarges 
00259          * the working storage at need. ... */
00260 
00261         DEBUG(10, ("Hi! This is smb_acl_to_tru64_acl.\n"));
00262 
00263         result = acl_init(1);
00264 
00265         if (result == NULL) {
00266                 DEBUG(3, ("acl_init failed!\n"));
00267                 goto fail;
00268         }
00269         
00270         DEBUGADD(10, ("parsing acl entries...\n"));
00271         for (i = 0; i < smb_acl->count; i++) {
00272                 /* XYZ - maybe eliminate this direct access? */
00273                 const struct smb_acl_entry *smb_entry = &smb_acl->acl[i];
00274                 acl_tag_t tru64_tag;
00275                 acl_perm_t tru64_permset;
00276 
00277                 tru64_tag = smb_tag_to_tru64(smb_entry->a_type);
00278                 if (tru64_tag == -1) {
00279                         DEBUG(3, ("smb_tag_to_tru64 failed!\n"));
00280                         goto fail;
00281                 }
00282 
00283                 if (tru64_tag == ACL_MASK) {
00284                         DEBUGADD(10, (" - acl type ACL_MASK: not implemented on Tru64 ==> skipping\n"));
00285                         continue;
00286                 }
00287                 
00288                 tru64_entry = acl_create_entry(&result);
00289                 if (tru64_entry == NULL) {
00290                         DEBUG(3, ("acl_create_entry failed: %s\n", 
00291                                         strerror(errno)));
00292                         goto fail;
00293                 }
00294 
00295                 if (acl_set_tag_type(tru64_entry, tru64_tag) != 0) {
00296                         DEBUG(3, ("acl_set_tag_type(%d) failed: %s\n",
00297                                         strerror(errno)));
00298                         goto fail;
00299                 }
00300                 
00301                 switch (smb_entry->a_type) {
00302                 case SMB_ACL_USER:
00303                         if (acl_set_qualifier(tru64_entry, 
00304                                                 (int *)&smb_entry->uid) != 0) 
00305                         {
00306                                 DEBUG(3, ("acl_set_qualifier failed: %s\n",
00307                                         strerror(errno)));
00308                                 goto fail;
00309                         }
00310                         DEBUGADD(10, (" - setting uid to %d\n", smb_entry->uid));
00311                         break;
00312                 case SMB_ACL_GROUP:
00313                         if (acl_set_qualifier(tru64_entry, 
00314                                                 (int *)&smb_entry->gid) != 0)
00315                         {
00316                                 DEBUG(3, ("acl_set_qualifier failed: %s\n",
00317                                         strerror(errno)));
00318                                 goto fail;
00319                         }
00320                         DEBUGADD(10, (" - setting gid to %d\n", smb_entry->gid));
00321                         break;
00322                 default:
00323                         break;
00324                 }
00325 
00326                 tru64_permset = smb_permset_to_tru64(smb_entry->a_perm);
00327                 if (tru64_permset == -1) {
00328                         DEBUG(3, ("smb_permset_to_tru64 failed!\n"));
00329                         goto fail;
00330                 }
00331                 DEBUGADD(10, (" - setting perms to %0d\n", tru64_permset));
00332                 if (acl_set_permset(tru64_entry, &tru64_permset) != 0)
00333                 {
00334                         DEBUG(3, ("acl_set_permset failed: %s\n", strerror(errno)));
00335                         goto fail;
00336                 }
00337         } /* for */
00338         DEBUGADD(10, ("done parsing acl entries\n"));
00339 
00340         tru64_entry = NULL;
00341         if (acl_valid(result, &tru64_entry) != 0) {
00342                 DEBUG(1, ("smb_acl_to_tru64_acl: ACL is invalid (%s)\n",
00343                                 strerror(errno)));
00344                 if (tru64_entry != NULL) {
00345                         DEBUGADD(1, ("the acl contains duplicate entries\n"));
00346                 }
00347                 goto fail;
00348         }
00349         DEBUGADD(10, ("acl is valid\n"));
00350 
00351         acl_text = acl_to_text(result, &acl_text_len);
00352         if (acl_text == NULL) {
00353                 DEBUG(3, ("acl_to_text failed: %s\n", strerror(errno)));
00354                 goto fail;
00355         }
00356         DEBUG(1, ("acl_text: %s\n", acl_text));
00357         free(acl_text);
00358 
00359         return result;
00360 
00361 fail:
00362         if (result != NULL) {
00363                 acl_free(result);
00364         }
00365         DEBUG(1, ("smb_acl_to_tru64_acl failed!\n"));
00366         return NULL;
00367 }

static acl_tag_t smb_tag_to_tru64 ( SMB_ACL_TAG_T  smb_tag  )  [static]

vfs_tru64acl.c369 行で定義されています。

参照先 resultSMB_ACL_GROUPSMB_ACL_GROUP_OBJSMB_ACL_MASKSMB_ACL_OTHERSMB_ACL_USERSMB_ACL_USER_OBJ.

参照元 smb_acl_to_tru64_acl().

00370 {
00371         acl_tag_t result;
00372         switch (smb_tag) {
00373         case SMB_ACL_USER:
00374                 result = ACL_USER;
00375                 DEBUGADD(10, ("got acl type ACL_USER\n"));
00376                 break;
00377         case SMB_ACL_USER_OBJ:
00378                 result = ACL_USER_OBJ;
00379                 DEBUGADD(10, ("got acl type ACL_USER_OBJ\n"));
00380                 break;
00381         case SMB_ACL_GROUP:
00382                 result = ACL_GROUP;
00383                 DEBUGADD(10, ("got acl type ACL_GROUP\n"));
00384                 break;
00385         case SMB_ACL_GROUP_OBJ:
00386                 result = ACL_GROUP_OBJ;
00387                 DEBUGADD(10, ("got acl type ACL_GROUP_OBJ\n"));
00388                 break;
00389         case SMB_ACL_OTHER:
00390                 result = ACL_OTHER;
00391                 DEBUGADD(10, ("got acl type ACL_OTHER\n"));
00392                 break;
00393         case SMB_ACL_MASK:
00394                 result = ACL_MASK;
00395                 DEBUGADD(10, ("got acl type ACL_MASK\n"));
00396                 break;
00397         default:
00398                 DEBUG(1, ("Unknown tag type %d\n", smb_tag));
00399                 result = -1;
00400         }
00401         return result;
00402 }

static SMB_ACL_TAG_T tru64_tag_to_smb ( acl_tag_t  tru64_tag  )  [static]

vfs_tru64acl.c405 行で定義されています。

参照先 SMB_ACL_GROUPSMB_ACL_GROUP_OBJSMB_ACL_MASKSMB_ACL_OTHERSMB_ACL_USERSMB_ACL_USER_OBJ.

参照元 tru64_ace_to_smb_ace().

00406 {
00407         SMB_ACL_TAG_T smb_tag_type;
00408         switch(tru64_tag) {
00409         case ACL_USER:
00410                 smb_tag_type = SMB_ACL_USER;
00411                 DEBUGADD(10, ("got smb acl tag type SMB_ACL_USER\n"));
00412                 break;
00413         case ACL_USER_OBJ:
00414                 smb_tag_type = SMB_ACL_USER_OBJ;
00415                 DEBUGADD(10, ("got smb acl tag type SMB_ACL_USER_OBJ\n"));
00416                 break;
00417         case ACL_GROUP:
00418                 smb_tag_type = SMB_ACL_GROUP;
00419                 DEBUGADD(10, ("got smb acl tag type SMB_ACL_GROUP\n"));
00420                 break;
00421         case ACL_GROUP_OBJ:
00422                 smb_tag_type = SMB_ACL_GROUP_OBJ;
00423                 DEBUGADD(10, ("got smb acl tag type SMB_ACL_GROUP_OBJ\n"));
00424                 break;
00425         case ACL_OTHER:
00426                 smb_tag_type = SMB_ACL_OTHER;
00427                 DEBUGADD(10, ("got smb acl tag type SMB_ACL_OTHER\n"));
00428                 break;
00429         case ACL_MASK:
00430                 smb_tag_type = SMB_ACL_MASK;
00431                 DEBUGADD(10, ("got smb acl tag type SMB_ACL_MASK\n"));
00432                 break;
00433         default:
00434                 DEBUG(0, ("Unknown tag type %d\n", (unsigned int)tru64_tag));
00435                 smb_tag_type = 0;
00436         }
00437         return smb_tag_type;
00438 }

static acl_perm_t smb_permset_to_tru64 ( SMB_ACL_PERM_T  smb_permset  )  [static]

vfs_tru64acl.c440 行で定義されています。

参照先 errnostrerror().

参照元 smb_acl_to_tru64_acl().

00441 {
00442         /* originally, I thought that acl_clear_perm was the
00443          * proper way to reset the permset to 0. but without 
00444          * initializing it to 0, acl_clear_perm fails.
00445          * so probably, acl_clear_perm is not necessary here... ?! */
00446         acl_perm_t tru64_permset = 0;
00447         if (acl_clear_perm(&tru64_permset) != 0) {
00448                 DEBUG(5, ("acl_clear_perm failed: %s\n", strerror(errno)));
00449                 return -1;
00450         }
00451         /* according to original lib/sysacls.c, acl_add_perm is
00452          * broken on tru64 ... */
00453         tru64_permset |= ((smb_permset & SMB_ACL_READ) ? ACL_READ : 0);
00454         tru64_permset |= ((smb_permset & SMB_ACL_WRITE) ? ACL_WRITE : 0);
00455         tru64_permset |= ((smb_permset & SMB_ACL_EXECUTE) ? ACL_EXECUTE : 0);
00456         return tru64_permset;
00457 }

static SMB_ACL_PERM_T tru64_permset_to_smb ( const acl_perm_t  tru64_permset  )  [static]

vfs_tru64acl.c459 行で定義されています。

参照元 tru64_ace_to_smb_ace().

00460 {
00461         SMB_ACL_PERM_T smb_permset  = 0;
00462         smb_permset |= ((tru64_permset & ACL_READ) ? SMB_ACL_READ : 0);
00463         smb_permset |= ((tru64_permset & ACL_WRITE) ? SMB_ACL_WRITE : 0);
00464         smb_permset |= ((tru64_permset & ACL_EXECUTE) ? SMB_ACL_EXECUTE : 0);
00465         return smb_permset;
00466 }

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

vfs_tru64acl.c37 行で定義されています。

参照先 errnoresulttru64_acl_to_smb_acl().

00040 {
00041         struct smb_acl_t *result;
00042         acl_type_t the_acl_type;
00043         acl_t tru64_acl;
00044 
00045         DEBUG(10, ("Hi! This is tru64acl_sys_acl_get_file.\n"));
00046 
00047         switch(type) {
00048         case SMB_ACL_TYPE_ACCESS:
00049                 the_acl_type = ACL_TYPE_ACCESS;
00050                 break;
00051         case SMB_ACL_TYPE_DEFAULT:
00052                 the_acl_type = ACL_TYPE_DEFAULT;
00053                 break;
00054         default:
00055                 errno = EINVAL;
00056                 return NULL;
00057         }
00058 
00059         tru64_acl = acl_get_file((char *)path_p, the_acl_type);
00060 
00061         if (tru64_acl == NULL) {
00062                 return NULL;
00063         }
00064 
00065         result = tru64_acl_to_smb_acl(tru64_acl);
00066         acl_free(tru64_acl);
00067         return result;
00068 }

SMB_ACL_T tru64acl_sys_acl_get_fd ( vfs_handle_struct handle,
files_struct fsp,
int  fd 
)

vfs_tru64acl.c70 行で定義されています。

参照先 resulttru64_acl_to_smb_acl().

00073 {
00074         struct smb_acl_t *result;
00075         acl_t tru64_acl = acl_get_fd(fd, ACL_TYPE_ACCESS);
00076 
00077         if (tru64_acl == NULL) {
00078                 return NULL;
00079         }
00080         
00081         result = tru64_acl_to_smb_acl(tru64_acl);
00082         acl_free(tru64_acl);
00083         return result;
00084 }

int tru64acl_sys_acl_set_file ( vfs_handle_struct handle,
const char *  name,
SMB_ACL_TYPE_T  type,
SMB_ACL_T  theacl 
)

vfs_tru64acl.c86 行で定義されています。

参照先 errnosmb_acl_to_tru64_acl()strerror().

00090 {
00091         int res;
00092         acl_type_t the_acl_type;
00093         acl_t tru64_acl;
00094 
00095         DEBUG(10, ("tru64acl_sys_acl_set_file called with name %s, type %d\n", 
00096                         name, type));
00097 
00098         switch(type) {
00099         case SMB_ACL_TYPE_ACCESS:
00100                 DEBUGADD(10, ("got acl type ACL_TYPE_ACCESS\n"));
00101                 the_acl_type = ACL_TYPE_ACCESS;
00102                 break;
00103         case SMB_ACL_TYPE_DEFAULT:
00104                 DEBUGADD(10, ("got acl type ACL_TYPE_DEFAULT\n"));
00105                 the_acl_type = ACL_TYPE_DEFAULT;
00106                 break;
00107         default:
00108                 DEBUGADD(10, ("invalid acl type\n"));
00109                 errno = EINVAL;
00110                 goto fail;
00111         }
00112 
00113         tru64_acl = smb_acl_to_tru64_acl(theacl);
00114         if (tru64_acl == NULL) {
00115                 DEBUG(10, ("smb_acl_to_tru64_acl failed!\n"));
00116                 goto fail;
00117         }
00118         DEBUG(10, ("got tru64 acl...\n"));
00119         res = acl_set_file((char *)name, the_acl_type, tru64_acl);
00120         acl_free(tru64_acl);
00121         if (res != 0) {
00122                 DEBUG(10, ("acl_set_file failed: %s\n", strerror(errno)));
00123                 goto fail;
00124         }
00125         return res;
00126 fail:
00127         DEBUG(1, ("tru64acl_sys_acl_set_file failed!\n"));
00128         return -1;
00129 }

int tru64acl_sys_acl_set_fd ( vfs_handle_struct handle,
files_struct fsp,
int  fd,
SMB_ACL_T  theacl 
)

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

参照先 smb_acl_to_tru64_acl().

00134 {
00135         int res;
00136         acl_t tru64_acl = smb_acl_to_tru64_acl(theacl);
00137         if (tru64_acl == NULL) {
00138                 return -1;
00139         }
00140         res =  acl_set_fd(fd, ACL_TYPE_ACCESS, tru64_acl);
00141         acl_free(tru64_acl);
00142         return res;
00143 
00144 }

int tru64acl_sys_acl_delete_def_file ( vfs_handle_struct handle,
const char *  path 
)

vfs_tru64acl.c146 行で定義されています。

00148 {
00149         return acl_delete_def_file((char *)path);
00150 }

NTSTATUS vfs_tru64acl_init ( void   ) 

vfs_tru64acl.c499 行で定義されています。

参照先 smb_register_vfs()tru64acl_op_tuples.

00500 {
00501         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "tru64acl",
00502                                 tru64acl_op_tuples);
00503 }


変数

vfs_op_tuple tru64acl_op_tuples[] [static]

初期値:

 {
        
  {SMB_VFS_OP(tru64acl_sys_acl_get_file),
   SMB_VFS_OP_SYS_ACL_GET_FILE,
   SMB_VFS_LAYER_TRANSPARENT},

  {SMB_VFS_OP(tru64acl_sys_acl_get_fd),
   SMB_VFS_OP_SYS_ACL_GET_FD,
   SMB_VFS_LAYER_TRANSPARENT},

  {SMB_VFS_OP(tru64acl_sys_acl_set_file),
   SMB_VFS_OP_SYS_ACL_SET_FILE,
   SMB_VFS_LAYER_TRANSPARENT},

  {SMB_VFS_OP(tru64acl_sys_acl_set_fd),
   SMB_VFS_OP_SYS_ACL_SET_FD,
   SMB_VFS_LAYER_TRANSPARENT},

  {SMB_VFS_OP(tru64acl_sys_acl_delete_def_file),
   SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE,
   SMB_VFS_LAYER_TRANSPARENT},

  {SMB_VFS_OP(NULL),
   SMB_VFS_OP_NOOP,
   SMB_VFS_LAYER_NOOP}
}

vfs_tru64acl.c471 行で定義されています。

参照元 vfs_tru64acl_init().


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