TODO fix callers s3:smbXsrv_session: for now truncate to session_ids to UINT16_MAX
authorStefan Metzmacher <metze@samba.org>
Sat, 28 Apr 2012 09:09:25 +0000 (11:09 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 16 May 2012 06:10:16 +0000 (08:10 +0200)
Currently all callers use 'uint16_t vuid'.

metze

source3/smbd/smbXsrv_session.c

index 805959a21f4e6ccc06201bdb8e20fd922449490f..7043122f6a861c55d7b50599a6d79aad824e8467 100644 (file)
@@ -447,6 +447,14 @@ static NTSTATUS smbXsrv_session_global_allocate(struct db_context *db,
                } else {
                        id = generate_random();
                }
+               if (id >= UINT16_MAX) {
+                       /*
+                        * For now we truncate to 16bit,
+                        * as that's what all callers
+                        * expect (uint16_t vuid).
+                        */
+                       id = id & UINT16_MAX;
+               }
                if (id == 0) {
                        id++;
                }