diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2010-10-25 15:14:24 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-10-26 08:00:21 -0400 |
commit | 580374daba2ab2c6075a7d0de9512abff133e2e9 (patch) | |
tree | dfd9abe14efa5f6c79291ef72b1d2ac0b8326334 /src/db | |
parent | 13147b598a8409c338abb9472e74bbd606f224bd (diff) | |
download | sssd-580374daba2ab2c6075a7d0de9512abff133e2e9.tar.gz sssd-580374daba2ab2c6075a7d0de9512abff133e2e9.tar.bz2 sssd-580374daba2ab2c6075a7d0de9512abff133e2e9.zip |
Always use uint32_t for UID/GID numbers
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/sysdb.c | 14 | ||||
-rw-r--r-- | src/db/sysdb.h | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c index ca053ae8..bc6f8fc9 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 2ca9527d..0d8b29c9 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); |