Print this page
NEX-15558 SMB logon fails during 1st second after service start
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15558 SMB logon fails during 1st second after service start
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-2626 SMB should not offer Kerberos in workgroup mode
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
NEX-4083 Upstream changes from illumos 5917 and 5995
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-2485 SMB authentication flood handled poorly
NEX-1810 extended security Kerberos (inbound)
NEX-1995 SMB fails to authenticate domain user with 40 or more domain group memberships
SUP-866 smbd lwps stuck in libsocket recv() for no apparent reason (more lint)
SUP-866 smbd lwps stuck in libsocket recv() for no apparent reason (lint)
SUP-866 smbd lwps stuck in libsocket recv() for no apparent reason
SMB-149 mount.cifs RedHat\Centos 6 doesn't work with default security options
SMB-77 Support raw NTLMSSP
SMB-50 User-mode SMB server (fix elfchk noise)
SMB-56 extended security NTLMSSP, inbound (fix a leak)
SMB-56 extended security NTLMSSP, inbound

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/smbsrv/smbd/smbd_authsvc.c
          +++ new/usr/src/cmd/smbsrv/smbd/smbd_authsvc.c
↓ open down ↓ 2 lines elided ↑ open up ↑
   3    3   * Common Development and Distribution License ("CDDL"), version 1.0.
   4    4   * You may only use this file in accordance with the terms of version
   5    5   * 1.0 of the CDDL.
   6    6   *
   7    7   * A full copy of the text of the CDDL should have accompanied this
   8    8   * source.  A copy of the CDDL is also available via the Internet at
   9    9   * http://www.illumos.org/license/CDDL.
  10   10   */
  11   11  
  12   12  /*
  13      - * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
       13 + * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  14   14   */
  15   15  
  16   16  /*
  17   17   * SMB authentication service
  18   18   *
  19   19   * This service listens on a local AF_UNIX socket, spawning a
  20   20   * thread to service each connection.  The client-side of such
  21   21   * connections is the in-kernel SMB service, with an open and
  22   22   * connect done in the SMB session setup handler.
  23   23   */
↓ open down ↓ 72 lines elided ↑ open up ↑
  96   96  int smbd_authsvc_hiwat = 0;     /* largest thrcnt seen */
  97   97  #ifdef DEBUG
  98   98  int smbd_authsvc_slowdown = 0;
  99   99  #endif
 100  100  
 101  101  /*
 102  102   * These are the mechanisms we support, in order of preference.
 103  103   * But note: it's really the _client's_ preference that matters.
 104  104   * See &pref in the spnegoIsMechTypeAvailable() calls below.
 105  105   * Careful with this table; the code below knows its format and
 106      - * may skip the fist two entries to ommit Kerberos.
      106 + * may skip the fist two entries to omit Kerberos.
 107  107   */
 108  108  static const spnego_mech_handler_t
 109  109  mech_table[] = {
 110  110          {
 111  111                  spnego_mech_oid_Kerberos_V5,
 112  112                  smbd_krb5ssp_init,
 113  113                  smbd_krb5ssp_work,
 114  114                  smbd_krb5ssp_fini
 115  115          },
 116  116          {
↓ open down ↓ 425 lines elided ↑ open up ↑
 542  542          xdrmem_create(&xdrs, ctx->ctx_irawbuf, ctx->ctx_irawlen,
 543  543              XDR_DECODE);
 544  544          if (!smb_logon_xdr(&xdrs, &user_info)) {
 545  545                  xdr_destroy(&xdrs);
 546  546                  return (NT_STATUS_INVALID_PARAMETER);
 547  547          }
 548  548          xdr_destroy(&xdrs);
 549  549  
 550  550          token = smbd_user_auth_logon(&user_info);
 551  551          xdr_free(smb_logon_xdr, (char *)&user_info);
 552      -        if (token == NULL)
 553      -                return (NT_STATUS_ACCESS_DENIED);
      552 +        if (token == NULL) {
      553 +                rc = user_info.lg_status;
      554 +                if (rc == 0) /* should not happen */
      555 +                        rc = NT_STATUS_INTERNAL_ERROR;
      556 +                return (rc);
      557 +        }
 554  558  
 555  559          ctx->ctx_token = token;
 556  560  
 557  561          return (rc);
 558  562  }
 559  563  
 560  564  static int
 561  565  smbd_authsvc_clinfo(authsvc_context_t *ctx)
 562  566  {
 563  567  
↓ open down ↓ 60 lines elided ↑ open up ↑
 624  628          }
 625  629  
 626  630          /*
 627  631           * Figure out which mech type to use.  We want to use the
 628  632           * first of the client's supported mechanisms that we also
 629  633           * support.  Unfortunately, the spnego code does not have an
 630  634           * interface to walk the token's mech list, so we have to
 631  635           * ask about each mech type we know and keep track of which
 632  636           * was earliest in the token's mech list.
 633  637           *
 634      -         * Also, skip the Kerberos mechanisms in workgroup mode.
      638 +         * Also, if not in domain mode, skip the Kerberos.
 635  639           */
 636  640          idx = 0;
 637  641          mh = mech_table;
 638  642          if (smb_config_get_secmode() != SMB_SECMODE_DOMAIN) {
 639  643                  idx = MECH_TBL_IDX_NTLMSSP;
 640  644                  mh = &mech_table[idx];
 641  645          }
 642  646          for (; mh->mh_init != NULL; idx++, mh++) {
 643  647  
 644  648                  if (spnegoIsMechTypeAvailable(ctx->ctx_itoken,
↓ open down ↓ 129 lines elided ↑ open up ↑
 774  778  
 775  779          /*
 776  780           * Wrap the outgoing body in a negTokenTarg SPNEGO token.
 777  781           * The selected mech. OID is returned only when the
 778  782           * incoming token was of type SPNEGO_TOKEN_INIT.
 779  783           */
 780  784          if (ctx->ctx_itoktype == SPNEGO_TOKEN_INIT) {
 781  785                  /* tell the client the selected mech. */
 782  786                  oid = ctx->ctx_mech_oid;
 783  787          } else {
 784      -                /* Ommit the "supported mech." field. */
      788 +                /* Omit the "supported mech." field. */
 785  789                  oid = spnego_mech_oid_NotUsed;
 786  790          }
 787  791  
 788  792          /*
 789  793           * Determine the spnego "negresult" from the
 790  794           * reply message type (from the work func).
 791  795           */
 792  796          switch (ctx->ctx_orawtype) {
 793  797          case LSA_MTYPE_ERROR:
 794  798                  ctx->ctx_negresult = spnego_negresult_rejected;
↓ open down ↓ 113 lines elided ↑ open up ↑
 908  912          if (!smb_token_xdr(&xdrs, token))
 909  913                  rc = NT_STATUS_INTERNAL_ERROR;
 910  914          xdr_destroy(&xdrs);
 911  915  
 912  916          return (rc);
 913  917  }
 914  918  
 915  919  /*
 916  920   * Initialization time code to figure out what mechanisms we support.
 917  921   * Careful with this table; the code below knows its format and may
 918      - * skip the fist two entries to ommit Kerberos.
      922 + * skip the fist two entries to omit Kerberos.
 919  923   */
 920  924  static SPNEGO_MECH_OID MechTypeList[] = {
 921  925          spnego_mech_oid_Kerberos_V5,
 922  926          spnego_mech_oid_Kerberos_V5_Legacy,
 923  927  #define MECH_OID_IDX_NTLMSSP    2
 924  928          spnego_mech_oid_NTLMSSP,
 925  929  };
 926  930  static int MechTypeCnt = sizeof (MechTypeList) /
 927  931          sizeof (MechTypeList[0]);
 928  932  
↓ open down ↓ 10 lines elided ↑ open up ↑
 939  943  {
 940  944          SPNEGO_MECH_OID *mechList = MechTypeList;
 941  945          int mechCnt = MechTypeCnt;
 942  946          SPNEGO_TOKEN_HANDLE hSpnegoToken = NULL;
 943  947          uchar_t *pBuf = kcfg->skc_negtok;
 944  948          uint32_t *pBufLen = &kcfg->skc_negtok_len;
 945  949          ulong_t tLen = sizeof (kcfg->skc_negtok);
 946  950          int rc;
 947  951  
 948  952          /*
 949      -         * In workgroup mode, skip Kerberos.
      953 +         * If not in domain mode, skip Kerberos.
 950  954           */
 951  955          if (smb_config_get_secmode() != SMB_SECMODE_DOMAIN) {
 952  956                  mechList += MECH_OID_IDX_NTLMSSP;
 953  957                  mechCnt  -= MECH_OID_IDX_NTLMSSP;
 954  958          }
 955  959  
 956  960          rc = spnegoCreateNegTokenHint(mechList, mechCnt,
 957  961              (uchar_t *)IgnoreSPN, &hSpnegoToken);
 958  962          if (rc != SPNEGO_E_SUCCESS) {
 959  963                  syslog(LOG_DEBUG, "smb_config_get_negtok: "
↓ open down ↓ 14 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX