source4: Update all consumers of strtoul_err(), strtoull_err() to new API
authorSwen Schillig <swen@linux.ibm.com>
Tue, 4 Jun 2019 07:06:37 +0000 (09:06 +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>
15 files changed:
source4/dns_server/dlz_bind9.c
source4/dsdb/common/dsdb_dn.c
source4/dsdb/common/util.c
source4/dsdb/samdb/ldb_modules/dirsync.c
source4/dsdb/samdb/ldb_modules/partition_metadata.c
source4/dsdb/samdb/ldb_modules/samldb.c
source4/dsdb/samdb/ldb_modules/schema_load.c
source4/dsdb/schema/schema_prefixmap.c
source4/lib/registry/ldb.c
source4/lib/socket/interface.c
source4/libcli/resolve/dns_ex.c
source4/nbt_server/wins/winsdb.c
source4/rpc_server/lsa/dcesrv_lsa.c
source4/torture/nbench/nbench.c
source4/torture/smb2/sharemode.c

index 5db1131e4dd9eb91d114192f4e68ded7bedef867..872eb3e0c1f48a854dd831a3af6928569c11aa6e 100644 (file)
@@ -341,7 +341,7 @@ static bool b9_dns_type(const char *type, enum dns_record_type *dtype)
        char *istr = strtok_r(str, sep, &saveptr); \
        int error = 0;\
        if ((istr) == NULL) return false; \
-       (ret) = strtoul_err(istr, NULL, 10, &error); \
+       (ret) = smb_strtoul(istr, NULL, 10, &error, SMB_STR_STANDARD); \
        if (error != 0) {\
                return false;\
        }\
index 2119a4faaf33602ceeaff57523f525952304a762..fd009a7af98617882c31a9054571dd9f4cdd1fc6 100644 (file)
@@ -135,7 +135,7 @@ struct dsdb_dn *dsdb_dn_parse_trusted(TALLOC_CTX *mem_ctx, struct ldb_context *l
        }
 
        errno = 0;
-       blen = strtoul_err(p1, &p2, 10, &error);
+       blen = smb_strtoul(p1, &p2, 10, &error, SMB_STR_STANDARD);
        if (error != 0) {
                DEBUG(10, (__location__ ": failed\n"));
                goto failed;
index a38f5061e7de904c453ffcdc6208c4bd652516fd..e521ed09999d68900cc10da2ad0de4740ad5878a 100644 (file)
@@ -3845,7 +3845,7 @@ NTSTATUS dsdb_get_extended_dn_uint64(struct ldb_dn *dn, uint64_t *val, const cha
                memcpy(s, v->data, v->length);
                s[v->length] = 0;
 
-               *val = strtoull_err(s, NULL, 0, &error);
+               *val = smb_strtoull(s, NULL, 0, &error, SMB_STR_STANDARD);
                if (error != 0) {
                        return NT_STATUS_INVALID_PARAMETER;
                }
@@ -3881,7 +3881,7 @@ NTSTATUS dsdb_get_extended_dn_uint32(struct ldb_dn *dn, uint32_t *val, const cha
                char s[v->length + 1];
                memcpy(s, v->data, v->length);
                s[v->length] = 0;
-               *val = strtoul_err(s, NULL, 0, &error);
+               *val = smb_strtoul(s, NULL, 0, &error, SMB_STR_STANDARD);
                if (error != 0) {
                        return NT_STATUS_INVALID_PARAMETER;
                }
@@ -3947,7 +3947,7 @@ uint32_t dsdb_dn_val_rmd_flags(const struct ldb_val *val)
        if (!p) {
                return 0;
        }
-       flags = strtoul_err(p+11, &end, 10, &error);
+       flags = smb_strtoul(p+11, &end, 10, &error, SMB_STR_STANDARD);
        if (!end || *end != '>' || error != 0) {
                /* it must end in a > */
                return 0;
index 74a107c847696592d5de890161ec1409b7871dbf..00f24bd6d59aac178eca1ad34048c082d236d048 100644 (file)
@@ -161,11 +161,12 @@ static int dirsync_filter_entry(struct ldb_request *req,
                         * to update the max USN in the cookie if we
                         * decide to keep this entry
                         */
-                       val = strtoull_err(
+                       val = smb_strtoull(
                                (const char*)msg->elements[i].values[0].data,
                                NULL,
                                0,
-                               &error);
+                               &error,
+                               SMB_STR_STANDARD);
                        if (error != 0) {
                                ldb_set_errstring(ldb,
                                                  "Failed to convert USN");
index 349f79c26457925e7b66f57dfe01b6121818ab26..44ce2c66639f65825bde02e12c8c607cf5b71332 100644 (file)
@@ -74,7 +74,7 @@ static int partition_metadata_get_uint64(struct ldb_module *module,
                return ldb_module_oom(module);
        }
 
-       *value = strtoull_err(value_str, NULL, 10, &error);
+       *value = smb_strtoull(value_str, NULL, 10, &error, SMB_STR_STANDARD);
        if (error != 0) {
                return ldb_module_error(module, LDB_ERR_OPERATIONS_ERROR,
                                        "partition_metadata: converision failed");
index 094f254c8fc8faf2f66e58fc65b3062fa13958d4..4da8564c77ab84eca1d9bc1c7e9a4f53d6701239 100644 (file)
@@ -3305,7 +3305,7 @@ static int check_address_roundtrip(const char *address, int family,
  */
 static int verify_cidr(const char *cidr)
 {
-       char *address = NULL, *slash = NULL, *endptr = NULL;
+       char *address = NULL, *slash = NULL;
        bool has_colon, has_dot;
        int res, ret;
        unsigned long mask;
@@ -3330,14 +3330,14 @@ static int verify_cidr(const char *cidr)
        /* terminate the address for strchr, inet_pton */
        *slash = '\0';
 
-       mask = strtoul_err(slash + 1, &endptr, 10, &error);
+       mask = smb_strtoul(slash + 1, NULL, 10, &error, SMB_STR_FULL_STR_CONV);
        if (mask == 0){
                DBG_INFO("Windows does not like the zero mask, "
                         "so nor do we: %s\n", cidr);
                goto error;
        }
 
-       if (error != 0 || *endptr != '\0'){
+       if (error != 0){
                DBG_INFO("CIDR mask is not a proper integer: %s\n", cidr);
                goto error;
        }
index 3b0781685cf95c327c86d1f47d4a539109373d2f..40ea42b55e42f1bf9d95b387d66255d66e8e520d 100644 (file)
@@ -170,7 +170,11 @@ static int schema_metadata_get_uint64(struct schema_load_private_data *data,
         * next time
         */
        data->tdb_seqnum = tdb_seqnum;
-       data->schema_seq_num_cache = strtoull_err(value_str, NULL, 10, &error);
+       data->schema_seq_num_cache = smb_strtoull(value_str,
+                                                 NULL,
+                                                 10,
+                                                 &error,
+                                                 SMB_STR_STANDARD);
        if (error != 0) {
                talloc_free(tmp_ctx);
                return ldb_module_error(data->module, LDB_ERR_OPERATIONS_ERROR,
index 482a35f21658b9458080c9dc68d942ba8a7bc6ad..706e48a034e490fe9f03eb932fc5786d06f5d80a 100644 (file)
@@ -224,7 +224,7 @@ static WERROR _dsdb_pfm_make_binary_oid(const char *full_oid, TALLOC_CTX *mem_ct
                return WERR_INVALID_PARAMETER;
        }
        oid_subid++;
-       last_subid = strtoul_err(oid_subid, NULL, 10, &error);
+       last_subid = smb_strtoul(oid_subid, NULL, 10, &error, SMB_STR_STANDARD);
        if (error != 0) {
                return WERR_INVALID_PARAMETER;
        }
index d0e9f46f4e118bf8ebf066a0e24a9197a22a8ca4..c0b13e0d4ce9424d803b97f4c33698b5b8f98ff6 100644 (file)
@@ -79,7 +79,11 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
                        /* The data is a plain DWORD */
                        uint32_t tmp;
 
-                       tmp = strtoul_err((char *)val->data, NULL, 0, &error);
+                       tmp = smb_strtoul((char *)val->data,
+                                         NULL,
+                                         0,
+                                         &error,
+                                         SMB_STR_STANDARD);
                        if (error != 0) {
                                data->data = NULL;
                                data->length = 0;
@@ -102,7 +106,11 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
                        /* The data is a plain QWORD */
                        uint64_t tmp;
 
-                       tmp = strtoull_err((char *)val->data, NULL, 0, &error);
+                       tmp = smb_strtoull((char *)val->data,
+                                          NULL,
+                                          0,
+                                          &error,
+                                          SMB_STR_STANDARD);
                        if (error != 0) {
                                data->data = NULL;
                                data->length = 0;
index 9bf002c2f01fecb1741af77cd4f7b01bfc21325f..93b60f7d32f1d7a19a2ffc4886743276fef2fb24 100644 (file)
@@ -224,11 +224,14 @@ static void interpret_interface(TALLOC_CTX *mem_ctx,
                        return;
                }
        } else {
-               char *endp = NULL;
                int error = 0;
 
-               unsigned long val = strtoul_err(p, &endp, 0, &error);
-               if (error != 0 || *endp != '\0') {
+               unsigned long 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 86eeb5f5921eef2a166eb26561a8e868b2921811..9ee19ffb4fda80ed72f078845b0a0eb2d0cccc99 100644 (file)
@@ -536,7 +536,7 @@ static void pipe_handler(struct tevent_context *ev, struct tevent_fd *fde,
                        composite_error(c, NT_STATUS_OBJECT_NAME_NOT_FOUND);
                        return;
                }
-               port = strtoul_err(p, NULL, 10, &error);
+               port = smb_strtoul(p, NULL, 10, &error, SMB_STR_STANDARD);
                if (port > UINT16_MAX || error != 0) {
                        composite_error(c, NT_STATUS_OBJECT_NAME_NOT_FOUND);
                        return;
index 5184d7de7b0cfc26efda283f84fc778b561dcfeb..41a9fd8550d4e9445c131c70cc18c77a1a8f8814 100644 (file)
@@ -183,11 +183,12 @@ static NTSTATUS winsdb_nbt_name(TALLOC_CTX *mem_ctx, struct ldb_dn *dn, struct n
 
        if (comp_num > cur && strcasecmp("type", ldb_dn_get_component_name(dn, cur)) == 0) {
                name->type =
-                       strtoul_err(
+                       smb_strtoul(
                                (char *)ldb_dn_get_component_val(dn, cur)->data,
                                NULL,
                                0,
-                               &error);
+                               &error,
+                               SMB_STR_STANDARD);
                if (error != 0) {
                        status = NT_STATUS_INTERNAL_DB_CORRUPTION;
                        goto failed;
index 3e83214458d9f34a4854ce62ec6396b67fb42cc9..831ebf42e36c666188b3c551bb34d6bc32a65d79 100644 (file)
@@ -1736,10 +1736,11 @@ static NTSTATUS update_uint32_t_value(TALLOC_CTX *mem_ctx,
                flags = LDB_FLAG_MOD_ADD;
 
        } else {
-               orig_uint = strtoul_err((const char *)orig_val->data,
+               orig_uint = smb_strtoul((const char *)orig_val->data,
                                        NULL,
                                        0,
-                                       &error);
+                                       &error,
+                                       SMB_STR_STANDARD);
                if (error != 0 || orig_uint != value) {
                        /* replace also if can't get value */
                        flags = LDB_FLAG_MOD_REPLACE;
index 83395123c3300ab2760d7eea4c5895b71705f2c9..6e2dbe0b907afb52f984f5e44f9fe7cf70a37001 100644 (file)
@@ -140,7 +140,11 @@ again:
 
                /* accept numeric or string status codes */
                if (strncmp(params[i-1], "0x", 2) == 0) {
-                       tmp = strtoul_err(params[i-1], NULL, 16, &error);
+                       tmp = smb_strtoul(params[i-1],
+                                         NULL,
+                                         16,
+                                         &error,
+                                         SMB_STR_STANDARD);
                        if (error != 0) {
                                tmp = error;
                        }
index c28e6b86dc591ace14a61fdbdd96d64a4476719b..5b1b8c4afba86dbab2ea1ba800f7684517c7923d 100644 (file)
@@ -192,7 +192,7 @@ bool torture_smb2_check_sharemode(struct torture_context *tctx)
        sharemode = smb2_util_share_access(sharemode_string);
 
        access_string = torture_setting_string(tctx, "access", "0xf01ff");
-       access = strtoul_err(access_string, NULL, 0, &error);
+       access = smb_strtoul(access_string, NULL, 0, &error, SMB_STR_STANDARD);
        if (error != 0) {
                torture_comment(tctx, "Initializing access failed.\n");
                return false;