mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
Reformatting fixes to bring in line with the rest of the source.
Jeremy.
This commit is contained in:
parent
d0d85dd49c
commit
3c11d93623
@ -70,15 +70,13 @@ static BOOL push_message(ubi_slList *list_head, char *buf, int msg_len)
|
||||
pending_message_list *msg = (pending_message_list *)
|
||||
malloc(sizeof(pending_message_list));
|
||||
|
||||
if(msg == NULL)
|
||||
{
|
||||
if(msg == NULL) {
|
||||
DEBUG(0,("push_message: malloc fail (1)\n"));
|
||||
return False;
|
||||
}
|
||||
|
||||
msg->msg_buf = (char *)malloc(msg_len);
|
||||
if(msg->msg_buf == NULL)
|
||||
{
|
||||
if(msg->msg_buf == NULL) {
|
||||
DEBUG(0,("push_message: malloc fail (2)\n"));
|
||||
SAFE_FREE(msg);
|
||||
return False;
|
||||
@ -311,6 +309,7 @@ void respond_to_all_remaining_local_messages(void)
|
||||
* Keep doing receive_local_message with a 1 ms timeout until
|
||||
* we have no more messages.
|
||||
*/
|
||||
|
||||
while(receive_local_message(buffer, sizeof(buffer), 1)) {
|
||||
/* Deal with oplock break requests from other smbd's. */
|
||||
process_local_message(buffer, sizeof(buffer));
|
||||
@ -339,13 +338,11 @@ force write permissions on print services.
|
||||
functions. Any message that has a NULL function is unimplemented -
|
||||
please feel free to contribute implementations!
|
||||
*/
|
||||
static const struct smb_message_struct
|
||||
{
|
||||
static const struct smb_message_struct {
|
||||
const char *name;
|
||||
int (*fn)(connection_struct *conn, char *, char *, int, int);
|
||||
int flags;
|
||||
}
|
||||
smb_messages[256] = {
|
||||
} smb_messages[256] = {
|
||||
|
||||
/* 0x00 */ { "SMBmkdir",reply_mkdir,AS_USER | NEED_WRITE},
|
||||
/* 0x01 */ { "SMBrmdir",reply_rmdir,AS_USER | NEED_WRITE},
|
||||
@ -849,9 +846,10 @@ set. Ignoring max smbd restriction.\n"));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
process an smb from the client - split out from the smbd_process() code so
|
||||
Process an smb from the client - split out from the smbd_process() code so
|
||||
it can be used by the oplock break code.
|
||||
****************************************************************************/
|
||||
|
||||
void process_smb(char *inbuf, char *outbuf)
|
||||
{
|
||||
static int trans_num;
|
||||
@ -868,11 +866,9 @@ void process_smb(char *inbuf, char *outbuf)
|
||||
parsing code from hosts not in the hosts allow list */
|
||||
if (smbd_process_limit() ||
|
||||
!check_access(smbd_server_fd(), lp_hostsallow(-1), lp_hostsdeny(-1))) {
|
||||
/* send a negative session response "not listening on calling
|
||||
name" */
|
||||
/* send a negative session response "not listening on calling name" */
|
||||
static unsigned char buf[5] = {0x83, 0, 0, 1, 0x81};
|
||||
DEBUG( 1, ( "Connection denied from %s\n",
|
||||
client_addr() ) );
|
||||
DEBUG( 1, ( "Connection denied from %s\n", client_addr() ) );
|
||||
(void)send_smb(smbd_server_fd(),(char *)buf);
|
||||
exit_server("connection denied");
|
||||
}
|
||||
@ -888,28 +884,24 @@ void process_smb(char *inbuf, char *outbuf)
|
||||
|
||||
nread = construct_reply(inbuf,outbuf,nread,max_send);
|
||||
|
||||
if(nread > 0)
|
||||
{
|
||||
if(nread > 0) {
|
||||
if (CVAL(outbuf,0) == 0)
|
||||
show_msg(outbuf);
|
||||
|
||||
if (nread != smb_len(outbuf) + 4)
|
||||
{
|
||||
if (nread != smb_len(outbuf) + 4) {
|
||||
DEBUG(0,("ERROR: Invalid message response size! %d %d\n",
|
||||
nread, smb_len(outbuf)));
|
||||
}
|
||||
else
|
||||
if (!send_smb(smbd_server_fd(),outbuf))
|
||||
} else if (!send_smb(smbd_server_fd(),outbuf)) {
|
||||
exit_server("process_smb: send_smb failed.");
|
||||
}
|
||||
}
|
||||
trans_num++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
return a string containing the function name of a SMB command
|
||||
Return a string containing the function name of a SMB command.
|
||||
****************************************************************************/
|
||||
|
||||
const char *smb_fn_name(int type)
|
||||
{
|
||||
const char *unknown_name = "SMBunknown";
|
||||
@ -949,8 +941,9 @@ void construct_reply_common(char *inbuf,char *outbuf)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
construct a chained reply and add it to the already made reply
|
||||
**************************************************************************/
|
||||
Construct a chained reply and add it to the already made reply
|
||||
****************************************************************************/
|
||||
|
||||
int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
|
||||
{
|
||||
static char *orig_inbuf;
|
||||
@ -1028,6 +1021,7 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
|
||||
/* restore the saved data, being careful not to overwrite any
|
||||
data from the reply header */
|
||||
memcpy(inbuf2,inbuf_saved,smb_wct);
|
||||
|
||||
{
|
||||
int ofs = smb_wct - PTR_DIFF(outbuf2,orig_outbuf);
|
||||
if (ofs < 0) ofs = 0;
|
||||
@ -1070,8 +1064,7 @@ void check_reload(int t)
|
||||
if(last_smb_conf_reload_time == 0)
|
||||
last_smb_conf_reload_time = t;
|
||||
|
||||
if (reload_after_sighup || (t >= last_smb_conf_reload_time+SMBD_RELOAD_CHECK))
|
||||
{
|
||||
if (reload_after_sighup || (t >= last_smb_conf_reload_time+SMBD_RELOAD_CHECK)) {
|
||||
reload_services(True);
|
||||
reload_after_sighup = False;
|
||||
last_smb_conf_reload_time = t;
|
||||
@ -1090,14 +1083,12 @@ static BOOL timeout_processing(int deadtime, int *select_timeout, time_t *last_t
|
||||
BOOL allidle = True;
|
||||
extern int keepalive;
|
||||
|
||||
if (smb_read_error == READ_EOF)
|
||||
{
|
||||
if (smb_read_error == READ_EOF) {
|
||||
DEBUG(3,("end of file from client\n"));
|
||||
return False;
|
||||
}
|
||||
|
||||
if (smb_read_error == READ_ERROR)
|
||||
{
|
||||
if (smb_read_error == READ_ERROR) {
|
||||
DEBUG(3,("receive_smb error (%s) exiting\n",
|
||||
strerror(errno)));
|
||||
return False;
|
||||
@ -1121,16 +1112,14 @@ static BOOL timeout_processing(int deadtime, int *select_timeout, time_t *last_t
|
||||
check_reload(t);
|
||||
|
||||
/* automatic timeout if all connections are closed */
|
||||
if (conn_num_open()==0 && (t - last_idle_closed_check) >= IDLE_CLOSED_TIMEOUT)
|
||||
{
|
||||
if (conn_num_open()==0 && (t - last_idle_closed_check) >= IDLE_CLOSED_TIMEOUT) {
|
||||
DEBUG( 2, ( "Closing idle connection\n" ) );
|
||||
return False;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
last_idle_closed_check = t;
|
||||
}
|
||||
|
||||
if (keepalive && (t - last_keepalive_sent_time)>keepalive)
|
||||
{
|
||||
if (keepalive && (t - last_keepalive_sent_time)>keepalive) {
|
||||
extern struct auth_context *negprot_global_auth_context;
|
||||
if (!send_keepalive(smbd_server_fd())) {
|
||||
DEBUG( 2, ( "Keepalive failed - exiting.\n" ) );
|
||||
@ -1140,9 +1129,9 @@ static BOOL timeout_processing(int deadtime, int *select_timeout, time_t *last_t
|
||||
/* send a keepalive for a password server or the like.
|
||||
This is attached to the auth_info created in the
|
||||
negprot */
|
||||
if (negprot_global_auth_context
|
||||
&& negprot_global_auth_context->challenge_set_method
|
||||
if (negprot_global_auth_context && negprot_global_auth_context->challenge_set_method
|
||||
&& negprot_global_auth_context->challenge_set_method->send_keepalive) {
|
||||
|
||||
negprot_global_auth_context->challenge_set_method->send_keepalive
|
||||
(&negprot_global_auth_context->challenge_set_method->private_data);
|
||||
}
|
||||
@ -1161,8 +1150,8 @@ static BOOL timeout_processing(int deadtime, int *select_timeout, time_t *last_t
|
||||
if(global_machine_password_needs_changing &&
|
||||
/* for ADS we need to do a regular ADS password change, not a domain
|
||||
password change */
|
||||
lp_security() == SEC_DOMAIN)
|
||||
{
|
||||
lp_security() == SEC_DOMAIN) {
|
||||
|
||||
unsigned char trust_passwd_hash[16];
|
||||
time_t lct;
|
||||
|
||||
@ -1182,9 +1171,7 @@ machine %s in domain %s.\n", global_myname(), lp_workgroup() ));
|
||||
return True;
|
||||
}
|
||||
|
||||
if(!secrets_fetch_trust_account_password(lp_workgroup(),
|
||||
trust_passwd_hash,
|
||||
&lct, NULL)) {
|
||||
if(!secrets_fetch_trust_account_password(lp_workgroup(), trust_passwd_hash, &lct, NULL)) {
|
||||
DEBUG(0,("process: unable to read the machine account password for \
|
||||
machine %s in domain %s.\n", global_myname(), lp_workgroup()));
|
||||
secrets_lock_trust_account_password(lp_workgroup(), False);
|
||||
|
Loading…
Reference in New Issue
Block a user