Memcached TODO list?

Lisa Marie Seelye lisa@gentoo.org
Wed, 27 Aug 2003 14:24:10 -0400


--=-ZMHVwhFL/cXjxe6mmsgA
Content-Type: multipart/mixed; boundary="=-CuBexLMenmHG8ggw7C8p"


--=-CuBexLMenmHG8ggw7C8p
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Tue, 2003-08-26 at 14:54, Brad Fitzpatrick wrote:
> Well, I'm sending this mail from danga.com.  Port 2401 looks open and
> happy.

Thanks, Brad.  Seems to be up now (I was able to find the cvs info from
Google).

Attached is a patch that will drop root privileges on start up.

Affected files:
Makefile.am
memcached.c

Added files:
errors.h
setuid.h
setuid.c

I'll admit my C isn't that strong, but this seems to be a good start.

The user that will switched to is defined in setuid.h.  Any error in the
setuid process is given an error label that is defined in errors.h
(seems like as good a place as any to put error labels and possibly
strings).

If the daemon is unable to switch users, it will print an error message
(possibly two, if the user doesn't exist) and continue running as
normal.

Switch users by calling `int switch_user()'.

--=20
Regards,
-Lisa
<Vix ulla tam iniqua pax, quin bello vel aequissimo sit potior>

--=-CuBexLMenmHG8ggw7C8p
Content-Disposition: attachment; filename=setuid.patch
Content-Type: text/x-patch; name=setuid.patch; charset=ISO-8859-1
Content-Transfer-Encoding: base64

Q29tbW9uIHN1YmRpcmVjdG9yaWVzOiBjdnMvLmRlcHMgYW5kIGN2cy1kaWZmLy5kZXBzDQpDb21t
b24gc3ViZGlyZWN0b3JpZXM6IGN2cy9DVlMgYW5kIGN2cy1kaWZmL0NWUw0KZGlmZiAtdU4gY3Zz
L01ha2VmaWxlLmFtIGN2cy1kaWZmL01ha2VmaWxlLmFtDQotLS0gY3ZzL01ha2VmaWxlLmFtCTIw
MDMtMDgtMjcgMTQ6MDE6NDguMDAwMDAwMDAwIC0wNDAwDQorKysgY3ZzLWRpZmYvTWFrZWZpbGUu
YW0JMjAwMy0wOC0yNyAxMzo0ODozMS4wMDAwMDAwMDAgLTA0MDANCkBAIC0xLDYgKzEsNiBAQA0K
IGJpbl9QUk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MC4wMDAwMDAwMDAg
LTA1MDANCisrKyBjdnMtZGlmZi9zZXR1aWQuaAkyMDAzLTA4LTI3IDE0OjExOjAxLjAwMDAwMDAw
MCAtMDQwMA0KQEAgLTAsMCArMSw5IEBADQorLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KKyAqICAgICAg
ICAgICAgc2V0dWlkLmgNCisgKg0KKyAqICBXZWQgQXVnIDI3IDE0OjAwOjEwIDIwMDMNCisgKiAg
TGlzYSBTZWVseWUgPGxpc2FAZ2VudG9vLm9yZz4sIGZvciBtZW1jYWNoZWQNCisgKioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKi8NCisNCisNCisjZGVmaW5lIFBVU0VSSUQgIm1lbWNhY2hlZCINCkNvbW1vbiBz
dWJkaXJlY3RvcmllczogY3ZzL3dlYnNpdGUgYW5kIGN2cy1kaWZmL3dlYnNpdGUNCm==

--=-CuBexLMenmHG8ggw7C8p--

--=-ZMHVwhFL/cXjxe6mmsgA
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

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

iD8DBQA/TPdKy0a1Vh5Jb8URAsAlAKCL1z/sBCktUzgUGBKoRwLjHQSIzQCbBX1+
6L3r5S7vbilwL28jeMQ8Gt4=
=D36B
-----END PGP SIGNATURE-----

--=-ZMHVwhFL/cXjxe6mmsgA--