Filling in calculated SAMR fields

Andrew Bartlett abartlet at samba.org
Thu Jul 28 23:03:35 GMT 2005


Mimir,

I just found this little gem in the libnet/userman.c code, which has me
confused:  Why are you filling in the name and length fields, when the
NDR layer will just overwrite them?  Or is there something more subtle
going on here?

If it's just 'extra work', perhaps it gives more weight to the argument
that exposing these elements to the C interface is a bad idea, as it
will just cause confusion.  Is there ever a time when we should read or
write anything but the .string element?

/**
 * Stage 2: Open user account
 */
static NTSTATUS usermod_open(struct composite_context *c,
			     struct usermod_state *s)
{

			level = 7;
			i->info7.account_name.length = 2*strlen_m(s->change.account_name);
			i->info7.account_name.size   = 2*strlen_m(s->change.account_name);
			i->info7.account_name.string = s->change.account_name;

			s->change.fields ^= USERMOD_FIELD_ACCOUNT_NAME;


-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Samba Developer, SuSE Labs, Novell Inc.        http://suse.de
Authentication Developer, Samba Team           http://samba.org
Student Network Administrator, Hawker College  http://hawkerc.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20050729/b0351242/attachment.bin


More information about the samba-technical mailing list