summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/cmd/smbsrv/smbadm/smbadm.c7
-rw-r--r--usr/src/lib/smbsrv/libsmb/common/smb_lgrp.c13
2 files changed, 15 insertions, 5 deletions
diff --git a/usr/src/cmd/smbsrv/smbadm/smbadm.c b/usr/src/cmd/smbsrv/smbadm/smbadm.c
index f181d45556..f1c1fa800f 100644
--- a/usr/src/cmd/smbsrv/smbadm/smbadm.c
+++ b/usr/src/cmd/smbsrv/smbadm/smbadm.c
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
*/
/*
@@ -1406,13 +1406,14 @@ smbadm_group_add_del_member(char *gname, char *mname,
/*
* We are given a SID. Just use it.
*
- * We'e like the real account type if we can get it,
+ * We'd like the real account type if we can get it,
* but don't want to error out if we can't get it.
+ * Lacking other info, assume it's a group.
*/
sidstr = mname;
rc = smb_lookup_sid(sidstr, &acct);
if ((rc != 0) || (acct.a_status != NT_STATUS_SUCCESS))
- acct.a_sidtype = SidTypeUnknown;
+ acct.a_sidtype = SidTypeGroup;
} else {
rc = smb_lookup_name(mname, SidTypeUnknown, &acct);
if ((rc != 0) || (acct.a_status != NT_STATUS_SUCCESS)) {
diff --git a/usr/src/lib/smbsrv/libsmb/common/smb_lgrp.c b/usr/src/lib/smbsrv/libsmb/common/smb_lgrp.c
index 3cab135341..ebd261b95d 100644
--- a/usr/src/lib/smbsrv/libsmb/common/smb_lgrp.c
+++ b/usr/src/lib/smbsrv/libsmb/common/smb_lgrp.c
@@ -20,9 +20,9 @@
*/
/*
- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 RackTop Systems.
+ * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
*/
#include <stdlib.h>
@@ -142,8 +142,12 @@ typedef struct smb_lgmid {
uint16_t m_type;
} smb_lgmid_t;
+/* Buffer size to hold hex form of the above (>24). */
#define SMB_LGRP_MID_HEXSZ 32
+/* Size of idx,rid parts of above, in hex form. */
+#define SMB_LGRP_IDXRID_LEN 16
+
/* Member list */
typedef struct smb_lgmlist {
uint32_t m_cnt;
@@ -2039,6 +2043,10 @@ smb_lgrp_mlist_add(smb_lgmlist_t *in_members, smb_lgmid_t *newm,
* memory for out_members by calling free().
*
* in_members and out_members are hex strings.
+ *
+ * Note that we ignore the SID "type" when matching because
+ * we always want to delete when the SID part matches.
+ * The "type" part can be fiction.
*/
static int
smb_lgrp_mlist_del(smb_lgmlist_t *in_members, smb_lgmid_t *mid,
@@ -2073,7 +2081,8 @@ smb_lgrp_mlist_del(smb_lgmlist_t *in_members, smb_lgmid_t *mid,
in_list = in_members->m_ids;
for (i = 0, out_cnt = 0; i < in_members->m_cnt; i++) {
- if (strncmp(in_list, mid_hex, mid_hexsz)) {
+ /* Keep only those NOT matching in IDX,RID */
+ if (strncmp(in_list, mid_hex, SMB_LGRP_IDXRID_LEN)) {
(void) strncat(out_list, in_list, mid_hexsz);
out_cnt++;
}