/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
#include <sys/priv_names.h>
#include <smbsrv/smb_idmap.h>
#include <smbsrv/smb_kproto.h>
#include <smbsrv/smb_token.h>
{
char *native_os;
char *native_lm;
int rc = 0;
/*
* Enforce the minimum word count seen in the old protocol,
* to make sure we have enough to decode the common stuff.
* Further wcnt checks below.
*/
rc = -1;
goto done;
}
/*
* Parse common part of SMB session setup.
* skip: vcnumber(2), sesskey(4)
*/
if (rc != 0)
goto done;
sinfo->ssi_capabilities = 0;
&sinfo->ssi_lmpwlen);
if (rc != 0)
goto done;
if (rc != 0)
goto done;
goto part2;
}
/*
* We have dialect >= NT_LM_0_12
*/
/* Old style (non-extended) request. */
&sinfo->ssi_lmpwlen,
&sinfo->ssi_ntpwlen,
if (rc != 0)
goto done;
/* paranoid: ignore cap. ext. sec. here */
if (rc != 0)
goto done;
goto part2;
}
/* New style (extended) request. */
&sinfo->ssi_iseclen,
if (rc != 0)
goto done;
rc = -1;
goto done;
}
if (rc != 0)
goto done;
goto part2;
}
/* Invalid message */
rc = -1;
goto done;
/*
* Get the "Native OS" and "Native LanMan" strings.
* These are not critical to protocol function, so
* if we can't parse them, just guess "NT".
* These strings are free'd with the sr.
*
* In NTLM 0.12, the padding between the Native OS and Native LM
* is a bit strange. On NT4.0, there is a 2 byte pad between the
* OS (Windows NT 1381) and LM (Windows NT 4.0). On Windows 2000,
* there is no padding between the OS (Windows 2000 2195) and LM
* (Windows 2000 5.0). If the padding is removed from the decode
* string the NT4.0 LM comes out as an empty string. So if the
* client's native OS is Win NT, assume extra padding.
*/
else
else
else
rc = 0;
done:
if (rc != 0) {
"SmbSessonSetupX: client %s invalid request",
}
}
void
{
}
/*
*
* NT systems use different native OS and native LanMan values dependent on
* whether they are acting as a client or a server. NT 4.0 server responds
* with the following values:
*
* NativeOS: Windows NT 4.0
* NativeLM: NT LAN Manager 4.0
*/
{
int rc;
/*
* Some stuff we do only in the first in a (possible)
* sequence of session setup requests.
*/
/* This is a first (or only) call */
if (!smb_oplock_levelII)
}
/*
* The "meat" of authentication happens here.
*/
else
switch (status) {
case NT_STATUS_SUCCESS:
break;
/*
* This is not really an error, but tells the client
* it should send another session setup request.
*/
break;
case NT_STATUS_ACCESS_DENIED:
return (SDRC_ERROR);
return (SDRC_ERROR);
return (SDRC_ERROR);
return (SDRC_ERROR);
return (SDRC_ERROR);
return (SDRC_ERROR);
case NT_STATUS_INTERNAL_ERROR:
default:
return (SDRC_ERROR);
}
default:
case SMB_SSNSETUP_PRE_NTLM012:
3,
-1, /* andx_off */
sr,
break;
4,
-1, /* andx_off */
sr,
break;
}
}