[Xcb] authorization API and implementation changes

Jamey Sharp jamey@minilop.net
Sun, 9 Nov 2003 00:49:28 -0800


--8R/sMIKPJVD0CT2D
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

I told Bart that if I had to do any work in xcb_auth I was going to
refactor it because I couldn't stand reading it. So I've refactored it.
(Gosh, Bart, aren't you the advocate of programming by successive
establishment of invariants and the opponent of copy-and-paste code?
And did you even test XDM-AUTH-1? That code was unreachable.)

Aw, truth is the code wasn't so bad: it's just fun to tease the software
engineering professor. ;-)

So the big change I was making was to make the XCBAuthInfo structure
contain pointers instead of statically allocated arrays, which I did
mostly because I don't trust authorization data to be limited to 256
bytes or any similarly reasonable size. If anyone wants to argue with me
on that point I'm happy to listen, but the X protocol allows 64kB auth
name and data fields.

I also partially undid an API change I made recently: XCBConnect now
takes a file descriptor and an XCBAuthInfo*, so that if XCL's
XSetAuthorization implementation is actually called (like by kdm) it can
pass that data on to XCB.

I also changed the API so XCBGetAuthInfo returns int, not a pointer to
XCBAuthInfo. I really wanted to be able to count on the assumption that
it was my XCBAuthInfo that I was supposed to pass on other things, and
having some pointer returned didn't make that clear. Returning int also
allows me to clearly distinguish between "no auth info found" and "error
occured getting auth info", which was possible before but was not how it
was implemented, which confused Bart too. All in all, this API change
makes my brain hurt less.=20

More news when I'm not so sleepy.
--=20
Jamey Sharp <jamey@minilop.net> - http://minilop.net/

--8R/sMIKPJVD0CT2D
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/rf+YNgAXSpyH6VcRAnElAJ9Zcfk+MU+Ad60agwAdbbiUAp8NIwCfXuBZ
utBELwhCiDdJE2/w1E0oImE=
=zNyt
-----END PGP SIGNATURE-----

--8R/sMIKPJVD0CT2D--