summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>1997-09-30 18:08:11 +0000
committerBill Paul <wpaul@FreeBSD.org>1997-09-30 18:08:11 +0000
commit23677e98fe628331f7eb20a472bb7005f0ce7087 (patch)
tree52343dcd6f6e514687cfaa098aeedcf8ceb5c4bf /libexec
parent026650e576c37dcd3f4b513e9b7a0b9cc5b3d4b1 (diff)
Notes
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ypxfr/ypxfr_main.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/libexec/ypxfr/ypxfr_main.c b/libexec/ypxfr/ypxfr_main.c
index 6e42c05ae93d..1c905cca367f 100644
--- a/libexec/ypxfr/ypxfr_main.c
+++ b/libexec/ypxfr/ypxfr_main.c
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ypxfr_main.c,v 1.8 1997/02/22 14:22:48 peter Exp $
+ * $Id: ypxfr_main.c,v 1.9 1997/03/28 15:48:21 imp Exp $
*/
#include <stdio.h>
#include <stdlib.h>
@@ -51,7 +51,7 @@ struct dom_binding {};
#include "ypxfr_extern.h"
#ifndef lint
-static const char rcsid[] = "$Id: ypxfr_main.c,v 1.8 1997/02/22 14:22:48 peter Exp $";
+static const char rcsid[] = "$Id: ypxfr_main.c,v 1.9 1997/03/28 15:48:21 imp Exp $";
#endif
char *progname = "ypxfr";
@@ -133,10 +133,26 @@ int ypxfr_foreach(status, key, keylen, val, vallen, data)
if (status != YP_TRUE)
return (status);
- dbkey.data = key;
- dbkey.size = keylen;
- dbval.data = val;
- dbval.size = vallen;
+ /*
+ * XXX Do not attempt to write zero-length keys or
+ * data into a Berkeley DB hash database. It causes a
+ * strange failure mode where sequential searches get
+ * caught in an infinite loop.
+ */
+ if (keylen) {
+ dbkey.data = key;
+ dbkey.size = keylen;
+ } else {
+ dbkey.data = "";
+ dbkey.size = 1;
+ }
+ if (vallen) {
+ dbval.data = val;
+ dbval.size = vallen;
+ } else {
+ dbval.data = "";
+ dbval.size = 1;
+ }
if (yp_put_record(dbp, &dbkey, &dbval, 0) != YP_TRUE)
return(yp_errno);