summaryrefslogtreecommitdiff
path: root/source3/lib/util_sock.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-11-24 14:16:41 +0000
committerAndrew Tridgell <tridge@samba.org>2001-11-24 14:16:41 +0000
commitad2974cd05b4d08c8b92f505bf95aa8e8533235f (patch)
tree68ed4b1c3c99a13154fb768ba9f4bfcc1a3e7ce9 /source3/lib/util_sock.c
parent0ebb29e032f2cdbfdb55184c0b97fd1f71b84609 (diff)
downloadsamba-ad2974cd05b4d08c8b92f505bf95aa8e8533235f.tar.gz
samba-ad2974cd05b4d08c8b92f505bf95aa8e8533235f.tar.bz2
samba-ad2974cd05b4d08c8b92f505bf95aa8e8533235f.zip
added "net join" command
this completes the first stage of the smbd ADS support (This used to be commit 058a5aee901e6609969ef7e1d482a720a84a4a12)
Diffstat (limited to 'source3/lib/util_sock.c')
-rw-r--r--source3/lib/util_sock.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 340a83cf13..045e18ac22 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -905,6 +905,37 @@ connect_again:
return res;
}
+/*
+ open a connected UDP socket to host on port
+*/
+int open_udp_socket(const char *host, int port)
+{
+ int type = SOCK_DGRAM;
+ struct sockaddr_in sock_out;
+ int res;
+ struct in_addr *addr;
+
+ addr = interpret_addr2(host);
+
+ res = socket(PF_INET, type, 0);
+ if (res == -1) {
+ return -1;
+ }
+
+ memset((char *)&sock_out,'\0',sizeof(sock_out));
+ putip((char *)&sock_out.sin_addr,(char *)addr);
+ sock_out.sin_port = htons(port);
+ sock_out.sin_family = PF_INET;
+
+ if (connect(res,(struct sockaddr *)&sock_out,sizeof(sock_out))) {
+ close(res);
+ return -1;
+ }
+
+ return res;
+}
+
+
/* the following 3 client_*() functions are nasty ways of allowing
some generic functions to get info that really should be hidden in
particular modules */