Filling in calculated SAMR fields

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


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                      
Samba Developer, SuSE Labs, Novell Inc.
Authentication Developer, Samba Team 
Student Network Administrator, Hawker College
-------------- 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 :

More information about the samba-technical mailing list