diff options
author | nectar <nectar@FreeBSD.org> | 2002-02-04 19:12:46 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2002-02-04 19:12:46 +0000 |
commit | ebeabb1ba32f14e308ae9aff9a2a7151265259cf (patch) | |
tree | 71ba64d0a82be4894e23f6d65f36b61203ec3875 /contrib/bind/lib/irs/irpmarshall.c | |
parent | 1385a0dca8f9199ece158336f4c6a9f1e2e03c3e (diff) | |
download | FreeBSD-src-ebeabb1ba32f14e308ae9aff9a2a7151265259cf.zip FreeBSD-src-ebeabb1ba32f14e308ae9aff9a2a7151265259cf.tar.gz |
Import of ISC BIND 8.3.1-REL.
Diffstat (limited to 'contrib/bind/lib/irs/irpmarshall.c')
-rw-r--r-- | contrib/bind/lib/irs/irpmarshall.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/contrib/bind/lib/irs/irpmarshall.c b/contrib/bind/lib/irs/irpmarshall.c index 240bb08..6331ce1 100644 --- a/contrib/bind/lib/irs/irpmarshall.c +++ b/contrib/bind/lib/irs/irpmarshall.c @@ -49,7 +49,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: irpmarshall.c,v 8.6 2000/11/13 05:08:08 vixie Exp $"; +static const char rcsid[] = "$Id: irpmarshall.c,v 8.7 2001/05/29 05:49:01 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #if 0 @@ -139,7 +139,7 @@ irp_marshall_pw(const struct passwd *pw, char **buffer, size_t *len) { char pwGid[24]; char pwChange[24]; char pwExpire[24]; - char *pwClass; + const char *pwClass; const char *fieldsep = COLONSTR; if (pw == NULL || len == NULL) { @@ -1228,8 +1228,8 @@ irp_marshall_ng(const char *host, const char *user, const char *domain, /* - * int irp_unmarshall_ng(char **host, char **user, char **domain, - * char *buffer) + * int irp_unmarshall_ng(const char **host, const char **user, + * const char **domain, char *buffer) * * notes: * @@ -1243,20 +1243,24 @@ irp_marshall_ng(const char *host, const char *user, const char *domain, */ int -irp_unmarshall_ng(char **host, char **user, char **domain, char *buffer) { +irp_unmarshall_ng(const char **hostp, const char **userp, const char **domainp, + char *buffer) +{ char *p, *q; char fieldsep = ','; int myerrno = EINVAL; + char *host, *user, *domain; - if (user == NULL || host == NULL || domain == NULL || buffer == NULL) { + if (userp == NULL || hostp == NULL || + domainp == NULL || buffer == NULL) { errno = EINVAL; return (-1); } - *host = *user = *domain = NULL; + host = user = domain = NULL; p = buffer; - while (isspace(*p)) { + while (isspace((unsigned char)*p)) { p++; } if (*p != '(') { @@ -1269,7 +1273,7 @@ irp_unmarshall_ng(char **host, char **user, char **domain, char *buffer) { if (!*q) { goto error; } else if (q > p + 1) { - *host = strndup(p, q - p); + host = strndup(p, q - p); } p = q + 1; @@ -1282,7 +1286,7 @@ irp_unmarshall_ng(char **host, char **user, char **domain, char *buffer) { if (!*q) { goto error; } - *user = strndup(p, q - p); + user = strndup(p, q - p); } else { p++; } @@ -1296,17 +1300,20 @@ irp_unmarshall_ng(char **host, char **user, char **domain, char *buffer) { if (!*q) { goto error; } - *domain = strndup(p, q - p); + domain = strndup(p, q - p); } + *hostp = host; + *userp = user; + *domainp = domain; return (0); error: errno = myerrno; - if (*host != NULL) free(*host); - if (*user != NULL) free(*user); - if (*domain != NULL) free(*domain); + if (host != NULL) free(host); + if (user != NULL) free(user); + if (domain != NULL) free(domain); return (-1); } @@ -1847,7 +1854,7 @@ getfield(char **res, size_t reslen, char **ptr, char delim) { if (*res == NULL) { *res = strndup(*ptr, q - *ptr); } else { - if (q - *ptr + 1 > reslen) { /* to big for res */ + if ((size_t)(q - *ptr + 1) > reslen) { /* to big for res */ errno = EINVAL; return (NULL); } else { |