CVS update: samba/source/rpc_parse
Jeremy Allison
jeremy at valinux.com
Thu May 10 03:31:06 EST 2001
Jean Francois Micouleau wrote:
>
> On Wed, 9 May 2001, Jeremy Allison wrote:
>
> > Tim Potter wrote:
> > >
> > > Date: Tuesday May 8, 2001 @ 22:05
> > > Author: tpot
> > >
> > > Update of /data/cvs/samba/source/rpc_parse
> > > In directory va:/tmp/cvs-serv29186
> > >
> > > Modified Files:
> > > parse_samr.c
> > > Log Message:
> > > So the samr_io_userinfo_ctr was requiring a SAM_USERINFO_CTR to be passed
> > > in as well as tallocating space for one itself. I've deleted code so the
> > > passed in container is used to store the SAM user info. This may have
> > > broken some server side SAM stuff which probably isn't used anyway. )-:
> >
> > Ah bum. I'd rather you deleted the passed in version, so
> > that it's *always* alloced. That makes for much cleaner
> > code.
>
> wrong too. on marshalling that's the passed version the valid one.
> on unmarshalling you should allocate before unmarshalling and return that
> one.
>
> I sent a mail to tpot in private this morning to tell him already :-)
>
> Jeremy, that's exactly the same thing as I asked you on monday evening.
That's what I meant by "always alloced" - I meant "always"
as in, on unmarshall :-).
Of course it needs to be valid on marshall :-).
Look at this code in parse_sec.c which was the fist
code changed to make use of this :
---------------------------------------------------------------------
/*******************************************************************
Reads or writes a SEC_ACL structure.
First of the xx_io_xx functions that allocates its data structures
for you as it reads them.
********************************************************************/
BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth)
{
int i;
uint32 old_offset;
uint32 offset_acl_size;
SEC_ACL *psa;
if (ppsa == NULL)
return False;
psa = *ppsa;
if(UNMARSHALLING(ps) && psa == NULL) {
/*
* This is a read and we must allocate the stuct to read into.
*/
if((psa = (SEC_ACL *)prs_alloc_mem(ps, sizeof(SEC_ACL))) == NULL)
return False;
*ppsa = psa;
}
---------------------------------------------------------------------
Go thou and code likewise :-).
Jeremy.
--
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------
More information about the samba-cvs
mailing list