summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/smb_macros.h5
-rw-r--r--source3/lib/cmd_interp.c20
-rw-r--r--source3/libsmb/clierror.c3
-rw-r--r--source3/libsmb/clireadwrite.c4
-rw-r--r--source3/passdb/passdb.c15
-rw-r--r--source3/rpc_client/cli_pipe.c14
-rw-r--r--source3/rpc_parse/parse_rpc.c5
-rw-r--r--source3/rpc_parse/parse_samr.c4
-rw-r--r--source3/rpc_parse/parse_sec.c4
-rw-r--r--source3/rpc_parse/parse_spoolss.c6
-rw-r--r--source3/rpc_server/srv_netlog.c28
-rw-r--r--source3/rpc_server/srv_pipe.c10
-rw-r--r--source3/rpc_server/srv_pipe_hnd.c13
-rw-r--r--source3/rpc_server/srv_samr.c2
-rw-r--r--source3/rpc_server/srv_srvsvc.c20
-rw-r--r--source3/rpc_server/srv_util.c12
-rw-r--r--source3/rpcclient/display.c8
-rw-r--r--source3/rpcclient/display_sec.c2
-rw-r--r--source3/smbd/nttrans.c10
-rw-r--r--source3/smbd/password.c4
-rw-r--r--source3/smbd/reply.c47
21 files changed, 97 insertions, 139 deletions
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index 51c7c1c638..fe0d15149b 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -30,11 +30,6 @@
#define BITSETB(ptr,bit) ((((char *)ptr)[0] & (1<<(bit)))!=0)
#define BITSETW(ptr,bit) ((SVAL(ptr,0) & (1<<(bit)))!=0)
-#define IS_BITS_SET_ALL(var,bit) (((var)&(bit))==(bit))
-#define IS_BITS_SET_SOME(var,bit) (((var)&(bit))!=0)
-#define IS_BITS_CLR_ALL(var,bit) (((var)&(bit))==0)
-#define IS_BITS_CLR_SOME(var,bit) (((var)&(bit))!=(bit))
-
/* for readability... */
#define IS_DOS_READONLY(test_mode) (((test_mode) & aRONLY) != 0)
#define IS_DOS_DIR(test_mode) (((test_mode) & aDIR) != 0)
diff --git a/source3/lib/cmd_interp.c b/source3/lib/cmd_interp.c
index 5f7e98c243..84fb28049a 100644
--- a/source3/lib/cmd_interp.c
+++ b/source3/lib/cmd_interp.c
@@ -1091,8 +1091,7 @@ static uint32 cmd_set(struct client_info *info, int argc, char *argv[])
}
}
- if (IS_BITS_SET_ALL(cmd_set_options, CMD_INTER))
- {
+ if (cmd_set_options & CMD_INTER) {
setup_logging(debugf, interactive);
if (!interactive)
reopen_logs();
@@ -1101,8 +1100,7 @@ static uint32 cmd_set(struct client_info *info, int argc, char *argv[])
strupper(global_myname);
fstrcpy(cli_info.myhostname, global_myname);
- if (IS_BITS_SET_ALL(cmd_set_options, CMD_SVC))
- {
+ if (cmd_set_options & CMD_SVC) {
if (!lp_load(servicesf, True, False, False))
{
fprintf(stderr,
@@ -1112,26 +1110,23 @@ static uint32 cmd_set(struct client_info *info, int argc, char *argv[])
}
- if (IS_BITS_SET_ALL(cmd_set_options, CMD_INTER))
- {
+ if (cmd_set_options & CMD_INTER) {
load_interfaces();
}
DEBUG(10, ("cmd_set: options: %x\n", cmd_set_options));
- if (IS_BITS_SET_ALL(cmd_set_options, CMD_HELP))
- {
+ if (cmd_set_options & CMD_HELP) {
return 0;
}
- if (IS_BITS_SET_ALL(cmd_set_options, CMD_NOPW))
- {
+ if (cmd_set_options & CMD_NOPW) {
set_user_password(&usr.ntc, True, NULL);
}
else
{
set_user_password(&usr.ntc,
- IS_BITS_SET_ALL(cmd_set_options, CMD_PASS),
+ ((cmd_set_options & CMD_PASS) != 0),
password);
}
@@ -1310,8 +1305,7 @@ int command_main(int argc, char *argv[])
status = cmd_set(&cli_info, argc, argv);
- if (IS_BITS_SET_SOME(cmd_set_options, CMD_HELP|CMD_STR))
- {
+ if (cmd_set_options & (CMD_HELP|CMD_STR)) {
free_connections();
get_safe_nt_error_msg(status, msg, sizeof(msg));
diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c
index 78a7c9d451..314b343f25 100644
--- a/source3/libsmb/clierror.c
+++ b/source3/libsmb/clierror.c
@@ -161,7 +161,8 @@ int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num, uint32 *nt_rpc_
uint32 nt_err = IVAL(cli->inbuf,smb_rcls);
if (num) *num = nt_err;
DEBUG(10,("cli_error: 32 bit codes: code=%08x\n", nt_err));
- if (!IS_BITS_SET_ALL(nt_err, 0xc0000000)) return 0;
+ if (!(nt_err & 0xc0000000))
+ return 0;
switch (nt_err) {
case NT_STATUS_ACCESS_VIOLATION: return EACCES;
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
index 8012c02a8f..86a51da835 100644
--- a/source3/libsmb/clireadwrite.c
+++ b/source3/libsmb/clireadwrite.c
@@ -148,10 +148,10 @@ static void cli_issue_write(struct cli_state *cli, int fnum, off_t offset, uint1
SSVAL(cli->outbuf,smb_vwv2,fnum);
SIVAL(cli->outbuf,smb_vwv3,offset);
- SIVAL(cli->outbuf,smb_vwv5,IS_BITS_SET_ALL(mode, 0x0008) ? 0xFFFFFFFF : 0);
+ SIVAL(cli->outbuf,smb_vwv5,(mode & 0x0008) ? 0xFFFFFFFF : 0);
SSVAL(cli->outbuf,smb_vwv7,mode);
- SSVAL(cli->outbuf,smb_vwv8,IS_BITS_SET_ALL(mode, 0x0008) ? size : 0);
+ SSVAL(cli->outbuf,smb_vwv8,(mode & 0x0008) ? size : 0);
SSVAL(cli->outbuf,smb_vwv10,size);
SSVAL(cli->outbuf,smb_vwv11,
smb_buf(cli->outbuf) - smb_base(cli->outbuf));
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 6556503dca..04f02e3704 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -703,24 +703,15 @@ void pdb_set_last_set_time(char *p, int max_len, time_t t)
**************************************************************/
void pdb_sethexpwd(char *p, unsigned char *pwd, uint16 acct_ctrl)
{
- if (pwd != NULL)
- {
+ if (pwd != NULL) {
int i;
for (i = 0; i < 16; i++)
- {
slprintf(&p[i*2], 3, "%02X", pwd[i]);
- }
- }
- else
- {
- if (IS_BITS_SET_ALL(acct_ctrl, ACB_PWNOTREQ))
- {
+ } else {
+ if (acct_ctrl & ACB_PWNOTREQ)
safe_strcpy(p, "NO PASSWORDXXXXXXXXXXXXXXXXXXXXX", 33);
- }
else
- {
safe_strcpy(p, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 33);
- }
}
}
/*************************************************************
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 8136b7894c..3a875cc46b 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -124,8 +124,8 @@ static BOOL rpc_check_hdr(prs_struct *rdata, RPC_HDR *rhdr,
return False;
}
- (*first) = IS_BITS_SET_ALL(rhdr->flags, RPC_FLG_FIRST);
- (*last) = IS_BITS_SET_ALL(rhdr->flags, RPC_FLG_LAST );
+ (*first) = ((rhdr->flags & RPC_FLG_FIRST) != 0);
+ (*last) = ((rhdr->flags & RPC_FLG_LAST ) != 0);
(*len) = (uint32)rhdr->frag_len - prs_data_size(rdata);
return (rhdr->pkt_type != RPC_FAULT);
@@ -188,8 +188,8 @@ static BOOL rpc_auth_pipe(struct cli_state *cli, prs_struct *rdata, int len, int
*/
char *reply_data = prs_data_p(rdata) + RPC_HEADER_LEN + RPC_HDR_REQ_LEN;
- BOOL auth_verify = IS_BITS_SET_ALL(cli->ntlmssp_srv_flgs, NTLMSSP_NEGOTIATE_SIGN);
- BOOL auth_seal = IS_BITS_SET_ALL(cli->ntlmssp_srv_flgs, NTLMSSP_NEGOTIATE_SEAL);
+ BOOL auth_verify = ((cli->ntlmssp_srv_flgs & NTLMSSP_NEGOTIATE_SIGN) != 0);
+ BOOL auth_seal = ((cli->ntlmssp_srv_flgs & NTLMSSP_NEGOTIATE_SEAL) != 0);
DEBUG(5,("rpc_auth_pipe: len: %d auth_len: %d verify %s seal %s\n",
len, auth_len, BOOLSTR(auth_verify), BOOLSTR(auth_seal)));
@@ -756,8 +756,8 @@ BOOL rpc_api_pipe_req(struct cli_state *cli, uint8 op_num,
uint32 crc32 = 0;
char *pdata_out = NULL;
- auth_verify = IS_BITS_SET_ALL(cli->ntlmssp_srv_flgs, NTLMSSP_NEGOTIATE_SIGN);
- auth_seal = IS_BITS_SET_ALL(cli->ntlmssp_srv_flgs, NTLMSSP_NEGOTIATE_SEAL);
+ auth_verify = ((cli->ntlmssp_srv_flgs & NTLMSSP_NEGOTIATE_SIGN) != 0);
+ auth_seal = ((cli->ntlmssp_srv_flgs & NTLMSSP_NEGOTIATE_SEAL) != 0);
/*
* The auth_len doesn't include the RPC_HDR_AUTH_LEN.
@@ -1168,7 +1168,7 @@ BOOL cli_nt_session_open(struct cli_state *cli, char *pipe_name)
{
int fnum;
- if (IS_BITS_SET_ALL(cli->capabilities, CAP_NT_SMBS)) {
+ if (cli->capabilities & CAP_NT_SMBS) {
if ((fnum = cli_nt_create(cli, &(pipe_name[5]))) == -1) {
DEBUG(0,("cli_nt_session_open: cli_nt_create failed on pipe %s to machine %s. Error was %s\n",
&(pipe_name[5]), cli->desthost, cli_errstr(cli)));
diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c
index af0569fd61..c40de10445 100644
--- a/source3/rpc_parse/parse_rpc.c
+++ b/source3/rpc_parse/parse_rpc.c
@@ -843,8 +843,7 @@ void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp,
offset = 0x40;
- if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE))
- {
+ if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) {
dom_len *= 2;
wks_len *= 2;
usr_len *= 2;
@@ -872,7 +871,7 @@ void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp,
memcpy(rsp->lm_resp, lm_resp, 24);
memcpy(rsp->nt_resp, nt_resp, 24);
- if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) {
+ if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) {
dos_struni2(rsp->domain, domain, sizeof(rsp->domain));
dos_struni2(rsp->user, user, sizeof(rsp->user));
dos_struni2(rsp->wks, wks, sizeof(rsp->wks));
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index 47e69670f7..58e65fa0af 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -1365,7 +1365,7 @@ void init_sam_info_2(SAM_INFO_2 *sam, uint32 acb_mask,
}
for (i = start_idx, entries_added = 0; i < num_sam_entries; i++) {
- if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask)) {
+ if ((pass[i].acb_info & acb_mask) == acb_mask) {
init_sam_entry2(&sam->sam[entries_added],
start_idx + entries_added + 1,
pass[i].uni_user_name.uni_str_len,
@@ -1451,7 +1451,7 @@ void init_sam_info_1(SAM_INFO_1 *sam, uint32 acb_mask,
for (i = 0, entries_added = 0;
i < num_sam_entries; i++) {
- if (IS_BITS_SET_ALL(pass[i].acb_info, acb_mask)) {
+ if ((pass[i].acb_info & acb_mask) == acb_mask) {
init_sam_entry1(&sam->sam[entries_added],
start_idx + entries_added + 1,
pass[i].uni_user_name.uni_str_len,
diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c
index 4a7db6d7c2..00a1532470 100644
--- a/source3/rpc_parse/parse_sec.c
+++ b/source3/rpc_parse/parse_sec.c
@@ -510,7 +510,7 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
max_offset = MAX(max_offset, prs_offset(ps));
- if (IS_BITS_SET_ALL(psd->type, SEC_DESC_SACL_PRESENT) && psd->off_sacl) {
+ if ((psd->type & SEC_DESC_SACL_PRESENT) && psd->off_sacl) {
if(!prs_set_offset(ps, old_offset + psd->off_sacl))
return False;
if(!sec_io_acl("sacl", &psd->sacl, ps, depth))
@@ -521,7 +521,7 @@ BOOL sec_io_desc(char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
max_offset = MAX(max_offset, prs_offset(ps));
- if (IS_BITS_SET_ALL(psd->type, SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) {
+ if ((psd->type & SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) {
if(!prs_set_offset(ps, old_offset + psd->off_dacl))
return False;
if(!sec_io_acl("dacl", &psd->dacl, ps, depth))
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index d0a745d095..e618a81cc8 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -173,10 +173,10 @@ static BOOL smb_io_doc_info_container(char *desc, DOC_INFO_CONTAINER *cont, prs_
if(!prs_align(ps))
return False;
- if(!prs_uint32("level", ps, depth, &(cont->level)))
+ if(!prs_uint32("level", ps, depth, &cont->level))
return False;
- if(!smb_io_doc_info("",&(cont->docinfo), ps, depth))
+ if(!smb_io_doc_info("",&cont->docinfo, ps, depth))
return False;
return True;
@@ -234,7 +234,7 @@ static BOOL smb_io_notify_option_type_data(char *desc, SPOOL_NOTIFY_OPTION_TYPE
/* parse the option type data */
for(i=0;i<type->count2;i++)
- if(!prs_uint16("fields",ps,depth,&(type->fields[i])))
+ if(!prs_uint16("fields",ps,depth,&type->fields[i]))
return False;
return True;
}
diff --git a/source3/rpc_server/srv_netlog.c b/source3/rpc_server/srv_netlog.c
index 7fe89f90b6..f634b8e15f 100644
--- a/source3/rpc_server/srv_netlog.c
+++ b/source3/rpc_server/srv_netlog.c
@@ -354,7 +354,7 @@ static BOOL api_net_req_chal(pipes_struct *p)
(char *)vuser->dc.md4pw, vuser->dc.sess_key);
} else {
/* lkclXXXX take a guess at a good error message to return :-) */
- status = 0xC0000000 | NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT;
+ status = NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT;
}
/* construct reply. */
@@ -370,7 +370,7 @@ static BOOL api_net_req_chal(pipes_struct *p)
static BOOL api_net_auth_2(pipes_struct *p)
{
- uint16 vuid = p->vuid;
+ uint16 vuid = p->vuid;
NET_Q_AUTH_2 q_a;
uint32 status = 0x0;
prs_struct *data = &p->in_data.data;
@@ -403,7 +403,7 @@ static BOOL api_net_auth_2(pipes_struct *p)
memcpy(vuser->dc.clnt_cred.challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data));
memcpy(vuser->dc.srv_cred .challenge.data, q_a.clnt_chal.data, sizeof(q_a.clnt_chal.data));
} else {
- status = NT_STATUS_ACCESS_DENIED | 0xC0000000;
+ status = NT_STATUS_ACCESS_DENIED;
}
/* construct reply. */
@@ -420,9 +420,9 @@ static BOOL api_net_auth_2(pipes_struct *p)
static BOOL api_net_srv_pwset(pipes_struct *p)
{
- uint16 vuid = p->vuid;
+ uint16 vuid = p->vuid;
NET_Q_SRV_PWSET q_a;
- uint32 status = NT_STATUS_WRONG_PASSWORD|0xC0000000;
+ uint32 status = NT_STATUS_WRONG_PASSWORD;
DOM_CRED srv_cred;
pstring mach_acct;
struct smb_passwd *smb_pass;
@@ -487,7 +487,7 @@ static BOOL api_net_srv_pwset(pipes_struct *p)
} else {
/* lkclXXXX take a guess at a sensible error code to return... */
- status = 0xC0000000 | NT_STATUS_NETWORK_CREDENTIAL_CONFLICT;
+ status = NT_STATUS_NETWORK_CREDENTIAL_CONFLICT;
}
/* Construct reply. */
@@ -582,7 +582,7 @@ static uint32 net_login_interactive(NET_ID_INFO_1 *id1, struct smb_passwd *smb_p
if (memcmp(smb_pass->smb_passwd , lm_pwd, 16) != 0 ||
memcmp(smb_pass->smb_nt_passwd, nt_pwd, 16) != 0)
{
- status = 0xC0000000 | NT_STATUS_WRONG_PASSWORD;
+ status = NT_STATUS_WRONG_PASSWORD;
}
return status;
@@ -609,7 +609,7 @@ static uint32 net_login_network(NET_ID_INFO_2 *id2, struct smb_passwd *smb_pass)
id2->lm_chal))
return 0x0;
else
- return 0xC0000000 | NT_STATUS_WRONG_PASSWORD;
+ return NT_STATUS_WRONG_PASSWORD;
}
/* lkclXXXX this is not a good place to put disabling of LM hashes in.
@@ -631,7 +631,7 @@ static uint32 net_login_network(NET_ID_INFO_2 *id2, struct smb_passwd *smb_pass)
/* oops! neither password check succeeded */
- return 0xC0000000 | NT_STATUS_WRONG_PASSWORD;
+ return NT_STATUS_WRONG_PASSWORD;
}
/*************************************************************************
@@ -673,7 +673,7 @@ static BOOL api_net_sam_logon(pipes_struct *p)
/* checks and updates credentials. creates reply credentials */
if (!deal_with_creds(vuser->dc.sess_key, &(vuser->dc.clnt_cred),
&(q_l.sam_id.client.cred), &srv_cred))
- status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
+ status = NT_STATUS_INVALID_HANDLE;
else
memcpy(&(vuser->dc.srv_cred), &(vuser->dc.clnt_cred),
sizeof(vuser->dc.clnt_cred));
@@ -695,7 +695,7 @@ static BOOL api_net_sam_logon(pipes_struct *p)
break;
default:
DEBUG(2,("SAM Logon: unsupported switch value\n"));
- status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
+ status = NT_STATUS_INVALID_INFO_CLASS;
break;
} /* end switch */
} /* end if status == 0 */
@@ -723,11 +723,11 @@ static BOOL api_net_sam_logon(pipes_struct *p)
unbecome_root();
if (smb_pass == NULL)
- status = 0xC0000000 | NT_STATUS_NO_SUCH_USER;
+ status = NT_STATUS_NO_SUCH_USER;
else if (smb_pass->acct_ctrl & ACB_PWNOTREQ)
status = 0;
else if (smb_pass->acct_ctrl & ACB_DISABLED)
- status = 0xC0000000 | NT_STATUS_ACCOUNT_DISABLED;
+ status = NT_STATUS_ACCOUNT_DISABLED;
}
/* Validate password - if required. */
@@ -851,7 +851,7 @@ static BOOL api_net_sam_logon(pipes_struct *p)
&global_sam_sid, /* DOM_SID *dom_sid */
NULL); /* char *other_sids */
else
- status = 0xC0000000 | NT_STATUS_NO_SUCH_USER;
+ status = NT_STATUS_NO_SUCH_USER;
/* Free any allocated groups array. */
if(gids)
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index 6f650c7e5e..049db69ca7 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -78,8 +78,8 @@ static void NTLMSSPcalc_p( pipes_struct *p, unsigned char *data, int len)
BOOL create_next_pdu(pipes_struct *p)
{
RPC_HDR_RESP hdr_resp;
- BOOL auth_verify = IS_BITS_SET_ALL(p->ntlmssp_chal_flags, NTLMSSP_NEGOTIATE_SIGN);
- BOOL auth_seal = IS_BITS_SET_ALL(p->ntlmssp_chal_flags, NTLMSSP_NEGOTIATE_SEAL);
+ BOOL auth_verify = ((p->ntlmssp_chal_flags & NTLMSSP_NEGOTIATE_SIGN) != 0);
+ BOOL auth_seal = ((p->ntlmssp_chal_flags & NTLMSSP_NEGOTIATE_SEAL) != 0);
uint32 data_len;
uint32 data_space_available;
uint32 data_len_left;
@@ -292,7 +292,7 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p, RPC_AUTH_NTLMSSP_RESP *ntlm
* We always negotiate UNICODE.
*/
- if (IS_BITS_SET_ALL(p->ntlmssp_chal_flags, NTLMSSP_NEGOTIATE_UNICODE)) {
+ if (p->ntlmssp_chal_flags & NTLMSSP_NEGOTIATE_UNICODE) {
fstrcpy(user_name, dos_unistrn2((uint16*)ntlmssp_resp->user, ntlmssp_resp->hdr_usr.str_str_len/2));
fstrcpy(domain, dos_unistrn2((uint16*)ntlmssp_resp->domain, ntlmssp_resp->hdr_domain.str_str_len/2));
fstrcpy(wks, dos_unistrn2((uint16*)ntlmssp_resp->wks, ntlmssp_resp->hdr_wks.str_str_len/2));
@@ -1014,8 +1014,8 @@ BOOL api_pipe_auth_process(pipes_struct *p, prs_struct *rpc_in)
/*
* We always negotiate the following two bits....
*/
- BOOL auth_verify = IS_BITS_SET_ALL(p->ntlmssp_chal_flags, NTLMSSP_NEGOTIATE_SIGN);
- BOOL auth_seal = IS_BITS_SET_ALL(p->ntlmssp_chal_flags, NTLMSSP_NEGOTIATE_SEAL);
+ BOOL auth_verify = ((p->ntlmssp_chal_flags & NTLMSSP_NEGOTIATE_SIGN) != 0);
+ BOOL auth_seal = ((p->ntlmssp_chal_flags & NTLMSSP_NEGOTIATE_SEAL) != 0);
int data_len;
int auth_len;
uint32 old_offset;
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index e51bc5ae4d..e6aeb26d63 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -213,17 +213,6 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
fstrcpy(p->name, pipe_name);
-#if 0
-
- Comment out until memory leak fixed. JRA.
-
- /*
- * For Luke - attempt to connect to RPC redirect process.
- */
-
- attempt_remote_rpc_connect(p);
-#endif
-
DEBUG(4,("Opened pipe %s with handle %x (pipes_open=%d)\n",
pipe_name, i, pipes_open));
@@ -364,7 +353,7 @@ static ssize_t unmarshall_rpc_header(pipes_struct *p)
static BOOL process_request_pdu(pipes_struct *p, prs_struct *rpc_in_p)
{
- BOOL auth_verify = IS_BITS_SET_ALL(p->ntlmssp_chal_flags, NTLMSSP_NEGOTIATE_SIGN);
+ BOOL auth_verify = ((p->ntlmssp_chal_flags & NTLMSSP_NEGOTIATE_SIGN) != 0);
size_t data_len = p->hdr.frag_len - RPC_HEADER_LEN - RPC_HDR_REQ_LEN -
(auth_verify ? RPC_HDR_AUTH_LEN : 0) - p->hdr.auth_len;
diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c
index 12b0d95abf..5a0f049ba7 100644
--- a/source3/rpc_server/srv_samr.c
+++ b/source3/rpc_server/srv_samr.c
@@ -88,7 +88,7 @@ static BOOL get_sampwd_entries(SAM_USER_INFO_21 *pw_buf,
(*num_entries), pwd->smb_name,
pwd->user_rid, pwd->acct_ctrl));
- if (acb_mask == 0 || IS_BITS_SET_SOME(pwd->acct_ctrl, acb_mask)) {
+ if (acb_mask == 0 || (pwd->acct_ctrl & acb_mask)) {
DEBUG(5,(" acb_mask %x accepts\n", acb_mask));
(*num_entries)++;
} else {
diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c
index 34f369bc8b..715a681a29 100644
--- a/source3/rpc_server/srv_srvsvc.c
+++ b/source3/rpc_server/srv_srvsvc.c
@@ -192,7 +192,7 @@ static void init_srv_r_net_share_enum(SRV_R_NET_SHARE_ENUM *r_n,
&resume_hnd, &r_n->total_entries)) {
r_n->status = 0x0;
} else {
- r_n->status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
+ r_n->status = NT_STATUS_INVALID_INFO_CLASS;
}
init_enum_hnd(&r_n->enum_hnd, resume_hnd);
@@ -255,11 +255,11 @@ static void init_srv_r_net_share_get_info(SRV_R_NET_SHARE_GET_INFO *r_n,
break;
default:
DEBUG(5,("init_srv_net_share_get_info: unsupported switch value %d\n", info_level));
- status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
+ status = NT_STATUS_INVALID_INFO_CLASS;
break;
}
} else {
- status = 0xC0000000 | NT_STATUS_BAD_NETWORK_NAME;
+ status = NT_STATUS_BAD_NETWORK_NAME;
}
r_n->ptr_share_ctr = (status == 0x0) ? 1 : 0;
@@ -462,7 +462,7 @@ static uint32 init_srv_sess_info_ctr(SRV_SESS_INFO_CTR *ctr,
(*resume_hnd) = 0;
(*total_entries) = 0;
ctr->ptr_sess_ctr = 0;
- status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
+ status = NT_STATUS_INVALID_INFO_CLASS;
break;
}
}
@@ -481,7 +481,7 @@ static void init_srv_r_net_sess_enum(SRV_R_NET_SESS_ENUM *r_n,
r_n->sess_level = sess_level;
if (sess_level == -1)
{
- r_n->status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
+ r_n->status = NT_STATUS_INVALID_INFO_CLASS;
}
else
{
@@ -675,7 +675,7 @@ static uint32 init_srv_conn_info_ctr(SRV_CONN_INFO_CTR *ctr,
(*resume_hnd = 0);
(*total_entries) = 0;
ctr->ptr_conn_ctr = 0;
- status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
+ status = NT_STATUS_INVALID_INFO_CLASS;
break;
}
}
@@ -694,7 +694,7 @@ static void init_srv_r_net_conn_enum(SRV_R_NET_CONN_ENUM *r_n,
r_n->conn_level = conn_level;
if (conn_level == -1)
{
- r_n->status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
+ r_n->status = NT_STATUS_INVALID_INFO_CLASS;
}
else
{
@@ -810,7 +810,7 @@ static uint32 init_srv_file_info_ctr(SRV_FILE_INFO_CTR *ctr,
(*resume_hnd = 0);
(*total_entries) = 0;
ctr->ptr_file_ctr = 0;
- status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
+ status = NT_STATUS_INVALID_INFO_CLASS;
break;
}
}
@@ -829,7 +829,7 @@ static void init_srv_r_net_file_enum(SRV_R_NET_FILE_ENUM *r_n,
r_n->file_level = file_level;
if (file_level == 0)
{
- r_n->status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
+ r_n->status = NT_STATUS_INVALID_INFO_CLASS;
}
else
{
@@ -910,7 +910,7 @@ static void srv_reply_net_srv_get_info(SRV_Q_NET_SRV_GET_INFO *q_n,
}
default:
{
- status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS;
+ status = NT_STATUS_INVALID_INFO_CLASS;
break;
}
}
diff --git a/source3/rpc_server/srv_util.c b/source3/rpc_server/srv_util.c
index a1f2a7c085..ba13f0ed7a 100644
--- a/source3/rpc_server/srv_util.c
+++ b/source3/rpc_server/srv_util.c
@@ -216,7 +216,7 @@ uint32 lookup_group_name(uint32 rid, char *group_name, uint32 *type)
}
DEBUG(5,(" none mapped\n"));
- return 0xC0000000 | NT_STATUS_NONE_MAPPED;
+ return NT_STATUS_NONE_MAPPED;
}
/*******************************************************************
@@ -242,7 +242,7 @@ uint32 lookup_alias_name(uint32 rid, char *alias_name, uint32 *type)
}
DEBUG(5,(" none mapped\n"));
- return 0xC0000000 | NT_STATUS_NONE_MAPPED;
+ return NT_STATUS_NONE_MAPPED;
}
/*******************************************************************
@@ -282,7 +282,7 @@ uint32 lookup_user_name(uint32 rid, char *user_name, uint32 *type)
}
DEBUG(5,(" none mapped\n"));
- return 0xC0000000 | NT_STATUS_NONE_MAPPED;
+ return NT_STATUS_NONE_MAPPED;
}
/*******************************************************************
@@ -301,7 +301,7 @@ uint32 lookup_group_rid(char *group_name, uint32 *rid)
} while (grp_name != NULL && !strequal(grp_name, group_name));
- return (grp_name != NULL) ? 0 : 0xC0000000 | NT_STATUS_NONE_MAPPED;
+ return (grp_name != NULL) ? 0 : NT_STATUS_NONE_MAPPED;
}
/*******************************************************************
@@ -320,7 +320,7 @@ uint32 lookup_alias_rid(char *alias_name, uint32 *rid)
} while (als_name != NULL && !strequal(als_name, alias_name));
- return (als_name != NULL) ? 0 : 0xC0000000 | NT_STATUS_NONE_MAPPED;
+ return (als_name != NULL) ? 0 : NT_STATUS_NONE_MAPPED;
}
/*******************************************************************
@@ -342,7 +342,7 @@ uint32 lookup_user_rid(char *user_name, uint32 *rid)
return 0x0;
}
- return 0xC0000000 | NT_STATUS_NONE_MAPPED;
+ return NT_STATUS_NONE_MAPPED;
}
#undef OLD_NTDOMAIN
diff --git a/source3/rpcclient/display.c b/source3/rpcclient/display.c
index bb0cdac320..12ae5e2dfe 100644
--- a/source3/rpcclient/display.c
+++ b/source3/rpcclient/display.c
@@ -58,8 +58,8 @@ convert an oplock mode to a string
char *get_file_oplock_str(uint32 op_type)
{
static fstring oplock;
- BOOL excl = IS_BITS_SET_ALL(op_type, EXCLUSIVE_OPLOCK);
- BOOL batch = IS_BITS_SET_ALL(op_type, BATCH_OPLOCK );
+ BOOL excl = ((op_type & EXCLUSIVE_OPLOCK) != 0);
+ BOOL batch = ((op_type & BATCH_OPLOCK ) != 0);
oplock[0] = 0;
@@ -106,7 +106,7 @@ char *get_server_type_str(uint32 type)
typestr[0] = 0;
for (i = 0; i < 32; i++)
{
- if (IS_BITS_SET_ALL(type, 1 << i))
+ if (type & (1 << i))
{
switch (((unsigned)1) << i)
{
@@ -984,7 +984,7 @@ char *get_sec_mask_str(uint32 type)
typestr[0] = 0;
for (i = 0; i < 32; i++)
{
- if (IS_BITS_SET_ALL(type, 1 << i))
+ if (type & (1 << i))
{
switch (((unsigned)1) << i)
{
diff --git a/source3/rpcclient/display_sec.c b/source3/rpcclient/display_sec.c
index e0e3bf0831..44e7e6e8aa 100644
--- a/source3/rpcclient/display_sec.c
+++ b/source3/rpcclient/display_sec.c
@@ -54,7 +54,7 @@ static const char *get_sec_mask_str(uint32 type)
typestr[0] = 0;
for (i = 0; i < 32; i++)
{
- if (IS_BITS_SET_ALL(type, 1 << i))
+ if (type & (1 << i))
{
switch (1 << i)
{
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 4673c87f58..8147a3adac 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -718,7 +718,7 @@ int reply_ntcreate_and_X(connection_struct *conn,
if( fname[0] == ':') {
SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0, 0xc0000000|NT_STATUS_OBJECT_PATH_NOT_FOUND));
+ return(ERROR(0, NT_STATUS_OBJECT_PATH_NOT_FOUND));
}
return(ERROR(ERRDOS,ERRbadfid));
}
@@ -848,7 +848,7 @@ int reply_ntcreate_and_X(connection_struct *conn,
if (create_options & FILE_NON_DIRECTORY_FILE) {
restore_case_semantics(file_attributes);
SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0, 0xc0000000|NT_STATUS_FILE_IS_A_DIRECTORY));
+ return(ERROR(0, NT_STATUS_FILE_IS_A_DIRECTORY));
}
oplock_request = 0;
@@ -1140,7 +1140,7 @@ static int call_nt_transact_create(connection_struct *conn,
if( fname[0] == ':') {
SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0, 0xc0000000|NT_STATUS_OBJECT_PATH_NOT_FOUND));
+ return(ERROR(0, NT_STATUS_OBJECT_PATH_NOT_FOUND));
}
return(ERROR(ERRDOS,ERRbadfid));
@@ -1250,7 +1250,7 @@ static int call_nt_transact_create(connection_struct *conn,
if (create_options & FILE_NON_DIRECTORY_FILE) {
restore_case_semantics(file_attributes);
SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0, 0xc0000000|NT_STATUS_FILE_IS_A_DIRECTORY));
+ return(ERROR(0, NT_STATUS_FILE_IS_A_DIRECTORY));
}
oplock_request = 0;
@@ -1524,7 +1524,7 @@ static int call_nt_transact_query_security_desc(connection_struct *conn,
free_sec_desc(&psd);
- send_nt_replies(inbuf, outbuf, bufsize, 0xC0000000|NT_STATUS_BUFFER_TOO_SMALL,
+ send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_BUFFER_TOO_SMALL,
params, 4, *ppdata, 0);
return -1;
}
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index fffddb4610..f9291b8705 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -520,7 +520,7 @@ BOOL pass_check_smb(char *user, char *domain,
if(smb_pass->acct_ctrl & ACB_DISABLED) {
DEBUG(1,("Account for user '%s' was disabled.\n", user));
return(False);
- }
+ }
/* Ensure the uid's match */
if (smb_pass->smb_userid != pass->pw_uid)
@@ -529,7 +529,7 @@ BOOL pass_check_smb(char *user, char *domain,
return(False);
}
- if (lm_pwd[0] == '\0' && IS_BITS_SET_ALL(smb_pass->acct_ctrl, ACB_PWNOTREQ) && lp_null_passwords())
+ if (lm_pwd[0] == '\0' && (smb_pass->acct_ctrl & ACB_PWNOTREQ) && lp_null_passwords())
{
DEBUG(3,("Account for user '%s' has no password and null passwords are allowed.\n", smb_pass->smb_name));
return(True);
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 8aa7f7c9e4..00697c999a 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -428,65 +428,54 @@ static int session_trust_account(connection_struct *conn, char *inbuf, char *out
char *smb_nt_passwd, int smb_nt_passlen)
{
struct smb_passwd *smb_trust_acct = NULL; /* check if trust account exists */
- if (lp_security() == SEC_USER)
- {
+ if (lp_security() == SEC_USER) {
smb_trust_acct = getsmbpwnam(user);
- }
- else
- {
+ } else {
DEBUG(0,("session_trust_account: Trust account %s only supported with security = user\n", user));
SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0, 0xc0000000|NT_STATUS_LOGON_FAILURE));
+ return(ERROR(0, NT_STATUS_LOGON_FAILURE));
}
- if (smb_trust_acct == NULL)
- {
+ if (smb_trust_acct == NULL) {
/* lkclXXXX: workstation entry doesn't exist */
DEBUG(0,("session_trust_account: Trust account %s user doesn't exist\n",user));
SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0, 0xc0000000|NT_STATUS_NO_SUCH_USER));
- }
- else
- {
- if ((smb_passlen != 24) || (smb_nt_passlen != 24))
- {
+ return(ERROR(0, NT_STATUS_NO_SUCH_USER));
+ } else {
+ if ((smb_passlen != 24) || (smb_nt_passlen != 24)) {
DEBUG(0,("session_trust_account: Trust account %s - password length wrong.\n", user));
SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0, 0xc0000000|NT_STATUS_LOGON_FAILURE));
+ return(ERROR(0, NT_STATUS_LOGON_FAILURE));
}
- if (!smb_password_ok(smb_trust_acct, NULL, (unsigned char *)smb_passwd, (unsigned char *)smb_nt_passwd))
- {
+ if (!smb_password_ok(smb_trust_acct, NULL, (unsigned char *)smb_passwd, (unsigned char *)smb_nt_passwd)) {
DEBUG(0,("session_trust_account: Trust Account %s - password failed\n", user));
SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0, 0xc0000000|NT_STATUS_LOGON_FAILURE));
+ return(ERROR(0, NT_STATUS_LOGON_FAILURE));
}
- if (IS_BITS_SET_ALL(smb_trust_acct->acct_ctrl, ACB_DOMTRUST))
- {
+ if (smb_trust_acct->acct_ctrl & ACB_DOMTRUST) {
DEBUG(0,("session_trust_account: Domain trust account %s denied by server\n",user));
SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0, 0xc0000000|NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT));
+ return(ERROR(0, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT));
}
- if (IS_BITS_SET_ALL(smb_trust_acct->acct_ctrl, ACB_SVRTRUST))
- {
+ if (smb_trust_acct->acct_ctrl & ACB_SVRTRUST) {
DEBUG(0,("session_trust_account: Server trust account %s denied by server\n",user));
SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0, 0xc0000000|NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT));
+ return(ERROR(0, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT));
}
- if (IS_BITS_SET_ALL(smb_trust_acct->acct_ctrl, ACB_WSTRUST))
- {
+ if (smb_trust_acct->acct_ctrl & ACB_WSTRUST) {
DEBUG(4,("session_trust_account: Wksta trust account %s denied by server\n", user));
SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0, 0xc0000000|NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT));
+ return(ERROR(0, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT));
}
}
/* don't know what to do: indicate logon failure */
SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0, 0xc0000000|NT_STATUS_LOGON_FAILURE));
+ return(ERROR(0, NT_STATUS_LOGON_FAILURE));
}
/****************************************************************************
@@ -637,7 +626,7 @@ static int bad_password_error(char *inbuf,char *outbuf)
if(((ra_type == RA_WINNT) || (ra_type == RA_WIN2K)) &&
(global_client_caps & (CAP_NT_SMBS | CAP_STATUS32 ))) {
SSVAL(outbuf,smb_flg2,FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0,0xc0000000|NT_STATUS_LOGON_FAILURE));
+ return(ERROR(0,NT_STATUS_LOGON_FAILURE));
}
return(ERROR(ERRSRV,ERRbadpw));