hamano(a)osstech.co.jp wrote:
> Full_Name: HAMANO Tsukasa
> Version: git master
> OS: Linux
> URL: ftp://ftp.openldap.org/incoming/0001-New-PBKDF2-module.patch
> Submission from: (NULL) (240b:10:2640:bf0:c1b8:b6c9:76f:8964)
>
>
> PBKDF2(RFC 2898) suport for OpenLDAP
> See README for details.
Thanks for the submission, added to git master.
>
> --
> The attached patch file is derived from OpenLDAP Software. All of the
> modifications to OpenLDAP Software represented in the following
> patch(es) were developed by HAMANO Tsukasa <hamano(a)osstech.co.jp>. I
> have not assigned rights and/or interest in this work to any party.
>
> Copyright 2013 HAMANO Tsukasa <hamano(a)osstech.co.jp>
> Redistribution and use in source and binary forms, with or without
> modification, are permitted only as authorized by the OpenLDAP Public
> License.
>
>
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
--533b042f_327b23c6_a8c6
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
I agree that it would be great to have MDB=5FNOT=46OUND returned
instead of EINVAL. =46or my purposes, I needed a work around to the
issue, and this seemed to work. Additionally because I=E2=80=99m in Go an=
d not
C, I cannot easily make use of the system definition for EINVAL.
Best Regards,
Armon Dadgar
=46rom:=C2=A0Hallvard Breien =46uruseth h.b.furuseth=40usit.uio.no
Reply:=C2=A0Hallvard Breien =46uruseth h.b.furuseth=40usit.uio.no
Date:=C2=A0April 1, 2014 at 8:36:43 AM
To:=C2=A0armon.dadgar=40gmail.comarmon.dadgar=40gmail.comCc:=C2=A0openldap-its=40openldap.orgopenldap-its=40openldap.org
Subject:=C2=A0 Re: (ITS=237829) MDB mdb=5Fcursor=5Fdel causes records to =
be skipped =20
On =46ri, 2014-03-28 at 04:58 +0000, armon.dadgar=40gmail.com wrote: =20
> I have a gist demonstrating this: https://gist.github.com/armon/9825666=
=20
Some notes about this code: =20
// LMDB will return EINVAL(22) for the GET=5FCURRENT op if =20
// there is no further keys. We treat this as no more =20
// keys being found. =20
if num, ok :=3D err.(mdb.Errno); ok && num =3D=3D 22 =7B =20
println(=22errno 22=22) =20
err =3D mdb.Not=46ound =20
=7D =20
The value of EINVAL is OS-dependent, it need not be 22. =20
EINVAL means you did something wrong, it's a bad idea to =20
assume it means any particular wrong thing. =46or one thing, =20
mdb might not keep catching that error. I'd follow up =20
with a test check that there are indeed no more keys. =20
That said, mdb=5Fcursor=5Fdel() followed by MDB=5FGET=5FCURRENT =20
seems to me a sensible thing to want to do. So I think =20
MDB=5FGET=5FCURRENT should return MDB=5FNOT=46OUND here. And maybe =20
also after cursor=5Fnext() returned MDB=5FNOT=46OUND, and on an =20
empty DB. OTOH maybe cursors would need to keep more state =20
to tell this from user errors which should get EINVAL. =20
--533b042f_327b23c6_a8c6
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
<html><head><style>body=7Bfont-family:Helvetica,Arial;font-size:13px=7D</=
style></head><body style=3D=22word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;=22><div id=3D=22bloop=5Fcust=
omfont=22 style=3D=22font-family:Helvetica,Arial;font-size:13px; color: r=
gba(0,0,0,1.0); margin: 0px; line-height: auto;=22>I agree that it would =
be great to have MDB=5FNOT=46OUND returned</div><div id=3D=22bloop=5Fcust=
omfont=22 style=3D=22font-family:Helvetica,Arial;font-size:13px; color: r=
gba(0,0,0,1.0); margin: 0px; line-height: auto;=22>instead of EINVAL. =46=
or my purposes, I needed a work around to the</div><div id=3D=22bloop=5Fc=
ustomfont=22 style=3D=22font-family:Helvetica,Arial;font-size:13px; color=
: rgba(0,0,0,1.0); margin: 0px; line-height: auto;=22>issue, and this see=
med to work. Additionally because I=E2=80=99m in Go and not</div><div id=3D=
=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial;font-size=
:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;=22>C, I ca=
nnot easily make use of the system definition for EINVAL.</div><div id=3D=
=22bloop=5Fcustomfont=22 style=3D=22font-family:Helvetica,Arial;font-size=
:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;=22><br></d=
iv> <div id=3D=22bloop=5Fsign=5F1396376480489799936=22 class=3D=22bloop=5F=
sign=22><div style=3D=22font-family:helvetica,arial;font-size:13px=22>Bes=
t Regards,</div><div style=3D=22font-family:helvetica,arial;font-size:13p=
x=22>Armon Dadgar<br></div></div> <div style=3D=22color:black=22><br>=46r=
om: <span style=3D=22color:black=22>Hallvard Breien =46uruseth</span=
> <a href=3D=22mailto:h.b.furuseth=40usit.uio.no=22>h.b.furuseth=40usit.u=
io.no</a><br>Reply: <span style=3D=22color:black=22>Hallvard Breien =
=46uruseth</span> <a href=3D=22mailto:h.b.furuseth=40usit.uio.no=22>h.b.f=
uruseth=40usit.uio.no</a><br>Date: <span style=3D=22color:black=22>A=
pril 1, 2014 at 8:36:43 AM</span><br>To: <span style=3D=22color:blac=
k=22>armon.dadgar=40gmail.com</span> <a href=3D=22mailto:armon.dadgar=40g=
mail.com=22>armon.dadgar=40gmail.com</a><br>Cc: <span style=3D=22col=
or:black=22>openldap-its=40openldap.org</span> <a href=3D=22mailto:openld=
ap-its=40openldap.org=22>openldap-its=40openldap.org</a><br>Subject: =
;<span style=3D=22color:black=22> Re: (ITS=237829) MDB mdb=5Fcursor=5Fdel=
causes records to be skipped <br></span></div><br> <blockquote type=3D=22=
cite=22 class=3D=22clean=5Fbq=22><span><div><div></div><div>On =46ri, 201=
4-03-28 at 04:58 +0000, armon.dadgar=40gmail.com wrote:
<br>> I have a gist demonstrating this: https://gist.github.com/armon/=
9825666
<br>
<br>Some notes about this code:
<br> // LMDB will return EINVAL(22) for the GET=5FCURRENT op if
<br> // there is no further keys. We treat this as no more
<br> // keys being found.
<br> if num, ok :=3D err.(mdb.Errno); ok && num =3D=3D 22 =7B
<br> println(=22errno 22=22)
<br> err =3D mdb.Not=46ound
<br> =7D
<br>
<br>The value of EINVAL is OS-dependent, it need not be 22.
<br>
<br>EINVAL means you did something wrong, it's a bad idea to
<br>assume it means any particular wrong thing. =46or one thing,
<br>mdb might not keep catching that error. I'd follow up
<br>with a test check that there are indeed no more keys.
<br>
<br>
<br>That said, mdb=5Fcursor=5Fdel() followed by MDB=5FGET=5FCURRENT
<br>seems to me a sensible thing to want to do. So I think
<br>MDB=5FGET=5FCURRENT should return MDB=5FNOT=46OUND here. And maybe
<br>also after cursor=5Fnext() returned MDB=5FNOT=46OUND, and on an
<br>empty DB. OTOH maybe cursors would need to keep more state
<br>to tell this from user errors which should get EINVAL.
<br>
<br></div></div></span></blockquote></body></html>
--533b042f_327b23c6_a8c6--
On Fri, 2014-03-28 at 04:58 +0000, armon.dadgar(a)gmail.com wrote:
> I have a gist demonstrating this: https://gist.github.com/armon/9825666
Some notes about this code:
// LMDB will return EINVAL(22) for the GET_CURRENT op if
// there is no further keys. We treat this as no more
// keys being found.
if num, ok := err.(mdb.Errno); ok && num == 22 {
println("errno 22")
err = mdb.NotFound
}
The value of EINVAL is OS-dependent, it need not be 22.
EINVAL means you did something wrong, it's a bad idea to
assume it means any particular wrong thing. For one thing,
mdb might not keep catching that error. I'd follow up
with a test check that there are indeed no more keys.
That said, mdb_cursor_del() followed by MDB_GET_CURRENT
seems to me a sensible thing to want to do. So I think
MDB_GET_CURRENT should return MDB_NOTFOUND here. And maybe
also after cursor_next() returned MDB_NOTFOUND, and on an
empty DB. OTOH maybe cursors would need to keep more state
to tell this from user errors which should get EINVAL.