Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Apr 2013 16:38:46 -0400 (EDT)
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        freebsd-hackers@freebsd.org
Subject:   review of patches for the gssd that handle getpwXX_r ERANGE return
Message-ID:  <1513398963.1192605.1367095126723.JavaMail.root@erie.cs.uoguelph.ca>
In-Reply-To: <1589161980.1192602.1367095122855.JavaMail.root@erie.cs.uoguelph.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
------=_Part_1192604_1659352415.1367095126720
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Hi,

I have attached two patches, which can also be found at:
  http://people.freebsd.org/~rmacklem/getpw.patch1 and getpw.patch2

They are almost identical and handle the ERANGE error return from
getpw[nam|uid]_r() when buf[128] isn't large enough.

Is anyone interested in reviewing these? (This has been discussed
some time ago, but the patch was never reviewed. Actually I reviewed
a patch similar to this, but the submitter subsequently requested that
I not use their patch, so I wrote similar ones.)

Thanks in advance for any review, rick

------=_Part_1192604_1659352415.1367095126720
Content-Type: text/x-patch; name=getpw.patch1
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=getpw.patch1

LS0tIHVzci5zYmluL2dzc2QvZ3NzZC5jLnNhdgkyMDEzLTA0LTI2IDIwOjM4OjQ1LjAwMDAwMDAw
MCAtMDQwMAorKysgdXNyLnNiaW4vZ3NzZC9nc3NkLmMJMjAxMy0wNC0yNiAyMDozODo1My4wMDAw
MDAwMDAgLTA0MDAKQEAgLTM3LDYgKzM3LDcgQEAgX19GQlNESUQoIiRGcmVlQlNEOiBoZWFkL3Vz
ci5zYmluL2dzc2QvZwogI2luY2x1ZGUgPGN0eXBlLmg+CiAjaW5jbHVkZSA8ZGlyZW50Lmg+CiAj
aW5jbHVkZSA8ZXJyLmg+CisjaW5jbHVkZSA8ZXJybm8uaD4KICNpZm5kZWYgV0lUSE9VVF9LRVJC
RVJPUwogI2luY2x1ZGUgPGtyYjUuaD4KICNlbmRpZgpAQCAtNTU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EVSQU5HRSkKKwkJCQkJYnJlYWs7CisJCQkJaWYgKGJ1Zmxl
biA+IHNpemVvZihidWYpKQorCQkJCQlmcmVlKGJ1ZnApOworCQkJCWJ1ZmxlbiArPSAxMDI0Owor
CQkJCWlmIChidWZsZW4gPiBidWZsZW5faGludCkKKwkJCQkJYnVmbGVuX2hpbnQgPSBidWZsZW47
CisJCQl9CiAJCQlpZiAocHcpIHsKIAkJCQlpbnQgbGVuID0gTkdSUFM7CiAJCQkJaW50IGdyb3Vw
c1tOR1JQU107CkBAIC01ODQsNiArNjA1LDggQEAgZ3NzZF9wbmFtZV90b191aWRfMV9zdmMocG5h
bWVfdG9fdWlkX2FyZwogCQkJCXJlc3VsdC0+Z2lkbGlzdC5naWRsaXN0X2xlbiA9IDA7CiAJCQkJ
cmVzdWx0LT5naWRsaXN0LmdpZGxpc3RfdmFsID0gTlVMTDsKIAkJCX0KKwkJCWlmIChidWZwICE9
IE5VTEwgJiYgYnVmbGVuID4gc2l6ZW9mKGJ1ZikpCisJCQkJZnJlZShidWZwKTsKIAkJfQogCX0g
ZWxzZSB7CiAJCXJlc3VsdC0+bWFqb3Jfc3RhdHVzID0gR1NTX1NfQkFEX05BTUU7Cg==
------=_Part_1192604_1659352415.1367095126720
Content-Type: text/x-patch; name=getpw.patch2
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=getpw.patch2

LS0tIGtlcmJlcm9zNS9saWIvbGliZ3NzYXBpX2tyYjUvcG5hbWVfdG9fdWlkLmMuc2F2CTIwMTMt
MDQtMjYgMjA6Mzc6NDUuMDAwMDAwMDAwIC0wNDAwCisrKyBrZXJiZXJvczUvbGliL2xpYmdzc2Fw
aV9rcmI1L3BuYW1lX3RvX3VpZC5jCTIwMTMtMDQtMjcgMTY6MjU6MTQuMDAwMDAwMDAwIC0wNDAw
CkBAIC0yNiw2ICsyNiw3IEBACiAgKi8KIC8qICRGcmVlQlNEOiBoZWFkL2tlcmJlcm9zNS9saWIv
bGliZ3NzYXBpX2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wkJaWYgKGJ1ZnAgPT0gTlVMTCkKKwkJCWJyZWFrOworCQllcnJvciA9IGdldHB3bmFtX3Io
bG5hbWUsICZwd2QsIGJ1ZnAsIGJ1ZmxlbiwgJnB3KTsKKwkJaWYgKGVycm9yICE9IEVSQU5HRSkK
KwkJCWJyZWFrOworCQlpZiAoYnVmbGVuID4gc2l6ZW9mKGJ1ZikpCisJCQlmcmVlKGJ1ZnApOwor
CQlidWZsZW4gKz0gMTAyNDsKKwkJaWYgKGJ1ZmxlbiA+IGJ1Zmxlbl9oaW50KQorCQkJYnVmbGVu
X2hpbnQgPSBidWZsZW47CisJfQogCWlmIChwdykgewogCQkqdWlkcCA9IHB3LT5wd191aWQ7Ci0J
CXJldHVybiAoR1NTX1NfQ09NUExFVEUpOworCQlyZXQgPSBHU1NfU19DT01QTEVURTsKIAl9IGVs
c2UgewotCQlyZXR1cm4gKEdTU19TX0ZBSUxVUkUpOworCQlyZXQgPSBHU1NfU19GQUlMVVJFOwog
CX0KKwlpZiAoYnVmcCAhPSBOVUxMICYmIGJ1ZmxlbiA+IHNpemVvZihidWYpKQorCQlmcmVlKGJ1
ZnApOworCXJldHVybiAocmV0KTsKIH0K
------=_Part_1192604_1659352415.1367095126720--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1513398963.1192605.1367095126723.JavaMail.root>