summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/db')
-rw-r--r--src/db/sysdb.c14
-rw-r--r--src/db/sysdb.h4
2 files changed, 9 insertions, 9 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index ca053ae8b..bc6f8fc97 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -20,6 +20,7 @@
*/
#include "util/util.h"
+#include "util/strtonum.h"
#include "db/sysdb_private.h"
#include "confdb/confdb.h"
#include <time.h>
@@ -171,13 +172,13 @@ int sysdb_attrs_get_string(struct sysdb_attrs *attrs, const char *name,
return EOK;
}
-int sysdb_attrs_get_ulong(struct sysdb_attrs *attrs, const char *name,
- unsigned long *value)
+int sysdb_attrs_get_uint32_t(struct sysdb_attrs *attrs, const char *name,
+ uint32_t *value)
{
struct ldb_message_element *el;
int ret;
char *endptr;
- unsigned long val;
+ uint32_t val;
ret = sysdb_attrs_get_el_int(attrs, name, false, &el);
if (ret) {
@@ -189,10 +190,9 @@ int sysdb_attrs_get_ulong(struct sysdb_attrs *attrs, const char *name,
}
errno = 0;
- val = strtoul((const char *) el->values[0].data, &endptr, 0);
- if (errno || *endptr) {
- return EINVAL;
- }
+ val = strtouint32((const char *) el->values[0].data, &endptr, 0);
+ if (errno != 0) return errno;
+ if (*endptr) return EINVAL;
*value = val;
return EOK;
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 2ca9527dc..0d8b29c96 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -196,8 +196,8 @@ int sysdb_attrs_get_string(struct sysdb_attrs *attrs, const char *name,
const char **string);
int sysdb_attrs_get_string_array(struct sysdb_attrs *attrs, const char *name,
TALLOC_CTX *mem_ctx, const char ***string);
-int sysdb_attrs_get_ulong(struct sysdb_attrs *attrs, const char *name,
- unsigned long *value);
+int sysdb_attrs_get_uint32_t(struct sysdb_attrs *attrs, const char *name,
+ uint32_t *value);
int sysdb_attrs_replace_name(struct sysdb_attrs *attrs, const char *oldname,
const char *newname);