/*
* Unix SMB/CIFS implementation.
* RPC Pipe client / server routines
- * Almost completely rewritten by (C) Jeremy Allison 2005.
+ * Almost completely rewritten by (C) Jeremy Allison 2005 - 2010
*
* 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
return False;
}
- if (data_len_left % SERVER_NDR_PADDING_SIZE) {
- ss_padding_len = SERVER_NDR_PADDING_SIZE - (data_len_left % SERVER_NDR_PADDING_SIZE);
- DEBUG(10,("create_next_pdu_ntlmssp: adding sign/seal padding of %u\n",
- ss_padding_len ));
- }
-
+ /* Space available - not including padding. */
data_space_available = RPC_MAX_PDU_FRAG_LEN - RPC_HEADER_LEN -
- RPC_HDR_RESP_LEN - ss_padding_len - RPC_HDR_AUTH_LEN -
- NTLMSSP_SIG_SIZE;
+ RPC_HDR_RESP_LEN - RPC_HDR_AUTH_LEN - NTLMSSP_SIG_SIZE;
/*
* The amount we send is the minimum of the available
data_len = MIN(data_len_left, data_space_available);
+ /* Work out any padding alignment requirements. */
+ if ((RPC_HEADER_LEN + RPC_HDR_RESP_LEN + data_len) % SERVER_NDR_PADDING_SIZE) {
+ ss_padding_len = SERVER_NDR_PADDING_SIZE -
+ ((RPC_HEADER_LEN + RPC_HDR_RESP_LEN + data_len) % SERVER_NDR_PADDING_SIZE);
+ DEBUG(10,("create_next_pdu_ntlmssp: adding sign/seal padding of %u\n",
+ ss_padding_len ));
+ /* If we're over filling the packet, we need to make space
+ * for the padding at the end of the data. */
+ if (data_len + ss_padding_len > data_space_available) {
+ data_len -= SERVER_NDR_PADDING_SIZE;
+ }
+ }
+
/*
* Set up the alloc hint. This should be the data left to
* send.
return False;
}
- if (data_len_left % SERVER_NDR_PADDING_SIZE) {
- ss_padding_len = SERVER_NDR_PADDING_SIZE - (data_len_left % SERVER_NDR_PADDING_SIZE);
- DEBUG(10,("create_next_pdu_schannel: adding sign/seal padding of %u\n",
- ss_padding_len ));
- }
-
+ /* Space available - not including padding. */
data_space_available = RPC_MAX_PDU_FRAG_LEN - RPC_HEADER_LEN
- - RPC_HDR_RESP_LEN - ss_padding_len - RPC_HDR_AUTH_LEN
+ - RPC_HDR_RESP_LEN - RPC_HDR_AUTH_LEN
- RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN;
/*
data_len = MIN(data_len_left, data_space_available);
+ /* Work out any padding alignment requirements. */
+ if ((RPC_HEADER_LEN + RPC_HDR_RESP_LEN + data_len) % SERVER_NDR_PADDING_SIZE) {
+ ss_padding_len = SERVER_NDR_PADDING_SIZE -
+ ((RPC_HEADER_LEN + RPC_HDR_RESP_LEN + data_len) % SERVER_NDR_PADDING_SIZE);
+ DEBUG(10,("create_next_pdu_schannel: adding sign/seal padding of %u\n",
+ ss_padding_len ));
+ /* If we're over filling the packet, we need to make space
+ * for the padding at the end of the data. */
+ if (data_len + ss_padding_len > data_space_available) {
+ data_len -= SERVER_NDR_PADDING_SIZE;
+ }
+ }
+
/*
* Set up the alloc hint. This should be the data left to
* send.
*/
become_root();
- status = schannel_fetch_session_key(p,
+ status = schannel_get_creds_state(p, NULL, lp_private_dir(),
neg.oem_netbios_computer.a,
&creds);
unbecome_root();