CVS update: samba/source/rpc_parse

Luke Leighton lkcl at samba.anu.edu.au
Mon Jan 31 17:00:43 EST 2000


Date:	Monday January 31, 2000 @ 17:00
Author:	lkcl

Update of /data/cvs/samba/source/rpc_parse
In directory samba:/tmp/cvs-serv3548/rpc_parse

Modified Files:
      Tag: SAMBA_TNG
	parse_prs.c 
Log Message:
some ideas are JUST so cool, i can't get over it.

created the following two functions:

int prs_tdb_store(TDB_CONTEXT *tdb, int flgs, prs_struct *pk, prs_struct *pd);
void prs_tdb_fetch(TDB_CONTEXT *tdb, prs_struct *pk, prs_struct *pd);

they are SO cool, it's unbelievable.  one prs_struct is used as a key,
the other as data.  they are used like this, which does a lookup of a
UNICODE domain name to look up the SID associated with it.

andrew, i'm in love with the tdb database code!

the point of using smb_io_unistr2 and smb_io_dom_sid is that these create
NDR (network data representation) flattened versions of the two
variable-length data structures, uni_domain and sid.  so it's an optimal
usage of pre-existing functions and also a reasonably optimal use of
database space (i cannot be bothered to write better disk-space-saving code
because these smb_io_() functions already exist).

p.s did i say i love the tdb code, already?

static uint32 tdb_lookup_domain(TDB_CONTEXT *tdb,
				const UNISTR2* uni_domain,
				DOM_SID *sid)
{
	prs_struct key;
	prs_struct data;
	UNISTR2 uni_dom_copy;

	copy_unistr2(&uni_dom_copy, uni_domain);

	prs_init(&key, 0, 4, False);
	if (!smb_io_unistr2("dom", &uni_dom_copy, True, &key, 0))
	{
		return NT_STATUS_NO_MEMORY;
	}

	prs_tdb_fetch(tdb, &key, &data);

	if (!smb_io_dom_sid("sid", sid, &data, 0))
	{
		prs_free_data(&key);
		prs_free_data(&data);
		return NT_STATUS_NO_SUCH_DOMAIN;
	}

	prs_free_data(&key);
	prs_free_data(&data);

	return 0x0;
}

<a href="mailto:lkcl at samba.org"   > Luke Kenneth Casson Leighton    </a>
<a href="http://www.cb1.com/~lkcl"> Samba and Network Development   </a>
<a href="http://samba.org"        > Samba Web site                  </a>
<a href="http://www.iss.net"      > Internet Security Systems, Inc. </a>
<a href="http://mcp.com"          > Macmillan Technical Publishing  </a>

 ISBN1578701503 DCE/RPC over SMB: Samba and Windows NT Domain Internals


More information about the samba-cvs mailing list