summaryrefslogtreecommitdiff
path: root/source3/smbd/negprot.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/negprot.c')
-rw-r--r--source3/smbd/negprot.c95
1 files changed, 46 insertions, 49 deletions
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index 0b48b0e2b2..b2366b0a37 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -26,8 +26,6 @@ extern int Protocol;
extern int max_recv;
extern fstring global_myworkgroup;
extern fstring remote_machine;
-extern pstring myhostname;
-extern dfs_internal dfs_struct;
/****************************************************************************
reply for the core protocol
@@ -160,6 +158,16 @@ reply for the nt protocol
static int reply_nt1(char *outbuf)
{
/* dual names + lock_and_read + nt SMBs + remote API calls */
+ int capabilities = CAP_NT_FIND|CAP_LOCK_AND_READ|
+ (lp_nt_smb_support() ? CAP_NT_SMBS | CAP_RPC_REMOTE_APIS : 0) |
+ (SMB_OFF_T_BITS == 64 ? CAP_LARGE_FILES : 0);
+
+
+/*
+ other valid capabilities which we may support at some time...
+ CAP_LARGE_READX|CAP_STATUS32|CAP_LEVEL_II_OPLOCKS;
+ */
+
int secword=0;
BOOL doencrypt = SMBENCRYPT();
time_t t = time(NULL);
@@ -168,32 +176,9 @@ static int reply_nt1(char *outbuf)
char cryptkey[8];
char crypt_len = 0;
- int capabilities = CAP_NT_FIND|CAP_LOCK_AND_READ;
-
- if (lp_nt_smb_support())
- {
- capabilities |= CAP_NT_SMBS | CAP_RPC_REMOTE_APIS;
- }
-
- if (SMB_OFF_T_BITS == 64)
- {
- capabilities |= CAP_LARGE_FILES;
- }
-
- if (dfs_struct.ready==True)
- {
- capabilities |= CAP_DFS;
- }
-
-/*
- other valid capabilities which we may support at some time...
- CAP_LARGE_READX|CAP_STATUS32|CAP_LEVEL_II_OPLOCKS;
- */
-
- if (lp_security() == SEC_SERVER)
- {
- cli = server_cryptkey();
- }
+ if (lp_security() == SEC_SERVER) {
+ cli = server_cryptkey();
+ }
if (cli) {
DEBUG(3,("using password server validation\n"));
@@ -218,13 +203,12 @@ static int reply_nt1(char *outbuf)
if (doencrypt) secword |= 2;
/* decide where (if) to put the encryption challenge, and
- follow it with the OEM'd domain name in Unicode.
+ follow it with the OEM'd domain name
*/
- data_len = crypt_len + (strlen(global_myworkgroup)+1)*2;
+ data_len = crypt_len + strlen(global_myworkgroup) + 1;
set_message(outbuf,17,data_len,True);
- ascii_to_unibuf(smb_buf(outbuf)+crypt_len, global_myworkgroup,
- (strlen(global_myworkgroup)+1)*2);
+ pstrcpy(smb_buf(outbuf)+crypt_len, global_myworkgroup);
CVAL(outbuf,smb_vwv1) = secword;
SSVALS(outbuf,smb_vwv16+1,crypt_len);
@@ -268,6 +252,14 @@ protocol [LM1.2X002]
protocol [LANMAN2.1]
protocol [NT LM 0.12]
+Win2K:
+protocol [PC NETWORK PROGRAM 1.0]
+protocol [LANMAN1.0]
+protocol [Windows for Workgroups 3.1a]
+protocol [LM1.2X002]
+protocol [LANMAN2.1]
+protocol [NT LM 0.12]
+
OS/2:
protocol [PC NETWORK PROGRAM 1.0]
protocol [XENIX CORE]
@@ -281,29 +273,31 @@ protocol [LANMAN2.1]
*
* This appears to be the matrix of which protocol is used by which
* MS product.
- Protocol WfWg Win95 WinNT OS/2
- PC NETWORK PROGRAM 1.0 1 1 1 1
- XENIX CORE 2 2
+ Protocol WfWg Win95 WinNT Win2K OS/2
+ PC NETWORK PROGRAM 1.0 1 1 1 1 1
+ XENIX CORE 2 2
MICROSOFT NETWORKS 3.0 2 2
DOS LM1.2X002 3 3
MICROSOFT NETWORKS 1.03 3
DOS LANMAN2.1 4 4
- LANMAN1.0 4 3
- Windows for Workgroups 3.1a 5 5 5
- LM1.2X002 6 4
- LANMAN2.1 7 5
- NT LM 0.12 6 8
+ LANMAN1.0 4 2 3
+ Windows for Workgroups 3.1a 5 5 5 3
+ LM1.2X002 6 4 4
+ LANMAN2.1 7 5 5
+ NT LM 0.12 6 8 6
*
* tim@fsg.com 09/29/95
+ * Win2K added by matty 17/7/99
*/
#define ARCH_WFWG 0x3 /* This is a fudge because WfWg is like Win95 */
#define ARCH_WIN95 0x2
-#define ARCH_OS2 0xC /* Again OS/2 is like NT */
-#define ARCH_WINNT 0x8
-#define ARCH_SAMBA 0x10
+#define ARCH_WINNT 0x4
+#define ARCH_WIN2K 0xC /* Win2K is like NT */
+#define ARCH_OS2 0x14 /* Again OS/2 is like NT */
+#define ARCH_SAMBA 0x20
-#define ARCH_ALL 0x1F
+#define ARCH_ALL 0x3F
/* List of supported protocols, most desired first */
static struct {
@@ -346,17 +340,17 @@ int reply_negprot(connection_struct *conn,
Index++;
DEBUG(3,("Requested protocol [%s]\n",p));
if (strcsequal(p,"Windows for Workgroups 3.1a"))
- arch &= ( ARCH_WFWG | ARCH_WIN95 | ARCH_WINNT );
+ arch &= ( ARCH_WFWG | ARCH_WIN95 | ARCH_WINNT | ARCH_WIN2K );
else if (strcsequal(p,"DOS LM1.2X002"))
arch &= ( ARCH_WFWG | ARCH_WIN95 );
else if (strcsequal(p,"DOS LANMAN2.1"))
arch &= ( ARCH_WFWG | ARCH_WIN95 );
else if (strcsequal(p,"NT LM 0.12"))
- arch &= ( ARCH_WIN95 | ARCH_WINNT );
+ arch &= ( ARCH_WIN95 | ARCH_WINNT | ARCH_WIN2K );
else if (strcsequal(p,"LANMAN2.1"))
- arch &= ( ARCH_WINNT | ARCH_OS2 );
+ arch &= ( ARCH_WINNT | ARCH_WIN2K | ARCH_OS2 );
else if (strcsequal(p,"LM1.2X002"))
- arch &= ( ARCH_WINNT | ARCH_OS2 );
+ arch &= ( ARCH_WINNT | ARCH_WIN2K | ARCH_OS2 );
else if (strcsequal(p,"MICROSOFT NETWORKS 1.03"))
arch &= ARCH_WINNT;
else if (strcsequal(p,"XENIX CORE"))
@@ -382,6 +376,9 @@ int reply_negprot(connection_struct *conn,
case ARCH_WINNT:
set_remote_arch(RA_WINNT);
break;
+ case ARCH_WIN2K:
+ set_remote_arch(RA_WIN2K);
+ break;
case ARCH_OS2:
set_remote_arch(RA_OS2);
break;
@@ -394,7 +391,7 @@ int reply_negprot(connection_struct *conn,
reload_services(True);
/* a special case to stop password server loops */
- if (Index == 1 && strequal(remote_machine,myhostname) &&
+ if (Index == 1 && strequal(remote_machine,myhostname()) &&
(lp_security()==SEC_SERVER || lp_security()==SEC_DOMAIN))
exit_server("Password server loop!");