Get Samba version or capability information from Windows

Volker Lendecke Volker.Lendecke at SerNet.DE
Sat Jan 19 18:47:57 GMT 2008


Hi, Corinna!

On Sat, Jan 19, 2008 at 03:04:20PM +0100, Corinna Vinschen wrote:
> +struct smb_extra_info *samba_extra_info_version()
> +{
> +	static struct smb_extra_info extra_info;

Hmmm. We got through some pain getting rid of this kind of
static, I'd much rather prefer this to be on the stack,
given to samba_extra_info_version() via a pointer.

>  			unsigned char objid[16];
>  			memcpy(pdata,create_volume_objectid(conn, objid),16);
> +			memcpy(pdata+16,samba_extra_info_version(),48);

Doesn't this create a potential portability problem? It's
not guaranteed that compilers will always put the uint32's
in the struct smb_extra_info consecutively. I could imagine
that some architectures if optimized for speed might align
the struct members on 8-byte boundaries. At least that would
be allowed.

The other problem is the endianess.

I'd much rather like to see the structure marshalled using
the SIVAL() macro. This way you avoid both problems.

Thanks,

Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20080119/991418c5/attachment.bin


More information about the samba-technical mailing list