smb_native.c revision b819cea2f73f98c5662230cc9affc8cc84f77fcf
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * CDDL HEADER START
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * The contents of this file are subject to the terms of the
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Common Development and Distribution License (the "License").
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * You may not use this file except in compliance with the License.
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * or http://www.opensolaris.org/os/licensing.
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * See the License for the specific language governing permissions
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * and limitations under the License.
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * When distributing Covered Code, include this CDDL HEADER in each
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * If applicable, add the following below this CDDL HEADER, with the
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * fields enclosed by brackets "[]" replaced with your own identifying
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * information: Portions Copyright [yyyy] [name of copyright owner]
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * CDDL HEADER END
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Use is subject to license terms.
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * This module defines generic functions to map Native OS and Native
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * LanMan names to values.
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington#if defined(_KERNEL) || defined(_FAKE_KERNEL)
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunningtontypedef struct smb_native {
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * smbnative_os_value
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Return the appropriate native OS value for the specified native OS name.
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Example OS values used by Windows:
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows 4.0, Windows NT, Windows NT 4.0
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows 5.0, Windows 5.1
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows 2000, Windows 2000 5.0, Windows 2000 5.1
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows 2002
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows .NET
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows Server 2003
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows 2000 server: "Windows 2000 2195"
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows XP Professional client: "Windows 2002 2543"
d19efe4dce3fa8d1e3ef1a40238380d37664316bNeil Madden * Windows XP PDC server: "Windows 5.1"
d19efe4dce3fa8d1e3ef1a40238380d37664316bNeil Madden * Windows .Net: "Windows .NET 3621"
d19efe4dce3fa8d1e3ef1a40238380d37664316bNeil Madden * Windows .Net: "Windows .NET 3718"
d19efe4dce3fa8d1e3ef1a40238380d37664316bNeil Madden * DAVE (Thursby Software: CIFS for MacOS) uses "MacOS", sometimes with a
d19efe4dce3fa8d1e3ef1a40238380d37664316bNeil Madden * version number appended, i.e. "MacOS 8.5.1". We treat DAVE like NT 4.0
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * except for the cases that DAVE clients set 'watch tree' flag in notify
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * change requests.
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Samba reports UNIX as its Native OS, which we can map to NT 4.0.
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows Vista sends an empty native OS string.
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington for (i = 0; i < sizeof (os_table)/sizeof (os_table[0]); ++i) {
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington if (smb_strcasecmp(name, native_os, len) == 0)
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * smbnative_lm_value
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Return the appropriate native LanMan value for the specified native
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * LanMan name. There's an alignment problem in some packets from some
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * clients that means we can miss the first character, so we do an
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * additional check starting from the second character.
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Example LanMan values:
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * NT LAN Manager 4.0
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows 4.0
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows NT, Windows NT 4.0
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows 2000 LAN Manager
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows 2000, Windows 2000 5.0, Windows 2000 5.1
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows 2002, Windows 2002 5.1
cded99f20058449fd5f9dea3a4934f536343a1f6Phill Cunnington * Windows .NET, Windows .NET 5.2
int len;
const char *name;
return (NATIVE_LM_WIN2000);
return (NATIVE_LM_WIN2000);
int len;
const char *name;
return (PDC_WIN2000);
return (PDC_WIN2000);