[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1610-g1f0eaaa

Volker Lendecke vl at samba.org
Tue Jan 22 12:27:52 GMT 2008


The branch, v3-2-test has been updated
       via  1f0eaaa5911f893c822465a26fe49ab65afb0730 (commit)
       via  85123aacdb13e97c3f44aeded1c80e13af53d83d (commit)
       via  28aa1c199d3a22cda34afcaab49c0561eeb0abcb (commit)
      from  e9bb3d5067b74a29beb778f85687829778e42b5b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 1f0eaaa5911f893c822465a26fe49ab65afb0730
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jan 22 13:00:22 2008 +0100

    Move samba_extended_info_version to smbd/trans2.c
    
    This is right now only used there, and in version.c it gave linker errors
    because some binaries (e.g. smbmnt) don't link in time.o

commit 85123aacdb13e97c3f44aeded1c80e13af53d83d
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jan 22 12:46:51 2008 +0100

    Avoid use of uninitialized memory

commit 28aa1c199d3a22cda34afcaab49c0561eeb0abcb
Author: Corinna Vinschen <corinna at vinschen.de>
Date:   Tue Jan 22 11:33:17 2008 +0100

    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

-----------------------------------------------------------------------

Summary of changes:
 source/include/smb.h |   11 +++++++++++
 source/smbd/trans2.c |   39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/smb.h b/source/include/smb.h
index 7de3568..f3cf1db 100644
--- a/source/include/smb.h
+++ b/source/include/smb.h
@@ -1936,4 +1936,15 @@ enum usershare_err {
 /* Different reasons for closing a file. */
 enum file_close_type {NORMAL_CLOSE=0,SHUTDOWN_CLOSE,ERROR_CLOSE};
 
+/* Used in SMB_FS_OBJECTID_INFORMATION requests.  Must be exactly 48 bytes. */
+#define SAMBA_EXTENDED_INFO_MAGIC 0x536d4261 /* "SmBa" */
+#define SAMBA_EXTENDED_INFO_VERSION_STRING_LENGTH 28
+struct smb_extended_info {
+	uint32 samba_magic;		/* Always SAMBA_EXTRA_INFO_MAGIC */
+	uint32 samba_version;		/* Major/Minor/Release/Revision */
+	uint32 samba_subversion;	/* Prerelease/RC/Vendor patch */
+	NTTIME samba_gitcommitdate;
+	char   samba_version_string[SAMBA_EXTENDED_INFO_VERSION_STRING_LENGTH];
+};
+
 #endif /* _SMB_H */
diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c
index b5b3ea7..8b999cd 100644
--- a/source/smbd/trans2.c
+++ b/source/smbd/trans2.c
@@ -2459,6 +2459,38 @@ unsigned char *create_volume_objectid(connection_struct *conn, unsigned char obj
 	return objid;
 }
 
+static void samba_extended_info_version(struct smb_extended_info *extended_info)
+{
+	SMB_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));
+
+	memset(extended_info->samba_version_string, 0,
+	       sizeof(extended_info->samba_version_string));
+
+	snprintf (extended_info->samba_version_string,
+		  sizeof(extended_info->samba_version_string),
+		  "%s", samba_version_string());
+}
+
 /****************************************************************************
  Reply to a TRANS2_QFSINFO (query filesystem info).
 ****************************************************************************/
@@ -2797,7 +2829,14 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
 		case SMB_FS_OBJECTID_INFORMATION:
 		{
 			unsigned char objid[16];
+			struct smb_extended_info extended_info;
 			memcpy(pdata,create_volume_objectid(conn, objid),16);
+			samba_extended_info_version (&extended_info);
+			SIVAL(pdata,16,extended_info.samba_magic);
+			SIVAL(pdata,20,extended_info.samba_version);
+			SIVAL(pdata,24,extended_info.samba_subversion);
+			SBIG_UINT(pdata,28,extended_info.samba_gitcommitdate);
+			memcpy(pdata+36,extended_info.samba_version_string,28);
 			data_len = 64;
 			break;
 		}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list