Print this page
Build provider 3rd arg from smb_request_t
hacking...


 210  * those access rights determined by "anding" the open mode rights and the
 211  * deny mode rights, i.e., the deny mode is checked on all file accesses.
 212  * For example, if a file is opened for Read/Write in Deny write mode, then
 213  * other clients may only read the file and cannot write; if a file is
 214  * opened for Read in Deny read mode, then the other clients can neither
 215  * read nor write the file.
 216  */
 217 
 218 smb_sdrc_t
 219 smb_pre_open(smb_request_t *sr)
 220 {
 221         struct open_param *op = &sr->arg.open;
 222         int rc;
 223 
 224         bzero(op, sizeof (sr->arg.open));
 225 
 226         rc = smbsr_decode_vwv(sr, "ww", &op->omode, &op->fqi.fq_sattr);
 227         if (rc == 0)
 228                 rc = smbsr_decode_data(sr, "%S", sr, &op->fqi.fq_path.pn_path);
 229 
 230         DTRACE_SMB_2(op__Open__start, smb_request_t *, sr,
 231             struct open_param *, op);
 232 
 233         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
 234 }
 235 
 236 void
 237 smb_post_open(smb_request_t *sr)
 238 {
 239         DTRACE_SMB_1(op__Open__done, smb_request_t *, sr);
 240 }
 241 
 242 smb_sdrc_t
 243 smb_com_open(smb_request_t *sr)
 244 {
 245         struct open_param *op = &sr->arg.open;
 246         smb_ofile_t *of;
 247         smb_attr_t attr;
 248         uint32_t status;
 249         uint16_t file_attr;
 250         int rc;
 251 


 350                  * The openx_flags use some "extended" flags that
 351                  * happen to match some of the NtCreateX flags.
 352                  */
 353                 if (openx_flags & NT_CREATE_FLAG_REQUEST_OPLOCK)
 354                         op->op_oplock_level = SMB_OPLOCK_EXCLUSIVE;
 355                 else if (openx_flags & NT_CREATE_FLAG_REQUEST_OPBATCH)
 356                         op->op_oplock_level = SMB_OPLOCK_BATCH;
 357                 else
 358                         op->op_oplock_level = SMB_OPLOCK_NONE;
 359                 if (openx_flags & NT_CREATE_FLAG_EXTENDED_RESPONSE)
 360                         op->nt_flags |= NT_CREATE_FLAG_EXTENDED_RESPONSE;
 361 
 362                 if ((creation_time != 0) && (creation_time != UINT_MAX))
 363                         op->crtime.tv_sec =
 364                             smb_time_local_to_gmt(sr, creation_time);
 365                 op->crtime.tv_nsec = 0;
 366 
 367                 op->create_disposition = smb_ofun_to_crdisposition(op->ofun);
 368         }
 369 
 370         DTRACE_SMB_2(op__OpenX__start, smb_request_t *, sr,
 371             struct open_param *, op);
 372 
 373         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
 374 }
 375 
 376 void
 377 smb_post_open_andx(smb_request_t *sr)
 378 {
 379         DTRACE_SMB_1(op__OpenX__done, smb_request_t *, sr);
 380 }
 381 
 382 smb_sdrc_t
 383 smb_com_open_andx(smb_request_t *sr)
 384 {
 385         struct open_param       *op = &sr->arg.open;
 386         smb_attr_t              *ap = &op->fqi.fq_fattr;
 387         smb_ofile_t             *of;
 388         uint32_t                status;
 389         uint32_t                mtime_sec;
 390         uint16_t                file_attr;
 391         int rc;




 210  * those access rights determined by "anding" the open mode rights and the
 211  * deny mode rights, i.e., the deny mode is checked on all file accesses.
 212  * For example, if a file is opened for Read/Write in Deny write mode, then
 213  * other clients may only read the file and cannot write; if a file is
 214  * opened for Read in Deny read mode, then the other clients can neither
 215  * read nor write the file.
 216  */
 217 
 218 smb_sdrc_t
 219 smb_pre_open(smb_request_t *sr)
 220 {
 221         struct open_param *op = &sr->arg.open;
 222         int rc;
 223 
 224         bzero(op, sizeof (sr->arg.open));
 225 
 226         rc = smbsr_decode_vwv(sr, "ww", &op->omode, &op->fqi.fq_sattr);
 227         if (rc == 0)
 228                 rc = smbsr_decode_data(sr, "%S", sr, &op->fqi.fq_path.pn_path);
 229 
 230         DTRACE_SMB_1(op__Open__start, smb_request_t *, sr); /* arg.open */

 231 
 232         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
 233 }
 234 
 235 void
 236 smb_post_open(smb_request_t *sr)
 237 {
 238         DTRACE_SMB_1(op__Open__done, smb_request_t *, sr);
 239 }
 240 
 241 smb_sdrc_t
 242 smb_com_open(smb_request_t *sr)
 243 {
 244         struct open_param *op = &sr->arg.open;
 245         smb_ofile_t *of;
 246         smb_attr_t attr;
 247         uint32_t status;
 248         uint16_t file_attr;
 249         int rc;
 250 


 349                  * The openx_flags use some "extended" flags that
 350                  * happen to match some of the NtCreateX flags.
 351                  */
 352                 if (openx_flags & NT_CREATE_FLAG_REQUEST_OPLOCK)
 353                         op->op_oplock_level = SMB_OPLOCK_EXCLUSIVE;
 354                 else if (openx_flags & NT_CREATE_FLAG_REQUEST_OPBATCH)
 355                         op->op_oplock_level = SMB_OPLOCK_BATCH;
 356                 else
 357                         op->op_oplock_level = SMB_OPLOCK_NONE;
 358                 if (openx_flags & NT_CREATE_FLAG_EXTENDED_RESPONSE)
 359                         op->nt_flags |= NT_CREATE_FLAG_EXTENDED_RESPONSE;
 360 
 361                 if ((creation_time != 0) && (creation_time != UINT_MAX))
 362                         op->crtime.tv_sec =
 363                             smb_time_local_to_gmt(sr, creation_time);
 364                 op->crtime.tv_nsec = 0;
 365 
 366                 op->create_disposition = smb_ofun_to_crdisposition(op->ofun);
 367         }
 368 
 369         DTRACE_SMB_1(op__OpenX__start, smb_request_t *, sr); /* arg.open */

 370 
 371         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
 372 }
 373 
 374 void
 375 smb_post_open_andx(smb_request_t *sr)
 376 {
 377         DTRACE_SMB_1(op__OpenX__done, smb_request_t *, sr);
 378 }
 379 
 380 smb_sdrc_t
 381 smb_com_open_andx(smb_request_t *sr)
 382 {
 383         struct open_param       *op = &sr->arg.open;
 384         smb_attr_t              *ap = &op->fqi.fq_fattr;
 385         smb_ofile_t             *of;
 386         uint32_t                status;
 387         uint32_t                mtime_sec;
 388         uint16_t                file_attr;
 389         int rc;