428 if (dvp == NULL) {
429 error = ESTALE;
430 goto out;
431 }
432 }
433
434 dva.va_mask = AT_ALL;
435 dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
436
437 if (args->what.name == nfs3nametoolong) {
438 resp->status = NFS3ERR_NAMETOOLONG;
439 goto out1;
440 }
441
442 if (args->what.name == NULL || *(args->what.name) == '\0') {
443 resp->status = NFS3ERR_ACCES;
444 goto out1;
445 }
446
447 fhp = &args->what.dir;
448 ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
449 if (strcmp(args->what.name, "..") == 0 &&
450 EQFID(&exi->exi_fid, FH3TOFIDP(fhp))) {
451 if ((exi->exi_export.ex_flags & EX_NOHIDE) &&
452 ((dvp->v_flag & VROOT) || VN_IS_CURZONEROOT(dvp))) {
453 /*
454 * special case for ".." and 'nohide'exported root
455 */
456 if (rfs_climb_crossmnt(&dvp, &exi, cr) != 0) {
457 resp->status = NFS3ERR_ACCES;
458 goto out1;
459 }
460 } else {
461 resp->status = NFS3ERR_NOENT;
462 goto out1;
463 }
464 }
465
466 ca = (struct sockaddr *)svc_getrpccaller(req->rq_xprt)->buf;
467 name = nfscmd_convname(ca, exi, args->what.name,
468 NFSCMD_CONV_INBOUND, MAXPATHLEN + 1);
1319 mblk_t *m;
1320 struct iovec *iovp;
1321 int iovcnt;
1322 int ioflag;
1323 cred_t *savecred;
1324 int in_crit = 0;
1325 int rwlock_ret = -1;
1326 caller_context_t ct;
1327
1328 vp = nfs3_fhtovp(&args->file, exi);
1329
1330 DTRACE_NFSV3_5(op__write__start, struct svc_req *, req,
1331 cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
1332 WRITE3args *, args);
1333
1334 if (vp == NULL) {
1335 error = ESTALE;
1336 goto err;
1337 }
1338
1339 ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
1340 ns = nfs3_get_srv();
1341
1342 if (is_system_labeled()) {
1343 bslabel_t *clabel = req->rq_label;
1344
1345 ASSERT(clabel != NULL);
1346 DTRACE_PROBE2(tx__rfs3__log__info__opwrite__clabel, char *,
1347 "got client label from request(1)", struct svc_req *, req);
1348
1349 if (!blequal(&l_admin_low->tsl_label, clabel)) {
1350 if (!do_rfs_label_check(clabel, vp, EQUALITY_CHECK,
1351 exi)) {
1352 resp->status = NFS3ERR_ACCES;
1353 goto err1;
1354 }
1355 }
1356 }
1357
1358 ct.cc_sysid = 0;
1359 ct.cc_pid = 0;
4122 vnode_t *vp;
4123 struct vattr *bvap;
4124 struct vattr bva;
4125 struct vattr *avap;
4126 struct vattr ava;
4127
4128 bvap = NULL;
4129 avap = NULL;
4130
4131 vp = nfs3_fhtovp(&args->file, exi);
4132
4133 DTRACE_NFSV3_5(op__commit__start, struct svc_req *, req,
4134 cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
4135 COMMIT3args *, args);
4136
4137 if (vp == NULL) {
4138 error = ESTALE;
4139 goto out;
4140 }
4141
4142 ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
4143 ns = nfs3_get_srv();
4144 bva.va_mask = AT_ALL;
4145 error = VOP_GETATTR(vp, &bva, 0, cr, NULL);
4146
4147 /*
4148 * If we can't get the attributes, then we can't do the
4149 * right access checking. So, we'll fail the request.
4150 */
4151 if (error)
4152 goto out;
4153
4154 bvap = &bva;
4155
4156 if (rdonly(ro, vp)) {
4157 resp->status = NFS3ERR_ROFS;
4158 goto out1;
4159 }
4160
4161 if (vp->v_type != VREG) {
4162 resp->status = NFS3ERR_INVAL;
|
428 if (dvp == NULL) {
429 error = ESTALE;
430 goto out;
431 }
432 }
433
434 dva.va_mask = AT_ALL;
435 dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
436
437 if (args->what.name == nfs3nametoolong) {
438 resp->status = NFS3ERR_NAMETOOLONG;
439 goto out1;
440 }
441
442 if (args->what.name == NULL || *(args->what.name) == '\0') {
443 resp->status = NFS3ERR_ACCES;
444 goto out1;
445 }
446
447 fhp = &args->what.dir;
448 ASSERT3U(curzone->zone_id, ==, exi->exi_zoneid); /* exi is non-NULL */
449 if (strcmp(args->what.name, "..") == 0 &&
450 EQFID(&exi->exi_fid, FH3TOFIDP(fhp))) {
451 if ((exi->exi_export.ex_flags & EX_NOHIDE) &&
452 ((dvp->v_flag & VROOT) || VN_IS_CURZONEROOT(dvp))) {
453 /*
454 * special case for ".." and 'nohide'exported root
455 */
456 if (rfs_climb_crossmnt(&dvp, &exi, cr) != 0) {
457 resp->status = NFS3ERR_ACCES;
458 goto out1;
459 }
460 } else {
461 resp->status = NFS3ERR_NOENT;
462 goto out1;
463 }
464 }
465
466 ca = (struct sockaddr *)svc_getrpccaller(req->rq_xprt)->buf;
467 name = nfscmd_convname(ca, exi, args->what.name,
468 NFSCMD_CONV_INBOUND, MAXPATHLEN + 1);
1319 mblk_t *m;
1320 struct iovec *iovp;
1321 int iovcnt;
1322 int ioflag;
1323 cred_t *savecred;
1324 int in_crit = 0;
1325 int rwlock_ret = -1;
1326 caller_context_t ct;
1327
1328 vp = nfs3_fhtovp(&args->file, exi);
1329
1330 DTRACE_NFSV3_5(op__write__start, struct svc_req *, req,
1331 cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
1332 WRITE3args *, args);
1333
1334 if (vp == NULL) {
1335 error = ESTALE;
1336 goto err;
1337 }
1338
1339 ASSERT3U(curzone->zone_id, ==, exi->exi_zoneid); /* exi is non-NULL. */
1340 ns = nfs3_get_srv();
1341
1342 if (is_system_labeled()) {
1343 bslabel_t *clabel = req->rq_label;
1344
1345 ASSERT(clabel != NULL);
1346 DTRACE_PROBE2(tx__rfs3__log__info__opwrite__clabel, char *,
1347 "got client label from request(1)", struct svc_req *, req);
1348
1349 if (!blequal(&l_admin_low->tsl_label, clabel)) {
1350 if (!do_rfs_label_check(clabel, vp, EQUALITY_CHECK,
1351 exi)) {
1352 resp->status = NFS3ERR_ACCES;
1353 goto err1;
1354 }
1355 }
1356 }
1357
1358 ct.cc_sysid = 0;
1359 ct.cc_pid = 0;
4122 vnode_t *vp;
4123 struct vattr *bvap;
4124 struct vattr bva;
4125 struct vattr *avap;
4126 struct vattr ava;
4127
4128 bvap = NULL;
4129 avap = NULL;
4130
4131 vp = nfs3_fhtovp(&args->file, exi);
4132
4133 DTRACE_NFSV3_5(op__commit__start, struct svc_req *, req,
4134 cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
4135 COMMIT3args *, args);
4136
4137 if (vp == NULL) {
4138 error = ESTALE;
4139 goto out;
4140 }
4141
4142 ASSERT3U(curzone->zone_id, ==, exi->exi_zoneid); /* exi is non-NULL. */
4143 ns = nfs3_get_srv();
4144 bva.va_mask = AT_ALL;
4145 error = VOP_GETATTR(vp, &bva, 0, cr, NULL);
4146
4147 /*
4148 * If we can't get the attributes, then we can't do the
4149 * right access checking. So, we'll fail the request.
4150 */
4151 if (error)
4152 goto out;
4153
4154 bvap = &bva;
4155
4156 if (rdonly(ro, vp)) {
4157 resp->status = NFS3ERR_ROFS;
4158 goto out1;
4159 }
4160
4161 if (vp->v_type != VREG) {
4162 resp->status = NFS3ERR_INVAL;
|