Re: TSE licenses - continuously asking for new one?
Florent Peterschmitt <[email protected]> Mon, 17 Feb 2014 14:04:42 +0100
| Newsgroups | gmane.network.rdesktop.devel |
|---|---|
| Message-ID | <[email protected]> |
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============3669785109305308992== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DcbJnUUb2Ito2P9uxnaNV9cLvj1KgH9HD" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --DcbJnUUb2Ito2P9uxnaNV9cLvj1KgH9HD Content-Type: multipart/mixed; boundary="------------080206010106060006010706" This is a multi-part message in MIME format. --------------080206010106060006010706 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Henrik, I have a workaround for the license problem. I printed sucesssively g_hostname, hi, ho and hash variables, in load_licence and save_licence, and saw that ho has never the same value and strangely, hi no more. =46rom that results an incorrect hash between load and save calls. I don't know how this is possible, but to make it work, I made a memset on hi and ho before any use of these variables. I'm not sure it is a correct way to do, but for the moment, it works well= =2E See the attached patch. On 07/02/2014 08:29, Henrik Andersson wrote: > On Tue, 04 Feb 2014 22:27:26 +0100 > Florent Peterschmitt <[email protected]> wrote: >=20 >> Le 07/01/2014 09:03, Henrik Andersson a =E9crit : >>> On Mon, 06 Jan 2014 17:04:45 +0100 >>> Florent Peterschmitt <[email protected]> wrote: >>> Hi Florent, >>> >>>> What we see here is: >>>> >>>> 1. search for 09dcea473ad6f1ca5c33bc89df88aa42560b82b4.cal file >>>> 2. fail to open it (it doesn't exists) >>>> 3. write to another file something (a new TSE license?) >>>> 4. close this new file >>>> >>>> If I re-launch rdesktop, then the same file (09...) is asked, not >>>> found and another _new_ CAL file is created. At this point, I have >>>> 2 CAL files. >>>> >>>> If I mv the latest CAL to the wanted CAL (09...), here is what I >>>> have: >>>> >>>> [admin@S777TXDTTEST ~]$ cd .local/share/rdesktop/licenses/ >>>> [admin@S777TXDTTEST licenses]$ ls >>>> 0f6f3932c9ecff5b253edabc71d017de013a1778.cal >>>> ebbcc14692930d5d3f71925f6cc657ec02fa02cf.cal >>>> [admin@S777TXDTTEST licenses]$ mv >>>> 0f6f3932c9ecff5b253edabc71d017de013a1778.cal >>>> 09dcea473ad6f1ca5c33bc89df88aa42560b82b4.cal >>>> [admin@S777TXDTTEST licenses]$ strace -o rdesktop.trace >>>> /usr/bin/rdesktop -x 0x86 -N -a 16 -P -z -k en-us S777SQ01 -u '' >>>> Failed to negotiate protocol, retrying with plain RDP. >>>> * is this behaviour the expected one? >>> >>> No, this is not an expected behavior. >>> >>>> * does this behaviour can be responsible about an over consumption >>>> of TSE licenses? >>>> >>> >>> I'm unsure, i need to investigate the issue first before having a >>> straight up answer, I will take a look at this issue this week and >>> get back to you. >>> >>> >>> Kind Regards, >>> >>> Henrik Andersson (Cendio AB) >> >> Hello, >> >> Did you have the time for any investigation? Also, do you think >> xfreerdp can "solve" this problem? >> >=20 > The license filename hash is generated from local hostname if not > specified by the -n <hostnam> argument to rdesktop. >=20 > I can't reproduce your problem and I have not found any oddities in the= > code regarding the license filename generation. Could you add a debug > print in load_license() and save_license() of g_hostname to verify that= > its same while loading/storing ? >=20 >=20 > Kind Regards, >=20 > Henrik Andersson >=20 --------------080206010106060006010706 Content-Type: text/x-diff; name="rdesktop.wa.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="rdesktop.wa.patch" --- rdesktop-1.8.1/rdesktop.c 2013-11-18 08:00:35.000000000 +0100 +++ rdesktop-1.8.1.modified/rdesktop.c 2014-02-17 13:59:43.313990522 +01= 00 @@ -1652,6 +1652,18 @@ return ret; } =20 +void CST_print(uint8 *in) { + char __gs[10]; + char __gss[512]; + int i; + memset(__gss, '\0', 512); + for(i =3D 0; i < 20; ++i) { + snprintf(__gs, sizeof(__gs), "%d", in[i]); + strncat(__gss, __gs, sizeof(__gs) - 1); + } + printf("DEBUG_CST ho: %s\n", __gss); +} + int load_licence(unsigned char **data) { @@ -1664,11 +1676,19 @@ if (home =3D=3D NULL) return -1; =20 + memset(ho, 0, 20); + memset(hi, 0, 16); + snprintf((char *) hi, 16, "%s", g_hostname); + puts("DEBUG_CST: load"); + printf("DEBUG_CST hiload: %s\n", hi); + CST_print(ho); sec_hash_sha1_16(ho, hi, g_static_rdesktop_salt_16); sec_hash_to_string(hash, sizeof(hash), ho, sizeof(ho)); + CST_print(ho); =20 snprintf(path, PATH_MAX, "%s" RDESKTOP_LICENSE_STORE "/%s.cal", h= ome, hash); + printf("DEBUG_CST hash_load1: %s\n", hash); path[sizeof(path) - 1] =3D '\0'; =20 fd =3D open(path, O_RDONLY); @@ -1690,6 +1710,7 @@ *data =3D (uint8 *) xmalloc(st.st_size); length =3D read(fd, *data, st.st_size); close(fd); + printf("DEBUG_CST loadOK: %s\n", g_hostname); return length; } =20 @@ -1704,6 +1725,9 @@ if (home =3D=3D NULL) return; =20 + memset(ho, 0, 20); + memset(hi, 0, 16); + snprintf(path, PATH_MAX, "%s" RDESKTOP_LICENSE_STORE, home); path[sizeof(path) - 1] =3D '\0'; if (utils_mkdir_p(path, 0700) =3D=3D -1) @@ -1713,12 +1737,17 @@ } =20 snprintf((char *) hi, 16, "%s", g_hostname); + puts("DEBUG_CST: save"); + printf("DEBUG_CST hisave: %s\n", hi); + CST_print(ho); sec_hash_sha1_16(ho, hi, g_static_rdesktop_salt_16); sec_hash_to_string(hash, sizeof(hash), ho, sizeof(ho)); + CST_print(ho); =20 /* write licence to {sha1}.cal.new, then atomically=20 rename to {sha1}.cal */ snprintf(path, PATH_MAX, "%s" RDESKTOP_LICENSE_STORE "/%s.cal", h= ome, hash); + printf("DEBUG_CST hash_save1: %s\n", hash); path[sizeof(path) - 1] =3D '\0'; =20 snprintf(tmppath, PATH_MAX, "%s.new", path); @@ -1743,6 +1772,7 @@ } =20 close(fd); + printf("DEBUG_CST save2: %s\n", g_hostname); } --------------080206010106060006010706-- --DcbJnUUb2Ito2P9uxnaNV9cLvj1KgH9HD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iQIcBAEBAgAGBQJTAgjvAAoJEFr01BkajbiBvJwQAMoYD+xD5cksL4XNAAfUIvYu FUPIZAr0qDpotDRDzuj+3sRjbot6pTqWrBHJb+yN4xsfX6XNZ/3g/EPF23hFFTwV BrOj9NQfK3BfzN89WCV6SILJ2xReVV2RxxLXU3obOSb2Nzu0F4i7eaVi6jqZ+gII /Z+BIH1LjzRWoSyxVcall0zvHChpLY/0omvSkCbu7uvJQxD2O4wax4EXYv+h4vL0 fuig3vnhdmTOw8i/POtWh66Pkq5aO2qULp3wHbXp6winkfBRBgguSutMFDCjTMsk uKYMbpX9NiNpvgdviUXxfgZ8YuL1VmXMFdz1CtlCL84mEajErTUA0nj2g2yxI3b7 74WyxpxxTcxad1u3gHfYj9ch0AgiP794ETG5n7OAFL/NnL0/VmTucxFBulbR3zd7 7YCWM93HiEKqg5RcWeF/2dIEj4S+jo7hStozNiwRwUOur6C8IKUeZuunuYHyDm08 dan/cyCkgxSa1rMyzw1iZiGwyoq0pLj4Oz3SiqMnNWf7hIGTKgA0XFLy+qOOhMjo pz30lx7mQhVVRRBiQgj65wGn7vv9hqoWHdqFhM+teAImeHp3zM0OzRvjYdJmBRVU waeqk2Qmo/Obp61wzZfISPW04OoAx5kVQhO0/A3ieCTrhDEjn7nGTS9A08UpBNdH c6IoaCwZth8WS+UakrWS =F9vN -----END PGP SIGNATURE----- --DcbJnUUb2Ito2P9uxnaNV9cLvj1KgH9HD-- --===============3669785109305308992== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk --===============3669785109305308992== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ rdesktop-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rdesktop-devel --===============3669785109305308992==--