RETURN(rc);
}
static void get_real_parameters(struct inode *inode, struct iattr *iattr,
- mode_t *mode, __u32 *uid, __u32 *gid)
+ struct posix_acl *new_acl, mode_t *mode,
+ __u32 *uid, __u32 *gid)
{
LASSERT(iattr);
- if (iattr->ia_valid & ATTR_MODE)
+ if (iattr->ia_valid & ATTR_MODE) {
*mode = iattr->ia_mode;
- else
+ } else {
*mode = inode->i_mode;
+ if (new_acl) {
+ posix_acl_equiv_mode(new_acl, mode);
+ CDEBUG(D_INFO, "get new mode %d \n", *mode);
+ }
+ }
if (iattr->ia_valid & ATTR_UID)
*uid = iattr->ia_uid;
acl, inode->i_mode, GKS_GET_MAC, iattr->ia_valid);
spin_unlock(&lli->lli_lock);
if (value) {
+ new_acl = posix_acl_from_xattr(value, size);
if (IS_ERR(new_acl)) {
rc = PTR_ERR(new_acl);
CERROR("convert from xattr to acl error: %d",rc);
acl_count = new_acl ? new_acl->a_count : 0;
kperm_size = crypto_kperm_size(acl_count);
OBD_ALLOC(kperm, kperm_size);
- get_real_parameters(inode, iattr, &mac_mode, &uid, &gid);
+ get_real_parameters(inode, iattr, new_acl, &mac_mode, &uid, &gid);
ll_init_key_perm(kperm, new_acl, uid, gid, mac_mode);
kparms.context = kcontext;
kparms.context_size = kcontext_size;
struct mds_rec_setattr *rec;
struct mdc_rpc_lock *rpc_lock;
struct obd_device *obd = exp->exp_obd;
- int rc, bufcount = 2, size[4] = {0, sizeof(*rec), ealen, ea2len};
+ int rc, bufcount = 2, size[5] = {0, sizeof(*rec), ealen, ea2len,
+ ea3len};
ENTRY;
LASSERT(iattr != NULL);
}
md->posix_acl = acl;
}
+ } else {
+ *offset += 2;
}
RETURN(rc);
}
buf, key_off, size);
md->key = (struct lustre_key *)buf;
*offset = key_off;
- }
+ } else {
+ *offset += 2;
+ }
RETURN(rc);
}
reply_buffers = 3;
if (it->opc & ( IT_OPEN | IT_GETATTR | IT_LOOKUP | IT_CHDIR )) {
+ /*Ugly here, Actually, we should prepare the reply buffer
+ *after we know whether these stuff exist or not, which should
+ * be fixed in future, Now each item is in the fix position,
+ * the sequence is lsm, acl, crypto ea, capa.*/
repsize[reply_buffers++] = sizeof(int);
/* XXX: mds_remote_perm is stored here too, and for it
* the 'size' is ignored */
repsize[reply_buffers++] =
xattr_acl_size(LL_ACL_MAX_ENTRIES);
-
- /*FIXME: ugly here, should be optimize for there
- * is no crypto key*/
+
repsize[reply_buffers++] = sizeof(int);
repsize[reply_buffers++] = sizeof(struct crypto_key);
int keylen;
LASSERT(rec->ur_eadatalen || rec->ur_ea3datalen);
LASSERT(rec->ur_eadata || rec->ur_ea3data);
- key = rec->ur_eadata ? rec->ur_eadata : rec->ur_ea3data;
- keylen = rec->ur_eadatalen ? rec->ur_eadatalen :
- rec->ur_ea3datalen;
+ key = rec->ur_ea3data ? rec->ur_ea3data : rec->ur_eadata;
+ keylen = rec->ur_ea3datalen ? rec->ur_ea3datalen :
+ rec->ur_eadatalen;
mds_set_gskey(obd, handle, inode, key, keylen,
rec->ur_iattr.ia_valid);
}
memcpy(ckey, rep_key, sizeof(*rep_key));
- CDEBUG(D_INFO, "get enkey %s, mac %s\n", ckey->ck_key, ckey->ck_mac);
+ CDEBUG(D_INFO, "get enkey %s, mac %s type %d\n", ckey->ck_key, ckey->ck_mac,
+ ckey->ck_type);
ptlrpc_req_finished(req);
RETURN(rc);
OBD_FREE(tmp_mac, MAC_SIZE);
RETURN(0);
}
+ CERROR("new_created %s EA is %s \n", tmp_mac, key->ck_mac);
OBD_FREE(tmp_mac, MAC_SIZE);
RETURN(-EPERM);
}
memcpy(ckey, &kctxt->kc_ck, sizeof(*ckey));
+ ckey->ck_type = GKS_TYPE;
rc = crypto_get_gks_mac(req, kperm, ckey->ck_mac);
if (rc != 0) {
CERROR("get new mac error %d \n", rc);