summaryrefslogtreecommitdiff
path: root/source3/pipeutil.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1997-10-22 17:51:02 +0000
committerLuke Leighton <lkcl@samba.org>1997-10-22 17:51:02 +0000
commita947dff4c001023d0f7c2f6f13c3a4b594c88139 (patch)
tree8ca4b41e80837d163b0507ac8066c4a96ed654f3 /source3/pipeutil.c
parent5897f0493d0665ae53ea181e122c467faa0c7642 (diff)
downloadsamba-a947dff4c001023d0f7c2f6f13c3a4b594c88139.tar.gz
samba-a947dff4c001023d0f7c2f6f13c3a4b594c88139.tar.bz2
samba-a947dff4c001023d0f7c2f6f13c3a4b594c88139.zip
Makefile client.c :
adding start of undocumented options to do NT domain logons, client-side. starting with LSA_REQCHAL. the code here happily crashes smbd: i'll investigate this further... :-) smbparse.c pipeutil.c lsaparse.c : moved some of the common make_xxxx() functions out of pipeutil.c so that the make_xxxx and (smb/lsa)_io_xxxx functions now sit together. makes sense, really... added a make_q_req_chal() function. restructured make_rpc_reply() and called it make_rpc_hdr(). created functions create_rpc_reply() and create_rpc_response(). pipenetlog.c pipentlsa.c pipesrvsvc.c calling new create_rpc_reply() function instead of old make_rpc_reply(). proto.h : usual. smb.h: added enum for RPC_PACKET_TYPE (This used to be commit b88ee3e16c6b671069f53ca2e9c5694ec8b1c030)
Diffstat (limited to 'source3/pipeutil.c')
-rw-r--r--source3/pipeutil.c117
1 files changed, 8 insertions, 109 deletions
diff --git a/source3/pipeutil.c b/source3/pipeutil.c
index a939e12766..135eb19190 100644
--- a/source3/pipeutil.c
+++ b/source3/pipeutil.c
@@ -123,51 +123,6 @@ char *dom_sid_to_string(DOM_SID *sid)
return sidstr;
}
-/* BIG NOTE: this function only does SIDS where the identauth is not >= 2^32 */
-/* identauth >= 2^32 can be detected because it will be specified in hex */
-void make_dom_sid(DOM_SID *sid, char *domsid)
-{
- int identauth;
- char *p;
-
- if (sid == NULL) return;
-
- if (domsid == NULL)
- {
- DEBUG(4,("netlogon domain SID: none\n"));
- sid->sid_rev_num = 0;
- sid->num_auths = 0;
- return;
- }
-
- DEBUG(4,("netlogon domain SID: %s\n", domsid));
-
- /* assume, but should check, that domsid starts "S-" */
- p = strtok(domsid+2,"-");
- sid->sid_rev_num = atoi(p);
-
- /* identauth in decimal should be < 2^32 */
- /* identauth in hex should be >= 2^32 */
- identauth = atoi(strtok(0,"-"));
-
- DEBUG(4,("netlogon rev %d\n", sid->sid_rev_num));
- DEBUG(4,("netlogon %s ia %d\n", p, identauth));
-
- sid->id_auth[0] = 0;
- sid->id_auth[1] = 0;
- sid->id_auth[2] = (identauth & 0xff000000) >> 24;
- sid->id_auth[3] = (identauth & 0x00ff0000) >> 16;
- sid->id_auth[4] = (identauth & 0x0000ff00) >> 8;
- sid->id_auth[5] = (identauth & 0x000000ff);
-
- sid->num_auths = 0;
-
- while ((p = strtok(0, "-")) != NULL)
- {
- sid->sub_auths[sid->num_auths++] = atoi(p);
- }
-}
-
int make_dom_sids(char *sids_str, DOM_SID *sids, int max_sids)
{
char *ptr;
@@ -262,77 +217,21 @@ int make_dom_gids(char *gids_str, DOM_GID *gids)
return count;
}
-void create_rpc_reply(RPC_HDR *hdr, uint32 call_id, int data_len)
-{
- if (hdr == NULL) return;
-
- hdr->major = 5; /* RPC version 5 */
- hdr->minor = 0; /* minor version 0 */
- hdr->pkt_type = 2; /* RPC response packet */
- hdr->frag = 3; /* first frag + last frag */
- hdr->pack_type = 0x10; /* packed data representation */
- hdr->frag_len = data_len; /* fragment length, fill in later */
- hdr->auth_len = 0; /* authentication length */
- hdr->call_id = call_id; /* call identifier - match incoming RPC */
- hdr->alloc_hint = data_len - 0x18; /* allocation hint (no idea) */
- hdr->context_id = 0; /* presentation context identifier */
- hdr->cancel_count = 0; /* cancel count */
- hdr->reserved = 0; /* reserved */
-}
-
-int make_rpc_reply(char *inbuf, char *q, int data_len)
+int create_rpc_request(uint32 call_id, uint16 op_num, char *q, int data_len)
{
- uint32 callid = IVAL(inbuf, 12);
RPC_HDR hdr;
- create_rpc_reply(&hdr, callid, data_len);
+ /* XXXX cheat - use cancel count to store opnum */
+ make_rpc_header(&hdr, RPC_RESPONSE, call_id, data_len, op_num);
return smb_io_rpc_hdr(False, &hdr, q, q, 4, 0) - q;
}
-void make_uni_hdr(UNIHDR *hdr, int max_len, int len, uint16 terminate)
-{
- hdr->uni_max_len = 2 * max_len;
- hdr->uni_str_len = 2 * len;
- hdr->undoc = terminate;
-}
-
-void make_uni_hdr2(UNIHDR2 *hdr, int max_len, int len, uint16 terminate)
-{
- make_uni_hdr(&(hdr->unihdr), max_len, len, terminate);
- hdr->undoc_buffer = len > 0 ? 1 : 0;
-}
-
-void make_unistr(UNISTR *str, char *buf)
-{
- /* store the string (null-terminated copy) */
- PutUniCode((char *)(str->buffer), buf);
-}
-
-void make_unistr2(UNISTR2 *str, char *buf, int len)
+int create_rpc_reply(uint32 call_id, char *q, int data_len)
{
- /* set up string lengths. add one if string is not null-terminated */
- str->uni_max_len = len;
- str->undoc = 0;
- str->uni_str_len = len;
-
- /* store the string (null-terminated copy) */
- PutUniCode((char *)str->buffer, buf);
-}
+ RPC_HDR hdr;
-void make_dom_rid2(DOM_RID2 *rid2, uint32 rid)
-{
- rid2->type = 0x5;
- rid2->undoc = 0x5;
- rid2->rid = rid;
- rid2->rid_idx = 0;
+ /* XXXX cheat - use cancel count to store opnum */
+ make_rpc_header(&hdr, RPC_RESPONSE, call_id, data_len, 0);
+ return smb_io_rpc_hdr(False, &hdr, q, q, 4, 0) - q;
}
-void make_dom_sid2(DOM_SID2 *sid2, char *sid_str)
-{
- int len_sid_str = strlen(sid_str);
-
- sid2->type = 0x5;
- sid2->undoc = 0;
- make_uni_hdr2(&(sid2->hdr), len_sid_str, len_sid_str, 0);
- make_unistr (&(sid2->str), sid_str);
-}