Print this page
NEX-15041 method to delete local SMB users
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15023 Windows usernames should be treated as case insensitive
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15041 method to delete local SMB users
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15023 Windows usernames should be treated as case insensitive
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
SMB-167 SMB passwd routines should syslog more failures
SMB-126 Unable to map share from win2003/win2003R2 client ...
SMB-107 Unable to map network drive in workgroup mode using Windows XP...
SMB-68 NTLM(v1) inbound with Extended Session Security

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/smbsrv/libsmb/common/smb_pwdutil.c
          +++ new/usr/src/lib/smbsrv/libsmb/common/smb_pwdutil.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  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   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   *
  25      - * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
       25 + * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  26   26   */
  27   27  
  28   28  #include <syslog.h>
  29   29  #include <stdlib.h>
  30   30  #include <unistd.h>
  31   31  #include <limits.h>
  32   32  #include <strings.h>
  33   33  #include <synch.h>
  34   34  #include <errno.h>
  35   35  #include <sys/types.h>
↓ open down ↓ 235 lines elided ↑ open up ↑
 271  271  
 272  272          if ((fp = fopen(SMB_PASSWD, "rF")) == NULL) {
 273  273                  syslog(LOG_WARNING, "smb_pwdutil: open failed, %m");
 274  274                  (void) smb_pwd_unlock();
 275  275                  return (NULL);
 276  276          }
 277  277  
 278  278          pwbuf.pw_pwd = smbpw;
 279  279  
 280  280          while (smb_pwd_fgetent(fp, &pwbuf, SMB_PWD_GETF_ALL) != NULL) {
 281      -                if (strcmp(name, smbpw->pw_name) == 0) {
      281 +                if (strcasecmp(name, smbpw->pw_name) == 0) {
 282  282                          found = B_TRUE;
 283  283                          break;
 284  284                  }
 285  285          }
 286  286  
 287  287          (void) fclose(fp);
 288  288          (void) smb_pwd_unlock();
 289  289  
 290  290          if (!found) {
 291  291                  bzero(smbpw, sizeof (smb_passwd_t));
↓ open down ↓ 225 lines elided ↑ open up ↑
 517  517                  control |= SMB_PWC_NOLM;
 518  518  
 519  519          pwbuf.pw_pwd = &smbpw;
 520  520  
 521  521          /*
 522  522           * copy old password entries to temporary file while replacing
 523  523           * the entry that matches "name"
 524  524           */
 525  525          while (smb_pwd_fgetent(src, &pwbuf, SMB_PWD_GETF_ALL) != NULL) {
 526  526                  if (strcmp(smbpw.pw_name, name) == 0) {
      527 +                        if ((control & SMB_PWC_DELETE) != 0) {
      528 +                                /* exclude the entry from the new passwd file */
      529 +                                newent = B_FALSE;
      530 +                                err = SMB_PWE_SUCCESS;
      531 +                                continue;
      532 +                        }
 527  533                          err = smb_pwd_chgpwent(&smbpw, password, control);
 528  534                          if (err == SMB_PWE_USER_DISABLE)
 529  535                                  user_disable = B_TRUE;
 530  536                          err = smb_pwd_fputent(dst, &pwbuf);
 531  537                          newent = B_FALSE;
 532  538                  } else {
 533  539                          err = smb_pwd_fputent(dst, &pwbuf);
 534  540                  }
 535  541  
 536  542                  if (err != SMB_PWE_SUCCESS) {
↓ open down ↓ 700 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX