365 rc = -1;
366 break;
367 }
368
369 if ((dialect = smb_xlate_dialect(negprot->ni_name)) < 0)
370 continue;
371
372 /*
373 * Conditionally recognize the SMB2 dialects.
374 */
375 if (dialect >= DIALECT_SMB2002 &&
376 skc->skc_max_protocol < SMB_VERS_2_BASE)
377 continue;
378
379 if (negprot->ni_dialect < dialect) {
380 negprot->ni_dialect = dialect;
381 negprot->ni_index = pos;
382 }
383 }
384
385 DTRACE_SMB_2(op__Negotiate__start, smb_request_t *, sr,
386 smb_arg_negotiate_t, negprot);
387
388 return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
389 }
390
391 void
392 smb_post_negotiate(smb_request_t *sr)
393 {
394 smb_arg_negotiate_t *negprot = sr->sr_negprot;
395
396 DTRACE_SMB_2(op__Negotiate__done, smb_request_t *, sr,
397 smb_arg_negotiate_t, negprot);
398
399 bzero(negprot, sizeof (smb_arg_negotiate_t));
400 }
401
402 smb_sdrc_t
403 smb_com_negotiate(smb_request_t *sr)
404 {
405 smb_session_t *session = sr->session;
406 smb_arg_negotiate_t *negprot = sr->sr_negprot;
407 uint16_t secmode;
408 uint32_t sesskey;
409 char *nbdomain;
410 uint8_t *wcbuf;
411 int wclen;
412 smb_msgbuf_t mb;
413 int rc;
414
415 if (session->s_state != SMB_SESSION_STATE_ESTABLISHED) {
416 /* The protocol has already been negotiated. */
417 smbsr_error(sr, 0, ERRSRV, ERRerror);
|
365 rc = -1;
366 break;
367 }
368
369 if ((dialect = smb_xlate_dialect(negprot->ni_name)) < 0)
370 continue;
371
372 /*
373 * Conditionally recognize the SMB2 dialects.
374 */
375 if (dialect >= DIALECT_SMB2002 &&
376 skc->skc_max_protocol < SMB_VERS_2_BASE)
377 continue;
378
379 if (negprot->ni_dialect < dialect) {
380 negprot->ni_dialect = dialect;
381 negprot->ni_index = pos;
382 }
383 }
384
385 DTRACE_SMB_1(op__Negotiate__start, smb_request_t *, sr);
386
387 return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
388 }
389
390 void
391 smb_post_negotiate(smb_request_t *sr)
392 {
393 smb_arg_negotiate_t *negprot = sr->sr_negprot;
394
395 DTRACE_SMB_1(op__Negotiate__done, smb_request_t *, sr);
396
397 bzero(negprot, sizeof (smb_arg_negotiate_t));
398 }
399
400 smb_sdrc_t
401 smb_com_negotiate(smb_request_t *sr)
402 {
403 smb_session_t *session = sr->session;
404 smb_arg_negotiate_t *negprot = sr->sr_negprot;
405 uint16_t secmode;
406 uint32_t sesskey;
407 char *nbdomain;
408 uint8_t *wcbuf;
409 int wclen;
410 smb_msgbuf_t mb;
411 int rc;
412
413 if (session->s_state != SMB_SESSION_STATE_ESTABLISHED) {
414 /* The protocol has already been negotiated. */
415 smbsr_error(sr, 0, ERRSRV, ERRerror);
|