The branch, master has been updated via d825a2a s3:libsmb/smb_seal: move smb_set_enclen() to smb_seal.c and make it static there via 0e0e44a s3:libsmb/smb_seal: s/uint16/uint16_t via 1b9c8d4 s3:include: move smb_seal.c prototypes to smb_crypt.h via bd8b275 s3:libsmb/smb_seal: make common_ntlm_[en|de]crypt_buffer static from ba08ad5 s4:libcli/raw: remove unused smb_len(), _smb_setlen() and _smb2_setlen() macros
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit d825a2add6c6b80a7cf516d726d27ab2be2c90e8 Author: Stefan Metzmacher <me...@samba.org> Date: Wed Oct 19 17:37:29 2011 +0200 s3:libsmb/smb_seal: move smb_set_enclen() to smb_seal.c and make it static there metze Autobuild-User: Stefan Metzmacher <me...@samba.org> Autobuild-Date: Wed Oct 19 19:06:35 CEST 2011 on sn-devel-104 commit 0e0e44a626538c6af8b06bcd9ca55b625d0ed540 Author: Stefan Metzmacher <me...@samba.org> Date: Wed Oct 19 15:35:23 2011 +0200 s3:libsmb/smb_seal: s/uint16/uint16_t metze commit 1b9c8d4867aed7aa19fecba563957a0d99280ce9 Author: Stefan Metzmacher <me...@samba.org> Date: Wed Oct 19 15:33:16 2011 +0200 s3:include: move smb_seal.c prototypes to smb_crypt.h metze commit bd8b2754ba2002b35815df986b29838ded8fb1da Author: Stefan Metzmacher <me...@samba.org> Date: Wed Oct 19 15:32:14 2011 +0200 s3:libsmb/smb_seal: make common_ntlm_[en|de]crypt_buffer static metze ----------------------------------------------------------------------- Summary of changes: source3/include/proto.h | 1 - source3/include/smb_crypt.h | 11 ++++++++++- source3/lib/util.c | 13 ------------- source3/libsmb/clientgen.c | 1 + source3/libsmb/proto.h | 14 -------------- source3/libsmb/smb_seal.c | 23 ++++++++++++++++++----- 6 files changed, 29 insertions(+), 34 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/include/proto.h b/source3/include/proto.h index 0fd2281..fdeabef 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -489,7 +489,6 @@ bool socket_exist(const char *fname); uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf); SMB_OFF_T get_file_size(char *file_name); void show_msg(const char *buf); -void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num); void smb_setlen(char *buf,int len); int set_message_bcc(char *buf,int num_bytes); ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob); diff --git a/source3/include/smb_crypt.h b/source3/include/smb_crypt.h index 4449a16..e4070b5 100644 --- a/source3/include/smb_crypt.h +++ b/source3/include/smb_crypt.h @@ -49,7 +49,7 @@ struct smb_tran_enc_state_gss { struct smb_trans_enc_state { enum smb_trans_enc_type smb_enc_type; - uint16 enc_ctx_num; + uint16_t enc_ctx_num; bool enc_on; union { struct auth_ntlmssp_state *auth_ntlmssp_state; @@ -59,4 +59,13 @@ struct smb_trans_enc_state { } s; }; +/* The following definitions come from libsmb/smb_seal.c */ + +NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16_t *p_enc_ctx_num); +bool common_encryption_on(struct smb_trans_enc_state *es); +NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out); +NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf); +void common_free_encryption_state(struct smb_trans_enc_state **pp_es); +void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf); + #endif /* _HEADER_SMB_CRYPT_H */ diff --git a/source3/lib/util.c b/source3/lib/util.c index f29568f..df82733 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -184,19 +184,6 @@ void show_msg(const char *buf) } /******************************************************************* - Set the length and marker of an encrypted smb packet. -********************************************************************/ - -void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num) -{ - _smb_setlen(buf,len); - - SCVAL(buf,4,0xFF); - SCVAL(buf,5,'E'); - SSVAL(buf,6,enc_ctx_num); -} - -/******************************************************************* Set the length and marker of an smb packet. ********************************************************************/ diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 1fae264..e8f4fbd 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -22,6 +22,7 @@ #include "libsmb/libsmb.h" #include "../lib/util/tevent_ntstatus.h" #include "smb_signing.h" +#include "smb_crypt.h" #include "async_smb.h" /******************************************************************* diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h index 8df3aab..ffb2ca0 100644 --- a/source3/libsmb/proto.h +++ b/source3/libsmb/proto.h @@ -848,20 +848,6 @@ NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli, uint8_t **rparam, uint32_t min_rparam, uint32_t *num_rparam, uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata); -/* The following definitions come from libsmb/smb_seal.c */ - -NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num); -bool common_encryption_on(struct smb_trans_enc_state *es); -NTSTATUS common_ntlm_decrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state, char *buf); -NTSTATUS common_ntlm_encrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state, - uint16 enc_ctx_num, - char *buf, - char **ppbuf_out); -NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out); -NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf); -void common_free_encryption_state(struct smb_trans_enc_state **pp_es); -void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf); - /* The following definitions come from libsmb/clisigning.c */ bool cli_simple_set_signing(struct cli_state *cli, diff --git a/source3/libsmb/smb_seal.c b/source3/libsmb/smb_seal.c index 1c7bec3..4afd617 100644 --- a/source3/libsmb/smb_seal.c +++ b/source3/libsmb/smb_seal.c @@ -28,7 +28,7 @@ Pull out the encryption context for this packet. 0 means global context. ******************************************************************************/ -NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num) +NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16_t *p_enc_ctx_num) { if (smb_len(buf) < 8) { return NT_STATUS_INVALID_BUFFER_SIZE; @@ -47,6 +47,19 @@ NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num) return NT_STATUS_INVALID_NETWORK_RESPONSE; } +/******************************************************************* + Set the length and marker of an encrypted smb packet. +********************************************************************/ + +static void smb_set_enclen(char *buf,int len,uint16_t enc_ctx_num) +{ + _smb_setlen(buf,len); + + SCVAL(buf,4,0xFF); + SCVAL(buf,5,'E'); + SSVAL(buf,6,enc_ctx_num); +} + /****************************************************************************** Generic code for client and server. Is encryption turned on ? @@ -64,7 +77,7 @@ bool common_encryption_on(struct smb_trans_enc_state *es) output, so cope with the same for compatibility. ******************************************************************************/ -NTSTATUS common_ntlm_decrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state, char *buf) +static NTSTATUS common_ntlm_decrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state, char *buf) { NTSTATUS status; size_t buf_len = smb_len(buf) + 4; /* Don't forget the 4 length bytes. */ @@ -112,8 +125,8 @@ NTSTATUS common_ntlm_decrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_stat output, so do the same for compatibility. ******************************************************************************/ -NTSTATUS common_ntlm_encrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state, - uint16 enc_ctx_num, +static NTSTATUS common_ntlm_encrypt_buffer(struct auth_ntlmssp_state *auth_ntlmssp_state, + uint16_t enc_ctx_num, char *buf, char **ppbuf_out) { @@ -224,7 +237,7 @@ static NTSTATUS common_gss_decrypt_buffer(struct smb_tran_enc_state_gss *gss_sta ******************************************************************************/ static NTSTATUS common_gss_encrypt_buffer(struct smb_tran_enc_state_gss *gss_state, - uint16 enc_ctx_num, + uint16_t enc_ctx_num, char *buf, char **ppbuf_out) { -- Samba Shared Repository