diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-01-22 11:33:17 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-01-22 12:39:47 +0100 |
commit | 28aa1c199d3a22cda34afcaab49c0561eeb0abcb (patch) | |
tree | c3e15689094998a791f4f3283e437eff8ff36d9e /source/lib/version.c | |
parent | e9bb3d5067b74a29beb778f85687829778e42b5b (diff) | |
download | samba-28aa1c199d3a22cda34afcaab49c0561eeb0abcb.tar.gz samba-28aa1c199d3a22cda34afcaab49c0561eeb0abcb.tar.xz samba-28aa1c199d3a22cda34afcaab49c0561eeb0abcb.zip |
Get Samba version or capability information from Windows
On Jan 21 16:18, Danilo Almeida wrote:
> Corina wrote:
>
> > + time_t samba_gitcommitdate;
>
> And:
>
> > + SIVAL(pdata,28,extended_info.samba_gitcommitdate);
> > + memcpy(pdata+32,extended_info.samba_version_string,32);
>
> Note that you are dropping bits on a system w/64-bit time_t, and that this has the 2038 problem.
Right. I changed samba_gitcommitdate from time_t to NTTIME and shortened
samba_version_string to 28 bytes. New patch below.
Thanks,
Corinna
Diffstat (limited to 'source/lib/version.c')
-rw-r--r-- | source/lib/version.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/lib/version.c b/source/lib/version.c index 3cae02ad2ee..38c4f45ac6a 100644 --- a/source/lib/version.c +++ b/source/lib/version.c @@ -59,3 +59,32 @@ const char *samba_version_string(void) return samba_version; #endif } + +void samba_extended_info_version(struct smb_extended_info *extended_info) +{ + assert(extended_info != NULL); + + extended_info->samba_magic = SAMBA_EXTENDED_INFO_MAGIC; + extended_info->samba_version = ((SAMBA_VERSION_MAJOR & 0xff) << 24) + | ((SAMBA_VERSION_MINOR & 0xff) << 16) + | ((SAMBA_VERSION_RELEASE & 0xff) << 8); +#ifdef SAMBA_VERSION_REVISION + extended_info->samba_version |= (tolower(*SAMBA_VERSION_REVISION) - 'a' + 1) & 0xff; +#endif +#ifdef SAMBA_VERSION_RC_RELEASE + extended_info->samba_subversion |= (SAMBA_VERSION_RC_RELEASE & 0xff) << 24; +#else +#ifdef SAMBA_VERSION_PRE_RELEASE + extended_info->samba_subversion |= (SAMBA_VERSION_PRE_RELEASE & 0xff) << 16; +#endif +#endif +#ifdef SAMBA_VERSION_VENDOR_PATCH + extended_info->samba_subversion |= (SAMBA_VERSION_VENDOR_PATCH & 0xffff); +#endif + /* FIXME: samba_gitcommitdate should contain the git commit date. */ + unix_to_nt_time(&extended_info->samba_gitcommitdate, time(NULL)); + + snprintf (extended_info->samba_version_string, + SAMBA_EXTENDED_INFO_VERSION_STRING_LENGTH, + "%s", samba_version_string()); +} |