[6475] in Moira

home help back first fref pref prev next nref lref last post

odd Moira bug in add_list

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Tue Apr 21 21:30:34 2015

From: Jonathan D Reed <jdreed@mit.edu>
To: "moiradev@mit.edu" <moiradev@mit.edu>
Date: Wed, 22 Apr 2015 01:30:31 +0000
Message-ID: <D17231BB-EF3E-4B52-A8C4-0CD676E71BD1@mit.edu>
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_D17231BBEF3E4B52A8C40CD676E71BD1mitedu_"
MIME-Version: 1.0

--_000_D17231BBEF3E4B52A8C40CD676E71BD1mitedu_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

I stumbled across a weird bug in add_list.  When creating a list, if you sp=
ecify the owner as a nonexistent list whose first 4 characters match the fi=
rst 4 characters of the list to be created, the query succeeds and the list=
 is self-owned.  This feels like an obscure string comparison bug in C, but=
 I haven=92t tracked it down yet.

I=92ve only tested this on ttsp so far, because I didn=92t want to pollute =
moira with test lists

Example:

[root@sois-python-dev-1 listmaker]# qy -db ttsp glin thislistdoesnotexist
moira (query): No records in database match query

[root@sois-python-dev-1 listmaker]# qy -db ttsp glin not_a_real_list
moira (query): No records in database match query

[root@sois-python-dev-1 listmaker]# qy -db ttsp glin thislistalsofake
moira (query): No records in database match query

[root@sois-python-dev-1 listmaker]# qy -db ttsp add_list thislistdoesnotexi=
st 1 0 0 1 0 'create unique GID' 0 0 '[NONE]' LIST not_a_real_list NONE NON=
E 'description'
moira (query): No such list

[root@sois-python-dev-1 listmaker]# qy -db ttsp add_list thislistdoesnotexi=
st 1 0 0 1 0 'create unique GID' 0 0 '[NONE]' LIST thislistalsofake NONE NO=
NE 'description'

[root@sois-python-dev-1 listmaker]# qy -s -db ttsp glin thislistdoesnotexis=
t
thislistdoesnotexist, 1, 0, 0, 1, 0, create unique GID, 0, 0, [NONE], LIST,=
 thislistdoesnotexist, NONE, NONE, description, 21-apr-2015 21:26:09, daemo=
n/listmaker-dev.mit.edu@ATHENA.MIT.EDU<mailto:daemon/listmaker-dev.mit.edu@=
ATHENA.MIT.EDU>, mrtest


Obviously the second add_list should have failed.  Testing revealed that if=
 the first 3 characters match, it correctly returns MR_LIST, but if 4+ matc=
h, it defaults to self-owned.

--_000_D17231BBEF3E4B52A8C40CD676E71BD1mitedu_
Content-Type: text/html; charset="Windows-1252"
Content-ID: <B1F57F1AF4818046ADFBE0DA38C8F3FB@exchange.mit.edu>
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
252">
</head>
<body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-lin=
e-break: after-white-space;">
I stumbled across a weird bug in add_list. &nbsp;When creating a list, if y=
ou specify the owner as a nonexistent list whose first 4 characters match t=
he first 4 characters of the list to be created, the query succeeds and the=
 list is self-owned. &nbsp;This feels like
 an obscure string comparison bug in C, but I haven=92t tracked it down yet=
.
<div><br>
</div>
<div>I=92ve only tested this on ttsp so far, because I didn=92t want to pol=
lute moira with test lists</div>
<div><br>
</div>
<div>Example:</div>
<div><br>
</div>
<div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;">[root@sois=
-python-dev-1 listmaker]# qy -db ttsp glin thislistdoesnotexist</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;">moira (que=
ry): No records in database match query&nbsp;</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;"><br>
</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;">[root@sois=
-python-dev-1 listmaker]# qy -db ttsp glin not_a_real_list</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;">moira (que=
ry): No records in database match query&nbsp;</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;"><br>
</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;">[root@sois=
-python-dev-1 listmaker]# qy -db ttsp glin thislistalsofake</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;">moira (que=
ry): No records in database match query&nbsp;</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;"><br>
</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;">[root@sois=
-python-dev-1 listmaker]# qy -db ttsp add_list thislistdoesnotexist 1 0 0 1=
 0 'create unique GID' 0 0 '[NONE]' LIST not_a_real_list NONE NONE 'descrip=
tion'</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;">moira (que=
ry): No such list&nbsp;</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;"><br>
</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;">[root@sois=
-python-dev-1 listmaker]# qy -db ttsp add_list thislistdoesnotexist 1 0 0 1=
 0 'create unique GID' 0 0 '[NONE]' LIST thislistalsofake NONE NONE 'descri=
ption'</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;"><br>
</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;">[root@sois=
-python-dev-1 listmaker]# qy -s -db ttsp glin thislistdoesnotexist</div>
<div style=3D"margin: 0px; font-size: 11px; font-family: Menlo;">thislistdo=
esnotexist, 1, 0, 0, 1, 0, create unique GID, 0, 0, [NONE], LIST, thislistd=
oesnotexist, NONE, NONE, description, 21-apr-2015 21:26:09,
<a href=3D"mailto:daemon/listmaker-dev.mit.edu@ATHENA.MIT.EDU">daemon/listm=
aker-dev.mit.edu@ATHENA.MIT.EDU</a>, mrtest</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Obviously the second add_list should have failed. &nbsp;Testing reveal=
ed that if the first 3 characters match, it correctly returns MR_LIST, but =
if 4&#43; match, it defaults to self-owned.</div>
</body>
</html>

--_000_D17231BBEF3E4B52A8C40CD676E71BD1mitedu_--

home help back first fref pref prev next nref lref last post