summaryrefslogtreecommitdiff
path: root/nsswitch
diff options
context:
space:
mode:
authorSwen Schillig <swen@linux.ibm.com>2019-06-04 09:01:02 +0200
committerRalph Boehme <slow@samba.org>2019-06-30 11:32:18 +0000
commitbf020a8c8db6bb6a0386d3bf69d40116601b1aca (patch)
treef932cb3e93dc812eb63569a748232b6fdd346e66 /nsswitch
parent39a518b6717a4687f43333b3e62a1765d45f5bff (diff)
downloadsamba-bf020a8c8db6bb6a0386d3bf69d40116601b1aca.tar.gz
nsswitch: Update all consumers of strtoul_err(), strtoull_err() to new API
Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
Diffstat (limited to 'nsswitch')
-rw-r--r--nsswitch/libwbclient/wbc_idmap.c18
-rw-r--r--nsswitch/libwbclient/wbc_sid.c24
-rw-r--r--nsswitch/wbinfo.c9
3 files changed, 35 insertions, 16 deletions
diff --git a/nsswitch/libwbclient/wbc_idmap.c b/nsswitch/libwbclient/wbc_idmap.c
index 6af96bddb59..270a3c3c3ec 100644
--- a/nsswitch/libwbclient/wbc_idmap.c
+++ b/nsswitch/libwbclient/wbc_idmap.c
@@ -380,15 +380,27 @@ wbcErr wbcCtxSidsToUnixIds(struct wbcContext *ctx,
switch (p[0]) {
case 'U':
id->type = WBC_ID_TYPE_UID;
- id->id.uid = strtoul_err(p+1, &q, 10, &error);
+ id->id.uid = smb_strtoul(p+1,
+ &q,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
break;
case 'G':
id->type = WBC_ID_TYPE_GID;
- id->id.gid = strtoul_err(p+1, &q, 10, &error);
+ id->id.gid = smb_strtoul(p+1,
+ &q,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
break;
case 'B':
id->type = WBC_ID_TYPE_BOTH;
- id->id.uid = strtoul_err(p+1, &q, 10, &error);
+ id->id.uid = smb_strtoul(p+1,
+ &q,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
break;
default:
id->type = WBC_ID_TYPE_NOT_SPECIFIED;
diff --git a/nsswitch/libwbclient/wbc_sid.c b/nsswitch/libwbclient/wbc_sid.c
index 514a7e8d738..cec7b519bfd 100644
--- a/nsswitch/libwbclient/wbc_sid.c
+++ b/nsswitch/libwbclient/wbc_sid.c
@@ -122,7 +122,7 @@ wbcErr wbcStringToSid(const char *str,
/* Get the SID revision number */
p = str+2;
- x = (uint64_t)strtoul_err(p, &q, 10, &error);
+ x = (uint64_t)smb_strtoul(p, &q, 10, &error, SMB_STR_STANDARD);
if (x == 0 || x > UINT8_MAX || !q || *q != '-' || error != 0) {
wbc_status = WBC_ERR_INVALID_SID;
BAIL_ON_WBC_ERROR(wbc_status);
@@ -135,7 +135,7 @@ wbcErr wbcStringToSid(const char *str,
* be expressed as a hex value, according to MS-DTYP.
*/
p = q+1;
- x = strtoull_err(p, &q, 0, &error);
+ x = smb_strtoull(p, &q, 0, &error, SMB_STR_STANDARD);
if (!q || *q != '-' || (x & AUTHORITY_MASK) || error != 0) {
wbc_status = WBC_ERR_INVALID_SID;
BAIL_ON_WBC_ERROR(wbc_status);
@@ -151,7 +151,7 @@ wbcErr wbcStringToSid(const char *str,
p = q +1;
sid->num_auths = 0;
while (sid->num_auths < WBC_MAXSUBAUTHS) {
- x = strtoull_err(p, &q, 10, &error);
+ x = smb_strtoull(p, &q, 10, &error, SMB_STR_ALLOW_NO_CONVERSION);
if (p == q)
break;
if (x > UINT32_MAX || error != 0) {
@@ -389,7 +389,7 @@ wbcErr wbcCtxLookupSids(struct wbcContext *ctx,
p = extra_data;
- num_domains = strtoul_err(p, &q, 10, &error);
+ num_domains = smb_strtoul(p, &q, 10, &error, SMB_STR_STANDARD);
if (*q != '\n' || error != 0) {
goto wbc_err_invalid;
}
@@ -429,7 +429,7 @@ wbcErr wbcCtxLookupSids(struct wbcContext *ctx,
p = q+1;
}
- num_names = strtoul_err(p, &q, 10, &error);
+ num_names = smb_strtoul(p, &q, 10, &error, SMB_STR_STANDARD);
if (*q != '\n' || error != 0) {
goto wbc_err_invalid;
}
@@ -449,7 +449,11 @@ wbcErr wbcCtxLookupSids(struct wbcContext *ctx,
for (i=0; i<num_names; i++) {
- names[i].domain_index = strtoul_err(p, &q, 10, &error);
+ names[i].domain_index = smb_strtoul(p,
+ &q,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (names[i].domain_index < 0 || error != 0) {
goto wbc_err_invalid;
}
@@ -462,7 +466,7 @@ wbcErr wbcCtxLookupSids(struct wbcContext *ctx,
}
p = q+1;
- names[i].type = strtoul_err(p, &q, 10, &error);
+ names[i].type = smb_strtoul(p, &q, 10, &error, SMB_STR_STANDARD);
if (*q != ' ' || error != 0) {
goto wbc_err_invalid;
}
@@ -585,7 +589,11 @@ wbcErr wbcCtxLookupRids(struct wbcContext *ctx, struct wbcDomainSid *dom_sid,
goto done;
}
- types[i] = (enum wbcSidType)strtoul_err(p, &q, 10, &error);
+ types[i] = (enum wbcSidType)smb_strtoul(p,
+ &q,
+ 10,
+ &error,
+ SMB_STR_STANDARD);
if (*q != ' ' || error != 0) {
wbc_status = WBC_ERR_INVALID_RESPONSE;
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index b8f04536299..ae89f876a9d 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -140,7 +140,7 @@ static bool parse_wbinfo_domain_user(const char *domuser, fstring domain,
* Return true if input was valid, false otherwise. */
static bool parse_mapping_arg(char *arg, int *id, char **sid)
{
- char *tmp, *endptr;
+ char *tmp;
int error = 0;
if (!arg || !*arg)
@@ -154,9 +154,8 @@ static bool parse_mapping_arg(char *arg, int *id, char **sid)
/* Because atoi() can return 0 on invalid input, which would be a valid
* UID/GID we must use strtoul() and do error checking */
- *id = strtoul_err(tmp, &endptr, 10, &error);
-
- if (endptr[0] != '\0' || error != 0)
+ *id = smb_strtoul(tmp, NULL, 10, &error, SMB_STR_FULL_STR_CONV);
+ if (error != 0)
return false;
return true;
@@ -1421,7 +1420,7 @@ static bool wbinfo_lookuprids(const char *domain, const char *arg)
int error = 0;
uint32_t rid;
- rid = strtoul_err(ridstr, NULL, 10, &error);
+ rid = smb_strtoul(ridstr, NULL, 10, &error, SMB_STR_STANDARD);
if (error != 0) {
d_printf("failed to convert rid\n");
goto done;