summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1997-10-13 12:21:56 +0000
committerLuke Leighton <lkcl@samba.org>1997-10-13 12:21:56 +0000
commit2259e56a947104b19a1196154af4e43ab15e4b7c (patch)
treed5ee15b237ddc33e1d06df99d8bf1cd3cb98a39b /source3
parent6032ec8a0172b9197ed1422e39ba4790d8df83f8 (diff)
downloadsamba-2259e56a947104b19a1196154af4e43ab15e4b7c.tar.gz
samba-2259e56a947104b19a1196154af4e43ab15e4b7c.tar.bz2
samba-2259e56a947104b19a1196154af4e43ab15e4b7c.zip
byteorder.h :
debugging output wasn't (still isn't) perfect. credentials.c lsaparse.c smbparse.c : added DEBUG strings. pipes.c : lost some changes, to do with setup of RPC headers. arg. (This used to be commit 9fdd697d17b68293bb95fd68f44c24f0f5b97f5f)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/byteorder.h4
-rw-r--r--source3/libsmb/credentials.c16
-rw-r--r--source3/lsaparse.c58
-rw-r--r--source3/smbd/pipes.c346
-rw-r--r--source3/smbparse.c61
-rw-r--r--source3/utils/smbpasswd.c6
6 files changed, 131 insertions, 360 deletions
diff --git a/source3/include/byteorder.h b/source3/include/byteorder.h
index c0e38adc2b..808026f9db 100644
--- a/source3/include/byteorder.h
+++ b/source3/include/byteorder.h
@@ -202,14 +202,14 @@ it also defines lots of intermediate macros, just ignore those :-)
RW_PCVAL(read,inbuf,outbuf,len) \
DEBUG(5,("%s %04x %s: ", \
tab_depth(depth), PTR_DIFF(inbuf,base),string)); \
- { int idx; for (idx = 0; idx < len; idx++) { DEBUG(5,("%d ", (inbuf)[idx])); } } \
+ { int idx; for (idx = 0; idx < len; idx++) { DEBUG(5,("%d ", (outbuf)[idx])); } } \
DEBUG(5,("\n"));
#define DBG_RW_PSVAL(string,depth,base,read,inbuf,outbuf,len) \
RW_PSVAL(read,inbuf,outbuf,len) \
DEBUG(5,("%s %04x %s: ", \
tab_depth(depth), PTR_DIFF(inbuf,base),string)); \
- { int idx; for (idx = 0; idx < len; idx++) { DEBUG(5,("%d ", (inbuf)[idx])); } } \
+ { int idx; for (idx = 0; idx < len; idx++) { DEBUG(5,("%d ", (outbuf)[idx])); } } \
DEBUG(5,("\n"));
#define DBG_RW_CVAL(string,depth,base,read,inbuf,outbuf) \
diff --git a/source3/libsmb/credentials.c b/source3/libsmb/credentials.c
index eb1039ddb0..ce7159f7ff 100644
--- a/source3/libsmb/credentials.c
+++ b/source3/libsmb/credentials.c
@@ -21,7 +21,7 @@
#include "includes.h"
-
+extern int DEBUGLEVEL;
/****************************************************************************
setup the session key.
Input: 8 byte challenge block
@@ -37,14 +37,24 @@ void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, char *pass,
char sum2[8];
char buf[8];
+ DEBUG(4,("cred_session_key\n"));
+
+ DEBUG(5,(" clnt_chal: %lx %lx srv_chal: %lx %lx\n",
+
+ IVAL(clnt_chal->data, 0), IVAL(clnt_chal->data, 4),
+ IVAL(srv_chal->data, 0), IVAL(srv_chal->data, 4)));
+
sum[0] = IVAL(clnt_chal->data, 0) + IVAL(srv_chal->data, 0);
sum[1] = IVAL(clnt_chal->data, 4) + IVAL(srv_chal->data, 4);
SIVAL(sum2,0,sum[0]);
SIVAL(sum2,4,sum[1]);
- smbhash(pass, sum2, buf);
- smbhash(pass+9,buf,session_key);
+ smbhash(pass , sum2, buf);
+ smbhash(pass+9, buf , session_key);
+
+ DEBUG(5,(" session_key: "));
+ dump_data(5, session_key, 16);
}
diff --git a/source3/lsaparse.c b/source3/lsaparse.c
index 34f4cb4048..69352466f6 100644
--- a/source3/lsaparse.c
+++ b/source3/lsaparse.c
@@ -115,14 +115,14 @@ char* lsa_io_q_lookup_sids(BOOL io, LSA_Q_LOOKUP_SIDS *q_s, char *q, char *base,
q = smb_io_pol_hnd(io, &(q_s->pol_hnd), q, base, align, depth); /* policy handle */
- DBG_RW_IVAL("num_entries", depth, base, io, q, q_s->num_entries); q += 4;
- DBG_RW_IVAL("buffer_dom_sid", depth, base, io, q, q_s->buffer_dom_sid); q += 4; /* undocumented domain SID buffer pointer */
- DBG_RW_IVAL("buffer_dom_name", depth, base, io, q, q_s->buffer_dom_name); q += 4; /* undocumented domain name buffer pointer */
+ DBG_RW_IVAL("num_entries ", depth, base, io, q, q_s->num_entries); q += 4;
+ DBG_RW_IVAL("buffer_dom_sid ", depth, base, io, q, q_s->buffer_dom_sid); q += 4; /* undocumented domain SID buffer pointer */
+ DBG_RW_IVAL("buffer_dom_name ", depth, base, io, q, q_s->buffer_dom_name); q += 4; /* undocumented domain name buffer pointer */
for (i = 0; i < q_s->num_entries; i++)
{
fstring temp;
- sprintf(temp, "buffer_lookup_sids[%d]", i);
+ sprintf(temp, "buffer_lookup_sids[%d] ", i);
DBG_RW_IVAL(temp, depth, base, io, q, q_s->buffer_lookup_sids[i]); q += 4; /* undocumented domain SID pointers to be looked up. */
}
@@ -131,7 +131,7 @@ char* lsa_io_q_lookup_sids(BOOL io, LSA_Q_LOOKUP_SIDS *q_s, char *q, char *base,
q = smb_io_dom_sid(io, &(q_s->dom_sids[i]), q, base, align, depth); /* domain SIDs to be looked up. */
}
- DBG_RW_PCVAL("undoc", depth, base, io, q, q_s->undoc, 16); q += 16; /* completely undocumented 16 bytes */
+ DBG_RW_PCVAL("undoc ", depth, base, io, q, q_s->undoc, 16); q += 16; /* completely undocumented 16 bytes */
return q;
}
@@ -152,7 +152,7 @@ char* lsa_io_r_lookup_sids(BOOL io, LSA_R_LOOKUP_SIDS *r_s, char *q, char *base,
q = smb_io_dom_r_ref(io, &(r_s->dom_ref), q, base, align, depth); /* domain reference info */
- DBG_RW_IVAL("num_entries", depth, base, io, q, r_s->num_entries); q += 4;
+ DBG_RW_IVAL("num_entries ", depth, base, io, q, r_s->num_entries); q += 4;
DBG_RW_IVAL("undoc_buffer", depth, base, io, q, r_s->undoc_buffer); q += 4;
DBG_RW_IVAL("num_entries2", depth, base, io, q, r_s->num_entries2); q += 4;
@@ -163,7 +163,7 @@ char* lsa_io_r_lookup_sids(BOOL io, LSA_R_LOOKUP_SIDS *r_s, char *q, char *base,
DBG_RW_IVAL("num_entries3", depth, base, io, q, r_s->num_entries3); q += 4;
- DBG_RW_IVAL("status", depth, base, io, q, r_s->status); q += 4;
+ DBG_RW_IVAL("status ", depth, base, io, q, r_s->status); q += 4;
return q;
}
@@ -184,9 +184,9 @@ char* lsa_io_q_lookup_rids(BOOL io, LSA_Q_LOOKUP_RIDS *q_r, char *q, char *base,
q = smb_io_pol_hnd(io, &(q_r->pol_hnd), q, base, align, depth); /* policy handle */
- DBG_RW_IVAL("num_entries", depth, base, io, q, q_r->num_entries); q += 4;
- DBG_RW_IVAL("num_entries2", depth, base, io, q, q_r->num_entries2); q += 4;
- DBG_RW_IVAL("buffer_dom_sid", depth, base, io, q, q_r->buffer_dom_sid); q += 4; /* undocumented domain SID buffer pointer */
+ DBG_RW_IVAL("num_entries ", depth, base, io, q, q_r->num_entries); q += 4;
+ DBG_RW_IVAL("num_entries2 ", depth, base, io, q, q_r->num_entries2); q += 4;
+ DBG_RW_IVAL("buffer_dom_sid ", depth, base, io, q, q_r->buffer_dom_sid); q += 4; /* undocumented domain SID buffer pointer */
DBG_RW_IVAL("buffer_dom_name", depth, base, io, q, q_r->buffer_dom_name); q += 4; /* undocumented domain name buffer pointer */
for (i = 0; i < q_r->num_entries; i++)
@@ -194,7 +194,7 @@ char* lsa_io_q_lookup_rids(BOOL io, LSA_Q_LOOKUP_RIDS *q_r, char *q, char *base,
q = smb_io_dom_name(io, &(q_r->lookup_name[i]), q, base, align, depth); /* names to be looked up */
}
- DBG_RW_PCVAL("undoc", depth, base, io, q, q_r->undoc, UNKNOWN_LEN); q += UNKNOWN_LEN; /* completely undocumented bytes of unknown length */
+ DBG_RW_PCVAL("undoc ", depth, base, io, q, q_r->undoc, UNKNOWN_LEN); q += UNKNOWN_LEN; /* completely undocumented bytes of unknown length */
return q;
}
@@ -215,7 +215,7 @@ char* lsa_io_r_lookup_rids(BOOL io, LSA_R_LOOKUP_RIDS *r_r, char *q, char *base,
q = smb_io_dom_r_ref(io, &(r_r->dom_ref), q, base, align, depth); /* domain reference info */
- DBG_RW_IVAL("num_entries", depth, base, io, q, r_r->num_entries); q += 4;
+ DBG_RW_IVAL("num_entries ", depth, base, io, q, r_r->num_entries); q += 4;
DBG_RW_IVAL("undoc_buffer", depth, base, io, q, r_r->undoc_buffer); q += 4;
DBG_RW_IVAL("num_entries2", depth, base, io, q, r_r->num_entries2); q += 4;
@@ -226,7 +226,7 @@ char* lsa_io_r_lookup_rids(BOOL io, LSA_R_LOOKUP_RIDS *r_r, char *q, char *base,
DBG_RW_IVAL("num_entries3", depth, base, io, q, r_r->num_entries3); q += 4;
- DBG_RW_IVAL("status", depth, base, io, q, r_r->status); q += 4;
+ DBG_RW_IVAL("status ", depth, base, io, q, r_r->status); q += 4;
return q;
}
@@ -365,7 +365,7 @@ char* lsa_io_user_info(BOOL io, LSA_USER_INFO *usr, char *q, char *base, int ali
q = align_offset(q, base, align);
- DBG_RW_IVAL("", depth, base, io, q, usr->undoc_buffer); q += 4;
+ DBG_RW_IVAL("undoc_buffer ", depth, base, io, q, usr->undoc_buffer); q += 4;
q = smb_io_time(io, &(usr->logon_time) , q, base, align, depth); /* logon time */
q = smb_io_time(io, &(usr->logoff_time) , q, base, align, depth); /* logoff time */
@@ -381,22 +381,22 @@ char* lsa_io_user_info(BOOL io, LSA_USER_INFO *usr, char *q, char *base, int ali
q = smb_io_unihdr(io, &(usr->hdr_home_dir) , q, base, align, depth); /* home directory unicode string header */
q = smb_io_unihdr(io, &(usr->hdr_dir_drive) , q, base, align, depth); /* home directory drive unicode string header */
- DBG_RW_SVAL("logon_count", depth, base, io, q, usr->logon_count ); q += 2; /* logon count */
- DBG_RW_SVAL("bad_pw_count", depth, base, io, q, usr->bad_pw_count); q += 2; /* bad password count */
+ DBG_RW_SVAL("logon_count. ", depth, base, io, q, usr->logon_count ); q += 2; /* logon count */
+ DBG_RW_SVAL("bad_pw_count ", depth, base, io, q, usr->bad_pw_count); q += 2; /* bad password count */
- DBG_RW_IVAL("user_id", depth, base, io, q, usr->user_id ); q += 4; /* User ID */
- DBG_RW_IVAL("group_id", depth, base, io, q, usr->group_id ); q += 4; /* Group ID */
- DBG_RW_IVAL("num_groups", depth, base, io, q, usr->num_groups ); q += 4; /* num groups */
- DBG_RW_IVAL("buffer_groups", depth, base, io, q, usr->buffer_groups); q += 4; /* undocumented buffer pointer to groups. */
- DBG_RW_IVAL("user_flgs", depth, base, io, q, usr->user_flgs ); q += 4; /* user flags */
+ DBG_RW_IVAL("user_id ", depth, base, io, q, usr->user_id ); q += 4; /* User ID */
+ DBG_RW_IVAL("group_id ", depth, base, io, q, usr->group_id ); q += 4; /* Group ID */
+ DBG_RW_IVAL("num_groups ", depth, base, io, q, usr->num_groups ); q += 4; /* num groups */
+ DBG_RW_IVAL("buffer_groups ", depth, base, io, q, usr->buffer_groups); q += 4; /* undocumented buffer pointer to groups. */
+ DBG_RW_IVAL("user_flgs ", depth, base, io, q, usr->user_flgs ); q += 4; /* user flags */
- DBG_RW_PCVAL("", depth, base, io, q, usr->sess_key, 16); q += 16; /* unused user session key */
+ DBG_RW_PCVAL("sess_key ", depth, base, io, q, usr->sess_key, 16); q += 16; /* unused user session key */
q = smb_io_unihdr(io, &(usr->hdr_logon_srv), q, base, align, depth); /* logon server unicode string header */
q = smb_io_unihdr(io, &(usr->hdr_logon_dom), q, base, align, depth); /* logon domain unicode string header */
- DBG_RW_IVAL("buffer_dom_id", depth, base, io, q, usr->buffer_dom_id); q += 4; /* undocumented logon domain id pointer */
- DBG_RW_PCVAL("padding", depth, base, io, q, usr->padding, 40); q += 40; /* unused padding bytes? */
+ DBG_RW_IVAL("buffer_dom_id ", depth, base, io, q, usr->buffer_dom_id); q += 4; /* undocumented logon domain id pointer */
+ DBG_RW_PCVAL("padding ", depth, base, io, q, usr->padding, 40); q += 40; /* unused padding bytes? */
DBG_RW_IVAL("num_other_sids", depth, base, io, q, usr->num_other_sids); q += 4; /* 0 - num_sids */
DBG_RW_IVAL("buffer_other_sids", depth, base, io, q, usr->buffer_other_sids); q += 4; /* NULL - undocumented pointer to SIDs. */
@@ -408,7 +408,7 @@ char* lsa_io_user_info(BOOL io, LSA_USER_INFO *usr, char *q, char *base, int ali
q = smb_io_unistr2(io, &(usr->uni_home_dir) , q, base, align, depth); /* home directory unicode string */
q = smb_io_unistr2(io, &(usr->uni_dir_drive) , q, base, align, depth); /* home directory drive unicode string */
- DBG_RW_IVAL("num_groups2", depth, base, io, q, usr->num_groups2); q += 4; /* num groups */
+ DBG_RW_IVAL("num_groups2 ", depth, base, io, q, usr->num_groups2); q += 4; /* num groups */
for (i = 0; i < usr->num_groups2; i++)
{
q = smb_io_gid(io, &(usr->gids[i]), q, base, align, depth); /* group info */
@@ -459,15 +459,15 @@ char* lsa_io_r_sam_logon(BOOL io, LSA_R_SAM_LOGON *r_l, char *q, char *base, int
DBG_RW_IVAL("buffer_creds", depth, base, io, q, r_l->buffer_creds); q += 4; /* undocumented buffer pointer */
q = smb_io_cred(io, &(r_l->srv_creds), q, base, align, depth); /* server credentials. server time stamp appears to be ignored. */
- DBG_RW_IVAL("buffer_user", depth, base, io, q, r_l->buffer_user); q += 4;
+ DBG_RW_IVAL("buffer_user ", depth, base, io, q, r_l->buffer_user); q += 4;
if (r_l->buffer_user != 0)
{
q = lsa_io_user_info(io, r_l->user, q, base, align, depth);
}
- DBG_RW_IVAL("auth_resp", depth, base, io, q, r_l->auth_resp); q += 4; /* 1 - Authoritative response; 0 - Non-Auth? */
+ DBG_RW_IVAL("auth_resp ", depth, base, io, q, r_l->auth_resp); q += 4; /* 1 - Authoritative response; 0 - Non-Auth? */
- DBG_RW_IVAL("status", depth, base, io, q, r_l->status); q += 4;
+ DBG_RW_IVAL("status ", depth, base, io, q, r_l->status); q += 4;
return q;
}
@@ -504,7 +504,7 @@ char* lsa_io_r_sam_logoff(BOOL io, LSA_R_SAM_LOGOFF *r_l, char *q, char *base, i
DBG_RW_IVAL("buffer_creds", depth, base, io, q, r_l->buffer_creds); q += 4; /* undocumented buffer pointer */
q = smb_io_cred(io, &(r_l->srv_creds), q, base, align, depth); /* server credentials. server time stamp appears to be ignored. */
- DBG_RW_IVAL("status", depth, base, io, q, r_l->status); q += 4;
+ DBG_RW_IVAL("status ", depth, base, io, q, r_l->status); q += 4;
return q;
}
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index eb8215b7a3..173b3cdd06 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -504,7 +504,6 @@ static int make_rpc_reply(char *inbuf, char *q, int data_len)
static int lsa_reply_open_policy(char *q, char *base)
{
int i;
- char *start = q;
LSA_R_OPEN_POL r_o;
/* set up the LSA QUERY INFO response */
@@ -519,7 +518,7 @@ static int lsa_reply_open_policy(char *q, char *base)
q = lsa_io_r_open_pol(False, &r_o, q, base, 4, 0);
/* return length of SMB data stored */
- return q - start;
+ return PTR_DIFF(q, base);
}
static void make_uni_hdr(UNIHDR *hdr, int max_len, int len, uint16 terminate)
@@ -593,7 +592,6 @@ static void make_dom_query(DOM_QUERY *d_q, char *dom_name, char *dom_sid)
static int lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, char *q, char *base,
char *dom_name, char *dom_sid)
{
- char *start = q;
LSA_R_QUERY_INFO r_q;
/* set up the LSA QUERY INFO response */
@@ -609,7 +607,7 @@ static int lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, char *q, char *base,
q = lsa_io_r_query(False, &r_q, q, base, 4, 0);
/* return length of SMB data stored */
- return q - start;
+ return PTR_DIFF(q, base);
}
/* pretty much hard-coded choice of "other" sids, unfortunately... */
@@ -693,7 +691,6 @@ static int lsa_reply_lookup_sids(char *q, char *base,
char *dom_name, char *dom_sid,
char *other_sid1, char *other_sid2, char *other_sid3)
{
- char *start = q;
LSA_R_LOOKUP_SIDS r_l;
/* set up the LSA Lookup SIDs response */
@@ -705,7 +702,7 @@ static int lsa_reply_lookup_sids(char *q, char *base,
q = lsa_io_r_lookup_sids(False, &r_l, q, base, 4, 0);
/* return length of SMB data stored */
- return q - start;
+ return PTR_DIFF(q, base);
}
static int lsa_reply_lookup_rids(char *q, char *base,
@@ -713,7 +710,6 @@ static int lsa_reply_lookup_rids(char *q, char *base,
char *dom_name, char *dom_sid,
char *other_sid1, char *other_sid2, char *other_sid3)
{
- char *start = q;
LSA_R_LOOKUP_RIDS r_l;
/* set up the LSA Lookup RIDs response */
@@ -725,35 +721,35 @@ static int lsa_reply_lookup_rids(char *q, char *base,
q = lsa_io_r_lookup_rids(False, &r_l, q, base, 4, 0);
/* return length of SMB data stored */
- return q - start;
+ return PTR_DIFF(q, base);
}
static void make_lsa_r_req_chal(LSA_R_REQ_CHAL *r_c,
DOM_CHAL *srv_chal, int status)
{
- memcpy(r_c->srv_chal.data, srv_chal->data, sizeof(r_c->srv_chal.data));
+ DEBUG(6,("make_lsa_r_req_chal: %d\n", __LINE__));
+ memcpy(r_c->srv_chal.data, srv_chal->data, sizeof(srv_chal->data));
r_c->status = status;
-
- DEBUG(5,("make_lsa_r_req_chal srv_chal: %lx %lx\n",
- *(uint32*)(&((r_c->srv_chal.data[0]))),
- *(uint32*)(&((r_c->srv_chal.data[4]))) ));
}
static int lsa_reply_req_chal(LSA_Q_REQ_CHAL *q_c, char *q, char *base,
DOM_CHAL *srv_chal)
{
- char *start = q;
LSA_R_REQ_CHAL r_c;
- /* set up the LSA REQUEST CHALLENGE response */
+ DEBUG(6,("lsa_reply_req_chal: %d\n", __LINE__));
+ memcpy(r_c->srv_chal.data, srv_chal->data, sizeof(srv_chal->data));
+ /* set up the LSA REQUEST CHALLENGE response */
make_lsa_r_req_chal(&r_c, srv_chal, 0);
/* store the response in the SMB stream */
q = lsa_io_r_req_chal(False, &r_c, q, base, 4, 0);
+ DEBUG(6,("lsa_reply_req_chal: %d\n", __LINE__));
+
/* return length of SMB data stored */
- return q - start;
+ return PTR_DIFF(q, base);
}
static void make_lsa_r_auth_2(LSA_R_AUTH_2 *r_a,
@@ -767,7 +763,6 @@ static void make_lsa_r_auth_2(LSA_R_AUTH_2 *r_a,
static int lsa_reply_auth_2(LSA_Q_AUTH_2 *q_a, char *q, char *base,
DOM_CHAL *resp_cred, int status)
{
- char *start = q;
LSA_R_AUTH_2 r_a;
/* set up the LSA AUTH 2 response */
@@ -778,7 +773,7 @@ static int lsa_reply_auth_2(LSA_Q_AUTH_2 *q_a, char *q, char *base,
q = lsa_io_r_auth_2(False, &r_a, q, base, 4, 0);
/* return length of SMB data stored */
- return q - start;
+ return PTR_DIFF(q, base);
}
static void make_lsa_r_srv_pwset(LSA_R_SRV_PWSET *r_a,
@@ -791,7 +786,6 @@ static void make_lsa_r_srv_pwset(LSA_R_SRV_PWSET *r_a,
static int lsa_reply_srv_pwset(LSA_Q_SRV_PWSET *q_s, char *q, char *base,
DOM_CRED *srv_cred, int status)
{
- char *start = q;
LSA_R_SRV_PWSET r_s;
/* set up the LSA Server Password Set response */
@@ -801,7 +795,7 @@ static int lsa_reply_srv_pwset(LSA_Q_SRV_PWSET *q_s, char *q, char *base,
q = lsa_io_r_srv_pwset(False, &r_s, q, base, 4, 0);
/* return length of SMB data stored */
- return q - start;
+ return PTR_DIFF(q, base);
}
static void make_lsa_user_info(LSA_USER_INFO *usr,
@@ -920,7 +914,6 @@ static void make_lsa_user_info(LSA_USER_INFO *usr,
static int lsa_reply_sam_logon(LSA_Q_SAM_LOGON *q_s, char *q, char *base,
DOM_CRED *srv_cred, LSA_USER_INFO *user_info)
{
- char *start = q;
LSA_R_SAM_LOGON r_s;
/* XXXX maybe we want to say 'no', reject the client's credentials */
@@ -936,7 +929,7 @@ static int lsa_reply_sam_logon(LSA_Q_SAM_LOGON *q_s, char *q, char *base,
q = lsa_io_r_sam_logon(False, &r_s, q, base, 4, 0);
/* return length of SMB data stored */
- return q - start;
+ return PTR_DIFF(q, base);
}
@@ -944,7 +937,6 @@ static int lsa_reply_sam_logoff(LSA_Q_SAM_LOGOFF *q_s, char *q, char *base,
DOM_CRED *srv_cred,
uint32 status)
{
- char *start = q;
LSA_R_SAM_LOGOFF r_s;
/* XXXX maybe we want to say 'no', reject the client's credentials */
@@ -957,55 +949,41 @@ static int lsa_reply_sam_logoff(LSA_Q_SAM_LOGOFF *q_s, char *q, char *base,
q = lsa_io_r_sam_logoff(False, &r_s, q, base, 4, 0);
/* return length of SMB data stored */
- return q - start;
+ return PTR_DIFF(q, base);
}
static void api_lsa_open_policy( char *param, char *data,
char **rdata, int *rdata_len )
{
- int reply_len;
-
/* we might actually want to decode the query, but it's not necessary */
/* lsa_io_q_open_policy(...); */
/* return a 20 byte policy handle */
- reply_len = lsa_reply_open_policy(*rdata + 0x18, *rdata + 0x18);
-
- /* construct header, now that we know the reply length */
- make_rpc_reply(data, *rdata, reply_len);
- *rdata_len = reply_len + 0x18;
+ *rdata_len = lsa_reply_open_policy(*rdata + 0x18, *rdata);
}
static void api_lsa_query_info( char *param, char *data,
char **rdata, int *rdata_len )
{
- int reply_len;
-
LSA_Q_QUERY_INFO q_i;
pstring dom_name;
pstring dom_sid;
/* grab the info class and policy handle */
- lsa_io_q_query(True, &q_i, data + 0x18, data + 0x18, 4, 0);
+ lsa_io_q_query(True, &q_i, data + 0x18, data, 4, 0);
pstrcpy(dom_name, lp_workgroup());
pstrcpy(dom_sid , lp_domainsid());
/* construct reply. return status is always 0x0 */
- reply_len = lsa_reply_query_info(&q_i, *rdata + 0x18, *rdata + 0x18,
+ *rdata_len = lsa_reply_query_info(&q_i, *rdata + 0x18, *rdata,
dom_name, dom_sid);
-
- /* construct header, now that we know the reply length */
- make_rpc_reply(data, *rdata, reply_len);
- *rdata_len = reply_len + 0x18;
}
static void api_lsa_lookup_sids( char *param, char *data,
char **rdata, int *rdata_len )
{
- int reply_len;
-
int i;
LSA_Q_LOOKUP_SIDS q_l;
pstring dom_name;
@@ -1013,7 +991,7 @@ static void api_lsa_lookup_sids( char *param, char *data,
fstring dom_sids[MAX_LOOKUP_SIDS];
/* grab the info class and policy handle */
- lsa_io_q_lookup_sids(True, &q_l, data + 0x18, data + 0x18, 4, 0);
+ lsa_io_q_lookup_sids(True, &q_l, data + 0x18, data, 4, 0);
pstrcpy(dom_name, lp_workgroup());
pstrcpy(dom_sid , lp_domainsid());
@@ -1025,21 +1003,15 @@ static void api_lsa_lookup_sids( char *param, char *data,
}
/* construct reply. return status is always 0x0 */
- reply_len = lsa_reply_lookup_sids(*rdata + 0x18, *rdata + 0x18,
+ *rdata_len = lsa_reply_lookup_sids(*rdata + 0x18, *rdata,
q_l.num_entries, dom_sids, /* text-converted SIDs */
dom_name, dom_sid, /* domain name, domain SID */
"S-1-1", "S-1-3", "S-1-5"); /* the three other SIDs */
-
- /* construct header, now that we know the reply length */
- make_rpc_reply(data, *rdata, reply_len);
- *rdata_len = reply_len + 0x18;
}
static void api_lsa_lookup_names( char *param, char *data,
char **rdata, int *rdata_len )
{
- int reply_len;
-
int i;
LSA_Q_LOOKUP_RIDS q_l;
pstring dom_name;
@@ -1047,7 +1019,7 @@ static void api_lsa_lookup_names( char *param, char *data,
uint32 dom_rids[MAX_LOOKUP_SIDS];
/* grab the info class and policy handle */
- lsa_io_q_lookup_rids(True, &q_l, data + 0x18, data + 0x18, 4, 0);
+ lsa_io_q_lookup_rids(True, &q_l, data + 0x18, data, 4, 0);
pstrcpy(dom_name, lp_workgroup());
pstrcpy(dom_sid , lp_domainsid());
@@ -1060,14 +1032,10 @@ static void api_lsa_lookup_names( char *param, char *data,
}
/* construct reply. return status is always 0x0 */
- reply_len = lsa_reply_lookup_rids(*rdata + 0x18, *rdata + 0x18,
+ *rdata_len = lsa_reply_lookup_rids(*rdata + 0x18, *rdata,
q_l.num_entries, dom_rids, /* text-converted SIDs */
dom_name, dom_sid, /* domain name, domain SID */
"S-1-1", "S-1-3", "S-1-5"); /* the three other SIDs */
-
- /* construct header, now that we know the reply length */
- make_rpc_reply(data, *rdata, reply_len);
- *rdata_len = reply_len + 0x18;
}
BOOL api_ntLsarpcTNP(int cnum,int uid, char *param,char *data,
@@ -1092,6 +1060,7 @@ BOOL api_ntLsarpcTNP(int cnum,int uid, char *param,char *data,
{
DEBUG(3,("LSA_OPENPOLICY\n"));
api_lsa_open_policy(param, data, rdata, rdata_len);
+ make_rpc_reply(data, *rdata, *rdata_len);
break;
}
@@ -1100,6 +1069,7 @@ BOOL api_ntLsarpcTNP(int cnum,int uid, char *param,char *data,
DEBUG(3,("LSA_QUERYINFOPOLICY\n"));
api_lsa_query_info(param, data, rdata, rdata_len);
+ make_rpc_reply(data, *rdata, *rdata_len);
break;
}
@@ -1161,6 +1131,7 @@ BOOL api_ntLsarpcTNP(int cnum,int uid, char *param,char *data,
{
DEBUG(3,("LSA_OPENSECRET\n"));
api_lsa_lookup_sids(param, data, rdata, rdata_len);
+ make_rpc_reply(data, *rdata, *rdata_len);
break;
}
@@ -1168,6 +1139,7 @@ BOOL api_ntLsarpcTNP(int cnum,int uid, char *param,char *data,
{
DEBUG(3,("LSA_LOOKUPNAMES\n"));
api_lsa_lookup_names(param, data, rdata, rdata_len);
+ make_rpc_reply(data, *rdata, *rdata_len);
break;
}
@@ -1180,11 +1152,16 @@ BOOL api_ntLsarpcTNP(int cnum,int uid, char *param,char *data,
return True;
}
-static BOOL update_dcinfo(struct dcinfo *dc, DOM_CHAL *clnt_chal, char *mach_acct)
+static BOOL update_dcinfo(int cnum, uint16 vuid,
+ struct dcinfo *dc, DOM_CHAL *clnt_chal, char *mach_acct)
{
- struct smb_passwd *smb_pass = get_smbpwnam(mach_acct);
+ struct smb_passwd *smb_pass;
int i;
+ unbecome_user();
+ smb_pass = get_smbpwnam(mach_acct);
+ become_user(cnum, vuid);
+
if (smb_pass != NULL)
{
memcpy(dc->md4pw, smb_pass->smb_nt_passwd, sizeof(dc->md4pw));
@@ -1219,43 +1196,39 @@ static BOOL update_dcinfo(struct dcinfo *dc, DOM_CHAL *clnt_chal, char *mach_acc
dc->srv_chal.data[i] = 0xA5;
}
+ DEBUG(6,("update_dcinfo: %d\n", __LINE__));
+
return True;
}
-static void api_lsa_req_chal( user_struct *vuser,
+static void api_lsa_req_chal( int cnum, uint16 vuid,
+ user_struct *vuser,
char *param, char *data,
char **rdata, int *rdata_len )
{
- int reply_len;
-
LSA_Q_REQ_CHAL q_r;
fstring mach_acct;
/* grab the challenge... */
- lsa_io_q_req_chal(True, &q_r, data + 0x18, data + 0x18, 4, 0);
+ lsa_io_q_req_chal(True, &q_r, data + 0x18, data, 4, 0);
fstrcpy(mach_acct, unistr2(q_r.uni_logon_clnt.buffer));
strcat(mach_acct, "$");
- update_dcinfo(&(vuser->dc), &(q_r.clnt_chal), mach_acct);
+ update_dcinfo(cnum, vuid, &(vuser->dc), &(q_r.clnt_chal), mach_acct);
/* construct reply. return status is always 0x0 */
- reply_len = lsa_reply_req_chal(&q_r, *rdata + 0x18, *rdata + 0x18,
+ *rdata_len = lsa_reply_req_chal(&q_r, *rdata + 0x18, *rdata,
&(vuser->dc.srv_chal));
- /* construct header, now that we know the reply length */
- reply_len += make_rpc_reply(data, *rdata, reply_len);
-
- *rdata_len = reply_len;
}
static void api_lsa_auth_2( user_struct *vuser,
char *param, char *data,
char **rdata, int *rdata_len )
{
- int reply_len;
LSA_Q_AUTH_2 q_a;
DOM_CHAL srv_chal;
@@ -1264,7 +1237,7 @@ static void api_lsa_auth_2( user_struct *vuser,
srv_time.time = 0;
/* grab the challenge... */
- lsa_io_q_auth_2(True, &q_a, data + 0x18, data + 0x18, 4, 0);
+ lsa_io_q_auth_2(True, &q_a, data + 0x18, data, 4, 0);
/* check that the client credentials are valid */
cred_assert(&(q_a.clnt_chal), vuser->dc.sess_key,
@@ -1274,13 +1247,8 @@ static void api_lsa_auth_2( user_struct *vuser,
cred_create(vuser->dc.sess_key, &(vuser->dc.clnt_cred), srv_time, &srv_chal);
/* construct reply. */
- reply_len = lsa_reply_auth_2(&q_a, *rdata + 0x18, *rdata + 0x18,
+ *rdata_len = lsa_reply_auth_2(&q_a, *rdata + 0x18, *rdata,
&srv_chal, 0x0);
-
- /* construct header, now that we know the reply length */
- reply_len += make_rpc_reply(data, *rdata, reply_len);
-
- *rdata_len = reply_len;
}
@@ -1316,26 +1284,20 @@ static void api_lsa_srv_pwset( user_struct *vuser,
char *param, char *data,
char **rdata, int *rdata_len )
{
- int reply_len;
LSA_Q_SRV_PWSET q_a;
DOM_CRED srv_cred;
/* grab the challenge and encrypted password ... */
- lsa_io_q_srv_pwset(True, &q_a, data + 0x18, data + 0x18, 4, 0);
+ lsa_io_q_srv_pwset(True, &q_a, data + 0x18, data, 4, 0);
/* checks and updates credentials. creates reply credentials */
deal_with_credentials(vuser, &(q_a.clnt_id.cred), &srv_cred);
/* construct reply. always indicate failure. nt keeps going... */
- reply_len = lsa_reply_srv_pwset(&q_a, *rdata + 0x18, *rdata + 0x18,
+ *rdata_len = lsa_reply_srv_pwset(&q_a, *rdata + 0x18, *rdata,
&srv_cred,
NT_STATUS_WRONG_PASSWORD|0xC000000);
-
- /* construct header, now that we know the reply length */
- reply_len += make_rpc_reply(data, *rdata, reply_len);
-
- *rdata_len = reply_len;
}
@@ -1343,26 +1305,20 @@ static void api_lsa_sam_logoff( user_struct *vuser,
char *param, char *data,
char **rdata, int *rdata_len )
{
- int reply_len;
LSA_Q_SAM_LOGOFF q_l;
DOM_CRED srv_cred;
/* grab the challenge... */
- lsa_io_q_sam_logoff(True, &q_l, data + 0x18, data + 0x18, 4, 0);
+ lsa_io_q_sam_logoff(True, &q_l, data + 0x18, data, 4, 0);
/* checks and updates credentials. creates reply credentials */
deal_with_credentials(vuser, &(q_l.sam_id.client.cred), &srv_cred);
/* construct reply. always indicate success */
- reply_len = lsa_reply_sam_logoff(&q_l, *rdata + 0x18, *rdata + 0x18,
+ *rdata_len = lsa_reply_sam_logoff(&q_l, *rdata + 0x18, *rdata,
&srv_cred,
0x0);
-
- /* construct header, now that we know the reply length */
- reply_len += make_rpc_reply(data, *rdata, reply_len);
-
- *rdata_len = reply_len;
}
@@ -1370,14 +1326,13 @@ static void api_lsa_sam_logon( user_struct *vuser,
char *param, char *data,
char **rdata, int *rdata_len )
{
- int reply_len;
LSA_Q_SAM_LOGON q_l;
LSA_USER_INFO usr_info;
LSA_USER_INFO *p_usr_info = NULL;
DOM_CRED srv_creds;
- lsa_io_q_sam_logon(True, &q_l, data + 0x18, data + 0x18, 4, 0);
+ lsa_io_q_sam_logon(True, &q_l, data + 0x18, data, 4, 0);
/* checks and updates credentials. creates reply credentials */
deal_with_credentials(vuser, &(q_l.sam_id.client.cred), &srv_creds);
@@ -1454,208 +1409,11 @@ static void api_lsa_sam_logon( user_struct *vuser,
NULL); /* char *other_sids */
}
- reply_len = lsa_reply_sam_logon(&q_l, *rdata + 0x18, *rdata + 0x18,
+ *rdata_len = lsa_reply_sam_logon(&q_l, *rdata + 0x18, *rdata,
&srv_creds, p_usr_info);
-
- /* construct header, now that we know the reply length */
- reply_len += make_rpc_reply(data, *rdata, reply_len);
-
- *rdata_len = reply_len;
}
-#if 0
-case LSASAMLOGON:
- DEBUG(1,("LSASAMLOGON\n"));
- dump_data(1,data,128);
- q = data + 0x18;
- logonsrv = q + 16;
- DEBUG(1,("SMLOG %d\n", __LINE__));
- q = skip_unicode_string(logonsrv,1)+16;
- q = align4(q, data);
- unicomp = q;
- q = skip_unicode_string(unicomp,1)+4;
- DEBUG(1,("SMLOG %d logonsrv=%s unicomp=%s\n",
- __LINE__, unistr(logonsrv), unistr(unicomp)));
- q = align4(q, data);
- rcvcred[0] = qIVAL;
- DEBUG(1,("SMLOG %d\n", __LINE__));
- rcvcred[1] = qIVAL;
- DEBUG(1,("SMLOG %d\n", __LINE__));
- clnttime = qIVAL;
- checkcred(cnum, rcvcred[0], rcvcred[1], clnttime);
- q += 2;
- rtncred[0] = qIVAL; /* all these are ignored */
- DEBUG(1,("SMLOG %d\n", __LINE__));
- rtncred[1] = qIVAL;
- rtntime = qIVAL;
- logonlevel = qSVAL;
- DEBUG(1,("SMLOG %d\n", __LINE__));
- switchval = qSVAL;
- switch (switchval)
- {
- case 1:
-
- q += 6;
- domlen = qSVAL;
- dommaxlen = qSVAL; q += 4;
- paramcontrol = qIVAL;
- logonid[0] = qIVAL; /* low part */
- logonid[1] = qIVAL; /* high part */
-
- usernamelen = qSVAL;
-
- DEBUG(1,("SMLOG %d\n", __LINE__));
- usernamemaxlen = qSVAL; q += 4;
-
- DEBUG(1,("usernamelen=%d maxlen=%d dommaxlen=%d\n",
- usernamelen, usernamemaxlen, dommaxlen));
-
- dump_data(1,q,128);
-
- wslen = qSVAL;
- wsmaxlen = qSVAL; q += 4;
- rc4lmowfpass = q; q += 16;
- rc4ntowfpass = q; q += 16;
-
- q += 12; domain = q; q += dommaxlen + 12;
- q = align4(q, data);
- username = q; q += usernamemaxlen + 12;
- q = align4(q, data);
- ws = q;
- DEBUG(1,("domain=%s username=%s ws=%s\n",
- unistr(domain), unistr(username),
- unistr(ws)));
- break;
- default:
- DEBUG(0,("unknown switch in SAMLOGON %d\n",
- switchval));
- }
- for(i=0;i<16;i++) sprintf(foo+i*2,"%02x",username[i]);
- DEBUG(1,("userNAME %s [%s]\n", foo, username));
- DEBUG(1,("SMLOG %d\n", __LINE__));
- q = *rdata + 0x18;
- qSIVAL(0x16a4b4); /* magic buffer pointer ? */
- makecred(cnum, clnttime+1, q);
- dcauth[cnum].svrcred[0] = dcauth[cnum].cred[0] = dcauth[cnum].cred[0] + clnttime + 1;
- q += 8;
- qSIVAL(0); /* timestamp. client doesn't care */
- qSSVAL(3); /* switch value 3. May be others? */
- qSSVAL(0); /* undocumented */
- DEBUG(1,("SMLOG %d\n", __LINE__));
-
- memset(rc4key, 0, sizeof rc4key);
- SIVAL(rc4key, 0, dcauth[cnum].sesskey[0]);
- SIVAL(rc4key, 4, dcauth[cnum].sesskey[1]);
- for(i=0;i<16;i++) sprintf(foo+i*2,"%02x",rc4ntowfpass[i]);
- DEBUG(1,("rc4ntowf %s\n", foo));
- arcfour_init(&c, rc4key, sizeof rc4key);
- arcfour_encrypt(&c, ntowfpass, rc4ntowfpass, sizeof ntowfpass);
- for(i=0;i<16;i++) sprintf(foo+i*2,"%02x",ntowfpass[i]);
- DEBUG(1,("ntowf %s\n", foo));
-
- if(!(userinfo = getuserinfo(username, usernamelen, ntowfpass))) {
- qSIVAL(0); /* no buffer */
- qSCVAL(1); /* Authoratitive. Change if passthrough? */
- qSCVAL(0); /* pad for above boolean */
- qSSVAL(0); /* pad for above boolean */
-
- endrpcreply(data, *rdata, q-*rdata, 0xc0000064, rdata_len);
- break;
- }
-
- qSIVAL(2); /* another magic bufptr? */
- DEBUG(1,("SMLOG %d %lx\n", __LINE__, userinfo));
- qSIVAL(userinfo->logontime[0]); qSIVAL(userinfo->logontime[1]);
- qSIVAL(userinfo->logofftime[0]); qSIVAL(userinfo->logofftime[1]);
- DEBUG(1,("SMLOG %d %lx\n", __LINE__, userinfo->passlastsettime[1]));
- qSIVAL(userinfo->kickofftime[0]); qSIVAL(userinfo->kickofftime[1]);
- qSIVAL(userinfo->passlastsettime[0]); qSIVAL(userinfo->passlastsettime[1]);
- qSIVAL(userinfo->passcanchgtime[0]); qSIVAL(userinfo->passcanchgtime[1]);
- qSIVAL(userinfo->passmustchgtime[0]); qSIVAL(userinfo->passmustchgtime[1]);
- DEBUG(1,("SMLOG %d %s\n", __LINE__, userinfo->effectivename));
- qunihdr(userinfo->effectivename);
- qunihdr(userinfo->fullname);
- DEBUG(1,("SMLOG %d\n", __LINE__));
- qunihdr(userinfo->logonscript);
- qunihdr(userinfo->profilepath);
- qunihdr(userinfo->homedirectory);
- qunihdr(userinfo->homedirectorydrive);
- DEBUG(1,("SMLOG %d\n", __LINE__));
- qSSVAL(userinfo->logoncount);
- qSSVAL(userinfo->badpwcount);
- qSIVAL(userinfo->uid);
- qSIVAL(userinfo->gid);
- DEBUG(1,("SMLOG %d\n", __LINE__));
- qSIVAL(userinfo->ngroups);
- qSIVAL(8); /* ptr to groups */
- qSIVAL(userinfo->userflags);
- DEBUG(1,("SMLOG %d\n", __LINE__));
- qSIVAL(0); qSIVAL(0); qSIVAL(0); qSIVAL(0); /* unused user session key */
- qunihdr(userinfo->logonserver);
- qunihdr(userinfo->logondomain);
- DEBUG(1,("SMLOG %d\n", __LINE__));
- qSIVAL(2); /* logon domain id ptr */
- DEBUG(1,("SMLOG %d\n", __LINE__));
- memset(q,0,40); q += 40; /* expansion room */
- DEBUG(1,("SMLOG %d\n", __LINE__));
- qSIVAL(userinfo->nsids);
- DEBUG(1,("SMLOG %d\n", __LINE__));
- qSIVAL(0); /* ptr to sids and values */
- DEBUG(1,("SMLOG %d\n", __LINE__));
- qunistr(userinfo->effectivename);
- DEBUG(1,("SMLOG %d\n", __LINE__));
- qunistr(userinfo->fullname);
- DEBUG(1,("SMLOG %d\n", __LINE__));
- qunistr(userinfo->logonscript);
- DEBUG(1,("SMLOG %d\n", __LINE__));
- qunistr(userinfo->profilepath);
- qunistr(userinfo->homedirectory);
- qunistr(userinfo->homedirectorydrive);
- DEBUG(1,("SMLOG %d\n", __LINE__));
- qSIVAL(userinfo->ngroups);
- for (i = 0; i < userinfo->ngroups; i++)
- {
- qSIVAL(userinfo->groups[i].gid);
- qSIVAL(userinfo->groups[i].attr);
- }
- qunistr(userinfo->logonserver);
- qunistr(userinfo->logondomain);
- for (i = 0; i < userinfo->nsids; i++)
- {
- /* put the extra sids: PAXX: TODO */
- }
- /* Assumption. This is the only domain, sending our SID */
- /* PAXX: may want to do passthrough later */
- strcpy(domsid,lp_domainsid());
-DEBUG(4,("netlogon LINE %d %lx %s\n",__LINE__, q, domsid));
- /* assume, but should check, that domsid starts "S-" */
- p = strtok(domsid+2,"-");
- revision = atoi(p);
-DEBUG(4,("netlogon LINE %d %lx %s rev %d\n",__LINE__, q, p, revision));
- identauth = atoi(strtok(0,"-"));
-DEBUG(4,("netlogon LINE %d %lx %s ia %d\n",__LINE__, q, p, identauth));
- numsubauths = 0;
- while (p = strtok(0, "-"))
- subauths[numsubauths++] = atoi(p);
- qSIVAL(numsubauths);
- qSCVAL(revision);
- qSCVAL(numsubauths);
- qRSSVAL(0); /* PAXX: FIX. first 2 bytes identifier authority */
- qRSIVAL(identauth); /* next 4 bytes */
- DEBUG(1,("SMLOG %d\n", __LINE__));
- for (i = 0; i < numsubauths; i++)
- {
- qSIVAL(subauths[i]);
- }
- qSCVAL(1); /* Authoratitive. Change if passthrough? */
- qSCVAL(0); /* pad for above boolean */
- qSSVAL(0); /* pad for above boolean */
-
- endrpcreply(data, *rdata, q-*rdata, 0, rdata_len);
- break;
-#endif
-
BOOL api_netlogrpcTNP(int cnum,int uid, char *param,char *data,
int mdrcnt,int mprcnt,
char **rdata,char **rparam,
@@ -1687,7 +1445,8 @@ BOOL api_netlogrpcTNP(int cnum,int uid, char *param,char *data,
case LSA_REQCHAL:
{
DEBUG(3,("LSA_REQCHAL\n"));
- api_lsa_req_chal(vuser, param, data, rdata, rdata_len);
+ api_lsa_req_chal(cnum, uid, vuser, param, data, rdata, rdata_len);
+ make_rpc_reply(data, *rdata, *rdata_len);
break;
}
@@ -1695,6 +1454,7 @@ BOOL api_netlogrpcTNP(int cnum,int uid, char *param,char *data,
{
DEBUG(3,("LSA_AUTH2\n"));
api_lsa_auth_2(vuser, param, data, rdata, rdata_len);
+ make_rpc_reply(data, *rdata, *rdata_len);
break;
}
@@ -1702,6 +1462,7 @@ BOOL api_netlogrpcTNP(int cnum,int uid, char *param,char *data,
{
DEBUG(3,("LSA_SRVPWSET\n"));
api_lsa_srv_pwset(vuser, param, data, rdata, rdata_len);
+ make_rpc_reply(data, *rdata, *rdata_len);
break;
}
@@ -1709,6 +1470,7 @@ BOOL api_netlogrpcTNP(int cnum,int uid, char *param,char *data,
{
DEBUG(3,("LSA_SAMLOGON\n"));
api_lsa_sam_logon(vuser, param, data, rdata, rdata_len);
+ make_rpc_reply(data, *rdata, *rdata_len);
break;
}
diff --git a/source3/smbparse.c b/source3/smbparse.c
index d7fbf53020..ba3e073e5f 100644
--- a/source3/smbparse.c
+++ b/source3/smbparse.c
@@ -53,7 +53,7 @@ char* smb_io_time(BOOL io, NTTIME *nttime, char *q, char *base, int align, int d
q = align_offset(q, base, align);
- DBG_RW_IVAL("low", depth, base, io, q, nttime->low ); q += 4; /* low part */
+ DBG_RW_IVAL("low ", depth, base, io, q, nttime->low ); q += 4; /* low part */
DBG_RW_IVAL("high", depth, base, io, q, nttime->high); q += 4; /* high part */
return q;
@@ -73,8 +73,8 @@ char* smb_io_dom_sid(BOOL io, DOM_SID *sid, char *q, char *base, int align, int
q = align_offset(q, base, align);
- DBG_RW_CVAL("sid_no", depth, base, io, q, sid->sid_no); q++;
- DBG_RW_CVAL("num_auths", depth, base, io, q, sid->num_auths); q++;
+ DBG_RW_CVAL("sid_no ", depth, base, io, q, sid->sid_no); q++;
+ DBG_RW_CVAL("num_auths ", depth, base, io, q, sid->num_auths); q++;
for (i = 0; i < 6; i++)
{
@@ -86,7 +86,7 @@ char* smb_io_dom_sid(BOOL io, DOM_SID *sid, char *q, char *base, int align, int
/* oops! XXXX should really issue a warning here... */
if (sid->num_auths > MAXSUBAUTHS) sid->num_auths = MAXSUBAUTHS;
- DBG_RW_PSVAL("num_auths", depth, base, io, q, sid->sub_auths, sid->num_auths); q += sid->num_auths * 2;
+ DBG_RW_PSVAL("num_auths ", depth, base, io, q, sid->sub_auths, sid->num_auths); q += sid->num_auths * 2;
return q;
}
@@ -108,7 +108,7 @@ char* smb_io_unihdr(BOOL io, UNIHDR *hdr, char *q, char *base, int align, int de
DBG_RW_IVAL("uni_max_len", depth, base, io, q, hdr->uni_max_len); q += 4;
DBG_RW_IVAL("uni_str_len", depth, base, io, q, hdr->uni_str_len); q += 4;
- DBG_RW_IVAL("undoc", depth, base, io, q, hdr->undoc ); q += 4;
+ DBG_RW_IVAL("undoc ", depth, base, io, q, hdr->undoc ); q += 4;
return q;
}
@@ -176,7 +176,7 @@ char* smb_io_unistr2(BOOL io, UNISTR2 *uni2, char *q, char *base, int align, int
uni2->undoc = 0;
DBG_RW_IVAL("uni_max_len", depth, base, io, q, uni2->uni_max_len); q += 4;
- DBG_RW_IVAL("undoc", depth, base, io, q, uni2->undoc ); q += 4;
+ DBG_RW_IVAL("undoc ", depth, base, io, q, uni2->undoc ); q += 4;
DBG_RW_IVAL("uni_str_len", depth, base, io, q, uni2->uni_str_len); q += 4;
/* oops! XXXX maybe issue a warning that this is happening... */
@@ -185,7 +185,7 @@ char* smb_io_unistr2(BOOL io, UNISTR2 *uni2, char *q, char *base, int align, int
/* buffer advanced by indicated length of string
NOT by searching for null-termination */
- DBG_RW_PSVAL("", depth, base, io, q, uni2->buffer, uni2->uni_max_len); q += uni2->uni_max_len * 2;
+ DBG_RW_PSVAL("buffer ", depth, base, io, q, uni2->buffer, uni2->uni_max_len); q += uni2->uni_max_len * 2;
return q;
}
@@ -208,7 +208,7 @@ char* smb_io_dom_sid2(BOOL io, DOM_SID2 *sid2, char *q, char *base, int align, i
/* should be value 0, so enforce it */
sid2->undoc = 0;
- DBG_RW_IVAL("type", depth, base, io, q, sid2->type ); q += 4;
+ DBG_RW_IVAL("type ", depth, base, io, q, sid2->type ); q += 4;
DBG_RW_IVAL("undoc", depth, base, io, q, sid2->undoc); q += 4;
q = smb_io_unihdr2(io, &(sid2->hdr), q, base, align, depth);
@@ -235,9 +235,9 @@ char* smb_io_dom_rid2(BOOL io, DOM_RID2 *rid2, char *q, char *base, int align, i
/* should be value 5, so enforce it */
rid2->undoc = 5;
- DBG_RW_IVAL("type", depth, base, io, q, rid2->type); q += 4;
- DBG_RW_IVAL("undoc", depth, base, io, q, rid2->undoc ); q += 4;
- DBG_RW_IVAL("rid", depth, base, io, q, rid2->rid ); q += 4;
+ DBG_RW_IVAL("type ", depth, base, io, q, rid2->type); q += 4;
+ DBG_RW_IVAL("undoc ", depth, base, io, q, rid2->undoc ); q += 4;
+ DBG_RW_IVAL("rid ", depth, base, io, q, rid2->rid ); q += 4;
DBG_RW_IVAL("rid_idx", depth, base, io, q, rid2->rid_idx ); q += 4;
return q;
@@ -262,8 +262,7 @@ char* smb_io_log_info(BOOL io, DOM_LOG_INFO *log, char *q, char *base, int align
DBG_RW_SVAL("sec_chan", depth, base, io, q, log->sec_chan); q += 2;
- /* XXXX no alignment required between sec_chan and uni_comp_name */
- q = smb_io_unistr2(io, &(log->uni_comp_name), q, base, 0, depth);
+ q = smb_io_unistr2(io, &(log->uni_comp_name), q, base, align, depth);
return q;
}
@@ -333,7 +332,7 @@ char* smb_io_logon_id(BOOL io, DOM_LOGON_ID *log, char *q, char *base, int align
q = align_offset(q, base, align);
- DBG_RW_IVAL("low", depth, base, io, q, log->low ); q += 4;
+ DBG_RW_IVAL("low ", depth, base, io, q, log->low ); q += 4;
DBG_RW_IVAL("high", depth, base, io, q, log->high); q += 4;
return q;
@@ -402,7 +401,7 @@ char* smb_io_sam_info(BOOL io, DOM_SAM_INFO *sam, char *q, char *base, int align
q = smb_io_cred (io, &(sam->rtn_cred), q, base, align, depth);
DBG_RW_IVAL("logon_level", depth, base, io, q, sam->logon_level); q += 4;
- DBG_RW_SVAL("auth_level", depth, base, io, q, sam->auth_level ); q += 4;
+ DBG_RW_SVAL("auth_level ", depth, base, io, q, sam->auth_level ); q += 4;
switch (sam->auth_level)
{
@@ -432,7 +431,7 @@ char* smb_io_gid(BOOL io, DOM_GID *gid, char *q, char *base, int align, int dept
q = align_offset(q, base, align);
- DBG_RW_IVAL("gid", depth, base, io, q, gid->gid ); q += 4;
+ DBG_RW_IVAL("gid ", depth, base, io, q, gid->gid ); q += 4;
DBG_RW_IVAL("attr", depth, base, io, q, gid->attr); q += 4;
return q;
@@ -451,17 +450,17 @@ char* smb_io_rpc_hdr(BOOL io, RPC_HDR *rpc, char *q, char *base, int align, int
/* reserved should be zero: enforce it */
rpc->reserved = 0;
- DBG_RW_CVAL("major", depth, base, io, q, rpc->major); q++;
- DBG_RW_CVAL("minor", depth, base, io, q, rpc->minor); q++;
- DBG_RW_CVAL("pkt_type", depth, base, io, q, rpc->pkt_type); q++;
- DBG_RW_CVAL("frag", depth, base, io, q, rpc->frag); q++;
- DBG_RW_IVAL("pack_type", depth, base, io, q, rpc->pack_type); q += 4;
- DBG_RW_SVAL("frag_len", depth, base, io, q, rpc->frag_len); q += 2;
- DBG_RW_SVAL("auth_len", depth, base, io, q, rpc->auth_len); q += 2;
- DBG_RW_IVAL("call_id", depth, base, io, q, rpc->call_id); q += 4;
+ DBG_RW_CVAL("major ", depth, base, io, q, rpc->major); q++;
+ DBG_RW_CVAL("minor ", depth, base, io, q, rpc->minor); q++;
+ DBG_RW_CVAL("pkt_type ", depth, base, io, q, rpc->pkt_type); q++;
+ DBG_RW_CVAL("frag ", depth, base, io, q, rpc->frag); q++;
+ DBG_RW_IVAL("pack_type ", depth, base, io, q, rpc->pack_type); q += 4;
+ DBG_RW_SVAL("frag_len ", depth, base, io, q, rpc->frag_len); q += 2;
+ DBG_RW_SVAL("auth_len ", depth, base, io, q, rpc->auth_len); q += 2;
+ DBG_RW_IVAL("call_id ", depth, base, io, q, rpc->call_id); q += 4;
DBG_RW_IVAL("alloc_hint", depth, base, io, q, rpc->alloc_hint); q += 4;
DBG_RW_CVAL("context_id", depth, base, io, q, rpc->context_id); q++;
- DBG_RW_CVAL("reserved", depth, base, io, q, rpc->reserved); q++;
+ DBG_RW_CVAL("reserved ", depth, base, io, q, rpc->reserved); q++;
return q;
}
@@ -513,11 +512,11 @@ char* smb_io_dom_query(BOOL io, DOM_QUERY *d_q, char *q, char *base, int align,
DBG_RW_SVAL("uni_dom_max_len", depth, base, io, q, d_q->uni_dom_max_len); q += 2; /* domain name string length * 2 */
- DBG_RW_SVAL("padding", depth, base, io, q, d_q->padding ); q += 2; /* 2 padding bytes */
+ DBG_RW_SVAL("padding ", depth, base, io, q, d_q->padding ); q += 2; /* 2 padding bytes */
DBG_RW_SVAL("uni_dom_str_len", depth, base, io, q, d_q->uni_dom_str_len); q += 2; /* domain name string length * 2 */
DBG_RW_IVAL("buffer_dom_name", depth, base, io, q, d_q->buffer_dom_name); q += 4; /* undocumented domain name string buffer pointer */
- DBG_RW_IVAL("buffer_dom_sid", depth, base, io, q, d_q->buffer_dom_sid ); q += 4; /* undocumented domain SID string buffer pointer */
+ DBG_RW_IVAL("buffer_dom_sid ", depth, base, io, q, d_q->buffer_dom_sid ); q += 4; /* undocumented domain SID string buffer pointer */
if (d_q->buffer_dom_name != 0)
{
@@ -545,11 +544,11 @@ char* smb_io_dom_r_ref(BOOL io, DOM_R_REF *r_r, char *q, char *base, int align,
q = align_offset(q, base, align);
- DBG_RW_IVAL("undoc_buffer", depth, base, io, q, r_r->undoc_buffer); q += 4; /* undocumented buffer pointer. */
- DBG_RW_IVAL("num_ref_doms_1", depth, base, io, q, r_r->num_ref_doms_1); q += 4; /* num referenced domains? */
+ DBG_RW_IVAL("undoc_buffer ", depth, base, io, q, r_r->undoc_buffer); q += 4; /* undocumented buffer pointer. */
+ DBG_RW_IVAL("num_ref_doms_1 ", depth, base, io, q, r_r->num_ref_doms_1); q += 4; /* num referenced domains? */
DBG_RW_IVAL("buffer_dom_name", depth, base, io, q, r_r->buffer_dom_name); q += 4; /* undocumented domain name buffer pointer. */
- DBG_RW_IVAL("max_entries", depth, base, io, q, r_r->max_entries); q += 4; /* 32 - max number of entries */
- DBG_RW_IVAL("num_ref_doms_2", depth, base, io, q, r_r->num_ref_doms_2); q += 4; /* 4 - num referenced domains? */
+ DBG_RW_IVAL("max_entries ", depth, base, io, q, r_r->max_entries); q += 4; /* 32 - max number of entries */
+ DBG_RW_IVAL("num_ref_doms_2 ", depth, base, io, q, r_r->num_ref_doms_2); q += 4; /* 4 - num referenced domains? */
q = smb_io_unihdr2(io, &(r_r->hdr_dom_name), q, base, align, depth); /* domain name unicode string header */
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index d20ff42c0e..31ac9e351b 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -396,9 +396,9 @@ static void usage(char *name)
/* Set read buffer to 16k for effiecient reads */
setvbuf(fp, readbuf, _IOFBF, sizeof(readbuf));
- /* make sure it is only rw by the owner */
- chmod(pfile, 0600);
-
+ /* need locking permission on smbpasswd file */
+ chmod(pfile, 0666);
+
/* Lock the smbpasswd file for write. */
if ((lockfd = pw_file_lock(pfile, F_WRLCK, 5)) < 0) {
err = errno;