summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1997-10-25 13:15:52 +0000
committerLuke Leighton <lkcl@samba.org>1997-10-25 13:15:52 +0000
commit027630f9ff79ae97d62012e6ca1c703425046778 (patch)
tree3d583da467d47ca1c627873fdc579b5c58ae98ff /source3
parent390c1f3c4d3136b454fa5eb8681fa9ca34eaacc2 (diff)
downloadsamba-027630f9ff79ae97d62012e6ca1c703425046778.tar.gz
samba-027630f9ff79ae97d62012e6ca1c703425046778.tar.bz2
samba-027630f9ff79ae97d62012e6ca1c703425046778.zip
sam logon query creation functions. written twice because i deleted it.
(This used to be commit 9eee8c2007bf4f7756f6d645a61055101d280316)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h14
-rw-r--r--source3/smbparse.c162
2 files changed, 173 insertions, 3 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 5321eb4187..037438f97d 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -910,17 +910,31 @@ void make_dom_sid2(DOM_SID2 *sid2, char *sid_str);
char* smb_io_dom_sid2(BOOL io, DOM_SID2 *sid2, char *q, char *base, int align, int depth);
void make_dom_rid2(DOM_RID2 *rid2, uint32 rid);
char* smb_io_dom_rid2(BOOL io, DOM_RID2 *rid2, char *q, char *base, int align, int depth);
+void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name);
char* smb_io_clnt_srv(BOOL io, DOM_CLNT_SRV *log, char *q, char *base, int align, int depth);
void make_log_info(DOM_LOG_INFO *log, char *logon_srv, char *acct_name,
uint16 sec_chan, char *comp_name);
char* smb_io_log_info(BOOL io, DOM_LOG_INFO *log, char *q, char *base, int align, int depth);
char* smb_io_chal(BOOL io, DOM_CHAL *chal, char *q, char *base, int align, int depth);
char* smb_io_cred(BOOL io, DOM_CRED *cred, char *q, char *base, int align, int depth);
+void make_clnt_info2(DOM_CLNT_INFO2 *clnt,
+ char *logon_srv, char *comp_name,
+ DOM_CRED *clnt_cred);
char* smb_io_clnt_info2(BOOL io, DOM_CLNT_INFO2 *clnt, char *q, char *base, int align, int depth);
char* smb_io_clnt_info(BOOL io, DOM_CLNT_INFO *clnt, char *q, char *base, int align, int depth);
+void make_logon_id(DOM_LOGON_ID *log, uint32 log_id_low, uint32 log_id_high);
char* smb_io_logon_id(BOOL io, DOM_LOGON_ID *log, char *q, char *base, int align, int depth);
+void make_arc4_owf(ARC4_OWF *hash, char data[16]);
char* smb_io_arc4_owf(BOOL io, ARC4_OWF *hash, char *q, char *base, int align, int depth);
+void make_id_info1(DOM_ID_INFO_1 *id, char *domain_name,
+ uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high,
+ char *user_name, char *workgroup_name,
+ char arc4_lm_owf[16], char arc4_nt_owf[16]);
char* smb_io_id_info1(BOOL io, DOM_ID_INFO_1 *id, char *q, char *base, int align, int depth);
+void make_sam_info(DOM_SAM_INFO *sam,
+ char *logon_srv, char *comp_name, DOM_CRED *clnt_cred,
+ DOM_CRED *rtn_cred, uint16 switch_value, uint16 logon_level,
+ DOM_ID_INFO_1 *id1);
char* smb_io_sam_info(BOOL io, DOM_SAM_INFO *sam, char *q, char *base, int align, int depth);
char* smb_io_gid(BOOL io, DOM_GID *gid, char *q, char *base, int align, int depth);
void make_rpc_header(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type,
diff --git a/source3/smbparse.c b/source3/smbparse.c
index 175534e3c8..292cfa1ada 100644
--- a/source3/smbparse.c
+++ b/source3/smbparse.c
@@ -361,6 +361,36 @@ char* smb_io_dom_rid2(BOOL io, DOM_RID2 *rid2, char *q, char *base, int align, i
}
/*******************************************************************
+makes a DOM_CLNT_SRV structure.
+********************************************************************/
+void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name)
+{
+ if (log == NULL) return;
+
+ DEBUG(5,("make_clnt_srv: %d\n", __LINE__));
+
+ if (logon_srv != NULL)
+ {
+ log->undoc_buffer = 1;
+ make_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv));
+ }
+ else
+ {
+ log->undoc_buffer = 1;
+ }
+
+ if (comp_name != NULL)
+ {
+ log->undoc_buffer2 = 1;
+ make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name));
+ }
+ else
+ {
+ log->undoc_buffer2 = 1;
+ }
+}
+
+/*******************************************************************
reads or writes a DOM_CLNT_SRV structure.
********************************************************************/
char* smb_io_clnt_srv(BOOL io, DOM_CLNT_SRV *log, char *q, char *base, int align, int depth)
@@ -372,10 +402,10 @@ char* smb_io_clnt_srv(BOOL io, DOM_CLNT_SRV *log, char *q, char *base, int align
q = align_offset(q, base, align);
- DBG_RW_IVAL("undoc_buffer ", depth, base, io, q, log->undoc_buffer); q += 4;
+ DBG_RW_IVAL("undoc_buffer ", depth, base, io, q, log->undoc_buffer ); q += 4;
q = smb_io_unistr2(io, &(log->uni_logon_srv), q, base, align, depth);
- DBG_RW_IVAL("undoc_buffer2", depth, base, io, q, log->undoc_buffer); q += 4;
+ DBG_RW_IVAL("undoc_buffer2", depth, base, io, q, log->undoc_buffer2); q += 4;
q = smb_io_unistr2(io, &(log->uni_comp_name), q, base, align, depth);
return q;
@@ -464,6 +494,30 @@ char* smb_io_cred(BOOL io, DOM_CRED *cred, char *q, char *base, int align, int d
}
/*******************************************************************
+makes a DOM_CLNT_INFO2 structure.
+********************************************************************/
+void make_clnt_info2(DOM_CLNT_INFO2 *clnt,
+ char *logon_srv, char *comp_name,
+ DOM_CRED *clnt_cred)
+{
+ if (clnt == NULL) return;
+
+ DEBUG(5,("make_clnt_info: %d\n", __LINE__));
+
+ make_clnt_srv(&(clnt->login), logon_srv, comp_name);
+
+ if (clnt_cred != NULL)
+ {
+ clnt->ptr_cred = 1;
+ memcpy(&(clnt->cred), clnt_cred, sizeof(clnt->cred));
+ }
+ else
+ {
+ clnt->ptr_cred = 0;
+ }
+}
+
+/*******************************************************************
reads or writes a DOM_CLNT_INFO2 structure.
********************************************************************/
char* smb_io_clnt_info2(BOOL io, DOM_CLNT_INFO2 *clnt, char *q, char *base, int align, int depth)
@@ -504,6 +558,19 @@ char* smb_io_clnt_info(BOOL io, DOM_CLNT_INFO *clnt, char *q, char *base, int al
}
/*******************************************************************
+makes a DOM_LOGON_ID structure.
+********************************************************************/
+void make_logon_id(DOM_LOGON_ID *log, uint32 log_id_low, uint32 log_id_high)
+{
+ if (log == NULL) return;
+
+ DEBUG(5,("make_logon_id: %d\n", __LINE__));
+
+ log->low = log_id_low;
+ log->high = log_id_high;
+}
+
+/*******************************************************************
reads or writes a DOM_LOGON_ID structure.
********************************************************************/
char* smb_io_logon_id(BOOL io, DOM_LOGON_ID *log, char *q, char *base, int align, int depth)
@@ -522,6 +589,18 @@ char* smb_io_logon_id(BOOL io, DOM_LOGON_ID *log, char *q, char *base, int align
}
/*******************************************************************
+makes an ARC4_OWF structure.
+********************************************************************/
+void make_arc4_owf(ARC4_OWF *hash, char data[16])
+{
+ if (hash == NULL) return;
+
+ DEBUG(5,("make_arc4_owf: %d\n", __LINE__));
+
+ memcpy(hash->data, data, sizeof(hash->data));
+}
+
+/*******************************************************************
reads or writes an ARC4_OWF structure.
********************************************************************/
char* smb_io_arc4_owf(BOOL io, ARC4_OWF *hash, char *q, char *base, int align, int depth)
@@ -539,6 +618,40 @@ char* smb_io_arc4_owf(BOOL io, ARC4_OWF *hash, char *q, char *base, int align, i
}
/*******************************************************************
+makes a DOM_ID_INFO_1 structure.
+********************************************************************/
+void make_id_info1(DOM_ID_INFO_1 *id, char *domain_name,
+ uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high,
+ char *user_name, char *workgroup_name,
+ char arc4_lm_owf[16], char arc4_nt_owf[16])
+{
+ int len_domain_name = strlen(domain_name );
+ int len_user_name = strlen(user_name );
+ int len_workgroup_name = strlen(workgroup_name);
+
+ if (id == NULL) return;
+
+ DEBUG(5,("make_id_info1: %d\n", __LINE__));
+
+ id->ptr_id_info1 = 1;
+
+ make_uni_hdr(&(id->hdr_domain_name ), len_domain_name , len_domain_name , 4);
+
+ id->param_ctrl = param_ctrl;
+ make_logon_id(&(id->logon_id), log_id_low, log_id_high);
+
+ make_uni_hdr(&(id->hdr_user_name ), len_user_name , len_user_name , 4);
+ make_uni_hdr(&(id->hdr_workgroup_name), len_workgroup_name, len_workgroup_name, 4);
+
+ make_arc4_owf(&(id->arc4_lm_owf), arc4_lm_owf);
+ make_arc4_owf(&(id->arc4_nt_owf), arc4_nt_owf);
+
+ make_unistr2(&(id->uni_domain_name ), domain_name , len_domain_name );
+ make_unistr2(&(id->uni_user_name ), user_name , len_user_name );
+ make_unistr2(&(id->uni_workgroup_name), workgroup_name, len_workgroup_name);
+}
+
+/*******************************************************************
reads or writes an DOM_ID_INFO_1 structure.
********************************************************************/
char* smb_io_id_info1(BOOL io, DOM_ID_INFO_1 *id, char *q, char *base, int align, int depth)
@@ -574,6 +687,49 @@ char* smb_io_id_info1(BOOL io, DOM_ID_INFO_1 *id, char *q, char *base, int align
}
/*******************************************************************
+makes a DOM_SAM_INFO structure.
+********************************************************************/
+void make_sam_info(DOM_SAM_INFO *sam,
+ char *logon_srv, char *comp_name, DOM_CRED *clnt_cred,
+ DOM_CRED *rtn_cred, uint16 switch_value, uint16 logon_level,
+ DOM_ID_INFO_1 *id1)
+{
+ if (sam == NULL) return;
+
+ DEBUG(5,("make_sam_info: %d\n", __LINE__));
+
+ make_clnt_info2(&(sam->client), logon_srv, comp_name, clnt_cred);
+
+ if (rtn_cred != NULL)
+ {
+ sam->ptr_rtn_cred = 1;
+ memcpy(&(sam->rtn_cred), rtn_cred, sizeof(sam->rtn_cred));
+ }
+ else
+ {
+ sam->ptr_rtn_cred = 0;
+ }
+
+ sam->logon_level = logon_level;
+ sam->switch_value = switch_value;
+
+ switch (sam->switch_value)
+ {
+ case 1:
+ {
+ sam->auth.id1 = id1;
+ break;
+ }
+ default:
+ {
+ /* PANIC! */
+ DEBUG(4,("make_sam_info: unknown switch_value!\n"));
+ break;
+ }
+ }
+}
+
+/*******************************************************************
reads or writes a DOM_SAM_INFO structure.
********************************************************************/
char* smb_io_sam_info(BOOL io, DOM_SAM_INFO *sam, char *q, char *base, int align, int depth)
@@ -597,7 +753,7 @@ char* smb_io_sam_info(BOOL io, DOM_SAM_INFO *sam, char *q, char *base, int align
{
case 1:
{
- q = smb_io_id_info1(io, &(sam->auth.id1), q, base, align, depth);
+ q = smb_io_id_info1(io, sam->auth.id1, q, base, align, depth);
break;
}
default: