419 if (dvp == NULL) {
420 error = ESTALE;
421 goto out;
422 }
423 }
424
425 dva.va_mask = AT_ALL;
426 dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
427
428 if (args->what.name == nfs3nametoolong) {
429 resp->status = NFS3ERR_NAMETOOLONG;
430 goto out1;
431 }
432
433 if (args->what.name == NULL || *(args->what.name) == '\0') {
434 resp->status = NFS3ERR_ACCES;
435 goto out1;
436 }
437
438 fhp = &args->what.dir;
439 if (strcmp(args->what.name, "..") == 0 &&
440 EQFID(&exi->exi_fid, FH3TOFIDP(fhp))) {
441 if ((exi->exi_export.ex_flags & EX_NOHIDE) &&
442 ((dvp->v_flag & VROOT) || VN_IS_CURZONEROOT(dvp))) {
443 /*
444 * special case for ".." and 'nohide'exported root
445 */
446 if (rfs_climb_crossmnt(&dvp, &exi, cr) != 0) {
447 resp->status = NFS3ERR_ACCES;
448 goto out1;
449 }
450 } else {
451 resp->status = NFS3ERR_NOENT;
452 goto out1;
453 }
454 }
455
456 ca = (struct sockaddr *)svc_getrpccaller(req->rq_xprt)->buf;
457 name = nfscmd_convname(ca, exi, args->what.name,
458 NFSCMD_CONV_INBOUND, MAXPATHLEN + 1);
1308 mblk_t *m;
1309 struct iovec *iovp;
1310 int iovcnt;
1311 int ioflag;
1312 cred_t *savecred;
1313 int in_crit = 0;
1314 int rwlock_ret = -1;
1315 caller_context_t ct;
1316
1317 vp = nfs3_fhtovp(&args->file, exi);
1318
1319 DTRACE_NFSV3_5(op__write__start, struct svc_req *, req,
1320 cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
1321 WRITE3args *, args);
1322
1323 if (vp == NULL) {
1324 error = ESTALE;
1325 goto err;
1326 }
1327
1328 ns = zone_getspecific(rfs3_zone_key, curzone);
1329 if (is_system_labeled()) {
1330 bslabel_t *clabel = req->rq_label;
1331
1332 ASSERT(clabel != NULL);
1333 DTRACE_PROBE2(tx__rfs3__log__info__opwrite__clabel, char *,
1334 "got client label from request(1)", struct svc_req *, req);
1335
1336 if (!blequal(&l_admin_low->tsl_label, clabel)) {
1337 if (!do_rfs_label_check(clabel, vp, EQUALITY_CHECK,
1338 exi)) {
1339 resp->status = NFS3ERR_ACCES;
1340 goto err1;
1341 }
1342 }
1343 }
1344
1345 ct.cc_sysid = 0;
1346 ct.cc_pid = 0;
1347 ct.cc_caller_id = nfs3_srv_caller_id;
4108 vnode_t *vp;
4109 struct vattr *bvap;
4110 struct vattr bva;
4111 struct vattr *avap;
4112 struct vattr ava;
4113
4114 bvap = NULL;
4115 avap = NULL;
4116
4117 vp = nfs3_fhtovp(&args->file, exi);
4118
4119 DTRACE_NFSV3_5(op__commit__start, struct svc_req *, req,
4120 cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
4121 COMMIT3args *, args);
4122
4123 if (vp == NULL) {
4124 error = ESTALE;
4125 goto out;
4126 }
4127
4128 ns = zone_getspecific(rfs3_zone_key, curzone);
4129 bva.va_mask = AT_ALL;
4130 error = VOP_GETATTR(vp, &bva, 0, cr, NULL);
4131
4132 /*
4133 * If we can't get the attributes, then we can't do the
4134 * right access checking. So, we'll fail the request.
4135 */
4136 if (error)
4137 goto out;
4138
4139 bvap = &bva;
4140
4141 if (rdonly(ro, vp)) {
4142 resp->status = NFS3ERR_ROFS;
4143 goto out1;
4144 }
4145
4146 if (vp->v_type != VREG) {
4147 resp->status = NFS3ERR_INVAL;
|
419 if (dvp == NULL) {
420 error = ESTALE;
421 goto out;
422 }
423 }
424
425 dva.va_mask = AT_ALL;
426 dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
427
428 if (args->what.name == nfs3nametoolong) {
429 resp->status = NFS3ERR_NAMETOOLONG;
430 goto out1;
431 }
432
433 if (args->what.name == NULL || *(args->what.name) == '\0') {
434 resp->status = NFS3ERR_ACCES;
435 goto out1;
436 }
437
438 fhp = &args->what.dir;
439 ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
440 if (strcmp(args->what.name, "..") == 0 &&
441 EQFID(&exi->exi_fid, FH3TOFIDP(fhp))) {
442 if ((exi->exi_export.ex_flags & EX_NOHIDE) &&
443 ((dvp->v_flag & VROOT) || VN_IS_CURZONEROOT(dvp))) {
444 /*
445 * special case for ".." and 'nohide'exported root
446 */
447 if (rfs_climb_crossmnt(&dvp, &exi, cr) != 0) {
448 resp->status = NFS3ERR_ACCES;
449 goto out1;
450 }
451 } else {
452 resp->status = NFS3ERR_NOENT;
453 goto out1;
454 }
455 }
456
457 ca = (struct sockaddr *)svc_getrpccaller(req->rq_xprt)->buf;
458 name = nfscmd_convname(ca, exi, args->what.name,
459 NFSCMD_CONV_INBOUND, MAXPATHLEN + 1);
1309 mblk_t *m;
1310 struct iovec *iovp;
1311 int iovcnt;
1312 int ioflag;
1313 cred_t *savecred;
1314 int in_crit = 0;
1315 int rwlock_ret = -1;
1316 caller_context_t ct;
1317
1318 vp = nfs3_fhtovp(&args->file, exi);
1319
1320 DTRACE_NFSV3_5(op__write__start, struct svc_req *, req,
1321 cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
1322 WRITE3args *, args);
1323
1324 if (vp == NULL) {
1325 error = ESTALE;
1326 goto err;
1327 }
1328
1329 ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
1330 ns = zone_getspecific(rfs3_zone_key, curzone);
1331 if (is_system_labeled()) {
1332 bslabel_t *clabel = req->rq_label;
1333
1334 ASSERT(clabel != NULL);
1335 DTRACE_PROBE2(tx__rfs3__log__info__opwrite__clabel, char *,
1336 "got client label from request(1)", struct svc_req *, req);
1337
1338 if (!blequal(&l_admin_low->tsl_label, clabel)) {
1339 if (!do_rfs_label_check(clabel, vp, EQUALITY_CHECK,
1340 exi)) {
1341 resp->status = NFS3ERR_ACCES;
1342 goto err1;
1343 }
1344 }
1345 }
1346
1347 ct.cc_sysid = 0;
1348 ct.cc_pid = 0;
1349 ct.cc_caller_id = nfs3_srv_caller_id;
4110 vnode_t *vp;
4111 struct vattr *bvap;
4112 struct vattr bva;
4113 struct vattr *avap;
4114 struct vattr ava;
4115
4116 bvap = NULL;
4117 avap = NULL;
4118
4119 vp = nfs3_fhtovp(&args->file, exi);
4120
4121 DTRACE_NFSV3_5(op__commit__start, struct svc_req *, req,
4122 cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
4123 COMMIT3args *, args);
4124
4125 if (vp == NULL) {
4126 error = ESTALE;
4127 goto out;
4128 }
4129
4130 ASSERT3P(curzone, ==, exi->exi_zone); /* exi is guaranteed non-NULL. */
4131 ns = zone_getspecific(rfs3_zone_key, curzone);
4132 bva.va_mask = AT_ALL;
4133 error = VOP_GETATTR(vp, &bva, 0, cr, NULL);
4134
4135 /*
4136 * If we can't get the attributes, then we can't do the
4137 * right access checking. So, we'll fail the request.
4138 */
4139 if (error)
4140 goto out;
4141
4142 bvap = &bva;
4143
4144 if (rdonly(ro, vp)) {
4145 resp->status = NFS3ERR_ROFS;
4146 goto out1;
4147 }
4148
4149 if (vp->v_type != VREG) {
4150 resp->status = NFS3ERR_INVAL;
|