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

@@ -20,11 +20,11 @@
  */
 /*
  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #include <syslog.h>
 #include <stdlib.h>
 #include <unistd.h>

@@ -276,11 +276,11 @@
         }
 
         pwbuf.pw_pwd = smbpw;
 
         while (smb_pwd_fgetent(fp, &pwbuf, SMB_PWD_GETF_ALL) != NULL) {
-                if (strcmp(name, smbpw->pw_name) == 0) {
+                if (strcasecmp(name, smbpw->pw_name) == 0) {
                         found = B_TRUE;
                         break;
                 }
         }
 

@@ -522,10 +522,16 @@
          * copy old password entries to temporary file while replacing
          * the entry that matches "name"
          */
         while (smb_pwd_fgetent(src, &pwbuf, SMB_PWD_GETF_ALL) != NULL) {
                 if (strcmp(smbpw.pw_name, name) == 0) {
+                        if ((control & SMB_PWC_DELETE) != 0) {
+                                /* exclude the entry from the new passwd file */
+                                newent = B_FALSE;
+                                err = SMB_PWE_SUCCESS;
+                                continue;
+                        }
                         err = smb_pwd_chgpwent(&smbpw, password, control);
                         if (err == SMB_PWE_USER_DISABLE)
                                 user_disable = B_TRUE;
                         err = smb_pwd_fputent(dst, &pwbuf);
                         newent = B_FALSE;