-/* $OpenBSD: modify.c,v 1.13 2010/07/13 12:54:51 martinh Exp $ */
+/* $OpenBSD: modify.c,v 1.14 2010/07/28 10:06:19 martinh Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
}
for (mod = mods->be_sub; mod; mod = mod->be_next) {
- if (ber_scanf_elements(mod, "{E{ese", &op, &prev, &attr, &vals) != 0) {
+ if (ber_scanf_elements(mod, "{E{ese(", &op, &prev, &attr, &vals) != 0) {
rc = LDAP_PROTOCOL_ERROR;
vals = NULL;
goto done;
if (ldap_add_attribute(entry, attr, vals) != NULL)
vals = NULL;
} else {
- if (ldap_merge_values(a, vals->be_sub) == 0)
+ if (ldap_merge_values(a, vals) == 0)
vals = NULL;
}
break;
ldap_del_attribute(entry, attr);
break;
case LDAP_MOD_REPLACE:
- if (vals->be_sub != NULL) {
+ if (vals->be_sub != NULL &&
+ vals->be_sub->be_type != BER_TYPE_EOC) {
if (a == NULL) {
if (ldap_add_attribute(entry, attr, vals) != NULL)
vals = NULL;
} else {
- if (ldap_set_values(a, vals->be_sub) == 0)
+ if (ldap_set_values(a, vals) == 0)
vals = NULL;
}
- } else if (a == NULL)
+ } else if (a != NULL)
ldap_del_attribute(entry, attr);
break;
}