source3: Update all consumers of strtoul_err(), strtoull_err() to new API
authorSwen Schillig <swen@linux.ibm.com>
Tue, 4 Jun 2019 07:04:15 +0000 (09:04 +0200)
committerRalph Boehme <slow@samba.org>
Sun, 30 Jun 2019 11:32:18 +0000 (11:32 +0000)
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
26 files changed:
source3/groupdb/mapping.c
source3/groupdb/mapping_tdb.c
source3/lib/interface.c
source3/lib/messages_dgm.c
source3/lib/namemap_cache.c
source3/lib/sysquotas.c
source3/lib/tldap_util.c
source3/lib/util_str.c
source3/modules/vfs_ceph_snapshots.c
source3/modules/vfs_preopen.c
source3/modules/vfs_snapper.c
source3/modules/vfs_unityed_media.c
source3/passdb/account_pol.c
source3/passdb/pdb_ldap.c
source3/passdb/pdb_tdb.c
source3/rpcclient/cmd_samr.c
source3/rpcclient/cmd_spoolss.c
source3/utils/net_idmap.c
source3/utils/net_registry.c
source3/utils/net_rpc_registry.c
source3/utils/net_sam.c
source3/utils/pdbedit.c
source3/utils/regedit_dialog.c
source3/winbindd/idmap_ldap.c
source3/winbindd/winbindd_lookuprids.c
source3/winbindd/winbindd_util.c

index 77eb0d6e5cd9e0a7cfc4f0f47d06e3fc3af37f53..1e25c5637dcb9dc8d1b22a864990d68ef2b25ca8 100644 (file)
@@ -245,10 +245,11 @@ int smb_create_group(const char *unix_group, gid_t *new_gid)
                        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);
index c80ff1f859a9f90fbf7538a5f8bd5ea2d1d9752c..b7ff724ba0553b3b4d6f7e0cbe2591584e2bafb9 100644 (file)
@@ -857,7 +857,6 @@ static int convert_ldb_record(TDB_CONTEXT *ltdb, TDB_DATA key,
        size_t len;
        char *name;
        char *val;
-       char *q;
        uint32_t num_mem = 0;
        struct dom_sid *members = NULL;
        int error = 0;
@@ -975,8 +974,12 @@ static int convert_ldb_record(TDB_CONTEXT *ltdb, TDB_DATA key,
                        /* 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;
                                }
@@ -986,11 +989,13 @@ static int convert_ldb_record(TDB_CONTEXT *ltdb, TDB_DATA key,
                                        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;
                                }
index 31066b8b5cc48fd6d44007d8d80537babcd87cec..af81695abab9cb915126d5119f45ad632c2d35fc 100644 (file)
@@ -370,7 +370,11 @@ static void parse_extra_info(char *key, uint64_t *speed, uint32_t *cap,
                        *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);
                                }
@@ -384,7 +388,11 @@ static void parse_extra_info(char *key, uint64_t *speed, uint32_t *cap,
                                                    "'%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);
                                }
@@ -523,11 +531,10 @@ static void interpret_interface(char *token)
                }
        } 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));
index 2d90f525f1dfcb63c3fb6ee9a17ad3ff7635c933..60a12e2008fa8c5871dd80eefe5f7ced533634b6 100644 (file)
@@ -1469,7 +1469,7 @@ static int messaging_dgm_read_unique(int fd, uint64_t *punique)
        }
        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;
        }
@@ -1640,7 +1640,7 @@ int messaging_dgm_forall(int (*fn)(pid_t pid, void *private_data),
                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
index 42656ede0b7b38e8e0b0aee8856af278f7061c6b..7075b7c5b1e36a58a90ce254b555fedf6e7b9a7b 100644 (file)
@@ -107,7 +107,6 @@ static void namemap_cache_find_sid_parser(
        const char *name;
        const char *typebuf;
        int error = 0;
-       char *endptr;
        unsigned long type;
 
        state->ok = false;
@@ -125,8 +124,8 @@ static void namemap_cache_find_sid_parser(
                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;
        }
 
@@ -251,7 +250,6 @@ static void namemap_cache_find_name_parser(
        const char *sidbuf;
        const char *sid_endptr;
        const char *typebuf;
-       char *endptr;
        int error = 0;
        struct dom_sid sid;
        unsigned long type;
@@ -276,8 +274,8 @@ static void namemap_cache_find_name_parser(
                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;
        }
 
index 864d9dd5c56cd44d4e09dde29f7578a11115cbd8..66436e86efd8341c06725ebd4a4b188b50095f13 100644 (file)
@@ -311,7 +311,11 @@ static int command_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t
 
                        /* 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;
                        }
index 78ed42be17902040b536c79c4e47d137577d5ca3..152942dab2c4ecc6b4983f89a545448d109e3a72 100644 (file)
@@ -399,7 +399,7 @@ bool tldap_pull_uint64(struct tldap_message *msg, const char *attr,
                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));
index 1a27227fe41300316dd90f579becfcd6c7b38807..e660e295c3394a3bd0620bce560b24f8a4755542 100644 (file)
@@ -850,20 +850,20 @@ uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr)
 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;
        }
 
index 0012962ac97ba88c3c47887ab644bcbd98594e67..4d935a55a1a36ece378854297cbcdaf688f3ae09 100644 (file)
@@ -83,25 +83,25 @@ static int ceph_snap_get_btime(struct vfs_handle_struct *handle,
 
        /* 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
index a2afbf179f89c8c2d1f3e51016fb2c3848628780..4a6816129eda63dc7ea63837df876db670737200 100644 (file)
@@ -366,7 +366,7 @@ static bool preopen_parse_fname(const char *fname, unsigned long *pnum,
                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;
        }
index 39b8ccb097a29fd47a9b8022f0f2a746f43b52a8..d862eb3151d898fda297cde535dcd2d080483a0c 100644 (file)
@@ -1250,7 +1250,7 @@ static NTSTATUS snapper_snap_path_to_id(TALLOC_CTX *mem_ctx,
        }
 
        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;
index 06bbe99402c194d40dc87af2e8d1747e1b5b41bc..43285191cd2abe3f567389ebdcfa2c9b8bcedddd 100644 (file)
@@ -100,7 +100,6 @@ typedef struct um_dirinfo_struct {
 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;
@@ -121,7 +120,11 @@ static bool get_digit_group(const char *path, uintmax_t *digit)
                        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;
                        }
index 4a180cb19bd374e29f0684345bc9dbabd9381dff..ee667815bc18ba210d691ad5e370a6b21bae560b 100644 (file)
@@ -459,7 +459,11 @@ bool cache_account_policy_get(enum pdb_policy_type type, uint32_t *value)
                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;
                }
index 85e9db8bb1f98ec8c7446953a9d5f5329d3c1527..3dbc8f9f07ab5f4918517d8357b406cdc90938bf 100644 (file)
@@ -996,7 +996,11 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
                                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;
@@ -1010,7 +1014,11 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
                                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;
@@ -2938,7 +2946,11 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
                                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;
@@ -2995,7 +3007,6 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
                fstring str;
                struct dom_sid sid;
                gid_t gid;
-               char *end;
 
                if (!smbldap_get_single_attribute(smbldap_get_ldap(conn),
                                                  entry, "sambaSID",
@@ -3010,9 +3021,9 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
                                                  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;
                }
 
@@ -4976,7 +4987,11 @@ static NTSTATUS ldapsam_get_new_rid(struct ldapsam_privates *priv,
        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;
                }
@@ -4987,7 +5002,11 @@ static NTSTATUS ldapsam_get_new_rid(struct ldapsam_privates *priv,
        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;
                }
@@ -4998,7 +5017,11 @@ static NTSTATUS ldapsam_get_new_rid(struct ldapsam_privates *priv,
        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;
                }
@@ -5136,7 +5159,11 @@ static bool ldapsam_sid_to_id(struct pdb_methods *methods,
                        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;
                }
@@ -5156,7 +5183,7 @@ static bool ldapsam_sid_to_id(struct pdb_methods *methods,
                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;
        }
@@ -5747,7 +5774,7 @@ static NTSTATUS ldapsam_create_dom_group(struct pdb_methods *my_methods,
                        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;
@@ -6024,7 +6051,7 @@ static NTSTATUS ldapsam_change_groupmem(struct pdb_methods *my_methods,
                        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;
index 067150334a35af0651727f9c564621f23edda8c6..0c97e70bad49cca7a684532faa1cd5cf326650af 100644 (file)
@@ -1183,7 +1183,11 @@ static int tdbsam_collect_rids(struct db_record *rec, void *private_data)
                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;
        }
index 7a3855b1b4c80c3f8e258652a5eef9b8e5ae1515..8cbf8ab24bdc78a8f35737e01eeb556cdf1380c6 100644 (file)
@@ -1413,7 +1413,7 @@ static NTSTATUS cmd_samr_delete_alias(struct rpc_pipe_client *cli,
                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;
        }
index f6d631761b2ef3b9238e1b45c1fca977a26423a0..78c381b9a594a23498e98852119c13b92a4306dd 100644 (file)
@@ -2708,7 +2708,11 @@ static WERROR cmd_spoolss_setprinterdata(struct rpc_pipe_client *cli,
                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;
index d1a6db95921950955490154465f1abd818a3d9f5..0aa45f742cd6dd148a0876421335998b937831f8 100644 (file)
@@ -627,11 +627,10 @@ 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;
        }
 
index 74224ddbf15a5d3eac295bf67e70b50b49fc797c..c6a681de42b986b669ba377361517f1633ef791f 100644 (file)
@@ -512,7 +512,7 @@ static int net_registry_setvalue(struct net_context *c, int argc,
                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;
                }
@@ -650,7 +650,11 @@ static int net_registry_increment(struct net_context *c, int argc,
        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;
                }
index 84936ee31aea4dce29cb310d70be534498443ec9..e47bad4e33f8f953ea84429a4992d2b2216d9f96 100644 (file)
@@ -606,7 +606,7 @@ static NTSTATUS rpc_registry_setvalue_internal(struct net_context *c,
                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;
                }
index 164d9408c56f4b9a7d38a8860ea952d54b55f073..74e500f0f3165ec956cb89b011c22e08654d94b0 100644 (file)
@@ -483,7 +483,6 @@ static int net_sam_policy_set(struct net_context *c, int argc, const char **argv
        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) {
@@ -501,9 +500,13 @@ static int net_sam_policy_set(struct net_context *c, int argc, const char **argv
                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]);
index 462c753217e3206a276b7f7cd817fa16bbf24be4..74f8c3b0b2f6598957ac11936a9e9631b18f635a 100644 (file)
@@ -594,15 +594,18 @@ static int set_user_info(const char *username, const char *fullname,
        }
 
        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;
                        }
index 7dd9f0fadea8b7674025d4c3587b9c8b11ccc4c6..c70dd44a743251a4b019a02b6b23778b84e1b273 100644 (file)
@@ -1030,7 +1030,6 @@ bool dialog_section_text_field_get_uint(struct dialog_section *section,
                                        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);
@@ -1041,8 +1040,8 @@ bool dialog_section_text_field_get_uint(struct dialog_section *section,
        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;
        }
 
index 822abb9f559e5f10afb915916202d70d7d9e5277..86cb6f1bc5112bd6044e6e9a863cfa6bb58bb278 100644 (file)
@@ -300,7 +300,7 @@ static NTSTATUS idmap_ldap_allocate_id_internal(struct idmap_domain *dom,
                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;
@@ -775,7 +775,7 @@ again:
                        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). "
@@ -1019,7 +1019,7 @@ again:
                        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). "
index 959a4a7db381c84bb61a2871e60b37e72956e91a..3b7b4176d186a0541f8d4fde5f0d4f0645a9638e 100644 (file)
@@ -184,7 +184,7 @@ static bool parse_ridlist(TALLOC_CTX *mem_ctx, char *ridstr,
                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;
index 91a2f6ef197632beb695b231e9ad649cf07f90b3..b79f90fb0cec88ea569f6edefe92736c292d7726 100644 (file)
@@ -507,7 +507,11 @@ static void trustdom_list_done(struct tevent_req *req)
                        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;
@@ -519,7 +523,11 @@ static void trustdom_list_done(struct tevent_req *req)
                        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;
@@ -531,7 +539,11 @@ static void trustdom_list_done(struct tevent_req *req)
                        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;
@@ -2170,7 +2182,7 @@ bool parse_xidlist(TALLOC_CTX *mem_ctx, const char *xidstr,
 
                p += 1;
 
-               id = strtoull_err(p, &endp, 10, &error);
+               id = smb_strtoull(p, &endp, 10, &error, SMB_STR_STANDARD);
                if (error != 0) {
                        goto fail;
                }