Print this page
NEX-16818 Add fksmbcl development tool
NEX-17264 SMB client test tp_smbutil_013 fails after NEX-14666
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
and: (fix ref leaks)

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libsmbfs/smb/keychain.c
          +++ new/usr/src/lib/libsmbfs/smb/keychain.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23      - * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
       23 + * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  24   24   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  25   25   * Use is subject to license terms.
  26   26   */
  27   27  
  28   28  /*
  29   29   * External interface to the libsmbfs/netsmb keychain
  30   30   * storage mechanism.  This interface is consumed by
  31   31   * the "smbutil" commands: login, logout, ...
  32   32   * and by the SMBFS PAM module.
  33   33   */
↓ open down ↓ 87 lines elided ↑ open up ↑
 121  121                  goto out;
 122  122          }
 123  123  
 124  124          fd = smb_open_driver();
 125  125          if (fd < 0) {
 126  126                  err = SMB_KEYCHAIN_NODRIVER;
 127  127                  goto out;
 128  128          }
 129  129  
 130  130          err = 0;
 131      -        if (ioctl(fd, cmd, &pk) < 0) {
      131 +        if (nsmb_ioctl(fd, cmd, &pk) < 0) {
 132  132                  err = errno;
 133  133                  goto out;
 134  134          }
 135  135  
 136  136          if (cmd == SMBIOC_PK_CHK) {
 137  137                  if (lmhash != NULL)
 138  138                          memcpy(lmhash, pk.pk_lmhash, SMBIOC_HASH_SZ);
 139  139                  if (nthash != NULL)
 140  140                          memcpy(nthash, pk.pk_nthash, SMBIOC_HASH_SZ);
 141  141          }
 142  142  
 143  143  out:
 144  144          if (fd != -1)
 145      -                close(fd);
      145 +                nsmb_close(fd);
 146  146  
 147  147          return (err);
 148  148  }
 149  149  
 150  150  /*
 151  151   * Add a password to the keychain.
 152  152   *
 153  153   * Note: pass is a cleartext password.
 154  154   * We use it here to compute the LM hash and NT hash,
 155  155   * and then store ONLY the hashes.
↓ open down ↓ 176 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX