modules/vfs_hpuxacl.c

ソースコードを見る。

データ構造

struct  hpux_acl_types

型定義

typedef acl HPUX_ACE_T
typedef acl * HPUX_ACL_T
typedef int HPUX_ACL_TAG_T
typedef ushort HPUX_PERM_T

関数

static HPUX_ACL_T hpux_acl_init (int count)
static BOOL smb_acl_to_hpux_acl (SMB_ACL_T smb_acl, HPUX_ACL_T *solariacl, int *count, SMB_ACL_TYPE_T type)
static SMB_ACL_T hpux_acl_to_smb_acl (HPUX_ACL_T hpuxacl, int count, SMB_ACL_TYPE_T type)
static HPUX_ACL_TAG_T smb_tag_to_hpux_tag (SMB_ACL_TAG_T smb_tag)
static SMB_ACL_TAG_T hpux_tag_to_smb_tag (HPUX_ACL_TAG_T hpux_tag)
static BOOL hpux_add_to_acl (HPUX_ACL_T *hpux_acl, int *count, HPUX_ACL_T add_acl, int add_count, SMB_ACL_TYPE_T type)
static BOOL hpux_acl_get_file (const char *name, HPUX_ACL_T *hpuxacl, int *count)
static SMB_ACL_PERM_T hpux_perm_to_smb_perm (const HPUX_PERM_T perm)
static HPUX_PERM_T smb_perm_to_hpux_perm (const SMB_ACL_PERM_T perm)
static BOOL hpux_acl_check (HPUX_ACL_T hpux_acl, int count)
static BOOL hpux_acl_sort (HPUX_ACL_T acl, int count)
static int hpux_internal_aclsort (int acl_count, int calclass, HPUX_ACL_T aclp)
static void hpux_count_obj (int acl_count, HPUX_ACL_T aclp, struct hpux_acl_types *acl_type_count)
static void hpux_swap_acl_entries (HPUX_ACE_T *aclp0, HPUX_ACE_T *aclp1)
static BOOL hpux_prohibited_duplicate_type (int acl_type)
static BOOL hpux_acl_call_present (void)
static BOOL hpux_aclsort_call_present (void)
SMB_ACL_T hpuxacl_sys_acl_get_file (vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type)
SMB_ACL_T hpuxacl_sys_acl_get_fd (vfs_handle_struct *handle, files_struct *fsp, int fd)
int hpuxacl_sys_acl_set_file (vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T theacl)
int hpuxacl_sys_acl_set_fd (vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl)
int hpuxacl_sys_acl_delete_def_file (vfs_handle_struct *handle, const char *path)
static int hpux_get_needed_class_perm (struct acl *aclp)
NTSTATUS vfs_hpuxacl_init (void)

変数

static vfs_op_tuple hpuxacl_op_tuples []


型定義

typedef struct acl HPUX_ACE_T

vfs_hpuxacl.c68 行で定義されています。

typedef struct acl* HPUX_ACL_T

vfs_hpuxacl.c69 行で定義されています。

typedef int HPUX_ACL_TAG_T

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

typedef ushort HPUX_PERM_T

vfs_hpuxacl.c71 行で定義されています。


関数

static HPUX_ACL_T hpux_acl_init ( int  count  )  [static]

vfs_hpuxacl.c394 行で定義されています。

参照先 errno.

参照元 hpux_acl_get_file().

00395 {
00396         HPUX_ACL_T hpux_acl = 
00397                 (HPUX_ACL_T)SMB_MALLOC(sizeof(HPUX_ACE_T) * count);
00398         if (hpux_acl == NULL) {
00399                 errno = ENOMEM;
00400         }
00401         return hpux_acl;
00402 }

static BOOL smb_acl_to_hpux_acl ( SMB_ACL_T  smb_acl,
HPUX_ACL_T solariacl,
int *  count,
SMB_ACL_TYPE_T  type 
) [static]

vfs_hpuxacl.c408 行で定義されています。

参照先 smb_acl_t::aclsmb_acl_t::counthpux_add_to_acl()smb_perm_to_hpux_perm()smb_tag_to_hpux_tag().

参照元 hpuxacl_sys_acl_delete_def_file()hpuxacl_sys_acl_set_file().

00411 {
00412         BOOL ret = False;
00413         int i;
00414         int check_which, check_rc;
00415 
00416         DEBUG(10, ("entering smb_acl_to_hpux_acl\n"));
00417         
00418         *hpux_acl = NULL;
00419         *count = 0;
00420 
00421         for (i = 0; i < smb_acl->count; i++) {
00422                 const struct smb_acl_entry *smb_entry = &(smb_acl->acl[i]);
00423                 HPUX_ACE_T hpux_entry;
00424 
00425                 ZERO_STRUCT(hpux_entry);
00426 
00427                 hpux_entry.a_type = smb_tag_to_hpux_tag(smb_entry->a_type);
00428                 if (hpux_entry.a_type == 0) {
00429                         DEBUG(10, ("smb_tag to hpux_tag failed\n"));
00430                         goto fail;
00431                 }
00432                 switch(hpux_entry.a_type) {
00433                 case USER:
00434                         DEBUG(10, ("got tag type USER with uid %d\n", 
00435                                    smb_entry->uid));
00436                         hpux_entry.a_id = (uid_t)smb_entry->uid;
00437                         break;
00438                 case GROUP:
00439                         DEBUG(10, ("got tag type GROUP with gid %d\n", 
00440                                    smb_entry->gid));
00441                         hpux_entry.a_id = (uid_t)smb_entry->gid;
00442                         break;
00443                 default:
00444                         break;
00445                 }
00446                 if (type == SMB_ACL_TYPE_DEFAULT) {
00447                         DEBUG(10, ("adding default bit to hpux ace\n"));
00448                         hpux_entry.a_type |= ACL_DEFAULT;
00449                 }
00450                 
00451                 hpux_entry.a_perm = 
00452                         smb_perm_to_hpux_perm(smb_entry->a_perm);
00453                 DEBUG(10, ("assembled the following hpux ace:\n"));
00454                 DEBUGADD(10, (" - type: 0x%04x\n", hpux_entry.a_type));
00455                 DEBUGADD(10, (" - id: %d\n", hpux_entry.a_id));
00456                 DEBUGADD(10, (" - perm: o%o\n", hpux_entry.a_perm));
00457                 if (!hpux_add_to_acl(hpux_acl, count, &hpux_entry, 
00458                                         1, type))
00459                 {
00460                         DEBUG(10, ("error adding acl entry\n"));
00461                         goto fail;
00462                 }
00463                 DEBUG(10, ("count after adding: %d (i: %d)\n", *count, i));
00464                 DEBUG(10, ("test, if entry has been copied into acl:\n"));
00465                 DEBUGADD(10, (" - type: 0x%04x\n",
00466                               (*hpux_acl)[(*count)-1].a_type));
00467                 DEBUGADD(10, (" - id: %d\n",
00468                               (*hpux_acl)[(*count)-1].a_id));
00469                 DEBUGADD(10, (" - perm: o%o\n",
00470                               (*hpux_acl)[(*count)-1].a_perm));
00471         }
00472 
00473         ret = True;
00474         goto done;
00475         
00476  fail:
00477         SAFE_FREE(*hpux_acl);
00478  done:
00479         DEBUG(10, ("smb_acl_to_hpux_acl %s\n",
00480                    ((ret == True) ? "succeeded" : "failed")));
00481         return ret;
00482 }

static SMB_ACL_T hpux_acl_to_smb_acl ( HPUX_ACL_T  hpuxacl,
int  count,
SMB_ACL_TYPE_T  type 
) [static]

vfs_hpuxacl.c488 行で定義されています。

参照先 hpux_perm_to_smb_perm()hpux_tag_to_smb_tag()resultsys_acl_init()sys_acl_set_permset()sys_acl_set_qualifier()sys_acl_set_tag_type().

参照元 hpuxacl_sys_acl_get_file().

00490 {
00491         SMB_ACL_T result;
00492         int i;
00493 
00494         if ((result = sys_acl_init(0)) == NULL) {
00495                 DEBUG(10, ("error allocating memory for SMB_ACL\n"));
00496                 goto fail;
00497         }
00498         for (i = 0; i < count; i++) {
00499                 SMB_ACL_ENTRY_T smb_entry;
00500                 SMB_ACL_PERM_T smb_perm;
00501                 
00502                 if (!_IS_OF_TYPE(hpux_acl[i], type)) {
00503                         continue;
00504                 }
00505                 result = SMB_REALLOC(result, 
00506                                      sizeof(struct smb_acl_t) +
00507                                      (sizeof(struct smb_acl_entry) *
00508                                       (result->count + 1)));
00509                 if (result == NULL) {
00510                         DEBUG(10, ("error reallocating memory for SMB_ACL\n"));
00511                         goto fail;
00512                 }
00513                 smb_entry = &result->acl[result->count];
00514                 if (sys_acl_set_tag_type(smb_entry,
00515                                          hpux_tag_to_smb_tag(hpux_acl[i].a_type)) != 0)
00516                 {
00517                         DEBUG(10, ("invalid tag type given: 0x%04x\n",
00518                                    hpux_acl[i].a_type));
00519                         goto fail;
00520                 }
00521                 /* intentionally not checking return code here: */
00522                 sys_acl_set_qualifier(smb_entry, (void *)&hpux_acl[i].a_id);
00523                 smb_perm = hpux_perm_to_smb_perm(hpux_acl[i].a_perm);
00524                 if (sys_acl_set_permset(smb_entry, &smb_perm) != 0) {
00525                         DEBUG(10, ("invalid permset given: %d\n", 
00526                                    hpux_acl[i].a_perm));
00527                         goto fail;
00528                 }
00529                 result->count += 1;
00530         }
00531         goto done;
00532         
00533  fail:
00534         SAFE_FREE(result);
00535  done:
00536         DEBUG(10, ("hpux_acl_to_smb_acl %s\n",
00537                    ((result == NULL) ? "failed" : "succeeded")));
00538         return result;
00539 }

static HPUX_ACL_TAG_T smb_tag_to_hpux_tag ( SMB_ACL_TAG_T  smb_tag  )  [static]

vfs_hpuxacl.c543 行で定義されています。

参照先 SMB_ACL_GROUPSMB_ACL_GROUP_OBJSMB_ACL_MASKSMB_ACL_OTHERSMB_ACL_USERSMB_ACL_USER_OBJ.

参照元 smb_acl_to_hpux_acl().

00544 {
00545         HPUX_ACL_TAG_T hpux_tag = 0;
00546 
00547         DEBUG(10, ("smb_tag_to_hpux_tag\n"));
00548         DEBUGADD(10, (" --> got smb tag 0x%04x\n", smb_tag));
00549         
00550         switch (smb_tag) {
00551         case SMB_ACL_USER:
00552                 hpux_tag = USER;
00553                 break;
00554         case SMB_ACL_USER_OBJ:
00555                 hpux_tag = USER_OBJ;
00556                 break;
00557         case SMB_ACL_GROUP:
00558                 hpux_tag = GROUP;
00559                 break;
00560         case SMB_ACL_GROUP_OBJ:
00561                 hpux_tag = GROUP_OBJ;
00562                 break;
00563         case SMB_ACL_OTHER:
00564                 hpux_tag = OTHER_OBJ;
00565                 break;
00566         case SMB_ACL_MASK:
00567                 hpux_tag = CLASS_OBJ;
00568                 break;
00569         default:
00570                 DEBUGADD(10, (" !!! unknown smb tag type 0x%04x\n", smb_tag));
00571                 break;
00572         }
00573         
00574         DEBUGADD(10, (" --> determined hpux tag 0x%04x\n", hpux_tag));
00575 
00576         return hpux_tag;
00577 }

static SMB_ACL_TAG_T hpux_tag_to_smb_tag ( HPUX_ACL_TAG_T  hpux_tag  )  [static]

vfs_hpuxacl.c579 行で定義されています。

参照先 SMB_ACL_GROUPSMB_ACL_GROUP_OBJSMB_ACL_MASKSMB_ACL_OTHERSMB_ACL_USERSMB_ACL_USER_OBJ.

参照元 hpux_acl_to_smb_acl().

00580 {
00581         SMB_ACL_TAG_T smb_tag = 0;
00582 
00583         DEBUG(10, ("hpux_tag_to_smb_tag:\n"));
00584         DEBUGADD(10, (" --> got hpux tag 0x%04x\n", hpux_tag)); 
00585         
00586         hpux_tag &= ~ACL_DEFAULT; 
00587 
00588         switch (hpux_tag) {
00589         case USER:
00590                 smb_tag = SMB_ACL_USER;
00591                 break;
00592         case USER_OBJ:
00593                 smb_tag = SMB_ACL_USER_OBJ;
00594                 break;
00595         case GROUP:
00596                 smb_tag = SMB_ACL_GROUP;
00597                 break;
00598         case GROUP_OBJ:
00599                 smb_tag = SMB_ACL_GROUP_OBJ;
00600                 break;
00601         case OTHER_OBJ:
00602                 smb_tag = SMB_ACL_OTHER;
00603                 break;
00604         case CLASS_OBJ:
00605                 smb_tag = SMB_ACL_MASK;
00606                 break;
00607         default:
00608                 DEBUGADD(10, (" !!! unknown hpux tag type: 0x%04x\n", 
00609                                         hpux_tag));
00610                 break;
00611         }
00612 
00613         DEBUGADD(10, (" --> determined smb tag 0x%04x\n", smb_tag));
00614         
00615         return smb_tag;
00616 }

static BOOL hpux_add_to_acl ( HPUX_ACL_T hpux_acl,
int *  count,
HPUX_ACL_T  add_acl,
int  add_count,
SMB_ACL_TYPE_T  type 
) [static]

vfs_hpuxacl.c707 行で定義されています。

参照先 errno.

参照元 hpuxacl_sys_acl_set_file()smb_acl_to_hpux_acl().

00710 {
00711         int i;
00712         
00713         if ((type != SMB_ACL_TYPE_ACCESS) && (type != SMB_ACL_TYPE_DEFAULT)) 
00714         {
00715                 DEBUG(10, ("invalid acl type given: %d\n", type));
00716                 errno = EINVAL;
00717                 return False;
00718         }
00719         for (i = 0; i < add_count; i++) {
00720                 if (!_IS_OF_TYPE(add_acl[i], type)) {
00721                         continue;
00722                 }
00723                 ADD_TO_ARRAY(NULL, HPUX_ACE_T, add_acl[i], 
00724                              hpux_acl, count);
00725                 if (hpux_acl == NULL) {
00726                         DEBUG(10, ("error enlarging acl.\n"));
00727                         errno = ENOMEM;
00728                         return False;
00729                 }
00730         }
00731         return True;
00732 }

static BOOL hpux_acl_get_file ( const char *  name,
HPUX_ACL_T hpuxacl,
int *  count 
) [static]

vfs_hpuxacl.c644 行で定義されています。

参照先 errnohpux_acl_init()resultstrerror().

参照元 hpuxacl_sys_acl_get_file()hpuxacl_sys_acl_set_file().

00646 {
00647         BOOL result = False;
00648         static HPUX_ACE_T dummy_ace;
00649 
00650         DEBUG(10, ("hpux_acl_get_file called for file '%s'\n", name));
00651         
00652         /* 
00653          * The original code tries some INITIAL_ACL_SIZE
00654          * and only did the ACL_CNT call upon failure
00655          * (for performance reasons).
00656          * For the sake of simplicity, I skip this for now. 
00657          *
00658          * NOTE: There is a catch here on HP-UX: acl with cmd parameter
00659          * ACL_CNT fails with errno EINVAL when called with a NULL
00660          * pointer as last argument. So we need to use a dummy acl
00661          * struct here (we make it static so it does not need to be
00662          * instantiated or malloced each time this function is
00663          * called). Btw: the count parameter does not seem to matter...
00664          */
00665         *count = acl(CONST_DISCARD(char *, name), ACL_CNT, 0, &dummy_ace);
00666         if (*count < 0) {
00667                 DEBUG(10, ("acl ACL_CNT failed: %s\n", strerror(errno)));
00668                 goto done;
00669         }
00670         *hpux_acl = hpux_acl_init(*count);
00671         if (*hpux_acl == NULL) {
00672                 DEBUG(10, ("error allocating memory for hpux acl...\n"));
00673                 goto done;
00674         }
00675         *count = acl(CONST_DISCARD(char *, name), ACL_GET, *count, *hpux_acl);
00676         if (*count < 0) {
00677                 DEBUG(10, ("acl ACL_GET failed: %s\n", strerror(errno)));
00678                 goto done;
00679         }
00680         result = True;
00681 
00682  done:
00683         DEBUG(10, ("hpux_acl_get_file %s.\n",
00684                    ((result == True) ? "succeeded" : "failed" )));
00685         return result;
00686 }

static SMB_ACL_PERM_T hpux_perm_to_smb_perm ( const HPUX_PERM_T  perm  )  [static]

vfs_hpuxacl.c624 行で定義されています。

参照元 hpux_acl_to_smb_acl().

00625 {
00626         SMB_ACL_PERM_T smb_perm = 0;
00627         smb_perm |= ((perm & SMB_ACL_READ) ? SMB_ACL_READ : 0);
00628         smb_perm |= ((perm & SMB_ACL_WRITE) ? SMB_ACL_WRITE : 0);
00629         smb_perm |= ((perm & SMB_ACL_EXECUTE) ? SMB_ACL_EXECUTE : 0);
00630         return smb_perm;
00631 }

static HPUX_PERM_T smb_perm_to_hpux_perm ( const SMB_ACL_PERM_T  perm  )  [static]

vfs_hpuxacl.c634 行で定義されています。

参照元 smb_acl_to_hpux_acl().

00635 {
00636         HPUX_PERM_T hpux_perm = 0;
00637         hpux_perm |= ((perm & SMB_ACL_READ) ? SMB_ACL_READ : 0);
00638         hpux_perm |= ((perm & SMB_ACL_WRITE) ? SMB_ACL_WRITE : 0);
00639         hpux_perm |= ((perm & SMB_ACL_EXECUTE) ? SMB_ACL_EXECUTE : 0);
00640         return hpux_perm;
00641 }

static BOOL hpux_acl_check ( HPUX_ACL_T  hpux_acl,
int  count 
) [static]

vfs_hpuxacl.c1126 行で定義されています。

01127 {
01128         int check_rc;
01129         int check_which;
01130         
01131         check_rc = aclcheck(hpux_acl, count, &check_which);
01132         if (check_rc != 0) {
01133                 DEBUG(10, ("acl is not valid:\n"));
01134                 DEBUGADD(10, (" - return code: %d\n", check_rc));
01135                 DEBUGADD(10, (" - which: %d\n", check_which));
01136                 if (check_which != -1) {
01137                         DEBUGADD(10, (" - invalid entry:\n"));
01138                         DEBUGADD(10, ("   * type: %d:\n", 
01139                                       hpux_acl[check_which].a_type));
01140                         DEBUGADD(10, ("   * id: %d\n",
01141                                       hpux_acl[check_which].a_id));
01142                         DEBUGADD(10, ("   * perm: 0o%o\n",
01143                                       hpux_acl[check_which].a_perm));
01144                 }
01145                 return False;
01146         }
01147         return True;
01148 }

static BOOL hpux_acl_sort ( HPUX_ACL_T  acl,
int  count 
) [static]

vfs_hpuxacl.c753 行で定義されています。

参照先 errnohpux_internal_aclsort().

参照元 hpuxacl_sys_acl_delete_def_file()hpuxacl_sys_acl_set_file().

00754 {
00755         int fixmask = (count <= 4);
00756 
00757         if (hpux_internal_aclsort(count, fixmask, hpux_acl) != 0) {
00758                 errno = EINVAL;
00759                 return False;
00760         }
00761         return True;
00762 }

static int hpux_internal_aclsort ( int  acl_count,
int  calclass,
HPUX_ACL_T  aclp 
) [static]

vfs_hpuxacl.c941 行で定義されています。

参照先 hpux_aclsort_call_present()hpux_count_obj()hpux_get_needed_class_perm()hpux_prohibited_duplicate_type()hpux_swap_acl_entries()hpux_acl_types::n_class_objhpux_acl_types::n_def_class_objhpux_acl_types::n_def_group_objhpux_acl_types::n_def_other_objhpux_acl_types::n_def_user_objhpux_acl_types::n_group_objhpux_acl_types::n_other_objhpux_acl_types::n_user_obj.

参照元 hpux_acl_sort().

00942 {
00943         struct hpux_acl_types acl_obj_count;
00944         int n_class_obj_perm = 0;
00945         int i, j;
00946  
00947         DEBUG(10,("Entering hpux_internal_aclsort. (calclass = %d)\n", calclass));
00948 
00949         if (hpux_aclsort_call_present()) {
00950                 DEBUG(10, ("calling hpux aclsort\n"));
00951                 return aclsort(acl_count, calclass, aclp);
00952         }
00953 
00954         DEBUG(10, ("using internal aclsort\n"));
00955 
00956         if(!acl_count) {
00957                 DEBUG(10,("Zero acl count passed. Returning Success\n"));
00958                 return 0;
00959         }
00960 
00961         if(aclp == NULL) {
00962                 DEBUG(0,("Null ACL pointer in hpux_acl_sort. Returning Failure. \n"));
00963                 return -1;
00964         }
00965 
00966         /* Count different types of ACLs in the ACLs array */
00967 
00968         hpux_count_obj(acl_count, aclp, &acl_obj_count);
00969 
00970         /* There should be only one entry each of type USER_OBJ, GROUP_OBJ, 
00971          * CLASS_OBJ and OTHER_OBJ 
00972          */
00973 
00974         if ( (acl_obj_count.n_user_obj  != 1) || 
00975                 (acl_obj_count.n_group_obj != 1) || 
00976                 (acl_obj_count.n_class_obj != 1) ||
00977                 (acl_obj_count.n_other_obj != 1) ) 
00978         {
00979                 DEBUG(0,("hpux_internal_aclsort: More than one entry or no entries for \
00980 USER OBJ or GROUP_OBJ or OTHER_OBJ or CLASS_OBJ\n"));
00981                 return -1;
00982         }
00983 
00984         /* If any of the default objects are present, there should be only
00985          * one of them each.
00986          */
00987 
00988         if ( (acl_obj_count.n_def_user_obj  > 1) || 
00989                 (acl_obj_count.n_def_group_obj > 1) || 
00990                 (acl_obj_count.n_def_other_obj > 1) || 
00991                 (acl_obj_count.n_def_class_obj > 1) ) 
00992         {
00993                 DEBUG(0,("hpux_internal_aclsort: More than one entry for DEF_CLASS_OBJ \
00994 or DEF_USER_OBJ or DEF_GROUP_OBJ or DEF_OTHER_OBJ\n"));
00995                 return -1;
00996         }
00997 
00998         /* We now have proper number of OBJ and DEF_OBJ entries. Now sort the acl 
00999          * structures.  
01000          *
01001          * Sorting crieteria - First sort by ACL type. If there are multiple entries of
01002          * same ACL type, sort by ACL id.
01003          *
01004          * I am using the trival kind of sorting method here because, performance isn't 
01005          * really effected by the ACLs feature. More over there aren't going to be more
01006          * than 17 entries on HPUX. 
01007          */
01008 
01009         for(i=0; i<acl_count;i++) {
01010                 for (j=i+1; j<acl_count; j++) {
01011                         if( aclp[i].a_type > aclp[j].a_type ) {
01012                                 /* ACL entries out of order, swap them */
01013                                 hpux_swap_acl_entries((aclp+i), (aclp+j));
01014                         } else if ( aclp[i].a_type == aclp[j].a_type ) {
01015                                 /* ACL entries of same type, sort by id */
01016                                 if(aclp[i].a_id > aclp[j].a_id) {
01017                                         hpux_swap_acl_entries((aclp+i), (aclp+j));
01018                                 } else if (aclp[i].a_id == aclp[j].a_id) {
01019                                         /* We have a duplicate entry. */
01020                                         if(hpux_prohibited_duplicate_type(aclp[i].a_type)) {
01021                                                 DEBUG(0, ("hpux_internal_aclsort: Duplicate entry: Type(hex): %x Id: %d\n",
01022                                                         aclp[i].a_type, aclp[i].a_id));
01023                                                 return -1;
01024                                         }
01025                                 }
01026                         }
01027                 }
01028         }
01029 
01030         /* set the class obj permissions to the computed one. */
01031         if(calclass) {
01032                 int n_class_obj_index = -1;
01033 
01034                 for(i=0;i<acl_count;i++) {
01035                         n_class_obj_perm |= hpux_get_needed_class_perm((aclp+i));
01036 
01037                         if(aclp[i].a_type == CLASS_OBJ)
01038                                 n_class_obj_index = i;
01039                 }
01040                 aclp[n_class_obj_index].a_perm = n_class_obj_perm;
01041         }
01042 
01043         return 0;
01044 }

static void hpux_count_obj ( int  acl_count,
HPUX_ACL_T  aclp,
struct hpux_acl_types acl_type_count 
) [static]

vfs_hpuxacl.c788 行で定義されています。

参照先 hpux_acl_types::n_class_objhpux_acl_types::n_def_class_objhpux_acl_types::n_def_grouphpux_acl_types::n_def_group_objhpux_acl_types::n_def_other_objhpux_acl_types::n_def_userhpux_acl_types::n_def_user_objhpux_acl_types::n_grouphpux_acl_types::n_group_objhpux_acl_types::n_illegal_objhpux_acl_types::n_other_objhpux_acl_types::n_userhpux_acl_types::n_user_obj.

参照元 hpux_internal_aclsort().

00789 {
00790         int i;
00791 
00792         memset(acl_type_count, 0, sizeof(struct hpux_acl_types));
00793 
00794         for(i=0;i<acl_count;i++) {
00795                 switch(aclp[i].a_type) {
00796                 case USER: 
00797                         acl_type_count->n_user++;
00798                         break;
00799                 case USER_OBJ: 
00800                         acl_type_count->n_user_obj++;
00801                         break;
00802                 case DEF_USER_OBJ: 
00803                         acl_type_count->n_def_user_obj++;
00804                         break;
00805                 case GROUP: 
00806                         acl_type_count->n_group++;
00807                         break;
00808                 case GROUP_OBJ: 
00809                         acl_type_count->n_group_obj++;
00810                         break;
00811                 case DEF_GROUP_OBJ: 
00812                         acl_type_count->n_def_group_obj++;
00813                         break;
00814                 case OTHER_OBJ: 
00815                         acl_type_count->n_other_obj++;
00816                         break;
00817                 case DEF_OTHER_OBJ: 
00818                         acl_type_count->n_def_other_obj++;
00819                         break;
00820                 case CLASS_OBJ:
00821                         acl_type_count->n_class_obj++;
00822                         break;
00823                 case DEF_CLASS_OBJ:
00824                         acl_type_count->n_def_class_obj++;
00825                         break;
00826                 case DEF_USER:
00827                         acl_type_count->n_def_user++;
00828                         break;
00829                 case DEF_GROUP:
00830                         acl_type_count->n_def_group++;
00831                         break;
00832                 default: 
00833                         acl_type_count->n_illegal_obj++;
00834                         break;
00835                 }
00836         }
00837 }

static void hpux_swap_acl_entries ( HPUX_ACE_T aclp0,
HPUX_ACE_T aclp1 
) [static]

vfs_hpuxacl.c844 行で定義されています。

参照元 hpux_internal_aclsort().

00845 {
00846         HPUX_ACE_T temp_acl;
00847 
00848         temp_acl.a_type = aclp0->a_type;
00849         temp_acl.a_id = aclp0->a_id;
00850         temp_acl.a_perm = aclp0->a_perm;
00851 
00852         aclp0->a_type = aclp1->a_type;
00853         aclp0->a_id = aclp1->a_id;
00854         aclp0->a_perm = aclp1->a_perm;
00855 
00856         aclp1->a_type = temp_acl.a_type;
00857         aclp1->a_id = temp_acl.a_id;
00858         aclp1->a_perm = temp_acl.a_perm;
00859 }

static BOOL hpux_prohibited_duplicate_type ( int  acl_type  )  [static]

vfs_hpuxacl.c875 行で定義されています。

参照元 hpux_internal_aclsort().

00876 {
00877         switch(acl_type) {
00878                 case USER:
00879                 case GROUP:
00880                 case DEF_USER: 
00881                 case DEF_GROUP:
00882                         return True;
00883                 default:
00884                         return False;
00885         }
00886 }

static BOOL hpux_acl_call_present ( void   )  [static]

vfs_hpuxacl.c1058 行で定義されています。

参照先 errnohandlestrerror().

参照元 hpuxacl_sys_acl_get_file()hpuxacl_sys_acl_set_file().

01059 {
01060 
01061         shl_t handle = NULL;
01062         void *value;
01063         int ret_val=0;
01064         static BOOL already_checked = False;
01065 
01066         if(already_checked)
01067                 return True;
01068 
01069         errno = 0;
01070 
01071         ret_val = shl_findsym(&handle, "acl", TYPE_PROCEDURE, &value);
01072 
01073         if(ret_val != 0) {
01074                 DEBUG(5, ("hpux_acl_call_present: shl_findsym() returned %d, errno = %d, error %s\n",
01075                         ret_val, errno, strerror(errno)));
01076                 DEBUG(5,("hpux_acl_call_present: acl() system call is not present. Check if you have JFS 3.3 and above?\n"));
01077                 errno = ENOSYS;
01078                 return False;
01079         }
01080 
01081         DEBUG(10,("hpux_acl_call_present: acl() system call is present. We have JFS 3.3 or above \n"));
01082 
01083         already_checked = True;
01084         return True;
01085 }

static BOOL hpux_aclsort_call_present ( void   )  [static]

vfs_hpuxacl.c1093 行で定義されています。

参照先 errnohandlestrerror().

参照元 hpux_internal_aclsort().

01094 {
01095         shl_t handle = NULL;
01096         void *value;
01097         int ret_val = 0;
01098         static BOOL already_checked = False;
01099 
01100         if (already_checked) {
01101                 return True;
01102         }
01103 
01104         errno = 0;
01105         ret_val = shl_findsym(&handle, "aclsort", TYPE_PROCEDURE, &value);
01106         if (ret_val != 0) {
01107                 DEBUG(5, ("hpux_aclsort_call_present: shl_findsym "
01108                         "returned %d, errno = %d, error %s", 
01109                         ret_val, errno, strerror(errno)));
01110                 DEBUG(5, ("hpux_aclsort_call_present: "
01111                         "aclsort() function not available.\n"));
01112                 return False;
01113         }
01114         DEBUG(10,("hpux_aclsort_call_present: aclsort() function present.\n"));
01115         already_checked = True;
01116         return True;
01117 }

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

vfs_hpuxacl.c138 行で定義されています。

参照先 errnohpux_acl_call_present()hpux_acl_get_file()hpux_acl_to_smb_acl()resultstrerror().

参照元 hpuxacl_sys_acl_delete_def_file()hpuxacl_sys_acl_get_fd().

00141 {
00142         SMB_ACL_T result = NULL;
00143         int count;
00144         HPUX_ACL_T hpux_acl = NULL;
00145         
00146         DEBUG(10, ("hpuxacl_sys_acl_get_file called for file '%s'.\n", 
00147                    path_p));
00148 
00149         if(hpux_acl_call_present() == False) {
00150                 /* Looks like we don't have the acl() system call on HPUX. 
00151                  * May be the system doesn't have the latest version of JFS.
00152                  */
00153                 goto done;
00154         }
00155 
00156         if (type != SMB_ACL_TYPE_ACCESS && type != SMB_ACL_TYPE_DEFAULT) {
00157                 DEBUG(10, ("invalid SMB_ACL_TYPE given (%d)\n", type));
00158                 errno = EINVAL;
00159                 goto done;
00160         }
00161 
00162         DEBUGADD(10, ("getting %s acl\n", 
00163                       ((type == SMB_ACL_TYPE_ACCESS) ? "access" : "default")));
00164 
00165         if (!hpux_acl_get_file(path_p, &hpux_acl, &count)) {
00166                 goto done;
00167         }
00168         result = hpux_acl_to_smb_acl(hpux_acl, count, type);
00169         if (result == NULL) {
00170                 DEBUG(10, ("conversion hpux_acl -> smb_acl failed (%s).\n",
00171                            strerror(errno)));
00172         }
00173         
00174  done:
00175         DEBUG(10, ("hpuxacl_sys_acl_get_file %s.\n",
00176                    ((result == NULL) ? "failed" : "succeeded" )));
00177         SAFE_FREE(hpux_acl);
00178         return result;
00179 }

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

vfs_hpuxacl.c185 行で定義されています。

参照先 errnofile_find_fd()files_struct::fsp_namehandlehpuxacl_sys_acl_get_file().

00188 {
00189         /* 
00190          * HPUX doesn't have the facl call. Fake it using the path.... JRA. 
00191          */
00192         /* For all I see, the info should already be in the fsp
00193          * parameter, but get it again to be safe --- necessary? */
00194         files_struct *file_struct_p = file_find_fd(fd);
00195         if (file_struct_p == NULL) {
00196                 errno = EBADF;
00197                 return NULL;
00198         }
00199         /*
00200          * We know we're in the same conn context. So we
00201          * can use the relative path.
00202          */
00203         DEBUG(10, ("redirecting call of hpuxacl_sys_acl_get_fd to "
00204                 "hpuxacl_sys_acl_get_file (no facl syscall on HPUX).\n"));
00205 
00206         return hpuxacl_sys_acl_get_file(handle, file_struct_p->fsp_name, 
00207                         SMB_ACL_TYPE_ACCESS);
00208 }

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

vfs_hpuxacl.c211 行で定義されています。

参照先 errnohandlehpux_acl_call_present()hpux_acl_get_file()hpux_acl_sort()hpux_add_to_acl()smb_acl_to_hpux_acl()strerror().

参照元 hpuxacl_sys_acl_set_fd().

00215 {
00216         int ret = -1;
00217         SMB_STRUCT_STAT s;
00218         HPUX_ACL_T hpux_acl = NULL;
00219         int count;
00220         
00221         DEBUG(10, ("hpuxacl_sys_acl_set_file called for file '%s'\n",
00222                    name));
00223 
00224 
00225         if(hpux_acl_call_present() == False) {
00226                 /* Looks like we don't have the acl() system call on HPUX. 
00227                  * May be the system doesn't have the latest version of JFS.
00228                  */
00229                 goto done;
00230         }
00231 
00232         if ((type != SMB_ACL_TYPE_ACCESS) && (type != SMB_ACL_TYPE_DEFAULT)) {
00233                 errno = EINVAL;
00234                 DEBUG(10, ("invalid smb acl type given (%d).\n", type));
00235                 goto done;
00236         }
00237         DEBUGADD(10, ("setting %s acl\n", 
00238                       ((type == SMB_ACL_TYPE_ACCESS) ? "access" : "default")));
00239 
00240         if(!smb_acl_to_hpux_acl(theacl, &hpux_acl, &count, type)) {
00241                 DEBUG(10, ("conversion smb_acl -> hpux_acl failed (%s).\n",
00242                            strerror(errno)));
00243                 goto done;
00244         }
00245 
00246         /*
00247          * if the file is a directory, there is extra work to do:
00248          * since the hpux acl call stores both the access acl and 
00249          * the default acl as provided, we have to get the acl part 
00250          * that has _not_ been specified in "type" from the file first 
00251          * and concatenate it with the acl provided.
00252          */
00253         if (SMB_VFS_STAT(handle->conn, name, &s) != 0) {
00254                 DEBUG(10, ("Error in stat call: %s\n", strerror(errno)));
00255                 goto done;
00256         }
00257         if (S_ISDIR(s.st_mode)) {
00258                 HPUX_ACL_T other_acl; 
00259                 int other_count;
00260                 SMB_ACL_TYPE_T other_type;
00261 
00262                 other_type = (type == SMB_ACL_TYPE_ACCESS) 
00263                         ? SMB_ACL_TYPE_DEFAULT
00264                         : SMB_ACL_TYPE_ACCESS;
00265                 DEBUGADD(10, ("getting acl from filesystem\n"));
00266                 if (!hpux_acl_get_file(name, &other_acl, &other_count)) {
00267                         DEBUG(10, ("error getting acl from directory\n"));
00268                         goto done;
00269                 }
00270                 DEBUG(10, ("adding %s part of fs acl to given acl\n",
00271                            ((other_type == SMB_ACL_TYPE_ACCESS) 
00272                             ? "access"
00273                             : "default")));
00274                 if (!hpux_add_to_acl(&hpux_acl, &count, other_acl,
00275                                         other_count, other_type)) 
00276                 {
00277                         DEBUG(10, ("error adding other acl.\n"));
00278                         SAFE_FREE(other_acl);
00279                         goto done;
00280                 }
00281                 SAFE_FREE(other_acl);
00282         }
00283         else if (type != SMB_ACL_TYPE_ACCESS) {
00284                 errno = EINVAL;
00285                 goto done;
00286         }
00287 
00288         if (!hpux_acl_sort(hpux_acl, count)) {
00289                 DEBUG(10, ("resulting acl is not valid!\n"));
00290                 goto done;
00291         }
00292         DEBUG(10, ("resulting acl is valid.\n"));
00293 
00294         ret = acl(CONST_DISCARD(char *, name), ACL_SET, count, hpux_acl);
00295         if (ret != 0) {
00296                 DEBUG(0, ("ERROR calling acl: %s\n", strerror(errno)));
00297         }
00298         
00299  done:
00300         DEBUG(10, ("hpuxacl_sys_acl_set_file %s.\n",
00301                    ((ret != 0) ? "failed" : "succeeded")));
00302         SAFE_FREE(hpux_acl);
00303         return ret;
00304 }

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

vfs_hpuxacl.c309 行で定義されています。

参照先 errnofile_find_fd()files_struct::fsp_namehandlehpuxacl_sys_acl_set_file().

00312 {
00313         /*
00314          * HPUX doesn't have the facl call. Fake it using the path.... JRA.
00315          */
00316         /* For all I see, the info should already be in the fsp
00317          * parameter, but get it again to be safe --- necessary? */
00318         files_struct *file_struct_p = file_find_fd(fd);
00319         if (file_struct_p == NULL) {
00320                 errno = EBADF;
00321                 return -1;
00322         }
00323         /*
00324          * We know we're in the same conn context. So we
00325          * can use the relative path.
00326          */
00327         DEBUG(10, ("redirecting call of hpuxacl_sys_acl_set_fd to "
00328                 "hpuxacl_sys_acl_set_file (no facl syscall on HPUX)\n"));
00329 
00330         return hpuxacl_sys_acl_set_file(handle, file_struct_p->fsp_name,
00331                         SMB_ACL_TYPE_ACCESS, theacl);
00332 }

int hpuxacl_sys_acl_delete_def_file ( vfs_handle_struct handle,
const char *  path 
)

vfs_hpuxacl.c351 行で定義されています。

参照先 handlehpux_acl_sort()hpuxacl_sys_acl_get_file()smb_acl_to_hpux_acl().

00353 {
00354         SMB_ACL_T smb_acl;
00355         int ret = -1;
00356         HPUX_ACL_T hpux_acl;
00357         int count;
00358 
00359         DEBUG(10, ("entering hpuxacl_sys_acl_delete_def_file.\n"));
00360         
00361         smb_acl = hpuxacl_sys_acl_get_file(handle, path, 
00362                                            SMB_ACL_TYPE_ACCESS);
00363         if (smb_acl == NULL) {
00364                 DEBUG(10, ("getting file acl failed!\n"));
00365                 goto done;
00366         }
00367         if (!smb_acl_to_hpux_acl(smb_acl, &hpux_acl, &count, 
00368                                  SMB_ACL_TYPE_ACCESS))
00369         {
00370                 DEBUG(10, ("conversion smb_acl -> hpux_acl failed.\n"));
00371                 goto done;
00372         }
00373         if (!hpux_acl_sort(hpux_acl, count)) {
00374                 DEBUG(10, ("resulting acl is not valid!\n"));
00375                 goto done;
00376         }
00377         ret = acl(CONST_DISCARD(char *, path), ACL_SET, count, hpux_acl);
00378         if (ret != 0) {
00379                 DEBUG(10, ("settinge file acl failed!\n"));
00380         }
00381         
00382  done:
00383         DEBUG(10, ("hpuxacl_sys_acl_delete_def_file %s.\n",
00384                    ((ret != 0) ? "failed" : "succeeded" )));
00385         SAFE_FREE(smb_acl);
00386         return ret;
00387 }

static int hpux_get_needed_class_perm ( struct acl *  aclp  )  [static]

vfs_hpuxacl.c896 行で定義されています。

参照元 hpux_internal_aclsort().

00897 {
00898         switch(aclp->a_type) {
00899                 case USER: 
00900                 case GROUP_OBJ: 
00901                 case GROUP: 
00902                 case DEF_USER_OBJ: 
00903                 case DEF_USER:
00904                 case DEF_GROUP_OBJ: 
00905                 case DEF_GROUP:
00906                 case DEF_CLASS_OBJ:
00907                 case DEF_OTHER_OBJ: 
00908                         return aclp->a_perm;
00909                 default: 
00910                         return 0;
00911         }
00912 }

NTSTATUS vfs_hpuxacl_init ( void   ) 

vfs_hpuxacl.c1180 行で定義されています。

参照先 hpuxacl_op_tuplessmb_register_vfs().

01181 {
01182         return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "hpuxacl",
01183                                 hpuxacl_op_tuples);
01184 }


変数

vfs_op_tuple hpuxacl_op_tuples[] [static]

初期値:

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

        {SMB_VFS_OP(hpuxacl_sys_acl_get_fd),
         SMB_VFS_OP_SYS_ACL_GET_FD,
         SMB_VFS_LAYER_TRANSPARENT},

        {SMB_VFS_OP(hpuxacl_sys_acl_set_file),
         SMB_VFS_OP_SYS_ACL_SET_FILE,
         SMB_VFS_LAYER_TRANSPARENT},

        {SMB_VFS_OP(hpuxacl_sys_acl_set_fd),
         SMB_VFS_OP_SYS_ACL_SET_FD,
         SMB_VFS_LAYER_TRANSPARENT},

        {SMB_VFS_OP(hpuxacl_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_hpuxacl.c1153 行で定義されています。

参照元 vfs_hpuxacl_init().


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