nread = read(fd, output, sizeof(output)-1);
if (nread > 0) {
output[nread] = '\0';
- *new_gid = (gid_t)strtoul_err(output,
+ *new_gid = (gid_t)smb_strtoul(output,
NULL,
10,
- &error);
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
*new_gid = 0;
close(fd);
size_t len;
char *name;
char *val;
- char *q;
uint32_t num_mem = 0;
struct dom_sid *members = NULL;
int error = 0;
/* we ignore unknown or uninteresting attributes
* (objectclass, etc.) */
if (strcasecmp_m(name, "gidNumber") == 0) {
- map->gid = strtoul_err(val, &q, 10, &error);
- if (*q || (error != 0)) {
+ map->gid = smb_strtoul(val,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_FULL_STR_CONV);
+ if (error != 0) {
errno = EIO;
goto failed;
}
goto failed;
}
} else if (strcasecmp_m(name, "sidNameUse") == 0) {
- map->sid_name_use = strtoul_err(val,
- &q,
- 10,
- &error);
- if (*q || (error != 0)) {
+ map->sid_name_use =
+ smb_strtoul(val,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_FULL_STR_CONV);
+ if (error != 0) {
errno = EIO;
goto failed;
}
*val++ = 0;
if (strequal_m(key, "speed")) {
- *speed = (uint64_t)strtoull_err(val, NULL, 0, &error);
+ *speed = (uint64_t)smb_strtoull(val,
+ NULL,
+ 0,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
DBG_DEBUG("Invalid speed value (%s)\n", val);
}
"'%s'\n", val);
}
} else if (strequal_m(key, "if_index")) {
- *if_index = (uint32_t)strtoul_err(val, NULL, 0, &error);
+ *if_index = (uint32_t)smb_strtoul(val,
+ NULL,
+ 0,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
DBG_DEBUG("Invalid key value (%s)\n", val);
}
}
} else {
int error = 0;
- char *endp = NULL;
unsigned long val;
- val = strtoul_err(p, &endp, 0, &error);
- if (error != 0 || *endp != '\0') {
+ val = smb_strtoul(p, NULL, 0, &error, SMB_STR_FULL_STR_CONV);
+ if (error != 0) {
DEBUG(2,("interpret_interface: "
"can't determine netmask value from %s\n",
p));
}
buf[rw_ret] = '\0';
- unique = strtoull_err(buf, &endptr, 10, &error);
+ unique = smb_strtoull(buf, &endptr, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
return error;
}
unsigned long pid;
int ret;
- pid = strtoul_err(dp->d_name, NULL, 10, &error);
+ pid = smb_strtoul(dp->d_name, NULL, 10, &error, SMB_STR_STANDARD);
if ((pid == 0) || (error != 0)) {
/*
* . and .. and other malformed entries
const char *name;
const char *typebuf;
int error = 0;
- char *endptr;
unsigned long type;
state->ok = false;
return;
}
- type = strtoul_err(typebuf, &endptr, 10, &error);
- if ((*endptr != '\0') || (error != 0)) {
+ type = smb_strtoul(typebuf, NULL, 10, &error, SMB_STR_FULL_STR_CONV);
+ if (error != 0) {
return;
}
const char *sidbuf;
const char *sid_endptr;
const char *typebuf;
- char *endptr;
int error = 0;
struct dom_sid sid;
unsigned long type;
return;
}
- type = strtoul_err(typebuf, &endptr, 10, &error);
- if ((*endptr != '\0') || (error != 0)) {
+ type = smb_strtoul(typebuf, NULL, 10, &error, SMB_STR_FULL_STR_CONV);
+ if (error != 0) {
return;
}
/* we need to deal with long long unsigned here, if supported */
- dp->qflags = strtoul_err(line, &p2, 10, &error);
+ dp->qflags = smb_strtoul(line,
+ &p2,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
goto invalid_param;
}
return false;
}
- result = strtoull_err(str, NULL, 10, &error);
+ result = smb_strtoull(str, NULL, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
DBG_DEBUG("Attribute conversion failed (%s)\n",
strerror(error));
uint64_t conv_str_size(const char * str)
{
uint64_t lval;
- char * end;
+ char *end;
int error = 0;
if (str == NULL || *str == '\0') {
return 0;
}
- lval = strtoull_err(str, &end, 10, &error);
+ lval = smb_strtoull(str, &end, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
return 0;
}
- if (*end == '\0') {
+ if (*end == '\0') {
return lval;
}
/* First component is seconds, extract it */
*s = '\0';
- snap_timespec.tv_sec = strtoull_err(snap_btime, &endptr, 10, &err);
+ snap_timespec.tv_sec = smb_strtoull(snap_btime,
+ &endptr,
+ 10,
+ &err,
+ SMB_STR_FULL_STR_CONV);
if (err != 0) {
return -err;
}
- if ((endptr == snap_btime) || (*endptr != '\0')) {
- DBG_ERR("couldn't process snap.tv_sec in %s\n", snap_btime);
- return -EINVAL;
- }
/* second component is nsecs */
s++;
- snap_timespec.tv_nsec = strtoul_err(s, &endptr, 10, &err);
+ snap_timespec.tv_nsec = smb_strtoul(s,
+ &endptr,
+ 10,
+ &err,
+ SMB_STR_FULL_STR_CONV);
if (err != 0) {
return -err;
}
- if ((endptr == s) || (*endptr != '\0')) {
- DBG_ERR("couldn't process snap.tv_nsec in %s\n", s);
- return -EINVAL;
- }
/*
* >> 30 is a rough divide by ~10**9. No need to be exact, as @GMT
return false;
}
- num = strtoul_err(p, (char **)&q, 10, &error);
+ num = smb_strtoul(p, (char **)&q, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
return false;
}
}
str_idx++;
- snap_id = strtoul_err(str_idx, NULL, 10, &error);
+ snap_id = smb_strtoul(str_idx, NULL, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
talloc_free(path_dup);
return NT_STATUS_INVALID_PARAMETER;
static bool get_digit_group(const char *path, uintmax_t *digit)
{
const char *p = path;
- char *endp = NULL;
codepoint_t cp;
size_t size;
int error = 0;
return false;
}
if ((size == 1) && (isdigit(cp))) {
- *digit = (uintmax_t)strtoul_err(p, &endp, 10, &error);
+ *digit = (uintmax_t)smb_strtoul(p,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
return false;
}
int error = 0;
uint32_t tmp;
- tmp = strtoul_err(cache_value, NULL, 10, &error);
+ tmp = smb_strtoul(cache_value,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
goto done;
}
ctx);
if (temp) {
/* We've got a uid, feed the cache */
- unix_pw.pw_uid = strtoul_err(temp, NULL, 10, &error);
+ unix_pw.pw_uid = smb_strtoul(temp,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
DBG_ERR("Failed to convert UID\n");
goto fn_exit;
ctx);
if (temp) {
/* We've got a uid, feed the cache */
- unix_pw.pw_gid = strtoul_err(temp, NULL, 10, &error);
+ unix_pw.pw_gid = smb_strtoul(temp,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
DBG_ERR("Failed to convert GID\n");
goto fn_exit;
ret = NT_STATUS_INTERNAL_DB_CORRUPTION;
goto done;
}
- primary_gid = strtoul_err(gidstr, NULL, 10, &error);
+ primary_gid = smb_strtoul(gidstr,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
DBG_ERR("Failed to convert GID\n");
goto done;
fstring str;
struct dom_sid sid;
gid_t gid;
- char *end;
if (!smbldap_get_single_attribute(smbldap_get_ldap(conn),
entry, "sambaSID",
str, sizeof(str)-1))
continue;
- gid = strtoul_err(str, &end, 10, &error);
+ gid = smb_strtoul(str, NULL, 10, &error, SMB_STR_FULL_STR_CONV);
- if ((PTR_DIFF(end, str) != strlen(str)) || (error != 0)) {
+ if (error != 0) {
goto done;
}
value = smbldap_talloc_single_attribute(priv2ld(priv), entry,
"sambaNextRid", mem_ctx);
if (value != NULL) {
- tmp = (uint32_t)strtoul_err(value, NULL, 10, &error);
+ tmp = (uint32_t)smb_strtoul(value,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
goto done;
}
value = smbldap_talloc_single_attribute(priv2ld(priv), entry,
"sambaNextUserRid", mem_ctx);
if (value != NULL) {
- tmp = (uint32_t)strtoul_err(value, NULL, 10, &error);
+ tmp = (uint32_t)smb_strtoul(value,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
goto done;
}
value = smbldap_talloc_single_attribute(priv2ld(priv), entry,
"sambaNextGroupRid", mem_ctx);
if (value != NULL) {
- tmp = (uint32_t)strtoul_err(value, NULL, 10, &error);
+ tmp = (uint32_t)smb_strtoul(value,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
goto done;
}
goto done;
}
- id->id = strtoul_err(gid_str, NULL, 10, &error);
+ id->id = smb_strtoul(gid_str,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
goto done;
}
goto done;
}
- id->id = strtoul_err(value, NULL, 10, &error);
+ id->id = smb_strtoul(value, NULL, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
goto done;
}
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- gid = strtoul_err(tmp, NULL, 10, &error);
+ gid = smb_strtoul(tmp, NULL, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
DBG_ERR("Failed to convert gidNumber\n");
return NT_STATUS_UNSUCCESSFUL;
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- user_gid = strtoul_err(gidstr, NULL, 10, &error);
+ user_gid = smb_strtoul(gidstr, NULL, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
DBG_ERR("Failed to convert user gid\n");
return NT_STATUS_UNSUCCESSFUL;
return 0;
}
- rid = strtoul_err((char *)key.dptr+prefixlen, NULL, 16, &error);
+ rid = smb_strtoul((char *)key.dptr+prefixlen,
+ NULL,
+ 16,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
return 0;
}
return NT_STATUS_OK;
}
- alias_rid = strtoul_err(argv[2], NULL, 10, &error);
+ alias_rid = smb_strtoul(argv[2], NULL, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
return NT_STATUS_INVALID_PARAMETER;
}
W_ERROR_HAVE_NO_MEMORY(data.string);
break;
case REG_DWORD:
- data.value = strtoul_err(argv[4], NULL, 10, &error);
+ data.value = smb_strtoul(argv[4],
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
result = WERR_INVALID_PARAMETER;
goto done;
static bool parse_uint32(const char *str, uint32_t *result)
{
unsigned long val;
- char *endptr;
int error = 0;
- val = strtoul_err(str, &endptr, 10, &error);
- if (error != 0 || *endptr != '\0') {
+ val = smb_strtoul(str, NULL, 10, &error, SMB_STR_FULL_STR_CONV);
+ if (error != 0) {
return false;
}
int error = 0;
uint32_t v;
- v = strtoul_err(argv[3], NULL, 10, &error);
+ v = smb_strtoul(argv[3], NULL, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
goto done;
}
if (argc == 3) {
int error = 0;
- state.increment = strtoul_err(argv[2], NULL, 10, &error);
+ state.increment = smb_strtoul(argv[2],
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
goto done;
}
int error = 0;
uint32_t v;
- v = strtoul_err(argv[3], NULL, 10, &error);
+ v = smb_strtoul(argv[3], NULL, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
goto error;
}
uint32_t value = 0;
uint32_t old_value = 0;
enum pdb_policy_type field;
- char *endptr;
int err = 0;
if (argc != 2 || c->display_usage) {
value = -1;
}
else {
- value = strtoul_err(argv[1], &endptr, 10, &err);
+ value = smb_strtoul(argv[1],
+ NULL,
+ 10,
+ &err,
+ SMB_STR_FULL_STR_CONV);
- if (err != 0 || *endptr != '\0') {
+ if (err != 0) {
d_printf(_("Unable to set policy \"%s\"! Invalid value "
"\"%s\".\n"),
account_policy, argv[1]);
}
if (kickoff_time) {
- char *endptr;
time_t value = get_time_t_max();
if (strcmp(kickoff_time, "never") != 0) {
int error = 0;
uint32_t num;
- num = strtoul_err(kickoff_time, &endptr, 10, &error);
- if (error != 0 || *endptr != '\0') {
+ num = smb_strtoul(kickoff_time,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_FULL_STR_CONV);
+ if (error != 0) {
fprintf(stderr, "Failed to parse kickoff time\n");
return -1;
}
unsigned long long *out)
{
const char *buf;
- char *endp;
int error = 0;
struct dialog_section_text_field *text_field =
talloc_get_type_abort(section, struct dialog_section_text_field);
if (buf == NULL) {
return false;
}
- *out = strtoull_err(buf, &endp, 0, &error);
- if (error != 0 || *endp != '\0') {
+ *out = smb_strtoull(buf, NULL, 0, &error, SMB_STR_FULL_STR_CONV);
+ if (error != 0) {
return false;
}
goto done;
}
- xid->id = strtoul_err(id_str, NULL, 10, &error);
+ xid->id = smb_strtoul(id_str, NULL, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
ret = NT_STATUS_UNSUCCESSFUL;
goto done;
continue;
}
- id = strtoul_err(tmp, NULL, 10, &error);
+ id = smb_strtoul(tmp, NULL, 10, &error, SMB_STR_STANDARD);
TALLOC_FREE(tmp);
if (error != 0) {
DEBUG(5, ("Requested id (%u) out of range (%u - %u). "
continue;
}
- id = strtoul_err(tmp, NULL, 10, &error);
+ id = smb_strtoul(tmp, NULL, 10, &error, SMB_STR_STANDARD);
TALLOC_FREE(tmp);
if (error != 0) {
DEBUG(5, ("Requested id (%u) out of range (%u - %u). "
char *q;
int error = 0;
- rids[i] = strtoul_err(p, &q, 10, &error);
+ rids[i] = smb_strtoul(p, &q, 10, &error, SMB_STR_STANDARD);
if (error != 0 || *q != '\n') {
DEBUG(0, ("Got invalid ridstr: %s\n", p));
return false;
break;
}
- trust_flags = (uint32_t)strtoul_err(q, NULL, 10, &error);
+ trust_flags = (uint32_t)smb_strtoul(q,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
DBG_ERR("Failed to convert trust_flags\n");
break;
break;
}
- trust_type = (uint32_t)strtoul_err(q, NULL, 10, &error);
+ trust_type = (uint32_t)smb_strtoul(q,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
DBG_ERR("Failed to convert trust_type\n");
break;
break;
}
- trust_attribs = (uint32_t)strtoul_err(q, NULL, 10, &error);
+ trust_attribs = (uint32_t)smb_strtoul(q,
+ NULL,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (error != 0) {
DBG_ERR("Failed to convert trust_attribs\n");
break;
p += 1;
- id = strtoull_err(p, &endp, 10, &error);
+ id = smb_strtoull(p, &endp, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
goto fail;
}