summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-05-25 13:52:32 +0200
committerStephen Gallagher <sgallagh@redhat.com>2012-05-25 08:51:28 -0400
commit188f9e1e646b0bed530913ca76bbcdf0f342cc66 (patch)
treeab8812ce32a3409bca86e0808b4d96e9264b011e /src
parentde00277c5a865501aa9d835c8dc94c7d22dfd88d (diff)
downloadsssd-188f9e1e646b0bed530913ca76bbcdf0f342cc66.tar.gz
sssd-188f9e1e646b0bed530913ca76bbcdf0f342cc66.tar.bz2
sssd-188f9e1e646b0bed530913ca76bbcdf0f342cc66.zip
Send 16bit protocol numbers from the sss_client
https://fedorahosted.org/sssd/ticket/1348
Diffstat (limited to 'src')
-rw-r--r--src/responder/nss/nsssrv_services.c2
-rw-r--r--src/sss_client/nss_services.c13
2 files changed, 8 insertions, 7 deletions
diff --git a/src/responder/nss/nsssrv_services.c b/src/responder/nss/nsssrv_services.c
index 2e539f13..db8a2ca1 100644
--- a/src/responder/nss/nsssrv_services.c
+++ b/src/responder/nss/nsssrv_services.c
@@ -1050,7 +1050,7 @@ errno_t parse_getservbyport(TALLOC_CTX *mem_ctx,
SAFEALIGN_COPY_UINT16(&c, body, NULL);
port = ntohs(c);
- port_and_padding_len = 2 * sizeof(uint16_t) + sizeof(uint32_t);
+ port_and_padding_len = 2 * sizeof(uint16_t);
i = port_and_padding_len;
j = 0;
diff --git a/src/sss_client/nss_services.c b/src/sss_client/nss_services.c
index 3f042b4a..8f25781a 100644
--- a/src/sss_client/nss_services.c
+++ b/src/sss_client/nss_services.c
@@ -270,6 +270,7 @@ _nss_sss_getservbyport_r(int port, const char *protocol,
size_t proto_len = 0;
uint8_t *repbuf;
uint8_t *data;
+ size_t p = 0;
size_t replen, len;
enum nss_status nret;
int ret;
@@ -285,23 +286,23 @@ _nss_sss_getservbyport_r(int port, const char *protocol,
}
}
- rd.len = sizeof(uint32_t)*2 + proto_len + 1;
- data = malloc(sizeof(char)*rd.len);
+ rd.len = sizeof(uint16_t)*2 + proto_len + 1;
+ data = malloc(sizeof(uint8_t)*rd.len);
if (data == NULL) {
nret = NSS_STATUS_TRYAGAIN;
goto out;
}
- SAFEALIGN_SET_UINT32(data, port, NULL);
+ SAFEALIGN_SET_UINT16(data, port, &p);
/* Padding */
- memset(data + sizeof(uint32_t), 0, 4);
+ SAFEALIGN_SET_UINT16(data + p, 0, &p);
if (protocol) {
- memcpy(data + sizeof(uint32_t)*2, protocol, proto_len + 1);
+ memcpy(data + p, protocol, proto_len + 1);
} else {
/* No protocol specified, pass empty string */
- data[sizeof(uint32_t)*2] = '\0';
+ data[p] = '\0';
}
rd.data = data;