return status;
}
-
/****************************************************************************
Add the standard 'Samba' signature to the end of the session setup.
****************************************************************************/
-static int add_signature(char *outbuf)
+
+static int add_signature(char *outbuf, char *p)
{
- char *p = outbuf;
+ char *start = p;
fstring lanman;
snprintf( lanman, sizeof(lanman), "Samba %s", VERSION );
p += srvstr_push(outbuf, p, lanman, -1, STR_TERMINATE);
p += srvstr_push(outbuf, p, lp_workgroup(), -1, STR_TERMINATE);
- return PTR_DIFF(p, outbuf);
+ return PTR_DIFF(p, start);
}
/****************************************************************************
-send a security blob via a session setup reply
+ Send a security blob via a session setup reply.
****************************************************************************/
+
static BOOL reply_sesssetup_blob(connection_struct *conn, char *outbuf,
DATA_BLOB blob, NTSTATUS nt_status)
{
memcpy(p, blob.data, blob.length);
p += blob.length;
- p += add_signature( p );
+ p += add_signature( outbuf, p );
set_message_end(outbuf,p);
/****************************************************************************
Do a 'guest' logon, getting back the
****************************************************************************/
+
static NTSTATUS check_guest_password(auth_serversupplied_info **server_info)
{
struct auth_context *auth_context;
}
#endif
-
/****************************************************************************
- send a session setup reply, wrapped in SPNEGO.
- get vuid and check first.
- end the NTLMSSP exchange context if we are OK/complete fail
+ Send a session setup reply, wrapped in SPNEGO.
+ Get vuid and check first.
+ End the NTLMSSP exchange context if we are OK/complete fail
***************************************************************************/
+
static BOOL reply_spnego_ntlmssp(connection_struct *conn, char *outbuf,
AUTH_NTLMSSP_STATE **auth_ntlmssp_state,
DATA_BLOB *ntlmssp_blob, NTSTATUS nt_status)
}
/****************************************************************************
-reply to a session setup spnego negotiate packet
+ Reply to a session setup spnego negotiate packet.
****************************************************************************/
+
static int reply_spnego_negotiate(connection_struct *conn,
char *inbuf,
char *outbuf,
/* already replied */
return -1;
}
-
/****************************************************************************
-reply to a session setup spnego auth packet
+ Reply to a session setup spnego auth packet.
****************************************************************************/
+
static int reply_spnego_auth(connection_struct *conn, char *inbuf, char *outbuf,
int length, int bufsize,
DATA_BLOB blob1)
return -1;
}
-
/****************************************************************************
-reply to a session setup command
+ Reply to a session setup command.
****************************************************************************/
+
static int reply_sesssetup_and_X_spnego(connection_struct *conn, char *inbuf,
char *outbuf,
int length,int bufsize)
return ERROR_NT(NT_STATUS_LOGON_FAILURE);
}
+/****************************************************************************
+ On new VC == 0, shutdown *all* old connections and users.
+ It seems that only NT4.x does this. At W2K and above (XP etc.).
+ a new session setup with VC==0 is ignored.
+****************************************************************************/
+
+static void setup_new_vc_session(void)
+{
+ DEBUG(2,("setup_new_vc_session: New VC == 0, if NT4.x compatible we would close all old resources.\n"));
+#if 0
+ conn_close_all();
+ invalidate_all_vuids();
+#endif
+}
/****************************************************************************
-reply to a session setup command
+ Reply to a session setup command.
****************************************************************************/
+
int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,
int length,int bufsize)
{
return ERROR_NT(NT_STATUS_UNSUCCESSFUL);
}
+ if (SVAL(inbuf,smb_vwv4) == 0) {
+ setup_new_vc_session();
+ }
return reply_sesssetup_and_X_spnego(conn, inbuf, outbuf, length, bufsize);
}
srvstr_pull_buf(inbuf, user, smb_buf(inbuf)+passlen1, sizeof(user), STR_TERMINATE);
*domain = 0;
-
+
} else {
uint16 passlen1 = SVAL(inbuf,smb_vwv7);
uint16 passlen2 = SVAL(inbuf,smb_vwv8);
nt_resp = data_blob(p+passlen1, passlen2);
} else {
pstring pass;
+ BOOL unic;
+ unic=SVAL(inbuf, smb_flg2) & FLAGS2_UNICODE_STRINGS;
srvstr_pull(inbuf, pass, smb_buf(inbuf),
- sizeof(pass), passlen1, STR_TERMINATE);
+ sizeof(pass), unic ? passlen2 : passlen1,
+ STR_TERMINATE);
plaintext_password = data_blob(pass, strlen(pass)+1);
}
}
+ if (SVAL(inbuf,smb_vwv4) == 0) {
+ setup_new_vc_session();
+ }
+
DEBUG(3,("sesssetupX:name=[%s]\\[%s]@[%s]\n", domain, user, get_remote_machine_name()));
if (*user) {
set_message(outbuf,3,0,True);
if (Protocol >= PROTOCOL_NT1) {
char *p = smb_buf( outbuf );
- p += add_signature( p );
+ p += add_signature( outbuf, p );
set_message_end( outbuf, p );
/* perhaps grab OS version here?? */
}