Print this page
NEX-1643 dtrace provider for smbsrv
Also illumos 1841:
 DTrace smb provider was mis-implemented, doesn't exist.
Add back handlers for read/write raw, so that
 legacy dtrace consumers can find the probes.
Kill extra arg in smb_negotiate
Fix missing "done" probe with smb_notify
Add example consumer: smb-trace.d
fix soi_pid


  83  * message that the server can handle.  The client should not generate
  84  * messages, nor expect to receive responses, larger than this.  This
  85  * must be constant for a given server. For newer dialects, this field
  86  * is ignored.
  87  */
  88 smb_sdrc_t
  89 smb_pre_tree_connect(smb_request_t *sr)
  90 {
  91         smb_arg_tcon_t  *tcon = &sr->sr_tcon;
  92         int             rc;
  93 
  94         /*
  95          * Perhaps this should be "%A.sA" now that unicode is enabled.
  96          */
  97         rc = smbsr_decode_data(sr, "%AAA", sr, &tcon->path,
  98             &tcon->password, &tcon->service);
  99 
 100         tcon->flags = 0;
 101         tcon->optional_support = 0;
 102 
 103         DTRACE_SMB_2(op__TreeConnect__start, smb_request_t *, sr,
 104             smb_arg_tcon_t *, tcon);
 105 
 106         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
 107 }
 108 
 109 void
 110 smb_post_tree_connect(smb_request_t *sr)
 111 {
 112         DTRACE_SMB_1(op__TreeConnect__done, smb_request_t *, sr);
 113 }
 114 
 115 smb_sdrc_t
 116 smb_com_tree_connect(smb_request_t *sr)
 117 {
 118         uint32_t status;
 119         int rc;
 120 
 121         status = smb_tree_connect(sr);
 122         if (status) {
 123                 smb_tcon_puterror(sr, status);
 124                 return (SDRC_ERROR);


 274         smb_arg_tcon_t  *tcon = &sr->sr_tcon;
 275         uint8_t         *pwbuf = NULL;
 276         uint16_t        pwlen = 0;
 277         int             rc;
 278 
 279         rc = smbsr_decode_vwv(sr, "b.www", &sr->andx_com, &sr->andx_off,
 280             &tcon->flags, &pwlen);
 281         if (rc == 0) {
 282                 if (pwlen != 0)
 283                         pwbuf = smb_srm_zalloc(sr, pwlen);
 284 
 285                 rc = smbsr_decode_data(sr, "%#cus", sr, pwlen, pwbuf,
 286                     &tcon->path, &tcon->service);
 287 
 288                 tcon->pwdlen = pwlen;
 289                 tcon->password = (char *)pwbuf;
 290         }
 291 
 292         tcon->optional_support = 0;
 293 
 294         DTRACE_SMB_2(op__TreeConnectX__start, smb_request_t *, sr,
 295             smb_arg_tcon_t *, tcon);
 296 
 297         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
 298 }
 299 
 300 void
 301 smb_post_tree_connect_andx(smb_request_t *sr)
 302 {
 303         DTRACE_SMB_1(op__TreeConnectX__done, smb_request_t *, sr);
 304 }
 305 
 306 smb_sdrc_t
 307 smb_com_tree_connect_andx(smb_request_t *sr)
 308 {
 309         smb_arg_tcon_t  *tcon = &sr->sr_tcon;
 310         smb_tree_t      *tree;
 311         char            *service;
 312         uint32_t        status;
 313         int             rc;
 314 
 315         if (tcon->flags & SMB_TCONX_DISCONECT_TID) {




  83  * message that the server can handle.  The client should not generate
  84  * messages, nor expect to receive responses, larger than this.  This
  85  * must be constant for a given server. For newer dialects, this field
  86  * is ignored.
  87  */
  88 smb_sdrc_t
  89 smb_pre_tree_connect(smb_request_t *sr)
  90 {
  91         smb_arg_tcon_t  *tcon = &sr->sr_tcon;
  92         int             rc;
  93 
  94         /*
  95          * Perhaps this should be "%A.sA" now that unicode is enabled.
  96          */
  97         rc = smbsr_decode_data(sr, "%AAA", sr, &tcon->path,
  98             &tcon->password, &tcon->service);
  99 
 100         tcon->flags = 0;
 101         tcon->optional_support = 0;
 102 
 103         DTRACE_SMB_1(op__TreeConnect__start, smb_request_t *, sr);

 104 
 105         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
 106 }
 107 
 108 void
 109 smb_post_tree_connect(smb_request_t *sr)
 110 {
 111         DTRACE_SMB_1(op__TreeConnect__done, smb_request_t *, sr);
 112 }
 113 
 114 smb_sdrc_t
 115 smb_com_tree_connect(smb_request_t *sr)
 116 {
 117         uint32_t status;
 118         int rc;
 119 
 120         status = smb_tree_connect(sr);
 121         if (status) {
 122                 smb_tcon_puterror(sr, status);
 123                 return (SDRC_ERROR);


 273         smb_arg_tcon_t  *tcon = &sr->sr_tcon;
 274         uint8_t         *pwbuf = NULL;
 275         uint16_t        pwlen = 0;
 276         int             rc;
 277 
 278         rc = smbsr_decode_vwv(sr, "b.www", &sr->andx_com, &sr->andx_off,
 279             &tcon->flags, &pwlen);
 280         if (rc == 0) {
 281                 if (pwlen != 0)
 282                         pwbuf = smb_srm_zalloc(sr, pwlen);
 283 
 284                 rc = smbsr_decode_data(sr, "%#cus", sr, pwlen, pwbuf,
 285                     &tcon->path, &tcon->service);
 286 
 287                 tcon->pwdlen = pwlen;
 288                 tcon->password = (char *)pwbuf;
 289         }
 290 
 291         tcon->optional_support = 0;
 292 
 293         DTRACE_SMB_1(op__TreeConnectX__start, smb_request_t *, sr);

 294 
 295         return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
 296 }
 297 
 298 void
 299 smb_post_tree_connect_andx(smb_request_t *sr)
 300 {
 301         DTRACE_SMB_1(op__TreeConnectX__done, smb_request_t *, sr);
 302 }
 303 
 304 smb_sdrc_t
 305 smb_com_tree_connect_andx(smb_request_t *sr)
 306 {
 307         smb_arg_tcon_t  *tcon = &sr->sr_tcon;
 308         smb_tree_t      *tree;
 309         char            *service;
 310         uint32_t        status;
 311         int             rc;
 312 
 313         if (tcon->flags & SMB_TCONX_DISCONECT_TID) {