summaryrefslogtreecommitdiff
path: root/src/libnsss
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-09-02 16:46:41 +0000
committerLaurent Bercot <ska@appnovation.com>2021-09-02 16:46:41 +0000
commit1f213b642deb1d8e6139d2b7daac8f639c8717e7 (patch)
tree09c938120a9be6a97ec6c52b082316d7a3143db9 /src/libnsss
parentc9a58ceb7c07774944930105ace2f042be7b5f53 (diff)
downloadnsss-1f213b642deb1d8e6139d2b7daac8f639c8717e7.tar.xz
Pass errno as unsigned char
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libnsss')
-rw-r--r--src/libnsss/nsss_switch_grp_getbygid.c2
-rw-r--r--src/libnsss/nsss_switch_grp_getbyname.c2
-rw-r--r--src/libnsss/nsss_switch_grp_getlist.c2
-rw-r--r--src/libnsss/nsss_switch_op.c4
-rw-r--r--src/libnsss/nsss_switch_pwd_get.c8
-rw-r--r--src/libnsss/nsss_switch_pwd_getbyname.c2
-rw-r--r--src/libnsss/nsss_switch_pwd_getbyuid.c2
-rw-r--r--src/libnsss/nsss_switch_shadow_get.c8
-rw-r--r--src/libnsss/nsss_switch_shadow_getbyname.c2
9 files changed, 16 insertions, 16 deletions
diff --git a/src/libnsss/nsss_switch_grp_getbygid.c b/src/libnsss/nsss_switch_grp_getbygid.c
index 8a4e7e3..d40235c 100644
--- a/src/libnsss/nsss_switch_grp_getbygid.c
+++ b/src/libnsss/nsss_switch_grp_getbygid.c
@@ -14,6 +14,6 @@ int nsss_switch_grp_getbygid (nsss_switch_t *a, struct group *gr, stralloc *sa,
if (!ipc_timed_send(buffer_fd(&a->b), buf, 5, deadline, stamp)) return 0 ;
if (!buffer_timed_get(&a->b, &buf[0], 1, deadline, stamp)) return 0 ;
if ((unsigned char)buf[0] == 255) return 0 ;
- if (buf[0]) return (errno = buf[0], 0) ;
+ if (buf[0]) return (errno = (unsigned char)buf[0], 0) ;
return nsss_switch_grp_read(&a->b, gr, sa, ga, deadline, stamp) ;
}
diff --git a/src/libnsss/nsss_switch_grp_getbyname.c b/src/libnsss/nsss_switch_grp_getbyname.c
index 086cdb1..2b7448a 100644
--- a/src/libnsss/nsss_switch_grp_getbyname.c
+++ b/src/libnsss/nsss_switch_grp_getbyname.c
@@ -19,6 +19,6 @@ int nsss_switch_grp_getbyname (nsss_switch_t *a, struct group *gr, stralloc *sa,
if (!ipc_timed_sendv(buffer_fd(&a->b), v, 2, deadline, stamp)) return 0 ;
if (!buffer_timed_get(&a->b, &buf[0], 1, deadline, stamp)) return 0 ;
if ((unsigned char)buf[0] == 255) return 0 ;
- if (buf[0]) return (errno = buf[0], 0) ;
+ if (buf[0]) return (errno = (unsigned char)buf[0], 0) ;
return nsss_switch_grp_read(&a->b, gr, sa, ga, deadline, stamp) ;
}
diff --git a/src/libnsss/nsss_switch_grp_getlist.c b/src/libnsss/nsss_switch_grp_getlist.c
index abd4d84..22fb156 100644
--- a/src/libnsss/nsss_switch_grp_getlist.c
+++ b/src/libnsss/nsss_switch_grp_getlist.c
@@ -61,6 +61,6 @@ int nsss_switch_grp_getlist (nsss_switch_t *a, char const *user, gid_t *gids, si
uint32_pack_big(buf + 9, len + 1) ;
if (!ipc_timed_sendv(buffer_fd(&a->b), v, 2, deadline, stamp)) return 0 ;
if (!buffer_timed_get(&a->b, &buf[0], 1, deadline, stamp)) return 0 ;
- if (buf[0]) return (errno = buf[0], 0) ;
+ if (buf[0]) return (errno = (unsigned char)buf[0], 0) ;
return nsss_switch_grouplist_read(&a->b, n, r, gids, sa, deadline, stamp) ;
}
diff --git a/src/libnsss/nsss_switch_op.c b/src/libnsss/nsss_switch_op.c
index 77c49ed..7e9c1b3 100644
--- a/src/libnsss/nsss_switch_op.c
+++ b/src/libnsss/nsss_switch_op.c
@@ -8,9 +8,9 @@
int nsss_switch_op (nsss_switch_t *a, char op, tain const *deadline, tain *stamp)
{
- char c ;
+ unsigned char c ;
if (!ipc_timed_send(buffer_fd(&a->b), &op, 1, deadline, stamp)) return 0 ;
- if (!buffer_timed_get(&a->b, &c, 1, deadline, stamp)) return 0 ;
+ if (!buffer_timed_get(&a->b, (char *)&c, 1, deadline, stamp)) return 0 ;
if (c) return (errno = c, 0) ;
return 1 ;
}
diff --git a/src/libnsss/nsss_switch_pwd_get.c b/src/libnsss/nsss_switch_pwd_get.c
index 6b9c310..146e934 100644
--- a/src/libnsss/nsss_switch_pwd_get.c
+++ b/src/libnsss/nsss_switch_pwd_get.c
@@ -8,10 +8,10 @@
int nsss_switch_pwd_get (nsss_switch_t *a, struct passwd *pw, stralloc *sa, tain const *deadline, tain *stamp)
{
- char c = NSSS_SWITCH_PWD_GET ;
- if (!ipc_timed_send(buffer_fd(&a->b), &c, 1, deadline, stamp)) return 0 ;
- if (!buffer_timed_get(&a->b, &c, 1, deadline, stamp)) return 0 ;
- if ((unsigned char)c == 255) return 0 ;
+ unsigned char c = NSSS_SWITCH_PWD_GET ;
+ if (!ipc_timed_send(buffer_fd(&a->b), (char *)&c, 1, deadline, stamp)) return 0 ;
+ if (!buffer_timed_get(&a->b, (char *)&c, 1, deadline, stamp)) return 0 ;
+ if (c == 255) return 0 ;
if (c) return (errno = c, 0) ;
return nsss_switch_pwd_read(&a->b, pw, sa, deadline, stamp) ;
}
diff --git a/src/libnsss/nsss_switch_pwd_getbyname.c b/src/libnsss/nsss_switch_pwd_getbyname.c
index 9b3d164..eea9923 100644
--- a/src/libnsss/nsss_switch_pwd_getbyname.c
+++ b/src/libnsss/nsss_switch_pwd_getbyname.c
@@ -19,6 +19,6 @@ int nsss_switch_pwd_getbyname (nsss_switch_t *a, struct passwd *pw, stralloc *sa
if (!ipc_timed_sendv(buffer_fd(&a->b), v, 2, deadline, stamp)) return 0 ;
if (!buffer_timed_get(&a->b, &buf[0], 1, deadline, stamp)) return 0 ;
if ((unsigned char)buf[0] == 255) return 0 ;
- if (buf[0]) return (errno = buf[0], 0) ;
+ if (buf[0]) return (errno = (unsigned char)buf[0], 0) ;
return nsss_switch_pwd_read(&a->b, pw, sa, deadline, stamp) ;
}
diff --git a/src/libnsss/nsss_switch_pwd_getbyuid.c b/src/libnsss/nsss_switch_pwd_getbyuid.c
index 3e95e9e..e5b5c8a 100644
--- a/src/libnsss/nsss_switch_pwd_getbyuid.c
+++ b/src/libnsss/nsss_switch_pwd_getbyuid.c
@@ -14,6 +14,6 @@ int nsss_switch_pwd_getbyuid (nsss_switch_t *a, struct passwd *pw, stralloc *sa,
if (!ipc_timed_send(buffer_fd(&a->b), buf, 5, deadline, stamp)) return 0 ;
if (!buffer_timed_get(&a->b, &buf[0], 1, deadline, stamp)) return 0 ;
if ((unsigned char)buf[0] == 255) return 0 ;
- if (buf[0]) return (errno = buf[0], 0) ;
+ if (buf[0]) return (errno = (unsigned char)buf[0], 0) ;
return nsss_switch_pwd_read(&a->b, pw, sa, deadline, stamp) ;
}
diff --git a/src/libnsss/nsss_switch_shadow_get.c b/src/libnsss/nsss_switch_shadow_get.c
index 27b1e70..a2fc431 100644
--- a/src/libnsss/nsss_switch_shadow_get.c
+++ b/src/libnsss/nsss_switch_shadow_get.c
@@ -8,10 +8,10 @@
int nsss_switch_shadow_get (nsss_switch_t *a, struct spwd *sp, stralloc *sa, tain const *deadline, tain *stamp)
{
- char c = NSSS_SWITCH_SHADOW_GET ;
- if (!ipc_timed_send(buffer_fd(&a->b), &c, 1, deadline, stamp)) return 0 ;
- if (!buffer_timed_get(&a->b, &c, 1, deadline, stamp)) return 0 ;
- if ((unsigned char)c == 255) return 0 ;
+ unsigned char c = NSSS_SWITCH_SHADOW_GET ;
+ if (!ipc_timed_send(buffer_fd(&a->b), (char *)&c, 1, deadline, stamp)) return 0 ;
+ if (!buffer_timed_get(&a->b, (char *)&c, 1, deadline, stamp)) return 0 ;
+ if (c == 255) return 0 ;
if (c) return (errno = c, 0) ;
return nsss_switch_shadow_read(&a->b, sp, sa, deadline, stamp) ;
}
diff --git a/src/libnsss/nsss_switch_shadow_getbyname.c b/src/libnsss/nsss_switch_shadow_getbyname.c
index 5e91c5a..d5cf57a 100644
--- a/src/libnsss/nsss_switch_shadow_getbyname.c
+++ b/src/libnsss/nsss_switch_shadow_getbyname.c
@@ -19,6 +19,6 @@ int nsss_switch_shadow_getbyname (nsss_switch_t *a, struct spwd *sp, stralloc *s
if (!ipc_timed_sendv(buffer_fd(&a->b), v, 2, deadline, stamp)) return 0 ;
if (!buffer_timed_get(&a->b, &buf[0], 1, deadline, stamp)) return 0 ;
if ((unsigned char)buf[0] == 255) return 0 ;
- if (buf[0]) return (errno = buf[0], 0) ;
+ if (buf[0]) return (errno = (unsigned char)buf[0], 0) ;
return nsss_switch_shadow_read(&a->b, sp, sa, deadline, stamp) ;
}