]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-shell/result.c
Happy New Year!
[openldap] / servers / slapd / back-shell / result.c
index 734beb3760b8f01de1e2b1669226938bed75c935..571d3c9b8819dae60276a9f07a38d7966257bc1b 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2012 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -49,6 +49,7 @@ read_and_send_results(
        int     bsize, len;
        char    *buf, *bp;
        char    line[BUFSIZ];
+       char    ebuf[128];
 
        /* read in the result and send it along */
        buf = (char *) ch_malloc( BUFSIZ );
@@ -61,7 +62,7 @@ read_and_send_results(
                        if ( errno == EINTR ) continue;
 
                        Debug( LDAP_DEBUG_ANY, "shell: fgets failed: %s (%d)\n",
-                               strerror(errno), errno, 0 ); 
+                               AC_STRERROR_R(errno, ebuf, sizeof ebuf), errno, 0 ); 
                        break;
                }
 
@@ -79,7 +80,7 @@ read_and_send_results(
                }
 
                len = strlen( line );
-               while ( bp + len - buf > bsize ) {
+               while ( bp + len + 1 - buf > bsize ) {
                        size_t offset = bp - buf;
                        bsize += BUFSIZ;
                        buf = (char *) ch_realloc( buf, bsize );
@@ -99,8 +100,10 @@ read_and_send_results(
                                    buf, 0, 0 );
                        } else {
                                rs->sr_attrs = op->oq_search.rs_attrs;
+                               rs->sr_flags = REP_ENTRY_MODIFIABLE;
                                send_search_entry( op, rs );
                                entry_free( rs->sr_entry );
+                               rs->sr_attrs = NULL;
                        }
 
                        bp = buf;