[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Mon Aug 17 21:00:06 UTC 2020


The branch, master has been updated
       via  546a0f99e86 auth: Fix a typo
       via  6c42bc48f46 tests: Fix typos
       via  f05f40316dd Fix a comment typo copied around
       via  4f3ab0e9cad ldap_server: Fix a typo
       via  07c64844330 torture: Align a few integer types
       via  a6e506afd88 torture: Fix a typo
       via  5416fd2ce3e torture: Fix a typo
       via  af34a411b90 gensec: Fix a typo
       via  acd8de28ac1 auth_log_test: Fix a typo
       via  2d29bb42c73 test: Fix a typo
       via  753b6cc572e lib: Move get_socket_port() to its only consumer
       via  f3c43c65950 lib: Remove unused client_socket_port()
       via  b0d270d934b lib: Align integer types in same_net()
       via  d5cca8d0fcb lib: Remove unused client_socket_addr()
       via  de03dba413e lib: Remove unused client_addr()
       via  630f228fc63 lib: Remove unused open_udp_socket()
       via  2ccc9df4b31 lib: Move read_udp_v4_socket() to nmbd
       via  2e7f3e5e650 lib: Move send_keepalive() to smbd/smb1_utils.c
      from  3514e4100cc ldap_server: Do an early TALLOC_FREE()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 546a0f99e8636fa390ef269eb8a21cb7981d16a1
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Aug 12 16:33:54 2020 +0200

    auth: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Mon Aug 17 20:59:51 UTC 2020 on sn-devel-184

commit 6c42bc48f467c0b469c386649f80cd7a67cc436e
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 11 12:34:14 2020 +0200

    tests: Fix typos
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f05f40316dd95a01d765095f431a652cb548894e
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 9 16:14:02 2020 +0200

    Fix a comment typo copied around
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4f3ab0e9cad8b8a4ce429f1ed13b9eddefff062b
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Aug 6 18:39:01 2020 +0200

    ldap_server: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 07c64844330adc8b6f99fbe3dacede662052dbb5
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Aug 3 21:55:51 2020 +0200

    torture: Align a few integer types
    
    Also move a variable closer to its use
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a6e506afd88ce2491380f315c3dc77f43c877f7c
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 4 09:43:28 2020 +0200

    torture: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5416fd2ce3e0946ab601620c8eb1b025c072c34f
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Aug 3 21:48:41 2020 +0200

    torture: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit af34a411b90fe29dcf8d47fb7e5266d8190205f0
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Jul 22 11:49:49 2020 +0200

    gensec: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit acd8de28ac140453efa49d2ceff68175422473d2
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jul 19 21:38:29 2020 +0200

    auth_log_test: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2d29bb42c736e639e4812eaef9c3106f2e09123a
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jun 29 14:59:54 2020 +0200

    test: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 753b6cc572e4de46f9d1d74bce70f943a9b27d8e
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jul 17 22:29:10 2020 +0200

    lib: Move get_socket_port() to its only consumer
    
    This is only used in netbios_session_retarget()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f3c43c6595042beeb5aec36bcb13f9df1cbfc6d3
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jul 17 12:56:43 2020 +0200

    lib: Remove unused client_socket_port()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b0d270d934b89cc491833b23c2183b7aa21be858
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jul 21 15:45:24 2020 +0200

    lib: Align integer types in same_net()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d5cca8d0fcb063d39572ca88903a4582c2425175
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jul 17 12:55:53 2020 +0200

    lib: Remove unused client_socket_addr()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit de03dba413e5612f0411eb10c7ee3cb4dea1576e
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jul 17 12:52:15 2020 +0200

    lib: Remove unused client_addr()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 630f228fc631f259b68c4bf082d60bf40a856996
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jul 17 12:48:10 2020 +0200

    lib: Remove unused open_udp_socket()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2ccc9df4b313e8ff07a6c6ee34ab52c5c283c2c9
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jul 17 12:40:28 2020 +0200

    lib: Move read_udp_v4_socket() to nmbd
    
    This is the only consumer of it
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2e7f3e5e650b31c5cdd89dfa703844053b4e4885
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jul 17 12:36:22 2020 +0200

    lib: Move send_keepalive() to smbd/smb1_utils.c
    
    This is a SMB1-only packet sent from smbd only
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 auth/credentials/credentials.h               |   2 +-
 auth/gensec/gensec.c                         |   2 +-
 lib/util/util_net.c                          |  73 +---------------
 lib/util/util_net.h                          |   2 -
 nsswitch/tests/test_idmap_ad.sh              |   4 +-
 python/samba/tests/audit_log_base.py         |   2 +-
 python/samba/tests/complex_expressions.py    |   2 +-
 source3/include/proto.h                      |  10 ---
 source3/include/smbldap.h                    |   2 +-
 source3/lib/util_sock.c                      | 122 ---------------------------
 source3/nmbd/nmbd_packets.c                  |  43 ++++++++++
 source3/passdb/pdb_ldap_schema.h             |   2 +-
 source3/passdb/pdb_ldap_util.c               |   2 +-
 source3/passdb/pdb_ldap_util.h               |   2 +-
 source3/passdb/pdb_nds.c                     |   2 +-
 source3/passdb/pdb_nds.h                     |   2 +-
 source3/smbd/process.c                       |   1 +
 source3/smbd/reply.c                         |  33 ++++++++
 source3/smbd/smb1_utils.c                    |  15 ++++
 source3/smbd/smb1_utils.h                    |   1 +
 source4/dsdb/kcc/kcc_connection.h            |   2 +-
 source4/dsdb/kcc/kcc_periodic.c              |   2 +-
 source4/dsdb/kcc/kcc_service.c               |   2 +-
 source4/dsdb/kcc/kcc_service.h               |   2 +-
 source4/dsdb/repl/drepl_extended.c           |   2 +-
 source4/dsdb/repl/drepl_fsmo.c               |   2 +-
 source4/dsdb/repl/drepl_notify.c             |   2 +-
 source4/dsdb/repl/drepl_out_helpers.c        |   2 +-
 source4/dsdb/repl/drepl_out_helpers.h        |   2 +-
 source4/dsdb/repl/drepl_out_pull.c           |   2 +-
 source4/dsdb/repl/drepl_partitions.c         |   2 +-
 source4/dsdb/repl/drepl_periodic.c           |   2 +-
 source4/dsdb/repl/drepl_replica.c            |   2 +-
 source4/dsdb/repl/drepl_ridalloc.c           |   2 +-
 source4/dsdb/repl/drepl_secret.c             |   2 +-
 source4/dsdb/repl/drepl_service.c            |   2 +-
 source4/dsdb/repl/drepl_service.h            |   2 +-
 source4/dsdb/repl/replicated_objects.c       |   2 +-
 source4/dsdb/samdb/ldb_modules/schema_data.c |   2 +-
 source4/dsdb/samdb/ldb_modules/schema_load.c |   2 +-
 source4/dsdb/schema/schema.h                 |   2 +-
 source4/dsdb/schema/schema_description.c     |   2 +-
 source4/dsdb/schema/schema_filtered.c        |   2 +-
 source4/dsdb/schema/schema_init.c            |   2 +-
 source4/dsdb/schema/schema_query.c           |   2 +-
 source4/dsdb/schema/schema_syntax.c          |   2 +-
 source4/ldap_server/ldap_server.c            |   2 +-
 source4/lib/stream/packet.c                  |   2 +-
 source4/lib/stream/packet.h                  |   2 +-
 source4/torture/drs/drs_util.c               |   3 +-
 source4/torture/drs/unit/schemainfo_tests.c  |   6 +-
 source4/torture/ldap/basic.c                 |   4 +-
 source4/torture/ldap/cldap.c                 |   2 +-
 source4/torture/ldap/common.c                |   2 +-
 source4/torture/ldap/ldap_sort.c             |   2 +-
 source4/torture/ldap/nested_search.c         |   2 +-
 source4/torture/ldap/netlogon.c              |   2 +-
 source4/torture/ldap/schema.c                |   2 +-
 source4/torture/ldap/uptodatevector.c        |   2 +-
 source4/torture/smbtorture.c                 |   2 +-
 60 files changed, 149 insertions(+), 262 deletions(-)


Changeset truncated at 500 lines:

diff --git a/auth/credentials/credentials.h b/auth/credentials/credentials.h
index 9fe6a82b1ea..c2a17fef445 100644
--- a/auth/credentials/credentials.h
+++ b/auth/credentials/credentials.h
@@ -52,7 +52,7 @@ enum credentials_obtained {
 enum credentials_use_kerberos {
 	CRED_AUTO_USE_KERBEROS = 0, /* Default, we try kerberos if available */
 	CRED_DONT_USE_KERBEROS,     /* Sometimes trying kerberos just does 'bad things', so don't */
-	CRED_MUST_USE_KERBEROS      /* Sometimes administrators are parinoid, so always do kerberos */
+	CRED_MUST_USE_KERBEROS      /* Sometimes administrators are paranoid, so always do kerberos */
 };
 
 enum credentials_krb_forwardable {
diff --git a/auth/gensec/gensec.c b/auth/gensec/gensec.c
index becf4ce8685..3641d4ba65e 100644
--- a/auth/gensec/gensec.c
+++ b/auth/gensec/gensec.c
@@ -627,7 +627,7 @@ _PUBLIC_ bool gensec_have_feature(struct gensec_security *gensec_security,
 	}
 
 	/* We might 'have' features that we don't 'want', because the
-	 * other end demanded them, or we can't neotiate them off */
+	 * other end demanded them, or we can't negotiate them off */
 	return gensec_security->ops->have_feature(gensec_security, feature);
 }
 
diff --git a/lib/util/util_net.c b/lib/util/util_net.c
index ad6ee792084..daaf9808b8f 100644
--- a/lib/util/util_net.c
+++ b/lib/util/util_net.c
@@ -717,7 +717,7 @@ bool same_net(const struct sockaddr *ip1,
 		char *p1 = (char *)&ip1_6.sin6_addr;
 		char *p2 = (char *)&ip2_6.sin6_addr;
 		char *m = (char *)&mask_6.sin6_addr;
-		int i;
+		size_t i;
 
 		for (i = 0; i < sizeof(struct in6_addr); i++) {
 			*p1++ &= *m;
@@ -894,77 +894,6 @@ char *print_canonical_sockaddr(TALLOC_CTX *ctx,
 	return dest;
 }
 
-/****************************************************************************
- Return the port number we've bound to on a socket.
-****************************************************************************/
-
-int get_socket_port(int fd)
-{
-	struct sockaddr_storage sa;
-	socklen_t length = sizeof(sa);
-
-	if (fd == -1) {
-		return -1;
-	}
-
-	if (getsockname(fd, (struct sockaddr *)&sa, &length) < 0) {
-		int level = (errno == ENOTCONN) ? 2 : 0;
-		DEBUG(level, ("getsockname failed. Error was %s\n",
-			       strerror(errno)));
-		return -1;
-	}
-
-#if defined(HAVE_IPV6)
-	if (sa.ss_family == AF_INET6) {
-		struct sockaddr_in6 *sa_in6 = (struct sockaddr_in6 *)&sa;
-		return ntohs(sa_in6->sin6_port);
-	}
-#endif
-	if (sa.ss_family == AF_INET) {
-		struct sockaddr_in *sa_in = (struct sockaddr_in *)&sa;
-		return ntohs(sa_in->sin_port);
-	}
-	return -1;
-}
-
-/****************************************************************************
- Return the string of an IP address (IPv4 or IPv6).
-****************************************************************************/
-
-static const char *get_socket_addr(int fd, char *addr_buf, size_t addr_len)
-{
-	struct sockaddr_storage sa;
-	socklen_t length = sizeof(sa);
-
-	/* Ok, returning a hard coded IPv4 address
-	 * is bogus, but it's just as bogus as a
-	 * zero IPv6 address. No good choice here.
-	 */
-
-	if (strlcpy(addr_buf, "0.0.0.0", addr_len) >= addr_len) {
-		/* Truncate ! */
-		return NULL;
-	}
-
-	if (fd == -1) {
-		return addr_buf;
-	}
-
-	if (getsockname(fd, (struct sockaddr *)&sa, &length) < 0) {
-		DEBUG(0,("getsockname failed. Error was %s\n",
-			strerror(errno) ));
-		return addr_buf;
-	}
-
-	return print_sockaddr_len(addr_buf, addr_len, (struct sockaddr *)&sa, length);
-}
-
-const char *client_socket_addr(int fd, char *addr, size_t addr_len)
-{
-	return get_socket_addr(fd, addr, addr_len);
-}
-
-
 enum SOCK_OPT_TYPES {OPT_BOOL,OPT_INT,OPT_ON};
 
 typedef struct smb_socket_option {
diff --git a/lib/util/util_net.h b/lib/util/util_net.h
index a14f9a95171..80a7e08b7e8 100644
--- a/lib/util/util_net.h
+++ b/lib/util/util_net.h
@@ -120,8 +120,6 @@ char *print_sockaddr(char *dest,
 			const struct sockaddr_storage *psa);
 char *print_canonical_sockaddr(TALLOC_CTX *ctx,
 			const struct sockaddr_storage *pss);
-int get_socket_port(int fd);
-const char *client_socket_addr(int fd, char *addr, size_t addr_len);
 
 void set_socket_options(int fd, const char *options);
 
diff --git a/nsswitch/tests/test_idmap_ad.sh b/nsswitch/tests/test_idmap_ad.sh
index d919dcd09e2..46c637f7649 100755
--- a/nsswitch/tests/test_idmap_ad.sh
+++ b/nsswitch/tests/test_idmap_ad.sh
@@ -37,13 +37,13 @@ fi
 
 BASE_DN=$($ldbsearch -H ldap://$DC_SERVER -b "" -s base defaultNamingContext | awk '/^defaultNamingContext/ {print $2}')
 if [ $? -ne 0 ] ; then
-    echo "Could not find base DB" | subunit_fail_test "test_idmap_ad"
+    echo "Could not find base DN" | subunit_fail_test "test_idmap_ad"
     exit 1
 fi
 
 TRUST_BASE_DN=$($ldbsearch -H ldap://$TRUST_SERVER -b "" -s base defaultNamingContext | awk '/^defaultNamingContext/ {print $2}')
 if [ $? -ne 0 ] ; then
-    echo "Could not find trusted base DB" | subunit_fail_test "test_idmap_ad"
+    echo "Could not find trusted base DN" | subunit_fail_test "test_idmap_ad"
     exit 1
 fi
 
diff --git a/python/samba/tests/audit_log_base.py b/python/samba/tests/audit_log_base.py
index c1223edad84..f328b615df6 100644
--- a/python/samba/tests/audit_log_base.py
+++ b/python/samba/tests/audit_log_base.py
@@ -66,7 +66,7 @@ class AuditLogTestBase(samba.tests.TestCase):
         self.remoteAddress = client_ip
 
         #
-        # Check the remote address of a message against the one beimg used
+        # Check the remote address of a message against the one being used
         # for the tests.
         #
         def isRemote(message):
diff --git a/python/samba/tests/complex_expressions.py b/python/samba/tests/complex_expressions.py
index d88f296be28..5657bf6b276 100644
--- a/python/samba/tests/complex_expressions.py
+++ b/python/samba/tests/complex_expressions.py
@@ -114,7 +114,7 @@ class ComplexExpressionTests(TestCase):
 
         for ldap_object in ldap_objects:
             # It's useful to keep appropriate python types in the ldap_object
-            # dict but smdb's 'add' function expects strings.
+            # dict but samdb's 'add' function expects strings.
             stringed_ldap_object = {k: str(v)
                                     for (k, v) in ldap_object.items()}
             try:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 51bac188919..506e2e80fa1 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -519,23 +519,14 @@ char *print_sockaddr(char *dest,
 			const struct sockaddr_storage *psa);
 char *print_canonical_sockaddr(TALLOC_CTX *ctx,
 			const struct sockaddr_storage *pss);
-int get_socket_port(int fd);
-const char *client_addr(int fd, char *addr, size_t addrlen);
-const char *client_socket_addr(int fd, char *addr, size_t addr_len);
-int client_socket_port(int fd);
 bool is_a_socket(int fd);
 void set_socket_options(int fd, const char *options);
-ssize_t read_udp_v4_socket(int fd,
-			char *buf,
-			size_t len,
-			struct sockaddr_storage *psa);
 NTSTATUS read_fd_with_timeout(int fd, char *buf,
 				  size_t mincnt, size_t maxcnt,
 				  unsigned int time_out,
 				  size_t *size_ret);
 NTSTATUS read_data_ntstatus(int fd, char *buffer, size_t N);
 
-bool send_keepalive(int client);
 NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
 					  unsigned int timeout,
 					  size_t *len);
@@ -565,7 +556,6 @@ struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
 					      uint16_t port,
 					      int timeout);
 NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
-int open_udp_socket(const char *host, int port);
 const char *get_peer_addr(int fd, char *addr, size_t addr_len);
 
 struct tsocket_address;
diff --git a/source3/include/smbldap.h b/source3/include/smbldap.h
index d063f44afbc..8820d141b8f 100644
--- a/source3/include/smbldap.h
+++ b/source3/include/smbldap.h
@@ -1,5 +1,5 @@
 /* 
-   Unix SMB/CIFS mplementation.
+   Unix SMB/CIFS Implementation.
    LDAP protocol helper functions for SAMBA
    Copyright (C) Gerald Carter			2001-2003
 
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 0b7029706a6..142946e9f5d 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -31,19 +31,6 @@
 #include "lib/util/sys_rw.h"
 #include "lib/util/sys_rw_data.h"
 
-const char *client_addr(int fd, char *addr, size_t addrlen)
-{
-	return get_peer_addr(fd,addr,addrlen);
-}
-
-#if 0
-/* Not currently used. JRA. */
-int client_socket_port(int fd)
-{
-	return get_socket_port(fd);
-}
-#endif
-
 /****************************************************************************
  Determine if a file descriptor is in fact a socket.
 ****************************************************************************/
@@ -56,48 +43,6 @@ bool is_a_socket(int fd)
 	return(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0);
 }
 
-/****************************************************************************
- Read from a socket.
-****************************************************************************/
-
-ssize_t read_udp_v4_socket(int fd,
-			char *buf,
-			size_t len,
-			struct sockaddr_storage *psa)
-{
-	ssize_t ret;
-	socklen_t socklen = sizeof(*psa);
-	struct sockaddr_in *si = (struct sockaddr_in *)psa;
-
-	memset((char *)psa,'\0',socklen);
-
-	ret = (ssize_t)sys_recvfrom(fd,buf,len,0,
-			(struct sockaddr *)psa,&socklen);
-	if (ret <= 0) {
-		/* Don't print a low debug error for a non-blocking socket. */
-		if (errno == EAGAIN) {
-			DEBUG(10,("read_udp_v4_socket: returned EAGAIN\n"));
-		} else {
-			DEBUG(2,("read_udp_v4_socket: failed. errno=%s\n",
-				strerror(errno)));
-		}
-		return 0;
-	}
-
-	if (psa->ss_family != AF_INET) {
-		DEBUG(2,("read_udp_v4_socket: invalid address family %d "
-			"(not IPv4)\n", (int)psa->ss_family));
-		return 0;
-	}
-
-	DEBUG(10,("read_udp_v4_socket: ip %s port %d read: %lu\n",
-			inet_ntoa(si->sin_addr),
-			si->sin_port,
-			(unsigned long)ret));
-
-	return ret;
-}
-
 /****************************************************************************
  Read data from a file descriptor with a timout in msec.
  mincount = if timeout, minimum to read before returning
@@ -203,20 +148,6 @@ NTSTATUS read_data_ntstatus(int fd, char *buffer, size_t N)
 	return read_fd_with_timeout(fd, buffer, N, N, 0, NULL);
 }
 
-/****************************************************************************
- Send a keepalive packet (rfc1002).
-****************************************************************************/
-
-bool send_keepalive(int client)
-{
-	unsigned char buf[4];
-
-	buf[0] = NBSSkeepalive;
-	buf[1] = buf[2] = buf[3] = 0;
-
-	return(write_data(client,(char *)buf,4) == 4);
-}
-
 /****************************************************************************
  Read 4 bytes of a smb packet and return the smb length of the packet.
  Store the result in the buffer.
@@ -697,59 +628,6 @@ NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd)
 	return NT_STATUS_OK;
 }
 
-/****************************************************************************
- Open a connected UDP socket to host on port
-**************************************************************************/
-
-int open_udp_socket(const char *host, int port)
-{
-	struct sockaddr_storage ss;
-	int res;
-	socklen_t salen;
-
-	if (!interpret_string_addr(&ss, host, 0)) {
-		DEBUG(10,("open_udp_socket: can't resolve name %s\n",
-			host));
-		return -1;
-	}
-
-	res = socket(ss.ss_family, SOCK_DGRAM, 0);
-	if (res == -1) {
-		return -1;
-	}
-
-#if defined(HAVE_IPV6)
-	if (ss.ss_family == AF_INET6) {
-		struct sockaddr_in6 *psa6;
-		psa6 = (struct sockaddr_in6 *)&ss;
-		psa6->sin6_port = htons(port);
-		if (psa6->sin6_scope_id == 0
-				&& IN6_IS_ADDR_LINKLOCAL(&psa6->sin6_addr)) {
-			setup_linklocal_scope_id(
-				(struct sockaddr *)&ss);
-		}
-		salen = sizeof(struct sockaddr_in6);
-	} else 
-#endif
-	if (ss.ss_family == AF_INET) {
-		struct sockaddr_in *psa;
-		psa = (struct sockaddr_in *)&ss;
-		psa->sin_port = htons(port);
-	    salen = sizeof(struct sockaddr_in);
-	} else {
-		DEBUG(1, ("unknown socket family %d", ss.ss_family));
-		close(res);
-		return -1;
-	}
-
-	if (connect(res, (struct sockaddr *)&ss, salen)) {
-		close(res);
-		return -1;
-	}
-
-	return res;
-}
-
 /*******************************************************************
  Return the IP addr of the remote end of a socket as a string.
  Optionally return the struct sockaddr_storage.
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index bbcb9582ec5..be9e091f006 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -1879,6 +1879,49 @@ static void nmbd_fd_handler(struct tevent_context *ev,
 	attr->triggered = true;
 }
 
+/****************************************************************************
+ Read from a socket.
+****************************************************************************/
+
+static ssize_t read_udp_v4_socket(
+	int fd,
+	char *buf,
+	size_t len,
+	struct sockaddr_storage *psa)
+{
+	ssize_t ret;
+	socklen_t socklen = sizeof(*psa);
+	struct sockaddr_in *si = (struct sockaddr_in *)psa;
+
+	memset((char *)psa,'\0',socklen);
+
+	ret = (ssize_t)sys_recvfrom(fd,buf,len,0,
+			(struct sockaddr *)psa,&socklen);
+	if (ret <= 0) {
+		/* Don't print a low debug error for a non-blocking socket. */
+		if (errno == EAGAIN) {
+			DEBUG(10,("read_udp_v4_socket: returned EAGAIN\n"));
+		} else {
+			DEBUG(2,("read_udp_v4_socket: failed. errno=%s\n",
+				strerror(errno)));
+		}
+		return 0;
+	}
+
+	if (psa->ss_family != AF_INET) {
+		DEBUG(2,("read_udp_v4_socket: invalid address family %d "
+			"(not IPv4)\n", (int)psa->ss_family));
+		return 0;
+	}
+
+	DEBUG(10,("read_udp_v4_socket: ip %s port %d read: %lu\n",
+			inet_ntoa(si->sin_addr),
+			si->sin_port,
+			(unsigned long)ret));
+
+	return ret;
+}
+
 /*******************************************************************
  Read a packet from a socket and parse it, returning a packet ready
  to be used or put on the queue. This assumes a UDP socket.
diff --git a/source3/passdb/pdb_ldap_schema.h b/source3/passdb/pdb_ldap_schema.h
index 947af183b18..ea98db22892 100644
--- a/source3/passdb/pdb_ldap_schema.h
+++ b/source3/passdb/pdb_ldap_schema.h
@@ -1,5 +1,5 @@
 /*
-   Unix SMB/CIFS mplementation.
+   Unix SMB/CIFS Implementation.
    LDAP protocol helper functions for SAMBA
    Copyright (C) Gerald Carter			2001-2003
 
diff --git a/source3/passdb/pdb_ldap_util.c b/source3/passdb/pdb_ldap_util.c
index 6fac6e209c3..0c1708d3d9a 100644
--- a/source3/passdb/pdb_ldap_util.c
+++ b/source3/passdb/pdb_ldap_util.c
@@ -1,5 +1,5 @@
 /*
-   Unix SMB/CIFS mplementation.
+   Unix SMB/CIFS Implementation.
    LDAP protocol helper functions for SAMBA
    Copyright (C) Jean François Micouleau	1998
    Copyright (C) Gerald Carter			2001-2003
diff --git a/source3/passdb/pdb_ldap_util.h b/source3/passdb/pdb_ldap_util.h
index fa1e96c7c9c..7e8967c212e 100644
--- a/source3/passdb/pdb_ldap_util.h
+++ b/source3/passdb/pdb_ldap_util.h
@@ -1,5 +1,5 @@
 /*
-   Unix SMB/CIFS mplementation.
+   Unix SMB/CIFS Implementation.
    LDAP protocol helper functions for SAMBA
    Copyright (C) Gerald Carter			2001-2003
 
diff --git a/source3/passdb/pdb_nds.c b/source3/passdb/pdb_nds.c
index 216c9e6b50b..5f00a8c5629 100644
--- a/source3/passdb/pdb_nds.c
+++ b/source3/passdb/pdb_nds.c
@@ -1,5 +1,5 @@
 /* 
-   Unix SMB/CIFS mplementation.
+   Unix SMB/CIFS Implementation.
    NDS LDAP helper functions for SAMBA
    Copyright (C) Vince Brimhall			2004-2005
     
diff --git a/source3/passdb/pdb_nds.h b/source3/passdb/pdb_nds.h
index 66d8319afed..ee71c787598 100644
--- a/source3/passdb/pdb_nds.h
+++ b/source3/passdb/pdb_nds.h
@@ -1,5 +1,5 @@
 /*
-   Unix SMB/CIFS mplementation.
+   Unix SMB/CIFS Implementation.
    NDS LDAP helper functions for SAMBA
    Copyright (C) Vince Brimhall			2004-2005
 
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 2bff5bf5a8f..5205674a006 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -46,6 +46,7 @@
 #include "util_event.h"
 #include "libcli/smb/smbXcli_base.h"
 #include "lib/util/time_basic.h"
+#include "smb1_utils.h"
 
 /* Internal message queue for deferred opens. */
 struct pending_message_list {
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 252b9556c3f..63d62a88a46 100644


-- 
Samba Shared Repository



More information about the samba-cvs mailing list