#include "tldap_util.h"
#include "../libcli/security/security.h"
#include "../lib/util/asn1.h"
-#include "../librpc/ndr/libndr.h"
-#include "lib/util/base64.h"
bool tldap_entry_values(struct tldap_message *msg, const char *attribute,
DATA_BLOB **values, int *num_values)
struct dom_sid *sid)
{
DATA_BLOB val;
+ struct sid_parse_ret ret;
if (!tldap_get_single_valueblob(msg, attribute, &val)) {
return false;
}
- return sid_parse(val.data, val.length, sid);
+ ret = sid_parse(val.data, val.length, sid);
+ return (ret.len != -1);
}
bool tldap_pull_guid(struct tldap_message *msg, const char *attribute,
{
char *str;
uint64_t result;
+ int error = 0;
str = tldap_talloc_single_attribute(msg, attr, talloc_tos());
if (str == NULL) {
DEBUG(10, ("Could not find attribute %s\n", attr));
return false;
}
- result = strtoull(str, NULL, 10);
+
+ result = strtoull_err(str, NULL, 10, &error);
+ if (error != 0) {
+ DBG_DEBUG("Attribute conversion failed (%s)\n",
+ strerror(error));
+ TALLOC_FREE(str);
+ return false;
+ }
+
TALLOC_FREE(str);
*presult = result;
return true;
rc = tldap_search_recv(subreq, state, &msg);
if (tevent_req_ldap_error(req, rc)) {
- TALLOC_FREE(subreq);
return;
}
rc = tldap_search_recv(subreq, state, &state->result);
if (tevent_req_ldap_error(req, rc)) {
- TALLOC_FREE(subreq);
return;
}