const char **attr_list;
const char *type;
struct idmap_ldap_context *ctx;
+ int error = 0;
/* Only do query if we are online */
if (idmap_is_offline()) {
goto done;
}
- xid->id = strtoul(id_str, NULL, 10);
+ xid->id = strtoul_err(id_str, NULL, 10, &error);
+ if (error != 0) {
+ ret = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
/* make sure we still have room to grow */
int count;
int rc;
int i;
+ int error = 0;
/* Only do query if we are online */
if (idmap_is_offline()) {
continue;
}
- id = strtoul(tmp, NULL, 10);
+ id = strtoul_err(tmp, NULL, 10, &error);
+ TALLOC_FREE(tmp);
+ if (error != 0) {
+ DEBUG(5, ("Requested id (%u) out of range (%u - %u). "
+ "Filtered!\n", id,
+ dom->low_id, dom->high_id));
+ TALLOC_FREE(sidstr);
+ continue;
+ }
+
if (!idmap_unix_id_is_in_range(id, dom)) {
DEBUG(5, ("Requested id (%u) out of range (%u - %u). "
"Filtered!\n", id,
dom->low_id, dom->high_id));
TALLOC_FREE(sidstr);
- TALLOC_FREE(tmp);
continue;
}
- TALLOC_FREE(tmp);
map = idmap_find_map_by_id(&ids[bidx], type, id);
if (!map) {
struct dom_sid sid;
struct dom_sid_buf buf;
uint32_t id;
+ int error = 0;
if (i == 0) { /* first entry */
entry = ldap_first_entry(
continue;
}
- id = strtoul(tmp, NULL, 10);
- if (!idmap_unix_id_is_in_range(id, dom)) {
+ id = strtoul_err(tmp, NULL, 10, &error);
+ TALLOC_FREE(tmp);
+ if (error != 0) {
+ DEBUG(5, ("Requested id (%u) out of range (%u - %u). "
+ "Filtered!\n", id,
+ dom->low_id, dom->high_id));
+ TALLOC_FREE(sidstr);
+ continue;
+ }
+
+ if (error != 0 || !idmap_unix_id_is_in_range(id, dom)) {
DEBUG(5, ("Requested id (%u) out of range (%u - %u). "
"Filtered!\n", id,
dom->low_id, dom->high_id));
TALLOC_FREE(sidstr);
- TALLOC_FREE(tmp);
continue;
}
- TALLOC_FREE(tmp);
if (map->status == ID_MAPPED) {
DEBUG(1, ("WARNING: duplicate %s mapping in LDAP. "
uint32_t trust_type;
uint32_t trust_attribs;
uint32_t trust_flags;
+ int error = 0;
DBG_DEBUG("parsing response line '%s'\n", p);
break;
}
- trust_flags = (uint32_t)strtoul(q, NULL, 10);
+ trust_flags = (uint32_t)strtoul_err(q, NULL, 10, &error);
+ if (error != 0) {
+ DBG_ERR("Failed to convert trust_flags\n");
+ break;
+ }
q = strtok(NULL, "\\");
if (q == NULL) {
break;
}
- trust_type = (uint32_t)strtoul(q, NULL, 10);
+ trust_type = (uint32_t)strtoul_err(q, NULL, 10, &error);
+ if (error != 0) {
+ DBG_ERR("Failed to convert trust_type\n");
+ break;
+ }
q = strtok(NULL, "\n");
if (q == NULL) {
break;
}
- trust_attribs = (uint32_t)strtoul(q, NULL, 10);
+ trust_attribs = (uint32_t)strtoul_err(q, NULL, 10, &error);
+ if (error != 0) {
+ DBG_ERR("Failed to convert trust_attribs\n");
+ break;
+ }
if (!within_forest) {
trust_flags &= ~NETR_TRUST_FLAG_IN_FOREST;
struct unixid xid;
unsigned long long id;
char *endp;
+ int error = 0;
switch (p[0]) {
case 'U':
p += 1;
- id = strtoull(p, &endp, 10);
- if ((id == ULLONG_MAX) && (errno == ERANGE)) {
+ id = strtoull_err(p, &endp, 10, &error);
+ if (error != 0) {
goto fail;
}
if (*endp != '\n') {