This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
char *host_princ_s = NULL;
BOOL ret = False;
- *pblob_out = data_blob(NULL,0);
+ *pblob_out = data_blob_null;
initialize_krb5_error_table();
kerr = krb5_init_context(&context);
PAC_DATA *pac_data;
DATA_BLOB ap_rep, ap_rep_wrapped, response;
auth_serversupplied_info *server_info = NULL;
- DATA_BLOB session_key = data_blob(NULL, 0);
+ DATA_BLOB session_key = data_blob_null;
uint8 tok_id[2];
- DATA_BLOB nullblob = data_blob(NULL, 0);
+ DATA_BLOB nullblob = data_blob_null;
fstring real_username;
BOOL map_domainuser_to_guest = False;
BOOL username_was_mapped;
return ERROR_NT(nt_status_squash(NT_STATUS_LOGON_FAILURE));
}
- ret = ads_verify_ticket(mem_ctx, lp_realm(), 0, &ticket, &client, &pac_data, &ap_rep, &session_key);
+ ret = ads_verify_ticket(mem_ctx, lp_realm(), 0, &ticket,
+ &client, &pac_data, &ap_rep,
+ &session_key, True);
data_blob_free(&ticket);
if (NT_STATUS_IS_OK(ret)) {
ap_rep_wrapped = spnego_gen_krb5_wrap(ap_rep, TOK_ID_KRB_AP_REP);
} else {
- ap_rep_wrapped = data_blob(NULL, 0);
+ ap_rep_wrapped = data_blob_null;
}
response = spnego_gen_auth_response(&ap_rep_wrapped, ret, OID_KERBEROS5_OLD);
reply_sesssetup_blob(conn, inbuf, outbuf, response, ret);
if (NT_STATUS_IS_OK(nt_status)) {
int sess_vuid;
- DATA_BLOB nullblob = data_blob(NULL, 0);
+ DATA_BLOB nullblob = data_blob_null;
DATA_BLOB session_key = data_blob((*auth_ntlmssp_state)->ntlmssp_state->session_key.data, (*auth_ntlmssp_state)->ntlmssp_state->session_key.length);
/* register_vuid keeps the server info */
DATA_BLOB blob1,
AUTH_NTLMSSP_STATE **auth_ntlmssp_state)
{
- DATA_BLOB auth = data_blob(NULL,0);
- DATA_BLOB auth_reply = data_blob(NULL,0);
- DATA_BLOB secblob = data_blob(NULL,0);
+ DATA_BLOB auth = data_blob_null;
+ DATA_BLOB auth_reply = data_blob_null;
+ DATA_BLOB secblob = data_blob_null;
NTSTATUS status = NT_STATUS_INVALID_PARAMETER;
if (!spnego_parse_auth(blob1, &auth)) {
}
/* We must store this blob until complete. */
- pad = SMB_MALLOC(sizeof(struct pending_auth_data));
- if (!pad) {
+ if (!(pad = SMB_MALLOC_P(struct pending_auth_data))) {
return NT_STATUS_NO_MEMORY;
}
pad->needed_len = needed_len - pblob->length;
user_struct *vuser = NULL;
NTSTATUS status = NT_STATUS_OK;
uint16 smbpid = SVAL(inbuf,smb_pid);
+ uint16 smb_flag2 = SVAL(inbuf, smb_flg2);
DEBUG(3,("Doing spnego session setup\n"));
#endif
p2 = inbuf + smb_vwv13 + data_blob_len;
- p2 += srvstr_pull_buf(inbuf, native_os, p2, sizeof(native_os), STR_TERMINATE);
- p2 += srvstr_pull_buf(inbuf, native_lanman, p2, sizeof(native_lanman), STR_TERMINATE);
- p2 += srvstr_pull_buf(inbuf, primary_domain, p2, sizeof(primary_domain), STR_TERMINATE);
+ p2 += srvstr_pull_buf(inbuf, smb_flag2, native_os, p2,
+ sizeof(native_os), STR_TERMINATE);
+ p2 += srvstr_pull_buf(inbuf, smb_flag2, native_lanman, p2,
+ sizeof(native_lanman), STR_TERMINATE);
+ p2 += srvstr_pull_buf(inbuf, smb_flag2, primary_domain, p2,
+ sizeof(primary_domain), STR_TERMINATE);
DEBUG(3,("NativeOS=[%s] NativeLanMan=[%s] PrimaryDomain=[%s]\n",
native_os, native_lanman, primary_domain));
}
if (!vuser) {
- vuid = register_vuid(NULL, data_blob(NULL, 0), data_blob(NULL, 0), NULL);
+ vuid = register_vuid(NULL, data_blob_null, data_blob_null, NULL);
if (vuid == UID_FIELD_INVALID ) {
data_blob_free(&blob1);
return ERROR_NT(nt_status_squash(NT_STATUS_INVALID_PARAMETER));
a new session setup with VC==0 is ignored.
****************************************************************************/
-static int shutdown_other_smbds(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
- void *p)
+static int shutdown_other_smbds(struct db_record *rec,
+ const struct connections_key *key,
+ const struct connections_data *crec,
+ void *private_data)
{
- struct sessionid *sessionid = (struct sessionid *)dbuf.dptr;
- const char *ip = (const char *)p;
+ const char *ip = (const char *)private_data;
- if (!process_exists(pid_to_procid(sessionid->pid))) {
+ if (!process_exists(crec->pid)) {
return 0;
}
- if (sessionid->pid == sys_getpid()) {
+ if (procid_is_me(&crec->pid)) {
return 0;
}
- if (strcmp(ip, sessionid->ip_addr) != 0) {
+ if (strcmp(ip, crec->addr) != 0) {
return 0;
}
- message_send_pid(pid_to_procid(sessionid->pid), MSG_SHUTDOWN,
- NULL, 0, True);
+ messaging_send(smbd_messaging_context(), crec->pid, MSG_SHUTDOWN,
+ &data_blob_null);
return 0;
}
invalidate_all_vuids();
#endif
if (lp_reset_on_zero_vc()) {
- session_traverse(shutdown_other_smbds, client_addr());
+ connections_forall(shutdown_other_smbds, client_addr());
}
}
static BOOL done_sesssetup = False;
auth_usersupplied_info *user_info = NULL;
auth_serversupplied_info *server_info = NULL;
+ uint16 smb_flag2 = SVAL(inbuf, smb_flg2);
NTSTATUS nt_status;
ZERO_STRUCT(nt_resp);
ZERO_STRUCT(plaintext_password);
- DEBUG(3,("wct=%d flg2=0x%x\n", CVAL(inbuf, smb_wct), SVAL(inbuf, smb_flg2)));
+ DEBUG(3,("wct=%d flg2=0x%x\n", CVAL(inbuf, smb_wct), smb_flag2));
/* a SPNEGO session setup has 12 command words, whereas a normal
NT1 session setup has 13. See the cifs spec. */
if (CVAL(inbuf, smb_wct) == 12 &&
- (SVAL(inbuf, smb_flg2) & FLAGS2_EXTENDED_SECURITY)) {
+ (smb_flag2 & FLAGS2_EXTENDED_SECURITY)) {
if (!global_spnego_negotiated) {
DEBUG(0,("reply_sesssetup_and_X: Rejecting attempt at SPNEGO session setup when it was not negoitiated.\n"));
return ERROR_NT(nt_status_squash(NT_STATUS_LOGON_FAILURE));
plaintext_password.data[passlen1] = 0;
}
- srvstr_pull_buf(inbuf, user, smb_buf(inbuf)+passlen1, sizeof(user), STR_TERMINATE);
+ srvstr_pull_buf(inbuf, smb_flag2, user,
+ smb_buf(inbuf)+passlen1, sizeof(user),
+ STR_TERMINATE);
*domain = 0;
} else {
nt_resp = data_blob(p+passlen1, passlen2);
} else {
pstring pass;
- BOOL unic=SVAL(inbuf, smb_flg2) & FLAGS2_UNICODE_STRINGS;
+ BOOL unic= smb_flag2 & FLAGS2_UNICODE_STRINGS;
#if 0
/* This was the previous fix. Not sure if it's still valid. JRA. */
if (unic && (passlen2 == 0) && passlen1) {
/* Only a ascii plaintext password was sent. */
- srvstr_pull(inbuf, pass, smb_buf(inbuf), sizeof(pass),
- passlen1, STR_TERMINATE|STR_ASCII);
+ srvstr_pull(inbuf, smb_flag2, pass,
+ smb_buf(inbuf), sizeof(pass),
+ passlen1, STR_TERMINATE|STR_ASCII);
} else {
- srvstr_pull(inbuf, pass, smb_buf(inbuf),
- sizeof(pass), unic ? passlen2 : passlen1,
- STR_TERMINATE);
+ srvstr_pull(inbuf, smb_flag2, pass,
+ smb_buf(inbuf), sizeof(pass),
+ unic ? passlen2 : passlen1,
+ STR_TERMINATE);
}
plaintext_password = data_blob(pass, strlen(pass)+1);
}
p += passlen1 + passlen2;
- p += srvstr_pull_buf(inbuf, user, p, sizeof(user), STR_TERMINATE);
- p += srvstr_pull_buf(inbuf, domain, p, sizeof(domain), STR_TERMINATE);
- p += srvstr_pull_buf(inbuf, native_os, p, sizeof(native_os), STR_TERMINATE);
- p += srvstr_pull_buf(inbuf, native_lanman, p, sizeof(native_lanman), STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, smb_flag2, user, p,
+ sizeof(user), STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, smb_flag2, domain, p,
+ sizeof(domain), STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, smb_flag2, native_os,
+ p, sizeof(native_os), STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, smb_flag2,
+ native_lanman, p, sizeof(native_lanman),
+ STR_TERMINATE);
/* not documented or decoded by Ethereal but there is one more string
in the extra bytes which is the same as the PrimaryDomain when using
byte_count = SVAL(inbuf, smb_vwv13);
if ( PTR_DIFF(p, save_p) < byte_count)
- p += srvstr_pull_buf(inbuf, primary_domain, p, sizeof(primary_domain), STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, smb_flag2,
+ primary_domain, p,
+ sizeof(primary_domain),
+ STR_TERMINATE);
else
fstrcpy( primary_domain, "null" );
if (server_info->user_session_key.data) {
session_key = data_blob(server_info->user_session_key.data, server_info->user_session_key.length);
} else {
- session_key = data_blob(NULL, 0);
+ session_key = data_blob_null;
}
data_blob_clear_free(&plaintext_password);