Print this page
NEX-17589 Get "too high" smbd error when copy big file to cifs share
Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
NEX-17795 SMB logon should tolerate idmap problems
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@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-2461 smb_split_sid uses wrong allocation size
*** 18,38 ****
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
! * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
/*
* SMB server interface to idmap
* (smb_idmap_get..., smb_idmap_batch_...)
*
! * There are three implementations of this interface:
! * uts/common/fs/smbsrv/smb_idmap.c (smbsrv kmod)
! * lib/smbsrv/libfksmbsrv/common/fksmb_idmap.c (libfksmbsrv)
! * lib/smbsrv/libsmb/common/smb_idmap.c (libsmb)
*
* There are enough differences (relative to the code size)
* that it's more trouble than it's worth to merge them.
*
* This one differs from the others in that it:
--- 18,38 ----
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
! * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
*/
/*
* SMB server interface to idmap
* (smb_idmap_get..., smb_idmap_batch_...)
*
! * There are three implementations of this interface.
! * This is the libsmb version of these routines. See also:
! * $SRC/uts/common/fs/smbsrv/smb_idmap.c
! * $SRC/lib/smbsrv/libfksmbsrv/common/fksmb_idmap.c
*
* There are enough differences (relative to the code size)
* that it's more trouble than it's worth to merge them.
*
* This one differs from the others in that it:
*** 195,205 ****
--- 195,213 ----
*/
for (i = 0; i < sib->sib_nmap; i++) {
smb_sid_free(sib->sib_maps[i].sim_sid);
free(sib->sib_maps[i].sim_domsid);
}
+ } else if (sib->sib_flags & SMB_IDMAP_SID2ID) {
+ /*
+ * SID prefixes are allocated only when mapping
+ * SIDs to UID/GID
+ */
+ for (i = 0; i < sib->sib_nmap; i++) {
+ free(sib->sib_maps[i].sim_domsid);
}
+ }
if (sib->sib_size && sib->sib_maps) {
free(sib->sib_maps);
sib->sib_maps = NULL;
}
*** 228,238 ****
return (IDMAP_ERR_ARG);
smb_sid_tostr(sid, sidstr);
if (smb_sid_splitstr(sidstr, &sim->sim_rid) != 0)
return (IDMAP_ERR_SID);
! sim->sim_domsid = sidstr;
sim->sim_idtype = idtype;
switch (idtype) {
case SMB_IDMAP_USER:
stat = idmap_get_uidbysid(idmaph, sim->sim_domsid,
--- 236,247 ----
return (IDMAP_ERR_ARG);
smb_sid_tostr(sid, sidstr);
if (smb_sid_splitstr(sidstr, &sim->sim_rid) != 0)
return (IDMAP_ERR_SID);
! /* Note: Free sim_domsid in smb_idmap_batch_destroy */
! sim->sim_domsid = strdup(sidstr);
sim->sim_idtype = idtype;
switch (idtype) {
case SMB_IDMAP_USER:
stat = idmap_get_uidbysid(idmaph, sim->sim_domsid,
*** 256,268 ****
default:
stat = IDMAP_ERR_ARG;
break;
}
- /* This was copied by idmap_get_Xbysid. */
- sim->sim_domsid = NULL;
-
return (stat);
}
/*
* smb_idmap_batch_getsid
--- 265,274 ----
*** 269,278 ****
--- 275,286 ----
*
* Queue a request to map the given UID/GID to a SID.
*
* sim->sim_domsid and sim->sim_rid will contain the mapping
* result upon successful process of the batched request.
+ * Stash the type for error reporting (caller saves the ID).
+ *
* NB: sim_domsid allocated by strdup, here or in libidmap
*/
idmap_stat
smb_idmap_batch_getsid(idmap_get_handle_t *idmaph, smb_idmap_t *sim,
uid_t id, int idtype)
*** 281,290 ****
--- 289,299 ----
int flag = 0;
if (!idmaph || !sim)
return (IDMAP_ERR_ARG);
+ sim->sim_idtype = idtype;
switch (idtype) {
case SMB_IDMAP_USER:
stat = idmap_get_sidbyuid(idmaph, id, flag,
&sim->sim_domsid, &sim->sim_rid, &sim->sim_stat);
smb_idmap_check("idmap_get_sidbyuid", stat);
*** 325,334 ****
--- 334,365 ----
}
return (stat);
}
+ static void
+ smb_idmap_bgm_report(smb_idmap_batch_t *sib, smb_idmap_t *sim)
+ {
+
+ if ((sib->sib_flags & SMB_IDMAP_ID2SID) != 0) {
+ /*
+ * Note: The ID and type we asked idmap to map
+ * were saved in *sim_id and sim_idtype.
+ */
+ uint_t id = (sim->sim_id == NULL) ?
+ 0 : (uint_t)*sim->sim_id;
+ syslog(LOG_ERR, "Can't get SID for "
+ "ID=%u type=%d, status=%d",
+ id, sim->sim_idtype, sim->sim_stat);
+ }
+
+ if ((sib->sib_flags & SMB_IDMAP_SID2ID) != 0) {
+ syslog(LOG_ERR, "Can't get ID for SID %s-%u, status=%d",
+ sim->sim_domsid, sim->sim_rid, sim->sim_stat);
+ }
+ }
+
/*
* smb_idmap_batch_getmappings
*
* trigger ID mapping service to get the mappings for queued
* requests.
*** 350,366 ****
/*
* Check the status for all the queued requests
*/
for (i = 0, sim = sib->sib_maps; i < sib->sib_nmap; i++, sim++) {
if (sim->sim_stat != IDMAP_SUCCESS) {
! if (sib->sib_flags == SMB_IDMAP_SID2ID) {
! smb_tracef("[%d] %d (%d)", sim->sim_idtype,
! sim->sim_rid, sim->sim_stat);
! }
return (sim->sim_stat);
}
}
if (smb_idmap_batch_binsid(sib) != 0)
stat = IDMAP_ERR_OTHER;
return (stat);
--- 381,396 ----
/*
* Check the status for all the queued requests
*/
for (i = 0, sim = sib->sib_maps; i < sib->sib_nmap; i++, sim++) {
if (sim->sim_stat != IDMAP_SUCCESS) {
! smb_idmap_bgm_report(sib, sim);
! if ((sib->sib_flags & SMB_IDMAP_SKIP_ERRS) == 0) {
return (sim->sim_stat);
}
}
+ }
if (smb_idmap_batch_binsid(sib) != 0)
stat = IDMAP_ERR_OTHER;
return (stat);