X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmdt%2Fmdt_idmap.c;h=f49c6dd7cd69698668cdd3192c59766fda6f872d;hb=386818f0c56e438779e17d0ca12b481f17c53682;hp=e6b8c46cd624b54495cb4079c972e3c70b0fb32d;hpb=f0c1b06f2418d2016e23eb6e8277be85ca13fc53;p=fs%2Flustre-release.git diff --git a/lustre/mdt/mdt_idmap.c b/lustre/mdt/mdt_idmap.c index e6b8c46..f49c6dd 100644 --- a/lustre/mdt/mdt_idmap.c +++ b/lustre/mdt/mdt_idmap.c @@ -161,7 +161,7 @@ int mdt_handle_idmap(struct tgt_session_info *tsi) RETURN(-EACCES); } - if (req->rq_auth_mapped_uid == INVALID_UID) { + if (!uid_valid(make_kuid(&init_user_ns, req->rq_auth_mapped_uid))) { CDEBUG(D_SEC, "invalid authorized mapped uid, please check " "/etc/lustre/idmap.conf!\n"); RETURN(-EACCES); @@ -279,30 +279,34 @@ void mdt_body_reverse_idmap(struct mdt_thread_info *info, struct mdt_body *body) if (!exp_connect_rmtclient(info->mti_exp)) return; - if (body->valid & OBD_MD_FLUID) { - uid_t uid = lustre_idmap_lookup_uid(uc, idmap, 1, body->uid); + if (body->mbo_valid & OBD_MD_FLUID) { + uid_t uid; - if (uid == CFS_IDMAP_NOTFOUND) { - uid = NOBODY_UID; - if (body->valid & OBD_MD_FLMODE) - body->mode = (body->mode & ~S_IRWXU) | - ((body->mode & S_IRWXO) << 6); - } + uid = lustre_idmap_lookup_uid(uc, idmap, 1, body->mbo_uid); - body->uid = uid; - } + if (uid == CFS_IDMAP_NOTFOUND) { + uid = NOBODY_UID; + if (body->mbo_valid & OBD_MD_FLMODE) + body->mbo_mode = (body->mbo_mode & ~S_IRWXU) | + ((body->mbo_mode & S_IRWXO) << 6); + } + + body->mbo_uid = uid; + } - if (body->valid & OBD_MD_FLGID) { - gid_t gid = lustre_idmap_lookup_gid(uc, idmap, 1, body->gid); + if (body->mbo_valid & OBD_MD_FLGID) { + gid_t gid; - if (gid == CFS_IDMAP_NOTFOUND) { - gid = NOBODY_GID; - if (body->valid & OBD_MD_FLMODE) - body->mode = (body->mode & ~S_IRWXG) | - ((body->mode & S_IRWXO) << 3); - } + gid = lustre_idmap_lookup_gid(uc, idmap, 1, body->mbo_gid); + + if (gid == CFS_IDMAP_NOTFOUND) { + gid = NOBODY_GID; + if (body->mbo_valid & OBD_MD_FLMODE) + body->mbo_mode = (body->mbo_mode & ~S_IRWXG) | + ((body->mbo_mode & S_IRWXO) << 3); + } - body->gid = gid; + body->mbo_gid = gid; } }