diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/auth/kerberos/krb5_init_context.c | 8 | ||||
-rw-r--r-- | source4/kdc/kdc.c | 4 | ||||
-rw-r--r-- | source4/lib/messaging/messaging.c | 4 | ||||
-rw-r--r-- | source4/lib/socket/socket.c | 20 | ||||
-rw-r--r-- | source4/lib/socket/socket.h | 16 | ||||
-rw-r--r-- | source4/lib/socket/socket_ipv4.c | 38 | ||||
-rw-r--r-- | source4/lib/socket/socket_ipv6.c | 19 | ||||
-rw-r--r-- | source4/lib/socket/socket_unix.c | 26 | ||||
-rw-r--r-- | source4/lib/stream/packet.c | 4 | ||||
-rw-r--r-- | source4/lib/tls/tls.c | 10 | ||||
-rw-r--r-- | source4/libcli/cldap/cldap.c | 6 | ||||
-rw-r--r-- | source4/libcli/dgram/dgramsocket.c | 4 | ||||
-rw-r--r-- | source4/libcli/nbt/nbtsocket.c | 4 | ||||
-rw-r--r-- | source4/rpc_server/dcerpc_sock.c | 4 | ||||
-rw-r--r-- | source4/torture/local/socket.c | 45 |
15 files changed, 69 insertions, 143 deletions
diff --git a/source4/auth/kerberos/krb5_init_context.c b/source4/auth/kerberos/krb5_init_context.c index dbcd979016..aefa8fbfbc 100644 --- a/source4/auth/kerberos/krb5_init_context.c +++ b/source4/auth/kerberos/krb5_init_context.c @@ -99,7 +99,7 @@ static void smb_krb5_socket_recv(struct smb_krb5_socket *smb_krb5) return; } - smb_krb5->status = socket_recv(smb_krb5->sock, blob.data, blob.length, &nread, 0); + smb_krb5->status = socket_recv(smb_krb5->sock, blob.data, blob.length, &nread); if (!NT_STATUS_IS_OK(smb_krb5->status)) { talloc_free(tmp_ctx); return; @@ -137,7 +137,7 @@ static void smb_krb5_socket_recv(struct smb_krb5_socket *smb_krb5) smb_krb5->status = socket_recv(smb_krb5->sock, smb_krb5->partial.data + smb_krb5->partial_read, 4 - smb_krb5->partial_read, - &nread, 0); + &nread); /* todo: this should be converted to the packet_*() routines */ if (!NT_STATUS_IS_OK(smb_krb5->status)) { return; @@ -164,7 +164,7 @@ static void smb_krb5_socket_recv(struct smb_krb5_socket *smb_krb5) smb_krb5->status = socket_recv(smb_krb5->sock, smb_krb5->partial.data + smb_krb5->partial_read, smb_krb5->partial.length - smb_krb5->partial_read, - &nread, 0); + &nread); if (!NT_STATUS_IS_OK(smb_krb5->status)) return; smb_krb5->partial_read += nread; @@ -200,7 +200,7 @@ static void smb_krb5_socket_send(struct smb_krb5_socket *smb_krb5) size_t len; len = smb_krb5->request.length; - status = socket_send(smb_krb5->sock, &smb_krb5->request, &len, 0); + status = socket_send(smb_krb5->sock, &smb_krb5->request, &len); if (!NT_STATUS_IS_OK(status)) return; diff --git a/source4/kdc/kdc.c b/source4/kdc/kdc.c index 2fd5674f79..4ce17a8718 100644 --- a/source4/kdc/kdc.c +++ b/source4/kdc/kdc.c @@ -87,7 +87,7 @@ static void kdc_send_handler(struct kdc_socket *kdc_socket) NTSTATUS status; size_t sendlen; - status = socket_sendto(kdc_socket->sock, &rep->packet, &sendlen, 0, + status = socket_sendto(kdc_socket->sock, &rep->packet, &sendlen, rep->dest); if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) { break; @@ -134,7 +134,7 @@ static void kdc_recv_handler(struct kdc_socket *kdc_socket) return; } - status = socket_recvfrom(kdc_socket->sock, blob.data, blob.length, &nread, 0, + status = socket_recvfrom(kdc_socket->sock, blob.data, blob.length, &nread, tmp_ctx, &src); if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 62170b64f3..bf06d68a33 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -170,7 +170,7 @@ static NTSTATUS try_send(struct messaging_rec *rec) /* we send with privileges so messages work from any context */ priv = root_privileges(); - status = socket_sendto(msg->sock, &rec->packet, &nsent, 0, path); + status = socket_sendto(msg->sock, &rec->packet, &nsent, path); talloc_free(path); talloc_free(priv); @@ -226,7 +226,7 @@ static void messaging_recv_handler(struct messaging_context *msg) return; } - status = socket_recv(msg->sock, packet.data, msize, &msize, 0); + status = socket_recv(msg->sock, packet.data, msize, &msize); if (!NT_STATUS_IS_OK(status)) { data_blob_free(&packet); return; diff --git a/source4/lib/socket/socket.c b/source4/lib/socket/socket.c index 9d18377db1..4f7f4ef4b9 100644 --- a/source4/lib/socket/socket.c +++ b/source4/lib/socket/socket.c @@ -171,7 +171,7 @@ _PUBLIC_ NTSTATUS socket_accept(struct socket_context *sock, struct socket_conte } _PUBLIC_ NTSTATUS socket_recv(struct socket_context *sock, void *buf, - size_t wantlen, size_t *nread, uint32_t flags) + size_t wantlen, size_t *nread) { if (sock == NULL) { return NT_STATUS_CONNECTION_DISCONNECTED; @@ -191,14 +191,14 @@ _PUBLIC_ NTSTATUS socket_recv(struct socket_context *sock, void *buf, *nread = 0; return STATUS_MORE_ENTRIES; } - return sock->ops->fn_recv(sock, buf, 1+(random() % wantlen), nread, flags); + return sock->ops->fn_recv(sock, buf, 1+(random() % wantlen), nread); } - return sock->ops->fn_recv(sock, buf, wantlen, nread, flags); + return sock->ops->fn_recv(sock, buf, wantlen, nread); } _PUBLIC_ NTSTATUS socket_recvfrom(struct socket_context *sock, void *buf, - size_t wantlen, size_t *nread, uint32_t flags, + size_t wantlen, size_t *nread, TALLOC_CTX *mem_ctx, struct socket_address **src_addr) { if (sock == NULL) { @@ -212,12 +212,12 @@ _PUBLIC_ NTSTATUS socket_recvfrom(struct socket_context *sock, void *buf, return NT_STATUS_NOT_IMPLEMENTED; } - return sock->ops->fn_recvfrom(sock, buf, wantlen, nread, flags, + return sock->ops->fn_recvfrom(sock, buf, wantlen, nread, mem_ctx, src_addr); } _PUBLIC_ NTSTATUS socket_send(struct socket_context *sock, - const DATA_BLOB *blob, size_t *sendlen, uint32_t flags) + const DATA_BLOB *blob, size_t *sendlen) { if (sock == NULL) { return NT_STATUS_CONNECTION_DISCONNECTED; @@ -238,15 +238,15 @@ _PUBLIC_ NTSTATUS socket_send(struct socket_context *sock, return STATUS_MORE_ENTRIES; } blob2.length = 1+(random() % blob2.length); - return sock->ops->fn_send(sock, &blob2, sendlen, flags); + return sock->ops->fn_send(sock, &blob2, sendlen); } - return sock->ops->fn_send(sock, blob, sendlen, flags); + return sock->ops->fn_send(sock, blob, sendlen); } _PUBLIC_ NTSTATUS socket_sendto(struct socket_context *sock, - const DATA_BLOB *blob, size_t *sendlen, uint32_t flags, + const DATA_BLOB *blob, size_t *sendlen, const struct socket_address *dest_addr) { if (sock == NULL) { @@ -265,7 +265,7 @@ _PUBLIC_ NTSTATUS socket_sendto(struct socket_context *sock, return NT_STATUS_NOT_IMPLEMENTED; } - return sock->ops->fn_sendto(sock, blob, sendlen, flags, dest_addr); + return sock->ops->fn_sendto(sock, blob, sendlen, dest_addr); } diff --git a/source4/lib/socket/socket.h b/source4/lib/socket/socket.h index 31dadb2f89..04ae53e464 100644 --- a/source4/lib/socket/socket.h +++ b/source4/lib/socket/socket.h @@ -62,15 +62,15 @@ struct socket_ops { /* general ops */ NTSTATUS (*fn_recv)(struct socket_context *sock, void *buf, - size_t wantlen, size_t *nread, uint32_t flags); + size_t wantlen, size_t *nread); NTSTATUS (*fn_send)(struct socket_context *sock, - const DATA_BLOB *blob, size_t *sendlen, uint32_t flags); + const DATA_BLOB *blob, size_t *sendlen); NTSTATUS (*fn_sendto)(struct socket_context *sock, - const DATA_BLOB *blob, size_t *sendlen, uint32_t flags, + const DATA_BLOB *blob, size_t *sendlen, const struct socket_address *dest_addr); NTSTATUS (*fn_recvfrom)(struct socket_context *sock, - void *buf, size_t wantlen, size_t *nread, uint32_t flags, + void *buf, size_t wantlen, size_t *nread, TALLOC_CTX *addr_ctx, struct socket_address **src_addr); NTSTATUS (*fn_pending)(struct socket_context *sock, size_t *npending); @@ -129,14 +129,14 @@ NTSTATUS socket_listen(struct socket_context *sock, int queue_size, uint32_t flags); NTSTATUS socket_accept(struct socket_context *sock, struct socket_context **new_sock); NTSTATUS socket_recv(struct socket_context *sock, void *buf, - size_t wantlen, size_t *nread, uint32_t flags); + size_t wantlen, size_t *nread); NTSTATUS socket_recvfrom(struct socket_context *sock, void *buf, - size_t wantlen, size_t *nread, uint32_t flags, + size_t wantlen, size_t *nread, TALLOC_CTX *addr_ctx, struct socket_address **src_addr); NTSTATUS socket_send(struct socket_context *sock, - const DATA_BLOB *blob, size_t *sendlen, uint32_t flags); + const DATA_BLOB *blob, size_t *sendlen); NTSTATUS socket_sendto(struct socket_context *sock, - const DATA_BLOB *blob, size_t *sendlen, uint32_t flags, + const DATA_BLOB *blob, size_t *sendlen, const struct socket_address *dest_addr); NTSTATUS socket_pending(struct socket_context *sock, size_t *npending); NTSTATUS socket_set_option(struct socket_context *sock, const char *option, const char *val); diff --git a/source4/lib/socket/socket_ipv4.c b/source4/lib/socket/socket_ipv4.c index 9e1f60d40a..38c9f98fdb 100644 --- a/source4/lib/socket/socket_ipv4.c +++ b/source4/lib/socket/socket_ipv4.c @@ -251,23 +251,13 @@ static NTSTATUS ipv4_accept(struct socket_context *sock, struct socket_context * } static NTSTATUS ipv4_recv(struct socket_context *sock, void *buf, - size_t wantlen, size_t *nread, uint32_t flags) + size_t wantlen, size_t *nread) { ssize_t gotlen; - int flgs = 0; - - /* TODO: we need to map all flags here */ - if (flags & SOCKET_FLAG_PEEK) { - flgs |= MSG_PEEK; - } - - if (flags & SOCKET_FLAG_BLOCK) { - flgs |= MSG_WAITALL; - } *nread = 0; - gotlen = recv(sock->fd, buf, wantlen, flgs); + gotlen = recv(sock->fd, buf, wantlen, 0); if (gotlen == 0) { return NT_STATUS_END_OF_FILE; } else if (gotlen == -1) { @@ -281,11 +271,10 @@ static NTSTATUS ipv4_recv(struct socket_context *sock, void *buf, static NTSTATUS ipv4_recvfrom(struct socket_context *sock, void *buf, - size_t wantlen, size_t *nread, uint32_t flags, + size_t wantlen, size_t *nread, TALLOC_CTX *addr_ctx, struct socket_address **_src) { ssize_t gotlen; - int flgs = 0; struct sockaddr_in *from_addr; socklen_t from_len = sizeof(*from_addr); struct socket_address *src; @@ -305,17 +294,10 @@ static NTSTATUS ipv4_recvfrom(struct socket_context *sock, void *buf, } src->sockaddr = (struct sockaddr *)from_addr; - if (flags & SOCKET_FLAG_PEEK) { - flgs |= MSG_PEEK; - } - - if (flags & SOCKET_FLAG_BLOCK) { - flgs |= MSG_WAITALL; - } *nread = 0; - gotlen = recvfrom(sock->fd, buf, wantlen, flgs, + gotlen = recvfrom(sock->fd, buf, wantlen, 0, src->sockaddr, &from_len); if (gotlen == 0) { talloc_free(src); @@ -345,14 +327,13 @@ static NTSTATUS ipv4_recvfrom(struct socket_context *sock, void *buf, } static NTSTATUS ipv4_send(struct socket_context *sock, - const DATA_BLOB *blob, size_t *sendlen, uint32_t flags) + const DATA_BLOB *blob, size_t *sendlen) { ssize_t len; - int flgs = 0; *sendlen = 0; - len = send(sock->fd, blob->data, blob->length, flgs); + len = send(sock->fd, blob->data, blob->length, 0); if (len == -1) { return map_nt_error_from_unix(errno); } @@ -363,14 +344,13 @@ static NTSTATUS ipv4_send(struct socket_context *sock, } static NTSTATUS ipv4_sendto(struct socket_context *sock, - const DATA_BLOB *blob, size_t *sendlen, uint32_t flags, + const DATA_BLOB *blob, size_t *sendlen, const struct socket_address *dest_addr) { ssize_t len; - int flgs = 0; if (dest_addr->sockaddr) { - len = sendto(sock->fd, blob->data, blob->length, flgs, + len = sendto(sock->fd, blob->data, blob->length, 0, dest_addr->sockaddr, dest_addr->sockaddrlen); } else { struct sockaddr_in srv_addr; @@ -387,7 +367,7 @@ static NTSTATUS ipv4_sendto(struct socket_context *sock, *sendlen = 0; - len = sendto(sock->fd, blob->data, blob->length, flgs, + len = sendto(sock->fd, blob->data, blob->length, 0, (struct sockaddr *)&srv_addr, sizeof(srv_addr)); } if (len == -1) { diff --git a/source4/lib/socket/socket_ipv6.c b/source4/lib/socket/socket_ipv6.c index 9b6dcbf985..3e987b4306 100644 --- a/source4/lib/socket/socket_ipv6.c +++ b/source4/lib/socket/socket_ipv6.c @@ -224,23 +224,13 @@ static NTSTATUS ipv6_tcp_accept(struct socket_context *sock, struct socket_conte } static NTSTATUS ipv6_tcp_recv(struct socket_context *sock, void *buf, - size_t wantlen, size_t *nread, uint32_t flags) + size_t wantlen, size_t *nread) { ssize_t gotlen; - int flgs = 0; - - /* TODO: we need to map all flags here */ - if (flags & SOCKET_FLAG_PEEK) { - flgs |= MSG_PEEK; - } - - if (flags & SOCKET_FLAG_BLOCK) { - flgs |= MSG_WAITALL; - } *nread = 0; - gotlen = recv(sock->fd, buf, wantlen, flgs); + gotlen = recv(sock->fd, buf, wantlen, 0); if (gotlen == 0) { return NT_STATUS_END_OF_FILE; } else if (gotlen == -1) { @@ -253,14 +243,13 @@ static NTSTATUS ipv6_tcp_recv(struct socket_context *sock, void *buf, } static NTSTATUS ipv6_tcp_send(struct socket_context *sock, - const DATA_BLOB *blob, size_t *sendlen, uint32_t flags) + const DATA_BLOB *blob, size_t *sendlen) { ssize_t len; - int flgs = 0; *sendlen = 0; - len = send(sock->fd, blob->data, blob->length, flgs); + len = send(sock->fd, blob->data, blob->length, 0); if (len == -1) { return map_nt_error_from_unix(errno); } diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c index 3feb1bf234..d59ef02ba9 100644 --- a/source4/lib/socket/socket_unix.c +++ b/source4/lib/socket/socket_unix.c @@ -219,23 +219,13 @@ static NTSTATUS unixdom_accept(struct socket_context *sock, } static NTSTATUS unixdom_recv(struct socket_context *sock, void *buf, - size_t wantlen, size_t *nread, uint32_t flags) + size_t wantlen, size_t *nread) { ssize_t gotlen; - int flgs = 0; - - /* TODO: we need to map all flags here */ - if (flags & SOCKET_FLAG_PEEK) { - flgs |= MSG_PEEK; - } - - if (flags & SOCKET_FLAG_BLOCK) { - flgs |= MSG_WAITALL; - } *nread = 0; - gotlen = recv(sock->fd, buf, wantlen, flgs); + gotlen = recv(sock->fd, buf, wantlen, 0); if (gotlen == 0) { return NT_STATUS_END_OF_FILE; } else if (gotlen == -1) { @@ -248,14 +238,13 @@ static NTSTATUS unixdom_recv(struct socket_context *sock, void *buf, } static NTSTATUS unixdom_send(struct socket_context *sock, - const DATA_BLOB *blob, size_t *sendlen, uint32_t flags) + const DATA_BLOB *blob, size_t *sendlen) { ssize_t len; - int flgs = 0; *sendlen = 0; - len = send(sock->fd, blob->data, blob->length, flgs); + len = send(sock->fd, blob->data, blob->length, 0); if (len == -1) { return unixdom_error(errno); } @@ -267,15 +256,14 @@ static NTSTATUS unixdom_send(struct socket_context *sock, static NTSTATUS unixdom_sendto(struct socket_context *sock, - const DATA_BLOB *blob, size_t *sendlen, uint32_t flags, + const DATA_BLOB *blob, size_t *sendlen, const struct socket_address *dest) { ssize_t len; - int flgs = 0; *sendlen = 0; if (dest->sockaddr) { - len = sendto(sock->fd, blob->data, blob->length, flgs, + len = sendto(sock->fd, blob->data, blob->length, 0, dest->sockaddr, dest->sockaddrlen); } else { struct sockaddr_un srv_addr; @@ -288,7 +276,7 @@ static NTSTATUS unixdom_sendto(struct socket_context *sock, srv_addr.sun_family = AF_UNIX; strncpy(srv_addr.sun_path, dest->addr, sizeof(srv_addr.sun_path)); - len = sendto(sock->fd, blob->data, blob->length, flgs, + len = sendto(sock->fd, blob->data, blob->length, 0, (struct sockaddr *)&srv_addr, sizeof(srv_addr)); } if (len == -1) { diff --git a/source4/lib/stream/packet.c b/source4/lib/stream/packet.c index 987193c7d7..613400226b 100644 --- a/source4/lib/stream/packet.c +++ b/source4/lib/stream/packet.c @@ -298,7 +298,7 @@ _PUBLIC_ void packet_recv(struct packet_context *pc) npending, &nread); } else { status = socket_recv(pc->sock, pc->partial.data + pc->num_read, - npending, &nread, 0); + npending, &nread); } if (NT_STATUS_IS_ERR(status)) { packet_error(pc, status); @@ -455,7 +455,7 @@ _PUBLIC_ void packet_queue_run(struct packet_context *pc) if (pc->tls) { status = tls_socket_send(pc->tls, &blob, &nwritten); } else { - status = socket_send(pc->sock, &blob, &nwritten, 0); + status = socket_send(pc->sock, &blob, &nwritten); } if (NT_STATUS_IS_ERR(status)) { packet_error(pc, NT_STATUS_NET_WRITE_FAULT); diff --git a/source4/lib/tls/tls.c b/source4/lib/tls/tls.c index 3d40fdafa0..7c129b573c 100644 --- a/source4/lib/tls/tls.c +++ b/source4/lib/tls/tls.c @@ -77,7 +77,7 @@ static ssize_t tls_pull(gnutls_transport_ptr ptr, void *buf, size_t size) return 1; } - status = socket_recv(tls->socket, buf, size, &nread, 0); + status = socket_recv(tls->socket, buf, size, &nread); if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { return 0; } @@ -118,7 +118,7 @@ static ssize_t tls_push(gnutls_transport_ptr ptr, const void *buf, size_t size) b.data = discard_const(buf); b.length = size; - status = socket_send(tls->socket, &b, &nwritten, 0); + status = socket_send(tls->socket, &b, &nwritten); if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) { errno = EAGAIN; return -1; @@ -225,7 +225,7 @@ NTSTATUS tls_socket_recv(struct tls_context *tls, void *buf, size_t wantlen, int ret; NTSTATUS status; if (tls->tls_enabled && tls->tls_detect) { - status = socket_recv(tls->socket, &tls->first_byte, 1, nread, 0); + status = socket_recv(tls->socket, &tls->first_byte, 1, nread); NT_STATUS_NOT_OK_RETURN(status); if (*nread == 0) return NT_STATUS_OK; tls->tls_detect = False; @@ -240,7 +240,7 @@ NTSTATUS tls_socket_recv(struct tls_context *tls, void *buf, size_t wantlen, } if (!tls->tls_enabled) { - return socket_recv(tls->socket, buf, wantlen, nread, 0); + return socket_recv(tls->socket, buf, wantlen, nread); } status = tls_handshake(tls); @@ -274,7 +274,7 @@ NTSTATUS tls_socket_send(struct tls_context *tls, const DATA_BLOB *blob, size_t int ret; if (!tls->tls_enabled) { - return socket_send(tls->socket, blob, sendlen, 0); + return socket_send(tls->socket, blob, sendlen); } status = tls_handshake(tls); diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c index 7a484607a7..58beb1b642 100644 --- a/source4/libcli/cldap/cldap.c +++ b/source4/libcli/cldap/cldap.c @@ -83,7 +83,7 @@ static void cldap_socket_recv(struct cldap_socket *cldap) return; } - status = socket_recvfrom(cldap->sock, blob.data, blob.length, &nread, 0, + status = socket_recvfrom(cldap->sock, blob.data, blob.length, &nread, tmp_ctx, &src); if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); @@ -156,7 +156,7 @@ static void cldap_request_timeout(struct event_context *event_ctx, req->num_retries--; - socket_sendto(req->cldap->sock, &req->encoded, &len, 0, + socket_sendto(req->cldap->sock, &req->encoded, &len, req->dest); req->te = event_add_timed(req->cldap->event_ctx, req, @@ -183,7 +183,7 @@ static void cldap_socket_send(struct cldap_socket *cldap) size_t len; len = req->encoded.length; - status = socket_sendto(cldap->sock, &req->encoded, &len, 0, + status = socket_sendto(cldap->sock, &req->encoded, &len, req->dest); if (NT_STATUS_IS_ERR(status)) { DEBUG(3,("Failed to send cldap request of length %u to %s:%d\n", diff --git a/source4/libcli/dgram/dgramsocket.c b/source4/libcli/dgram/dgramsocket.c index 16bb9d2fb7..e7eb01b7e9 100644 --- a/source4/libcli/dgram/dgramsocket.c +++ b/source4/libcli/dgram/dgramsocket.c @@ -53,7 +53,7 @@ static void dgm_socket_recv(struct nbt_dgram_socket *dgmsock) return; } - status = socket_recvfrom(dgmsock->sock, blob.data, blob.length, &nread, 0, + status = socket_recvfrom(dgmsock->sock, blob.data, blob.length, &nread, tmp_ctx, &src); if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); @@ -113,7 +113,7 @@ static void dgm_socket_send(struct nbt_dgram_socket *dgmsock) size_t len; len = req->encoded.length; - status = socket_sendto(dgmsock->sock, &req->encoded, &len, 0, + status = socket_sendto(dgmsock->sock, &req->encoded, &len, req->dest); if (NT_STATUS_IS_ERR(status)) { DEBUG(3,("Failed to send datagram of length %u to %s:%d: %s\n", diff --git a/source4/libcli/nbt/nbtsocket.c b/source4/libcli/nbt/nbtsocket.c index 1e808e698d..50da8168e0 100644 --- a/source4/libcli/nbt/nbtsocket.c +++ b/source4/libcli/nbt/nbtsocket.c @@ -73,7 +73,7 @@ static void nbt_name_socket_send(struct nbt_name_socket *nbtsock) size_t len; len = req->encoded.length; - status = socket_sendto(nbtsock->sock, &req->encoded, &len, 0, + status = socket_sendto(nbtsock->sock, &req->encoded, &len, req->dest); if (NT_STATUS_IS_ERR(status)) goto failed; @@ -172,7 +172,7 @@ static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock) return; } - status = socket_recvfrom(nbtsock->sock, blob.data, blob.length, &nread, 0, + status = socket_recvfrom(nbtsock->sock, blob.data, blob.length, &nread, tmp_ctx, &src); if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); diff --git a/source4/rpc_server/dcerpc_sock.c b/source4/rpc_server/dcerpc_sock.c index 587e8259f8..3346dedd44 100644 --- a/source4/rpc_server/dcerpc_sock.c +++ b/source4/rpc_server/dcerpc_sock.c @@ -47,7 +47,7 @@ static NTSTATUS dcerpc_write_fn(void *private_data, DATA_BLOB *out, size_t *nwri struct socket_context *sock = talloc_get_type(private_data, struct socket_context); size_t sendlen; - status = socket_send(sock, out, &sendlen, 0); + status = socket_send(sock, out, &sendlen); NT_STATUS_IS_ERR_RETURN(status); *nwritten = sendlen; @@ -152,7 +152,7 @@ static void dcesrv_sock_recv(struct stream_connection *conn, uint16_t flags) return; } - status = socket_recv(conn->socket, tmp_blob.data, tmp_blob.length, &nread, 0); + status = socket_recv(conn->socket, tmp_blob.data, tmp_blob.length, &nread); if (NT_STATUS_IS_ERR(status)) { dcesrv_terminate_connection(dce_conn, nt_errstr(status)); return; diff --git a/source4/torture/local/socket.c b/source4/torture/local/socket.c index 9a29ef0fec..91bd3b5315 100644 --- a/source4/torture/local/socket.c +++ b/source4/torture/local/socket.c @@ -82,10 +82,10 @@ static BOOL test_udp(TALLOC_CTX *mem_ctx) generate_random_buffer(blob.data, blob.length); sent = size; - status = socket_sendto(sock2, &blob, &sent, 0, srv_addr); + status = socket_sendto(sock2, &blob, &sent, srv_addr); CHECK_STATUS(status, NT_STATUS_OK); - status = socket_recvfrom(sock1, blob2.data, size, &nread, 0, + status = socket_recvfrom(sock1, blob2.data, size, &nread, sock1, &from_addr); CHECK_STATUS(status, NT_STATUS_OK); @@ -104,10 +104,10 @@ static BOOL test_udp(TALLOC_CTX *mem_ctx) } generate_random_buffer(blob.data, blob.length); - status = socket_sendto(sock1, &blob, &sent, 0, from_addr); + status = socket_sendto(sock1, &blob, &sent, from_addr); CHECK_STATUS(status, NT_STATUS_OK); - status = socket_recvfrom(sock2, blob2.data, size, &nread, 0, + status = socket_recvfrom(sock2, blob2.data, size, &nread, sock2, &from_addr); CHECK_STATUS(status, NT_STATUS_OK); if (strcmp(from_addr->addr, srv_addr->addr) != 0) { @@ -195,10 +195,10 @@ static BOOL test_tcp(TALLOC_CTX *mem_ctx) generate_random_buffer(blob.data, blob.length); sent = size; - status = socket_send(sock2, &blob, &sent, 0); + status = socket_send(sock2, &blob, &sent); CHECK_STATUS(status, NT_STATUS_OK); - status = socket_recv(sock3, blob2.data, size, &nread, 0); + status = socket_recv(sock3, blob2.data, size, &nread); CHECK_STATUS(status, NT_STATUS_OK); from_addr = socket_get_peer_addr(sock3, mem_ctx); @@ -217,38 +217,7 @@ static BOOL test_tcp(TALLOC_CTX *mem_ctx) } if (memcmp(blob2.data, blob.data, size) != 0) { - printf("Bad data in recvfrom\n"); - ret = False; - } - - generate_random_buffer(blob.data, blob.length); - status = socket_send(sock3, &blob, &sent, 0); - CHECK_STATUS(status, NT_STATUS_OK); - - status = socket_recv(sock2, blob2.data, size, &nread, 0); - CHECK_STATUS(status, NT_STATUS_OK); - - from_addr = socket_get_peer_addr(sock2, mem_ctx); - - if (!from_addr || !from_addr->addr) { - printf("Unexpected recvfrom addr NULL\n"); - return False; - } - if (strcmp(from_addr->addr, srv_addr->addr) != 0) { - printf("Unexpected recvfrom addr %s\n", from_addr ? from_addr->addr : NULL); - ret = False; - } - if (nread != size) { - printf("Unexpected recvfrom size %d should be %d\n", (int)nread, (int)size); - ret = False; - } - if (from_addr->port != srv_addr->port) { - printf("Unexpected recvfrom port %d should be %d\n", - from_addr->port, srv_addr->port); - ret = False; - } - if (memcmp(blob2.data, blob.data, size) != 0) { - printf("Bad data in recvfrom\n"); + printf("Bad data in recv\n"); ret = False; } |