rs = LDAP_NO_SUCH_OBJECT;
else
rs = LDAP_UNWILLING_TO_PERFORM;
+ Debug( LDAP_DEBUG_ANY, "could not open \"%s\": %s\n",
+ path->bv_val, strerror( errno ), 0 );
}
else {
struct berval rdn;
fd = open( path->bv_val, O_RDONLY );
if ( fd < 0 ) {
Debug( LDAP_DEBUG_ANY,
- "=> ldif_enum_tree: failed to open %s\n",
- path->bv_val, 0, 0 );
+ "=> ldif_enum_tree: failed to open %s: %s\n",
+ path->bv_val, strerror(errno), 0 );
return LDAP_NO_SUCH_OBJECT;
}
int statres;
char textbuf[SLAP_TEXT_BUFLEN];
+ Debug( LDAP_DEBUG_TRACE, "ldif_back_add: \"%s\"\n", dn.bv_val, 0, 0);
slap_add_opattrs( op, &rs->sr_text, textbuf, sizeof( textbuf ), 1 );
rs->sr_err = entry_schema_check(op, e, NULL, 0,
base.bv_val[base.bv_len] = '\0';
if(statres == -1 && errno == ENOENT) {
rs->sr_err = LDAP_NO_SUCH_OBJECT; /* parent doesn't exist */
+ rs->sr_text = "Parent does not exist";
}
else if(statres != -1) { /* create parent */
int mkdirres = mkdir(base.bv_val, 0750);
if(mkdirres == -1) {
rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
+ rs->sr_text = "Could not create parent folder";
+ Debug( LDAP_DEBUG_ANY, "could not create folder \"%s\": %s\n",
+ base.bv_val, strerror( errno ), 0 );
}
}
else
rs->sr_err = (int) spew_entry(e, &leaf_path);
ldap_pvt_thread_mutex_unlock(&entry2str_mutex);
}
+ else if ( statres == -1 ) {
+ rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
+ Debug( LDAP_DEBUG_ANY, "could not stat file \"%s\": %s\n",
+ leaf_path.bv_val, strerror( errno ), 0 );
+ }
else /* it already exists */
rs->sr_err = LDAP_ALREADY_EXISTS;
}
ldap_pvt_thread_mutex_unlock(&ni->li_mutex);
send_res:
+ Debug( LDAP_DEBUG_TRACE,
+ "ldif_back_add: err: %d text: %s\n", rs->sr_err, rs->sr_text, 0);
send_ldap_result(op, rs);
slap_graduate_commit_csn( op );
return 0;