From 53091e3bce487ee82e2805a0231e780551561717 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 12 Mar 2017 19:39:01 +0000 Subject: Adapt to skalibs-2.5.0.0 --- src/libs6net/s6net_ident_client.c | 8 ++++---- src/libs6net/s6net_ident_error.c | 2 +- src/libs6net/s6net_ident_reply_get.c | 5 ++--- src/libs6net/s6net_ident_reply_parse.c | 18 +++++++++--------- 4 files changed, 16 insertions(+), 17 deletions(-) (limited to 'src/libs6net') diff --git a/src/libs6net/s6net_ident_client.c b/src/libs6net/s6net_ident_client.c index e4f4b87..a014fe2 100644 --- a/src/libs6net/s6net_ident_client.c +++ b/src/libs6net/s6net_ident_client.c @@ -1,22 +1,22 @@ /* ISC license. */ +#include #include #include -#include #include #include #include -int s6net_ident_client (char *s, size_t max, ip46_t const *remoteip, uint16_t remoteport, ip46_t const *localip, uint16_t localport, tain_t const *deadline, tain_t *stamp) +ssize_t s6net_ident_client (char *s, size_t max, ip46_t const *remoteip, uint16_t remoteport, ip46_t const *localip, uint16_t localport, tain_t const *deadline, tain_t *stamp) { char buf[S6NET_IDENT_REPLY_SIZE] ; size_t len ; - register ssize_t r = s6net_ident_reply_get(buf, remoteip, remoteport, localip, localport, deadline, stamp) ; + ssize_t r = s6net_ident_reply_get(buf, remoteip, remoteport, localip, localport, deadline, stamp) ; if (r < 0) return errno == EPIPE ? (errno = EIO, 0) : -1 ; /* the RFC says so */ len = r ; r = s6net_ident_reply_parse(buf, remoteport, localport) ; if (r <= 0) return r ; if (max + r < len + 1) return (errno = ENAMETOOLONG, -1) ; - byte_copy(s, len - r + 1, buf + r) ; + memcpy(s, buf + r, len - r + 1) ; return len - r + 1 ; } diff --git a/src/libs6net/s6net_ident_error.c b/src/libs6net/s6net_ident_error.c index de01714..fca41fc 100644 --- a/src/libs6net/s6net_ident_error.c +++ b/src/libs6net/s6net_ident_error.c @@ -27,7 +27,7 @@ static int const s6net_ident_error_codes[N] = char const *s6net_ident_error_str (int e) { - register unsigned int i = 0 ; + unsigned int i = 0 ; for (; i < N ; i++) if (e == s6net_ident_error_codes[i]) break ; return s6net_ident_error_strings[i] ; } diff --git a/src/libs6net/s6net_ident_reply_get.c b/src/libs6net/s6net_ident_reply_get.c index ee8c87e..18a833d 100644 --- a/src/libs6net/s6net_ident_reply_get.c +++ b/src/libs6net/s6net_ident_reply_get.c @@ -1,9 +1,8 @@ /* ISC license. */ -#include #include #include -#include +#include #include #include #include @@ -15,7 +14,7 @@ ssize_t s6net_ident_reply_get (char *s, ip46_t const *remoteip, uint16_t remoteport, ip46_t const *localip, uint16_t localport, tain_t const *deadline, tain_t *stamp) { - unsigned int len ; /* XXX: change when skalibs changes */ + size_t len ; int fd ; if (ip46_is6(remoteip) != ip46_is6(localip)) return (errno = EAFNOSUPPORT, -1) ; fd = socket_tcp46(ip46_is6(remoteip)) ; diff --git a/src/libs6net/s6net_ident_reply_parse.c b/src/libs6net/s6net_ident_reply_parse.c index dd3e84c..f2e3308 100644 --- a/src/libs6net/s6net_ident_reply_parse.c +++ b/src/libs6net/s6net_ident_reply_parse.c @@ -1,16 +1,16 @@ /* ISC license. */ -#include +#include #include #include -#include +#include #include #include #include static size_t skipspace (char const *s) { - register size_t n = 0 ; + size_t n = 0 ; while ((s[n] == ' ') || (s[n] == '\t')) n++ ; return n ; } @@ -33,8 +33,8 @@ ssize_t s6net_ident_reply_parse (char const *s, uint16_t rp, uint16_t lp) n += skipspace(s+n) ; if (!s[n]) goto err ; if (s[n++] != ':') goto err ; n += skipspace(s+n) ; if (!s[n]) goto err ; - if (!str_diffn(s+n, "ERROR", 5)) goto ERROR ; - if (!str_diffn(s+n, "USERID", 6)) goto USERID ; + if (!strncmp(s+n, "ERROR", 5)) goto ERROR ; + if (!strncmp(s+n, "USERID", 6)) goto USERID ; err: return (errno = EPROTO, -1) ; @@ -43,10 +43,10 @@ ssize_t s6net_ident_reply_parse (char const *s, uint16_t rp, uint16_t lp) n += skipspace(s+n) ; if (!s[n]) goto err ; if (s[n++] != ':') goto err ; n += skipspace(s+n) ; if (!s[n]) goto err ; - if (!str_diffn(s+n, "INVALID-PORT", 12)) return (errno = EINVAL, 0) ; - if (!str_diffn(s+n, "NO-USER", 7)) return (errno = ESRCH, 0) ; - if (!str_diffn(s+n, "HIDDEN-USER", 11)) return (errno = EPERM, 0) ; - if (!str_diffn(s+n, "UNKNOWN-ERROR", 13)) return (errno = EIO, 0) ; + if (!strncmp(s+n, "INVALID-PORT", 12)) return (errno = EINVAL, 0) ; + if (!strncmp(s+n, "NO-USER", 7)) return (errno = ESRCH, 0) ; + if (!strncmp(s+n, "HIDDEN-USER", 11)) return (errno = EPERM, 0) ; + if (!strncmp(s+n, "UNKNOWN-ERROR", 13)) return (errno = EIO, 0) ; if (s[n] == 'X') return (errno = EEXIST, 0) ; goto err ; -- cgit v1.2.3