+++ /dev/null
-diff -ur samba-2.2.8a/source/acconfig.h samba-2.2.8a+IPv6-20030712/source/acconfig.h
---- samba-2.2.8a/source/acconfig.h 2003-02-28 10:56:06.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/acconfig.h 2003-07-12 22:28:29.000000000 -0400
-@@ -59,6 +59,7 @@
- #undef WITH_SYSLOG
- #undef WITH_PROFILE
- #undef WITH_SSL
-+#undef HAVE_INET6
- #undef WITH_LDAP
- #undef WITH_NISPLUS
- #undef WITH_TDBPWD
-diff -ur samba-2.2.8a/source/client/client.c samba-2.2.8a+IPv6-20030712/source/client/client.c
---- samba-2.2.8a/source/client/client.c 2003-03-14 16:34:47.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/client/client.c 2003-07-12 22:28:29.000000000 -0400
-@@ -30,7 +30,7 @@
- struct cli_state *cli;
- extern BOOL in_client;
- extern BOOL AllowDebugChange;
--static int port = SMB_PORT;
-+static int port = 0;
- pstring cur_dir = "\\";
- pstring cd_path = "";
- static pstring service;
-@@ -80,7 +80,7 @@
- static BOOL recurse = False;
- BOOL lowercase = False;
-
--struct in_addr dest_ip;
-+char dest_ip[512];
-
- #define SEPARATORS " \t\n\r"
-
-@@ -2153,8 +2153,8 @@
- struct cli_state *c;
- struct nmb_name called, calling;
- const char *server_n;
-- struct in_addr ip;
- fstring servicename;
-+ struct sockaddr_list *salist;
- char *sharename;
-
- /* make a copy so we don't modify the global string 'service' */
-@@ -2170,21 +2170,18 @@
-
- server_n = server;
-
-- zero_ip(&ip);
--
- make_nmb_name(&calling, global_myname, 0x0);
- make_nmb_name(&called , server, name_type);
-
- again:
-- zero_ip(&ip);
-- if (have_ip) ip = dest_ip;
--
-- /* have to open a new connection */
-- if (!(c=cli_initialise(NULL)) || (cli_set_port(c, port) == 0) ||
-- !cli_connect(c, server_n, &ip)) {
-- DEBUG(0,("Connection to %s failed\n", server_n));
-- return NULL;
-- }
-+ salist = resolve_name_smb(have_ip ? dest_ip : server_n, port);
-+
-+ /* have to open a new connection */
-+ if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, salist)) {
-+ DEBUG(0,("Connection to %s failed\n", server_n));
-+ free_sockaddr_list(salist);
-+ return NULL;
-+ }
-
- c->protocol = max_protocol;
- if (timeout_msec)
-@@ -2429,29 +2426,19 @@
-
- static int do_message_op(void)
- {
-- struct in_addr ip;
- struct nmb_name called, calling;
--
-- zero_ip(&ip);
-+ struct sockaddr_list *salist;
-
- make_nmb_name(&calling, global_myname, 0x0);
- make_nmb_name(&called , desthost, name_type);
-
-- zero_ip(&ip);
-- if (have_ip)
-- ip = dest_ip;
-- else if (name_type != 0x20) {
-- /* We must do our own resolve name here as the nametype is #0x3, not #0x20. */
-- if (!resolve_name(desthost, &ip, name_type)) {
-- DEBUG(0,("Cannot resolve name %s#0x%x\n", desthost, name_type));
-- return 1;
-- }
-- }
--
-- if (!(cli=cli_initialise(NULL)) || (cli_set_port(cli, port) == 0) || !cli_connect(cli, desthost, &ip)) {
-- DEBUG(0,("Connection to %s failed\n", desthost));
-- return 1;
-- }
-+ salist = resolve_name_smb(have_ip ? dest_ip : desthost, port);
-+
-+ if (!(cli=cli_initialise(NULL)) || !cli_connect(cli, desthost, salist)) {
-+ DEBUG(0,("Connection to %s failed\n", desthost));
-+ free_sockaddr_list(salist);
-+ return 1;
-+ }
-
- if (!cli_session_request(cli, &calling, &called)) {
- DEBUG(0,("session request failed\n"));
-@@ -2682,9 +2669,7 @@
- break;
- case 'I':
- {
-- dest_ip = *interpret_addr2(optarg);
-- if (is_zero_ip(dest_ip))
-- exit(1);
-+ strncpy(dest_ip, optarg, sizeof(dest_ip));
- have_ip = True;
- }
- break;
-diff -ur samba-2.2.8a/source/client/smbmount.c samba-2.2.8a+IPv6-20030712/source/client/smbmount.c
---- samba-2.2.8a/source/client/smbmount.c 2002-04-30 09:26:19.000000000 -0400
-+++ samba-2.2.8a+IPv6-20030712/source/client/smbmount.c 2003-07-12 22:28:29.000000000 -0400
-@@ -41,9 +41,9 @@
- static pstring service;
- static pstring options;
-
--static struct in_addr dest_ip;
-+static char dest_ip[512];
- static BOOL have_ip;
--static int smb_port = 139;
-+static int smb_port = 0;
- static BOOL got_pass;
- static uid_t mount_uid;
- static gid_t mount_gid;
-@@ -116,8 +116,8 @@
- {
- struct cli_state *c;
- struct nmb_name called, calling;
-+ struct sockaddr_list *salist;
- char *server_n;
-- struct in_addr ip;
- pstring server;
- char *share;
-
-@@ -141,16 +141,15 @@
- make_nmb_name(&called , server, 0x20);
-
- again:
-- zero_ip(&ip);
-- if (have_ip) ip = dest_ip;
-+ salist = resolve_name_smb(have_ip ? dest_ip : server_n, smb_port);
-
- /* have to open a new connection */
-- if (!(c=cli_initialise(NULL)) || (cli_set_port(c, smb_port) == 0) ||
-- !cli_connect(c, server_n, &ip)) {
-- DEBUG(0,("%d: Connection to %s failed\n", getpid(), server_n));
-- if (c) {
-- cli_shutdown(c);
-- }
-+ if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, salist)) {
-+ DEBUG(0,("%d: Connection to %s failed\n", getpid(), server_n));
-+ free_sockaddr_list(salist);
-+ if (c) {
-+ cli_shutdown(c);
-+ }
- return NULL;
- }
-
-@@ -744,11 +743,7 @@
- } else if(!strcmp(opts, "debug")) {
- DEBUGLEVEL = val;
- } else if(!strcmp(opts, "ip")) {
-- dest_ip = *interpret_addr2(opteq+1);
-- if (is_zero_ip(dest_ip)) {
-- fprintf(stderr,"Can't resolve address %s\n", opteq+1);
-- exit(1);
-- }
-+ strncpy(dest_ip, optarg, sizeof(dest_ip));
- have_ip = True;
- } else if(!strcmp(opts, "workgroup")) {
- pstrcpy(workgroup,opteq+1);
-diff -ur samba-2.2.8a/source/client/smbspool.c samba-2.2.8a+IPv6-20030712/source/client/smbspool.c
---- samba-2.2.8a/source/client/smbspool.c 2003-02-28 10:56:18.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/client/smbspool.c 2003-07-12 22:28:29.000000000 -0400
-@@ -279,7 +279,6 @@
- struct cli_state *c; /* New connection */
- struct nmb_name called, /* NMB name of server */
- calling; /* NMB name of client */
-- struct in_addr ip; /* IP address of server */
- pstring myname; /* Client name */
-
-
-@@ -289,8 +288,6 @@
-
- get_myname(myname);
-
-- zero_ip(&ip);
--
- make_nmb_name(&calling, myname, 0x0);
- make_nmb_name(&called, server, 0x20);
-
-@@ -304,14 +301,7 @@
- return (NULL);
- }
-
-- if (!cli_set_port(c, SMB_PORT))
-- {
-- fputs("ERROR: cli_set_port() failed...\n", stderr);
-- cli_shutdown(c);
-- return (NULL);
-- }
--
-- if (!cli_connect(c, server, &ip))
-+ if (!cli_connect(c, server, NULL))
- {
- fputs("ERROR: cli_connect() failed...\n", stderr);
- cli_shutdown(c);
-diff -ur samba-2.2.8a/source/configure.in samba-2.2.8a+IPv6-20030712/source/configure.in
---- samba-2.2.8a/source/configure.in 2003-02-28 10:56:18.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/configure.in 2003-07-12 22:28:29.000000000 -0400
-@@ -2282,6 +2282,53 @@
- )
-
- #################################################
-+# check for IPv6 support
-+AC_MSG_CHECKING(whether to use IPv6)
-+AC_ARG_WITH(ipv6,
-+[ --with-ipv6 Include IPv6 support (default=no)],
-+[ case "$withval" in
-+ yes)
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(HAVE_INET6)
-+
-+ AC_CACHE_CHECK(for struct sockaddr_in6,samba_cv_struct_sockaddr_in6,
-+ AC_TRY_COMPILE(
-+ [#include <sys/types.h>
-+ #include <sys/socket.h>
-+ #include <netinet/in.h>],
-+ [struct sockaddr_in6 sin6;
-+ sin6.sin6_port = 0;],
-+ [samba_cv_struct_sockaddr_in6=yes],
-+ [samba_cv_struct_sockaddr_in6=no]))
-+ if test "$samba_cv_struct_sockaddr_in6" != yes ; then
-+ AC_MSG_ERROR([This system does not have IPv6 support. Reconfigure without the --with-ipv6 flag.])
-+ fi
-+
-+ AC_CHECK_FUNC(getaddrinfo,,
-+ AC_MSG_ERROR([IPv6 functionality requires getaddrinfo. Reconfigure without the --with-ipv6 flag.]))
-+
-+ dnl This can't check for member names because we're not sure what they
-+ dnl might be. Doesn't matter - we only need it defined for sizeof.
-+ AC_CACHE_CHECK(for struct sockaddr_storage,samba_cv_struct_sockaddr_storage,
-+ AC_TRY_COMPILE(
-+ [#include <sys/types.h>
-+ #include <sys/socket.h>
-+ #include <netinet/in.h>],
-+ [struct sockaddr_storage ss;],
-+ [samba_cv_struct_sockaddr_storage=yes],
-+ [samba_cv_struct_sockaddr_storage=no]))
-+ if test "$samba_cv_struct_sockaddr_storage" != yes ; then
-+ AC_MSG_ERROR([IPv6 functionality requires the sockaddr_storage structure. Reconfigure without the --with-ipv6 flag.])
-+ fi
-+ ;;
-+ *)
-+ AC_MSG_RESULT(no)
-+ ;;
-+ esac],
-+ AC_MSG_RESULT(no)
-+)
-+
-+#################################################
- # check for syslog logging
- AC_MSG_CHECKING(whether to use syslog logging)
- AC_ARG_WITH(syslog,
-diff -ur samba-2.2.8a/source/include/client.h samba-2.2.8a+IPv6-20030712/source/include/client.h
---- samba-2.2.8a/source/include/client.h 2003-03-14 16:34:47.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/include/client.h 2003-07-12 22:28:29.000000000 -0400
-@@ -58,7 +58,7 @@
- };
-
- struct cli_state {
-- int port;
-+ int default_port;
- int fd;
- int smb_rw_error; /* Copy of last read or write error. */
- uint16 cnum;
-@@ -89,7 +89,8 @@
- struct nmb_name called;
- struct nmb_name calling;
- fstring full_dest_host_name;
-- struct in_addr dest_ip;
-+ struct sockaddr_list *dest_addrs;
-+ struct sockaddr_list *connected_addr;
-
- struct pwd_info pwd;
- unsigned char cryptkey[8];
-diff -ur samba-2.2.8a/source/include/config.h.in samba-2.2.8a+IPv6-20030712/source/include/config.h.in
---- samba-2.2.8a/source/include/config.h.in 2003-02-28 10:56:18.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/include/config.h.in 2003-07-12 22:28:29.000000000 -0400
-@@ -125,6 +125,7 @@
- #undef WITH_SYSLOG
- #undef WITH_PROFILE
- #undef WITH_SSL
-+#undef HAVE_INET6
- #undef WITH_LDAP
- #undef WITH_NISPLUS
- #undef WITH_TDBPWD
-diff -ur samba-2.2.8a/source/include/nameserv.h samba-2.2.8a+IPv6-20030712/source/include/nameserv.h
---- samba-2.2.8a/source/include/nameserv.h 2002-05-18 09:40:11.000000000 -0400
-+++ samba-2.2.8a+IPv6-20030712/source/include/nameserv.h 2003-07-12 22:28:29.000000000 -0400
-@@ -129,6 +129,17 @@
- #define FIND_SELF_NAME 1
-
- /*
-+ * Linked-list structure for storing resolved IP addresses.
-+ */
-+
-+struct sockaddr_list {
-+ struct sockaddr_list *next;
-+ int pfamily;
-+ int len;
-+ struct sockaddr *addr;
-+};
-+
-+/*
- * The different name types that can be in namelists.
- *
- * SELF_NAME should only be on the broadcast and unicast subnets.
-diff -ur samba-2.2.8a/source/include/proto.h samba-2.2.8a+IPv6-20030712/source/include/proto.h
---- samba-2.2.8a/source/include/proto.h 2003-03-14 16:34:47.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/include/proto.h 2003-07-12 22:28:29.000000000 -0400
-@@ -203,9 +203,10 @@
- BOOL cli_negprot(struct cli_state *cli);
- BOOL cli_session_request(struct cli_state *cli,
- struct nmb_name *calling, struct nmb_name *called);
--BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip);
-+BOOL cli_connect(struct cli_state *cli, const char *host,
-+ struct sockaddr_list *salist);
- BOOL cli_establish_connection(struct cli_state *cli,
-- const char *dest_host, struct in_addr *dest_ip,
-+ char *dest_host, struct sockaddr_list *salist,
- struct nmb_name *calling, struct nmb_name *called,
- const char *service, const char *service_type,
- BOOL do_shutdown, BOOL do_tcon);
-@@ -215,8 +216,8 @@
- const char *service, const char *service_type,
- const char *user, const char *domain,
- const char *password, int pass_len) ;
--BOOL attempt_netbios_session_request(struct cli_state *cli, const char *srchost, const char *desthost,
-- struct in_addr *pdest_ip);
-+BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost,
-+ char *desthost);
-
- /* The following definitions come from libsmb/cli_dfs.c */
-
-@@ -723,12 +724,12 @@
- BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipaddr);
- void endlmhosts(FILE *fp);
- BOOL name_register_wins(const char *name, int name_type);
--BOOL name_resolve_bcast(const char *name, int name_type,
-- struct in_addr **return_ip_list, int *return_count);
--BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type);
--BOOL resolve_name_2(const char *name, struct in_addr **return_ip, int *count, int name_type);
--BOOL resolve_srv_name(const char* srv_name, fstring dest_host,
-- struct in_addr *ip);
-+struct sockaddr_list *name_resolve_bcast(const char *name, int name_type);
-+BOOL resolve_name_netbios(const char *name, struct in_addr *return_ip,
-+ int name_type);
-+struct sockaddr_list *resolve_name_smb(const char *name, int port);
-+struct sockaddr_list *resolve_srv_name(const char* srv_name,
-+ fstring dest_host, int port);
- BOOL find_master_ip(char *group, struct in_addr *master_ip);
- BOOL lookup_dc_name(const char *srcname, const char *domain,
- struct in_addr *dc_ip, char *ret_name);
-@@ -1155,8 +1156,21 @@
- void safe_free(void *p);
- BOOL get_myname(char *my_name);
- int interpret_protocol(char *str,int def);
-+BOOL is_ipv4address(const char *str);
- BOOL is_ipaddress(const char *str);
- uint32 interpret_addr(const char *str);
-+struct sockaddr *get_numeric_addr(const char *str);
-+BOOL sa_host_equal(struct sockaddr *a, struct sockaddr *b);
-+int get_sockaddr_port(struct sockaddr *sa);
-+void set_sockaddr_port(struct sockaddr *sa, int port);
-+struct sockaddr_list *set_default_ports(struct sockaddr_list *salist);
-+BOOL is_directsmb(struct sockaddr *sa);
-+char *print_sockaddr(struct sockaddr *sa);
-+void make_sockaddr_in(struct sockaddr *sa, struct in_addr *addr);
-+void free_sockaddr_list(struct sockaddr_list *salist);
-+struct sockaddr_list *make_sin_list(struct in_addr *addr, int count);
-+struct sockaddr_list *make_singlet_list(struct in_addr *addr, int port);
-+struct sockaddr_list *make_sa_list(struct addrinfo *ai);
- struct in_addr *interpret_addr2(const char *str);
- BOOL is_zero_ip(struct in_addr ip);
- void zero_ip(struct in_addr *ip);
-@@ -1311,7 +1325,8 @@
- BOOL send_smb(int fd,char *buffer);
- BOOL send_one_packet(char *buf,int len,struct in_addr ip,int port,int type);
- int open_socket_in( int type, int port, int dlevel, uint32 socket_addr, BOOL rebind );
--int open_socket_out(int type, struct in_addr *addr, int port ,int timeout);
-+int open_socket_out(struct sockaddr_list *addrs,
-+ struct sockaddr_list **connected_addr, int timeout);
- void client_setfd(int fd);
- char *client_name(void);
- char *client_addr(void);
-@@ -4507,10 +4522,6 @@
- char *inbuf,char *outbuf, int dum_size,
- int dum_buffsize);
-
--/* The following definitions come from smbd/noquotas.c */
--
--BOOL disk_quotas(const char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize);
--
- /* The following definitions come from smbd/notify.c */
-
- void remove_pending_change_notify_requests_by_fid(files_struct *fsp);
-@@ -4643,6 +4654,16 @@
- void check_reload(int t);
- void smbd_process(void);
-
-+/* The following definitions come from smbd/quotas.c */
-+
-+BOOL disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
-+BOOL disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
-+BOOL disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
-+BOOL disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
-+BOOL disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
-+BOOL disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
-+BOOL disk_quotas_vxfs(const pstring name, char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
-+
- /* The following definitions come from smbd/reply.c */
-
- int reply_special(char *inbuf,char *outbuf);
-diff -ur samba-2.2.8a/source/include/smb.h samba-2.2.8a+IPv6-20030712/source/include/smb.h
---- samba-2.2.8a/source/include/smb.h 2003-03-14 16:34:47.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/include/smb.h 2003-07-12 22:28:29.000000000 -0400
-@@ -486,7 +486,8 @@
- char *user; /* name of user who *opened* this connection */
- uid_t uid; /* uid of user who *opened* this connection */
- gid_t gid; /* gid of user who *opened* this connection */
-- char client_address[18]; /* String version of client IP address. */
-+ char client_address[50]; /* String version of client IP address.
-+ * Nice and long for IPv6 addresses... */
-
- uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
-
-diff -ur samba-2.2.8a/source/lib/access.c samba-2.2.8a+IPv6-20030712/source/lib/access.c
---- samba-2.2.8a/source/lib/access.c 2003-03-14 16:34:47.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/lib/access.c 2003-07-12 22:28:29.000000000 -0400
-@@ -18,7 +18,7 @@
- #define ALLONES ((uint32)0xFFFFFFFF)
-
- /* masked_match - match address against netnumber/netmask */
--static int masked_match(char *tok, char *slash, char *s)
-+static BOOL masked_match_ipv4(char *tok, char *slash, char *s)
- {
- uint32 net;
- uint32 mask;
-@@ -43,6 +43,54 @@
- return ((addr & mask) == net);
- }
-
-+#ifdef HAVE_INET6
-+static BOOL masked_match_ipv6(char *tok, char *slash, char *s)
-+{
-+ struct in6_addr net, addr;
-+ unsigned char *n = (unsigned char *)&net;
-+ unsigned char *a = (unsigned char *)&addr;
-+ int ret, len, i, mask;
-+
-+ if(inet_pton(AF_INET6, s, &addr) <= 0)
-+ {
-+ DEBUG(0,("access: unable to parse remote address: %s\n", s));
-+ return False;
-+ }
-+ *slash = '\0';
-+ ret = inet_pton(AF_INET6, tok, &net);
-+ *slash = '/';
-+ len = atoi(slash + 1);
-+ if(ret <= 0 || len < 0 || len > 128
-+ || (len == 0 && strcmp(slash + 1, "0")))
-+ {
-+ DEBUG(0,("access: bad net/mask access control: %s\n", tok));
-+ return False;
-+ }
-+ for(i = 0; i < len; i += 8)
-+ {
-+
-+ if( len - i < 8 )
-+ mask = ~((1 << (8 - (len - i))) - 1);
-+ else
-+ mask = ~0;
-+ DEBUG(3,("len=%d i=%d mask=%02x *n=%02x *a=%02x *a&mask=%02x\n",
-+ len, i, mask, *n, *a, *a & mask));
-+ if(*(n++) != (*(a++) & mask)) return False;
-+ }
-+ return True;
-+}
-+#endif
-+
-+static BOOL masked_match(char *tok, char *slash, char *s)
-+{
-+ if(is_ipv4address(s)) return masked_match_ipv4(tok, slash, s);
-+#ifdef HAVE_INET6
-+ return masked_match_ipv6(tok, slash, s);
-+#else
-+ return False;
-+#endif
-+}
-+
- /* string_match - match string against token */
- static int string_match(char *tok,char *s, char *invalid_char)
- {
-@@ -113,8 +161,13 @@
- } else if (tok[(tok_len = strlen(tok)) - 1] == '.') { /* network */
- if (strncmp(tok, s, tok_len) == 0)
- return (True);
-+#ifdef HAVE_INET6
-+ } else if (tok[(tok_len = strlen(tok)) - 1] == ':') { /* IPv6 network */
-+ if (strncasecmp(tok, s, tok_len) == 0)
-+ return (True);
-+#endif
- } else if ((cut = strchr(tok, '/')) != 0) { /* netnumber/netmask */
-- if (isdigit((int)s[0]) && masked_match(tok, cut, s))
-+ if (isxdigit((int)s[0]) && masked_match(tok, cut, s))
- return (True);
- } else if (strchr(tok, '*') != 0) {
- *invalid_char = '*';
-@@ -208,9 +261,13 @@
- client[1] = caddr;
-
- /* if it is loopback then always allow unless specifically denied */
-+#ifdef HAVE_INET6
-+ if (strcmp(caddr, "127.0.0.1") == 0 || strcmp(caddr, "::1") == 0) {
-+#else
- if (strcmp(caddr, "127.0.0.1") == 0) {
-+#endif
- /*
-- * If 127.0.0.1 matches both allow and deny then allow.
-+ * If 127.0.0.1 or ::1 matches both allow and deny then allow.
- * Patch from Steve Langasek vorlon@netexpress.net.
- */
- if (deny_list &&
-diff -ur samba-2.2.8a/source/lib/util.c samba-2.2.8a+IPv6-20030712/source/lib/util.c
---- samba-2.2.8a/source/lib/util.c 2003-03-14 16:34:47.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/lib/util.c 2003-07-12 22:28:29.000000000 -0400
-@@ -745,11 +745,11 @@
- Return true if a string could be a pure IP address.
- ****************************************************************************/
-
--BOOL is_ipaddress(const char *str)
-+BOOL is_ipv4address(const char *str)
- {
- BOOL pure_address = True;
- int i;
--
-+
- for (i=0; pure_address && str[i]; i++)
- if (!(isdigit((int)str[i]) || str[i] == '.'))
- pure_address = False;
-@@ -760,6 +760,26 @@
- return pure_address;
- }
-
-+BOOL is_ipaddress(const char *str)
-+{
-+#ifdef HAVE_INET6
-+ /* First we see if the address is an IPv6 address */
-+ if (strchr(str, ':'))
-+ {
-+ int i;
-+
-+ /* It contains a colon; it probably is */
-+ for (i=0; str[i]; i++)
-+ if (!(isxdigit((int)str[i]) || str[i] == '.' || str[i] == ':'))
-+ return False;
-+
-+ return True;
-+ }
-+#endif
-+
-+ return is_ipv4address(str);
-+}
-+
- /****************************************************************************
- interpret an internet address or name into an IP address in 4 byte form
- ****************************************************************************/
-@@ -794,6 +814,204 @@
- return(res);
- }
-
-+struct sockaddr *get_numeric_addr(const char *str)
-+{
-+#ifdef HAVE_INET6
-+ struct sockaddr *sa;
-+ struct addrinfo *ai, hints;
-+
-+ memset(&hints, 0, sizeof(hints));
-+ hints.ai_socktype = SOCK_STREAM;
-+ hints.ai_flags = AI_NUMERICHOST;
-+ if(getaddrinfo(str, NULL, &hints, &ai) || ! ai) return NULL;
-+ sa = (struct sockaddr *)malloc(ai->ai_addrlen);
-+ memcpy(sa, ai->ai_addr, ai->ai_addrlen);
-+ freeaddrinfo(ai);
-+ return sa;
-+#else
-+ struct sockaddr *sa;
-+ struct in_addr addr;
-+
-+ if(inet_aton(str, &addr))
-+ {
-+ sa = (struct sockaddr *)malloc(sizeof(struct sockaddr_in));
-+ make_sockaddr_in(sa, &addr);
-+ return sa;
-+ }
-+ return NULL;
-+#endif
-+}
-+
-+BOOL sa_host_equal(struct sockaddr *a, struct sockaddr *b)
-+{
-+#ifdef HAVE_INET6
-+ if(a->sa_family == AF_INET6 && b->sa_family == AF_INET6)
-+ {
-+ return IN6_ARE_ADDR_EQUAL(
-+ &((struct sockaddr_in6 *)a)->sin6_addr,
-+ &((struct sockaddr_in6 *)b)->sin6_addr);
-+ } else
-+#endif
-+ if(a->sa_family == AF_INET && b->sa_family == AF_INET)
-+ {
-+ return ((struct sockaddr_in *)a)->sin_addr.s_addr
-+ == ((struct sockaddr_in *)b)->sin_addr.s_addr;
-+ }
-+ return False;
-+}
-+
-+int get_sockaddr_port(struct sockaddr *sa)
-+{
-+#ifdef HAVE_INET6
-+ if(sa->sa_family==AF_INET6)
-+ return ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
-+ else
-+#endif
-+ if(sa->sa_family==AF_INET)
-+ return ntohs(((struct sockaddr_in *)sa)->sin_port);
-+ else
-+ return 0;
-+}
-+
-+void set_sockaddr_port(struct sockaddr *sa, int port)
-+{
-+#ifdef HAVE_INET6
-+ if(sa->sa_family==AF_INET6)
-+ ((struct sockaddr_in6 *)sa)->sin6_port = htons(port);
-+ else
-+#endif
-+ if(sa->sa_family==AF_INET)
-+ ((struct sockaddr_in *)sa)->sin_port = htons(port);
-+}
-+
-+struct sockaddr_list *set_default_ports(struct sockaddr_list *salist)
-+{
-+ struct sockaddr_list *cur;
-+
-+ for(cur = salist; cur; cur = cur->next)
-+ {
-+ set_sockaddr_port(cur->addr, 445);
-+ if(cur->addr->sa_family == AF_INET)
-+ {
-+ struct sockaddr_list *sc;
-+
-+ sc = (struct sockaddr_list *)
-+ malloc(sizeof(struct sockaddr_list));
-+ sc->next = cur->next;
-+ cur->next = sc;
-+ sc->pfamily = cur->pfamily;
-+ sc->len = cur->len;
-+ sc->addr = (struct sockaddr *)malloc(sc->len);
-+ memcpy(sc->addr, cur->addr, cur->len);
-+ set_sockaddr_port(sc->addr, 139);
-+ cur = sc;
-+ }
-+ }
-+ return salist;
-+}
-+
-+
-+BOOL is_directsmb(struct sockaddr *sa)
-+{
-+ BOOL ret = sa->sa_family != AF_INET
-+ || ((struct sockaddr_in *)sa)->sin_port == htons(445);
-+ DEBUG(4,("connection is%s direct SMB\n", ret ? "" : " not"));
-+ return ret;
-+}
-+
-+char *print_sockaddr(struct sockaddr *sa)
-+{
-+#ifdef HAVE_INET6
-+ static char addr[64];
-+
-+ if(sa->sa_family == AF_INET6)
-+ {
-+ inet_ntop(AF_INET6, &((struct sockaddr_in6 *)sa)->sin6_addr,
-+ addr, sizeof(addr));
-+ return addr;
-+ } else
-+#endif
-+ if(sa->sa_family == AF_INET)
-+ return inet_ntoa(((struct sockaddr_in *)sa)->sin_addr);
-+ else return NULL;
-+}
-+
-+void make_sockaddr_in(struct sockaddr *sa, struct in_addr *addr)
-+{
-+ memset(sa, 0, sizeof(struct sockaddr_in));
-+ ((struct sockaddr_in *)sa)->sin_family = AF_INET;
-+ ((struct sockaddr_in *)sa)->sin_port = 0;
-+ memcpy(&((struct sockaddr_in *)sa)->sin_addr, addr,
-+ sizeof(struct in_addr));
-+}
-+
-+void free_sockaddr_list(struct sockaddr_list *salist)
-+{
-+ struct sockaddr_list *next;
-+
-+ while(salist)
-+ {
-+ next = salist->next;
-+ SAFE_FREE(salist->addr);
-+ SAFE_FREE(salist);
-+ salist = next;
-+ }
-+}
-+
-+struct sockaddr_list *make_sin_list(struct in_addr *addr, int count)
-+{
-+ int i;
-+ struct sockaddr_list *top = NULL, *last = NULL, *sc;
-+
-+ for(i = 0; i<count; ++i)
-+ {
-+ sc = (struct sockaddr_list *)
-+ malloc(sizeof(struct sockaddr_list));
-+ if(i==0) top = sc;
-+ else last->next = sc;
-+ last = sc;
-+ sc->next = NULL;
-+ sc->pfamily = PF_INET;
-+ sc->len = sizeof(struct sockaddr_in);
-+ sc->addr = (struct sockaddr *)
-+ malloc(sizeof(struct sockaddr_in));
-+ make_sockaddr_in(sc->addr, &addr[i]);
-+ }
-+ return top;
-+}
-+
-+struct sockaddr_list *make_singlet_list(struct in_addr *addr, int port)
-+{
-+ struct sockaddr_list *salist;
-+
-+ salist = make_sin_list(addr, 1);
-+ if(port) set_sockaddr_port(salist->addr, port);
-+ else salist = set_default_ports(salist);
-+ return salist;
-+}
-+
-+#ifdef HAVE_INET6
-+struct sockaddr_list *make_sa_list(struct addrinfo *ai)
-+{
-+ struct sockaddr_list *top = NULL, *last = NULL, *sc;
-+
-+ for(; ai; ai = ai->ai_next)
-+ {
-+ sc = (struct sockaddr_list *)
-+ malloc(sizeof(struct sockaddr_list));
-+ if(top==NULL) top = sc;
-+ else last->next = sc;
-+ last = sc;
-+ sc->next = NULL;
-+ sc->pfamily = ai->ai_family;
-+ sc->len = ai->ai_addrlen;
-+ sc->addr = (struct sockaddr *)malloc(ai->ai_addrlen);
-+ memcpy(sc->addr, ai->ai_addr, ai->ai_addrlen);
-+ }
-+ return top;
-+}
-+#endif
-+
- /*******************************************************************
- a convenient addition to interpret_addr()
- ******************************************************************/
-@@ -1394,7 +1612,7 @@
- return True;
-
- /* maybe its an IP address? */
-- if (is_ipaddress(s))
-+ if (is_ipv4address(s))
- {
- struct iface_struct nics[MAX_INTERFACES];
- int i, n;
-diff -ur samba-2.2.8a/source/lib/util_sock.c samba-2.2.8a+IPv6-20030712/source/lib/util_sock.c
---- samba-2.2.8a/source/lib/util_sock.c 2003-03-14 16:34:47.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/lib/util_sock.c 2003-07-12 22:28:29.000000000 -0400
-@@ -819,67 +819,94 @@
- create an outgoing socket. timeout is in milliseconds.
- **************************************************************************/
-
--int open_socket_out(int type, struct in_addr *addr, int port ,int timeout)
-+int open_socket_out(struct sockaddr_list *addrs,
-+ struct sockaddr_list **connected_addr, int timeout)
- {
-- struct sockaddr_in sock_out;
-- int res,ret;
-- int connect_loop = 250; /* 250 milliseconds */
-- int loops = (timeout) / connect_loop;
--
-- /* create a socket to write to */
-- res = socket(PF_INET, type, 0);
-- if (res == -1)
-- { DEBUG(0,("socket error\n")); return -1; }
--
-- if (type != SOCK_STREAM) return(res);
--
-- 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;
--
-- /* set it non-blocking */
-- set_blocking(res,False);
--
-- DEBUG(3,("Connecting to %s at port %d\n",inet_ntoa(*addr),port));
--
-- /* and connect it to the destination */
--connect_again:
-- ret = connect(res,(struct sockaddr *)&sock_out,sizeof(sock_out));
--
-- /* Some systems return EAGAIN when they mean EINPROGRESS */
-- if (ret < 0 && (errno == EINPROGRESS || errno == EALREADY ||
-- errno == EAGAIN) && loops--) {
-- msleep(connect_loop);
-- goto connect_again;
-- }
--
-- if (ret < 0 && (errno == EINPROGRESS || errno == EALREADY ||
-- errno == EAGAIN)) {
-- DEBUG(1,("timeout connecting to %s:%d\n",inet_ntoa(*addr),port));
-- close(res);
-- return -1;
-- }
-+ struct sockaddr_list *sl;
-+ int res,ret;
-+ int connect_loop = 250; /* 250 milliseconds */
-+ int loops = (timeout) / connect_loop;
-+
-+ if(connected_addr) *connected_addr = NULL;
-+
-+ for(sl = addrs; sl; sl = sl->next)
-+ {
-+ /* create a socket to write to */
-+ res = socket(sl->pfamily, SOCK_STREAM, 0);
-+ if (res == -1)
-+ {
-+ /* If there are more addresses available, then we
-+ * are probably running on a platform without IPv6
-+ * support in the kernel, and we just tried
-+ * connecting to an IPv6 address. Don't complain
-+ * until we're out of addresses. */
-+
-+ if(!sl->next) DEBUG(0,("socket error\n"));
-+ continue;
-+ }
-+
-+ /* set it non-blocking */
-+ set_blocking(res,False);
-+
-+ DEBUG(3,("Connecting to %s at port %d\n",
-+ print_sockaddr(sl->addr), get_sockaddr_port(sl->addr)));
-+
-+ /* and connect it to the destination */
-+ connect_again:
-+ ret = connect(res,sl->addr,sl->len);
-+
-+ /* Some systems return EAGAIN when they mean EINPROGRESS */
-+ if (ret < 0 && (errno == EINPROGRESS || errno == EALREADY ||
-+ errno == EAGAIN) && loops--) {
-+ msleep(connect_loop);
-+ goto connect_again;
-+ }
-+
-+ if (ret < 0 && (errno == EINPROGRESS || errno == EALREADY ||
-+ errno == EAGAIN)) {
-+ DEBUG(1,("timeout connecting to [%s]:%d\n",
-+ print_sockaddr(sl->addr),
-+ get_sockaddr_port(sl->addr)));
-+ close(res);
-+ if(sl->next) {
-+ DEBUG(1,("attempting next address...\n"));
-+ continue;
-+ } else return -1;
-+ }
-
- #ifdef EISCONN
-- if (ret < 0 && errno == EISCONN) {
-- errno = 0;
-- ret = 0;
-- }
-+ if (ret < 0 && errno == EISCONN) {
-+ errno = 0;
-+ ret = 0;
-+ }
- #endif
-
-- if (ret < 0) {
-- DEBUG(2,("error connecting to %s:%d (%s)\n",
-- inet_ntoa(*addr),port,strerror(errno)));
-- close(res);
-- return -1;
-- }
-+ if (ret < 0) {
-+ /* If we got connection refused or host unreachable,
-+ * we may be trying to connect to an IPv6 host but
-+ * this system isn't configured for IPv6. If we have
-+ * more addresses, don't complain about this one --
-+ * just try the next ones. */
-+
-+ BOOL can_ignore = sl->next &&
-+ (errno == ECONNREFUSED || errno == ENETUNREACH);
-+ DEBUG(can_ignore ? 3 : 2,
-+ ("error connecting to [%s]:%d (%s)\n",
-+ print_sockaddr(sl->addr),
-+ get_sockaddr_port(sl->addr),
-+ strerror(errno)));
-+ close(res);
-+ continue;
-+ }
-
-- /* set it blocking again */
-- set_blocking(res,True);
-+ /* set it blocking again */
-+ set_blocking(res,True);
-
-- return res;
-+ if(connected_addr) *connected_addr = sl;
-+
-+ return res;
-+ }
-+ return -1;
- }
-
- /* the following 3 client_*() functions are nasty ways of allowing
-@@ -906,9 +933,63 @@
- matchname - determine if host name matches IP address. Used to
- confirm a hostname lookup to prevent spoof attacks
- ******************************************************************/
--static BOOL matchname(char *remotehost,struct in_addr addr)
-+#ifdef HAVE_INET6
-+static BOOL addr_equal(struct sockaddr *a, struct sockaddr *b)
- {
-+ if(a->sa_family == AF_INET6 && b->sa_family == AF_INET6)
-+ {
-+ struct sockaddr_in6 *a6 = (struct sockaddr_in6 *)a;
-+ struct sockaddr_in6 *b6 = (struct sockaddr_in6 *)b;
-+
-+ return !memcmp(&a6->sin6_addr, &b6->sin6_addr, 16);
-+ }
-+ if(a->sa_family == AF_INET && b->sa_family == AF_INET)
-+ {
-+ struct sockaddr_in *a4 = (struct sockaddr_in *)a;
-+ struct sockaddr_in *b4 = (struct sockaddr_in *)b;
-+
-+ return a4->sin_addr.s_addr == b4->sin_addr.s_addr;
-+ }
-+ return False;
-+}
-+#endif
-+
-+/*******************************************************************
-+ matchname - determine if host name matches IP address. Used to
-+ confirm a hostname lookup to prevent spoof attacks
-+ ******************************************************************/
-+static BOOL matchname(char *remotehost, struct sockaddr *can)
-+{
-+#ifdef HAVE_INET6
-+ struct addrinfo *ai, hints, *cur;
-+
-+ memset(&hints, 0, sizeof(hints));
-+ hints.ai_socktype = SOCK_STREAM;
-+ if(getaddrinfo(remotehost, NULL, &hints, &ai)){
-+ DEBUG(0,("getaddrinfo(%s): lookup failure.\n", remotehost));
-+ return False;
-+ }
-+ for( cur = ai; cur; cur = cur->ai_next )
-+ if(addr_equal(cur->ai_addr, can))
-+ {
-+ freeaddrinfo(ai);
-+ return True;
-+ }
-+
-+ /*
-+ * The host name does not map to the original host address. Perhaps
-+ * someone has compromised a name server. More likely someone botched
-+ * it, but that could be dangerous, too.
-+ */
-+
-+ DEBUG(0,("host name/address mismatch: %s != %s\n",
-+ print_sockaddr(can), remotehost));
-+
-+ freeaddrinfo(ai);
-+ return False;
-+#else
- struct hostent *hp;
-+ struct in_addr addr = ((struct sockaddr_in *)can)->sin_addr;
- int i;
-
- if ((hp = sys_gethostbyname(remotehost)) == 0) {
-@@ -946,6 +1027,56 @@
- DEBUG(0,("host name/address mismatch: %s != %s\n",
- inet_ntoa(addr), hp->h_name));
- return False;
-+#endif
-+}
-+
-+/*******************************************************************
-+ return a sockaddr describing the remote endpoint
-+ ******************************************************************/
-+static BOOL get_socket_sa(int fd, struct sockaddr **sa, int *len)
-+{
-+ if (fd == -1) {
-+ return False;
-+ }
-+
-+#ifdef HAVE_INET6
-+ *len = sizeof(struct sockaddr_storage);
-+#else
-+ *len = sizeof(struct sockaddr);
-+#endif
-+
-+ *sa = (struct sockaddr *)malloc(*len);
-+
-+ if (getpeername(fd, *sa, len) < 0) {
-+ DEBUG(0,("getpeername failed. Error was %s\n", strerror(errno) ));
-+ SAFE_FREE(*sa);
-+ *sa = NULL;
-+ return False;
-+ }
-+
-+#ifdef HAVE_INET6
-+ if((*sa)->sa_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(
-+ &((struct sockaddr_in6 *)(*sa))->sin6_addr))
-+ {
-+ struct sockaddr_in *newsin;
-+ struct in_addr addr;
-+ int port = ((struct sockaddr_in6 *)(*sa))->sin6_port;
-+
-+ DEBUG(5,("converting IPv6-mapped address %s\n",
-+ print_sockaddr(*sa)));
-+ memcpy(&addr, &((struct sockaddr_in6 *)
-+ (*sa))->sin6_addr + 12, 4);
-+ SAFE_FREE(*sa);
-+ *len = sizeof(struct sockaddr_in);
-+ *sa = (struct sockaddr *)malloc(*len);
-+ newsin = (struct sockaddr_in *)(*sa);
-+ newsin->sin_family = AF_INET;
-+ newsin->sin_port = port;
-+ newsin->sin_addr = addr;
-+ }
-+#endif
-+
-+ return True;
- }
-
-
-@@ -955,34 +1086,60 @@
- char *get_socket_name(int fd)
- {
- static pstring name_buf;
-- static fstring addr_buf;
-- struct hostent *hp;
-- struct in_addr addr;
-+ struct sockaddr *sa;
- char *p;
-+ int len;
-
-- p = get_socket_addr(fd);
--
-- /* it might be the same as the last one - save some DNS work */
-- if (strcmp(p, addr_buf) == 0) return name_buf;
--
- pstrcpy(name_buf,"UNKNOWN");
- if (fd == -1) return name_buf;
-
-- fstrcpy(addr_buf, p);
-+ if(!get_socket_sa(fd, &sa, &len)) return name_buf;
-+ p = print_sockaddr(sa);
-
-- addr = *interpret_addr2(p);
--
-- /* Look up the remote host name. */
-- if ((hp = gethostbyaddr((char *)&addr.s_addr, sizeof(addr.s_addr), AF_INET)) == 0) {
-- DEBUG(1,("Gethostbyaddr failed for %s\n",p));
-- pstrcpy(name_buf, p);
-- } else {
-- pstrcpy(name_buf,(char *)hp->h_name);
-- if (!matchname(name_buf, addr)) {
-- DEBUG(0,("Matchname failed on %s %s\n",name_buf,p));
-- pstrcpy(name_buf,"UNKNOWN");
-+#ifdef HAVE_INET6
-+ {
-+ char hostbuf[NI_MAXHOST];
-+
-+ if(getnameinfo(sa, len, hostbuf, NI_MAXHOST, NULL, 0, 0)) {
-+ DEBUG(1,("Getnameinfo failed for %s\n",p));
-+ pstrcpy(name_buf, p);
-+ } else {
-+ if (matchname(hostbuf, sa))
-+ pstrcpy(name_buf, hostbuf);
-+ else {
-+ DEBUG(0,("Matchname failed on %s %s\n",
-+ name_buf, p));
-+ pstrcpy(name_buf,p);
-+ }
-+ }
-+ }
-+#else
-+ {
-+ struct hostent *hp;
-+ struct sockaddr_in *nsin = (struct sockaddr_in *)sa;
-+
-+ if(sa->sa_family != AF_INET)
-+ {
-+ SAFE_FREE(sa);
-+ return name_buf;
-+ }
-+
-+ /* Look up the remote host name. */
-+ if ((hp = gethostbyaddr((char *)&nsin->sin_addr.s_addr,
-+ sizeof(nsin->sin_addr.s_addr), AF_INET)) == 0) {
-+ DEBUG(1,("Gethostbyaddr failed for %s\n",p));
-+ pstrcpy(name_buf, p);
-+ } else {
-+ pstrcpy(name_buf,(char *)hp->h_name);
-+ if (!matchname(name_buf, sa)) {
-+ DEBUG(0,("Matchname failed on %s %s\n",
-+ name_buf, p));
-+ pstrcpy(name_buf,p);
-+ }
- }
- }
-+#endif
-+ SAFE_FREE(sa);
-
- alpha_strcpy(name_buf, name_buf, "_-.", sizeof(name_buf));
- if (strstr(name_buf,"..")) {
-@@ -997,24 +1154,18 @@
- ******************************************************************/
- char *get_socket_addr(int fd)
- {
-- struct sockaddr sa;
-- struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa);
-- socklen_t length = sizeof(sa);
- static fstring addr_buf;
-+ struct sockaddr *sa;
-+ int len;
-
- fstrcpy(addr_buf,"0.0.0.0");
-
-- if (fd == -1) {
-- return addr_buf;
-+ if(get_socket_sa(fd, &sa, &len))
-+ {
-+ fstrcpy(addr_buf,print_sockaddr(sa));
-+ SAFE_FREE(sa);
- }
-
-- if (getpeername(fd, &sa, &length) < 0) {
-- DEBUG(0,("getpeername failed. Error was %s\n", strerror(errno) ));
-- return addr_buf;
-- }
--
-- fstrcpy(addr_buf,(char *)inet_ntoa(sockin->sin_addr));
--
- return addr_buf;
- }
-
-diff -ur samba-2.2.8a/source/lib/wins_srv.c samba-2.2.8a+IPv6-20030712/source/lib/wins_srv.c
---- samba-2.2.8a/source/lib/wins_srv.c 2003-03-14 16:34:47.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/lib/wins_srv.c 2003-07-12 22:28:29.000000000 -0400
-@@ -155,7 +155,7 @@
- else
- {
- /* Add server to list. */
-- if( is_ipaddress( wins_id_bufr ) )
-+ if( is_ipv4address( wins_id_bufr ) )
- entry->ip_addr = *interpret_addr2( wins_id_bufr );
- else
- entry->ip_addr = *interpret_addr2( "0.0.0.0" );
-diff -ur samba-2.2.8a/source/libsmb/cliconnect.c samba-2.2.8a+IPv6-20030712/source/libsmb/cliconnect.c
---- samba-2.2.8a/source/libsmb/cliconnect.c 2003-03-14 16:34:48.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/libsmb/cliconnect.c 2003-07-12 22:28:29.000000000 -0400
-@@ -638,8 +638,8 @@
- int len = 4;
- extern pstring user_socket_options;
-
-- /* 445 doesn't have session request */
-- if (cli->port == 445) return True;
-+ /* Direct SMB doesn't have session request */
-+ if (is_directsmb(cli->connected_addr->addr)) return True;
-
- /* send a session request (RFC 1002) */
- memcpy(&(cli->calling), calling, sizeof(*calling));
-@@ -690,9 +690,12 @@
- */
- int port = (CVAL(cli->inbuf,8)<<8)+CVAL(cli->inbuf,9);
- /* SESSION RETARGET */
-- putip((char *)&cli->dest_ip,cli->inbuf+4);
--
-- cli->fd = open_socket_out(SOCK_STREAM, &cli->dest_ip, port, LONG_CONNECT_TIMEOUT);
-+ struct in_addr addr;
-+ putip((char *)&addr,cli->inbuf+4);
-+ if(cli->dest_addrs) free_sockaddr_list(cli->dest_addrs);
-+ cli->dest_addrs = make_singlet_list(&addr, port);
-+ cli->fd = open_socket_out(cli->dest_addrs,
-+ &cli->connected_addr, LONG_CONNECT_TIMEOUT);
- if (cli->fd == -1)
- return False;
-
-@@ -736,10 +739,11 @@
- Open the client sockets.
- ****************************************************************************/
-
--BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip)
-+BOOL cli_connect(struct cli_state *cli, const char *host,
-+ struct sockaddr_list *salist)
- {
- extern pstring user_socket_options;
-- int name_type = 0x20;
-+ BOOL free_on_error = False;
- char *p;
-
- /* reasonable default hostname */
-@@ -747,45 +751,44 @@
- host = "*SMBSERVER";
-
- fstrcpy(cli->desthost, host);
--
-- /* allow hostnames of the form NAME#xx and do a netbios lookup */
-- if ((p = strchr(cli->desthost, '#'))) {
-- name_type = strtol(p+1, NULL, 16);
-- *p = 0;
-- }
--
-- if (!ip || is_zero_ip(*ip)) {
-- if (!resolve_name(cli->desthost, &cli->dest_ip, name_type)) {
-- return False;
-+
-+ /* At this point, cli->dest_addrs should be empty */
-+ if(cli->dest_addrs) free_sockaddr_list(cli->dest_addrs);
-+
-+ if(!salist) {
-+ free_on_error = True;
-+ if ((p = strchr(cli->desthost, '#'))) {
-+ struct in_addr ip;
-+ int name_type = strtol(p+1, NULL, 16);
-+
-+ *p = 0;
-+ if(!resolve_name_netbios(cli->desthost, &ip, name_type))
-+ return False;
-+ salist = make_singlet_list(&ip, 139);
-+ } else {
-+ if(!(salist = resolve_name_smb(cli->desthost,
-+ cli->default_port)))
-+ return False;
- }
-- if (ip)
-- *ip = cli->dest_ip;
-- } else {
-- cli->dest_ip = *ip;
- }
--
-+
- if (getenv("LIBSMB_PROG")) {
- cli->fd = sock_exec(getenv("LIBSMB_PROG"));
- } else {
-- /* try 445 first, then 139 */
-- int port = cli->port?cli->port:445;
-- cli->fd = open_socket_out(SOCK_STREAM, &cli->dest_ip,
-- port, cli->timeout);
-- if (cli->fd == -1 && cli->port == 0) {
-- port = 139;
-- cli->fd = open_socket_out(SOCK_STREAM, &cli->dest_ip,
-- port, cli->timeout);
-- }
-- if (cli->fd != -1) cli->port = port;
-+ cli->fd = open_socket_out(salist, &cli->connected_addr,
-+ cli->timeout);
- }
- if (cli->fd == -1) {
- DEBUG(1,("Error connecting to %s (%s)\n",
-- inet_ntoa(*ip),strerror(errno)));
-+ print_sockaddr(salist->addr),strerror(errno)));
-+ if(free_on_error) free_sockaddr_list(salist);
- return False;
- }
-
- set_socket_options(cli->fd,user_socket_options);
-
-+ cli->dest_addrs = salist;
-+
- return True;
- }
-
-@@ -794,13 +797,14 @@
- ****************************************************************************/
-
- BOOL cli_establish_connection(struct cli_state *cli,
-- const char *dest_host, struct in_addr *dest_ip,
-+ char *dest_host, struct sockaddr_list *salist,
- struct nmb_name *calling, struct nmb_name *called,
- const char *service, const char *service_type,
- BOOL do_shutdown, BOOL do_tcon)
- {
- DEBUG(5,("cli_establish_connection: %s connecting to %s (%s) - %s [%s]\n",
-- nmb_namestr(calling), nmb_namestr(called), inet_ntoa(*dest_ip),
-+ nmb_namestr(calling), nmb_namestr(called),
-+ salist ? print_sockaddr(salist->addr) : "unspecified",
- cli->user_name, cli->domain));
-
- /* establish connection */
-@@ -809,9 +813,12 @@
- return False;
-
- if (cli->fd == -1) {
-- if (!cli_connect(cli, dest_host, dest_ip)) {
-+ if (!cli_connect(cli, dest_host, salist))
-+ {
- DEBUG(1,("cli_establish_connection: failed to connect to %s (%s)\n",
-- nmb_namestr(called), inet_ntoa(*dest_ip)));
-+ nmb_namestr(called),
-+ salist ? print_sockaddr(salist->addr)
-+ : "unknown"));
- return False;
- }
- }
-@@ -944,7 +951,7 @@
- struct nmb_name calling;
- struct nmb_name called;
- struct cli_state *cli;
-- struct in_addr ip;
-+ struct sockaddr_list *salist;
-
- if (!output_cli)
- DEBUG(0, ("output_cli is NULL!?!"));
-@@ -964,14 +971,14 @@
- return NT_STATUS_UNSUCCESSFUL;
- }
-
-- ip = *dest_ip;
-+ salist = make_singlet_list(dest_ip, port);
-
- DEBUG(3,("Connecting to host=%s share=%s\n", dest_host, service));
-
-- if (!cli_connect(cli, dest_host, &ip)) {
-+ if (!cli_connect(cli, dest_host, salist)) {
- DEBUG(1,("cli_establish_connection: failed to connect to %s (%s)\n",
- nmb_namestr(&called), inet_ntoa(*dest_ip)));
-- cli_shutdown(cli);
-+ free_sockaddr_list(salist);
- return NT_STATUS_UNSUCCESSFUL;
- }
-
-@@ -1031,9 +1038,10 @@
- Attempt a NetBIOS session request, falling back to *SMBSERVER if needed.
- ****************************************************************************/
-
--BOOL attempt_netbios_session_request(struct cli_state *cli, const char *srchost, const char *desthost,
-- struct in_addr *pdest_ip)
-+BOOL attempt_netbios_session_request(struct cli_state *cli, char *srchost,
-+ char *desthost)
- {
-+ struct sockaddr_list *dest_addrs_cache = cli->dest_addrs;
- struct nmb_name calling, called;
-
- make_nmb_name(&calling, srchost, 0x0);
-@@ -1076,9 +1084,11 @@
- * for this purpose. JRA. Based on work by "Kim R. Pedersen" <krp@filanet.dk>.
- */
-
-+ cli->dest_addrs = NULL; /* we cached it, so it shouldn't free */
- cli_close_connection(cli);
-
-- if (!cli_initialise(cli) || !cli_connect(cli, desthost, pdest_ip) ||
-+ if (!cli_initialise(cli) ||
-+ !cli_connect(cli, desthost, dest_addrs_cache) ||
- !cli_session_request(cli, &calling, &smbservername)) {
- DEBUG(0,("attempt_netbios_session_request: %s rejected the session for name *SMBSERVER with error %s\n",
- desthost, cli_errstr(cli) ));
-diff -ur samba-2.2.8a/source/libsmb/clidgram.c samba-2.2.8a+IPv6-20030712/source/libsmb/clidgram.c
---- samba-2.2.8a/source/libsmb/clidgram.c 2003-03-14 16:34:48.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/libsmb/clidgram.c 2003-07-12 22:28:29.000000000 -0400
-@@ -147,7 +147,7 @@
- struct sockaddr_in sock_out;
- socklen_t name_size;
-
-- if (!resolve_name(send_to_name, &sendto_ip, 0x1d)) {
-+ if (!resolve_name_netbios(send_to_name, &sendto_ip, 0x1d)) {
-
- DEBUG(0, ("Could not resolve name: %s<1D>\n", send_to_name));
- return False;
-@@ -156,17 +156,15 @@
-
- my_ip.s_addr = inet_addr("0.0.0.0");
-
-- if (!resolve_name(myname, &my_ip, 0x00)) { /* FIXME: Call others here */
-+ if (!resolve_name_netbios(myname, &my_ip, 0x00)) { /* FIXME: Call others here */
-
- DEBUG(0, ("Could not resolve name: %s<00>\n", myname));
-
- }
-
-- if ((dgram_sock = open_socket_out(SOCK_DGRAM, &sendto_ip, 138, LONG_CONNECT_TIMEOUT)) < 0) {
--
-- DEBUG(4, ("open_sock_out failed ..."));
-+ if ((dgram_sock = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
-+ DEBUG(0, ("socket failed (%s)", strerror(errno)));
- return False;
--
- }
-
- /* Make it a broadcast socket ... */
-diff -ur samba-2.2.8a/source/libsmb/clientgen.c samba-2.2.8a+IPv6-20030712/source/libsmb/clientgen.c
---- samba-2.2.8a/source/libsmb/clientgen.c 2002-12-10 09:58:15.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/libsmb/clientgen.c 2003-07-12 22:28:29.000000000 -0400
-@@ -24,12 +24,15 @@
- #include "includes.h"
-
- /****************************************************************************
-- Change the port number used to call on.
-+ Change the default port number used to call on.
-+
-+ This should only truly be used if we're operating on a non-standard
-+ port. The default behavior is to first try port 445, then 139.
- ****************************************************************************/
-
- int cli_set_port(struct cli_state *cli, int port)
- {
-- cli->port = port;
-+ cli->default_port = port;
- return port;
- }
-
-@@ -186,7 +189,9 @@
-
- ZERO_STRUCTP(cli);
-
-- cli->port = 0;
-+ cli->default_port = 0;
-+ cli->dest_addrs = NULL;
-+ cli->connected_addr = NULL;
- cli->fd = -1;
- cli->cnum = -1;
- cli->pid = (uint16)sys_getpid();
-@@ -243,6 +248,9 @@
- SAFE_FREE(cli->outbuf);
- SAFE_FREE(cli->inbuf);
-
-+ if (cli->dest_addrs)
-+ free_sockaddr_list(cli->dest_addrs);
-+
- if (cli->mem_ctx) {
- talloc_destroy(cli->mem_ctx);
- cli->mem_ctx = NULL;
-diff -ur samba-2.2.8a/source/libsmb/cli_lsarpc.c samba-2.2.8a+IPv6-20030712/source/libsmb/cli_lsarpc.c
---- samba-2.2.8a/source/libsmb/cli_lsarpc.c 2002-06-06 17:31:33.000000000 -0400
-+++ samba-2.2.8a+IPv6-20030712/source/libsmb/cli_lsarpc.c 2003-07-12 22:28:29.000000000 -0400
-@@ -1064,6 +1064,7 @@
- {
- extern pstring global_myname;
- struct cli_state cli;
-+ struct sockaddr_list *dest_addrs;
- NTSTATUS result;
- POLICY_HND lsa_pol;
- BOOL ret = False;
-@@ -1074,20 +1075,22 @@
- return False;
- }
-
-- if(!resolve_name( remote_machine, &cli.dest_ip, 0x20)) {
-+ if(!(dest_addrs = resolve_name_smb(remote_machine, 0))) {
- DEBUG(0,("fetch_domain_sid: Can't resolve address for %s\n", remote_machine));
- goto done;
- }
-
-- if (!cli_connect(&cli, remote_machine, &cli.dest_ip)) {
-+ if (!cli_connect(&cli, remote_machine, dest_addrs)) {
- DEBUG(0,("fetch_domain_sid: unable to connect to SMB server on \
- machine %s. Error was : %s.\n", remote_machine, cli_errstr(&cli) ));
- goto done;
- }
-
-- if (!attempt_netbios_session_request(&cli, global_myname, remote_machine, &cli.dest_ip)) {
-+ if (!attempt_netbios_session_request(&cli, global_myname,
-+ remote_machine)) {
- DEBUG(0,("fetch_domain_sid: machine %s rejected the NetBIOS session request.\n",
- remote_machine));
-+ free_sockaddr_list(dest_addrs);
- goto done;
- }
-
-diff -ur samba-2.2.8a/source/libsmb/cli_pipe_util.c samba-2.2.8a+IPv6-20030712/source/libsmb/cli_pipe_util.c
---- samba-2.2.8a/source/libsmb/cli_pipe_util.c 2003-03-14 16:34:47.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/libsmb/cli_pipe_util.c 2003-07-12 22:28:29.000000000 -0400
-@@ -27,7 +27,7 @@
- const char *pipe_name,
- struct ntuser_creds *creds)
- {
-- struct in_addr dest_ip;
-+ struct sockaddr_list *dest_addrs;
- struct nmb_name calling, called;
- fstring dest_host;
- extern pstring global_myname;
-@@ -49,15 +49,18 @@
-
- /* Establish a SMB connection */
-
-- if (!resolve_srv_name(system_name, dest_host, &dest_ip)) {
-+ if (!(dest_addrs = resolve_srv_name(system_name, dest_host,
-+ cli->default_port))) {
- return NULL;
- }
-
- make_nmb_name(&called, dns_to_netbios_name(dest_host), 0x20);
- make_nmb_name(&calling, dns_to_netbios_name(global_myname), 0);
-
-- if (!cli_establish_connection(cli, dest_host, &dest_ip, &calling,
-+ if (!cli_establish_connection(cli, dest_host, dest_addrs, &calling,
- &called, "IPC$", "IPC", False, True)) {
-+ cli_shutdown(cli);
-+ free_sockaddr_list(dest_addrs);
- return NULL;
- }
-
-diff -ur samba-2.2.8a/source/libsmb/libsmbclient.c samba-2.2.8a+IPv6-20030712/source/libsmb/libsmbclient.c
---- samba-2.2.8a/source/libsmb/libsmbclient.c 2003-02-28 10:56:19.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/libsmb/libsmbclient.c 2003-07-12 22:28:30.000000000 -0400
-@@ -244,10 +244,8 @@
- char *p, *server_n = server;
- fstring group;
- pstring ipenv;
-- struct in_addr ip;
- int tried_reverse = 0;
-
-- zero_ip(&ip);
- ZERO_STRUCT(c);
-
- /* try to use an existing connection */
-@@ -305,10 +303,8 @@
- again:
- slprintf(ipenv,sizeof(ipenv)-1,"HOST_%s", server_n);
-
-- zero_ip(&ip);
--
- /* have to open a new connection */
-- if (!cli_initialise(&c) || !cli_connect(&c, server_n, &ip)) {
-+ if (!cli_initialise(&c) || !cli_connect(&c, server_n, NULL)) {
- if (c.initialised) cli_shutdown(&c);
- errno = ENOENT;
- return NULL;
-@@ -324,7 +320,7 @@
-
- /* Only try this if server is an IP address ... */
-
-- if (is_ipaddress(server) && !tried_reverse) {
-+ if (is_ipv4address(server) && !tried_reverse) {
- fstring remote_name;
- struct in_addr rem_ip;
-
-@@ -1617,8 +1613,8 @@
- /* first try to get the LMB for our workgroup, and if that fails, */
- /* try the DMB */
-
-- if (!(resolve_name(lp_workgroup(), &rem_ip, 0x1d) ||
-- resolve_name(lp_workgroup(), &rem_ip, 0x1b))) {
-+ if (!(resolve_name_netbios(lp_workgroup(), &rem_ip, 0x1d) ||
-+ resolve_name_netbios(lp_workgroup(), &rem_ip, 0x1b))) {
-
- errno = EINVAL; /* Something wrong with smb.conf? */
- return -1;
-@@ -1689,9 +1685,9 @@
- /* Check to see if <server><1D>, <server><1B>, or <server><20> translates */
- /* However, we check to see if <server> is an IP address first */
-
-- if (!is_ipaddress(server) && /* Not an IP addr so check next */
-- (resolve_name(server, &rem_ip, 0x1d) || /* Found LMB */
-- resolve_name(server, &rem_ip, 0x1b) )) { /* Found DMB */
-+ if (!is_ipv4address(server) && /* Not an IP addr so check next */
-+ (resolve_name_netbios(server, &rem_ip, 0x1d) || /* Found LMB */
-+ resolve_name_netbios(server, &rem_ip, 0x1b) )) { /* Found DMB */
- pstring buserver;
-
- smbc_file_table[slot]->dir_type = SMBC_SERVER;
-@@ -1743,8 +1739,7 @@
-
- }
- else {
--
-- if (resolve_name(server, &rem_ip, 0x20)) {
-+ if (resolve_name_netbios(server, &rem_ip, 0x20)) {
-
- /* Now, list the shares ... */
-
-diff -ur samba-2.2.8a/source/libsmb/namequery.c samba-2.2.8a+IPv6-20030712/source/libsmb/namequery.c
---- samba-2.2.8a/source/libsmb/namequery.c 2003-03-14 16:34:48.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/libsmb/namequery.c 2003-07-12 22:28:30.000000000 -0400
-@@ -643,15 +643,11 @@
- Resolve via "bcast" method.
- *********************************************************/
-
--BOOL name_resolve_bcast(const char *name, int name_type,
-- struct in_addr **return_ip_list, int *return_count)
-+struct sockaddr_list *name_resolve_bcast(const char *name, int name_type)
- {
- int sock, i;
- int num_interfaces = iface_count();
-
-- *return_ip_list = NULL;
-- *return_count = 0;
--
- /*
- * "bcast" means do a broadcast lookup on all the local interfaces.
- */
-@@ -661,7 +657,7 @@
- sock = open_socket_in( SOCK_DGRAM, 0, 3,
- interpret_addr(lp_socket_address()), True );
-
-- if (sock == -1) return False;
-+ if (sock == -1) return NULL;
-
- set_socket_options(sock,"SO_BROADCAST");
- /*
-@@ -670,35 +666,37 @@
- */
- for( i = num_interfaces-1; i >= 0; i--) {
- struct in_addr sendto_ip;
-- int flags;
-+ struct in_addr *addr;
-+ int return_count, flags;
-+
- /* Done this way to fix compiler error on IRIX 5.x */
- sendto_ip = *iface_bcast(*iface_n_ip(i));
-- *return_ip_list = name_query(sock, name, name_type, True,
-- True, sendto_ip, return_count, &flags);
-- if(*return_ip_list != NULL) {
-- close(sock);
-- return True;
-- }
-- }
--
-- close(sock);
-- return False;
-+ addr = name_query(sock, name, name_type, True,
-+ True, sendto_ip, &return_count, &flags);
-+ if(addr != NULL) {
-+ struct sockaddr_list *salist;
-+
-+ close(sock);
-+ salist = make_sin_list(addr, return_count);
-+ SAFE_FREE(addr);
-+ return salist;
-+ }
-+ }
-+
-+ close(sock);
-+ return NULL;
- }
-
- /********************************************************
- Resolve via "wins" method.
- *********************************************************/
-
--static BOOL resolve_wins(const char *name, int name_type,
-- struct in_addr **return_iplist, int *return_count)
-+static struct sockaddr_list *resolve_wins(const char *name, int name_type)
- {
- int sock;
- struct in_addr wins_ip;
- BOOL wins_ismyip;
-
-- *return_iplist = NULL;
-- *return_count = 0;
--
- /*
- * "wins" means do a unicast lookup to the WINS server.
- * Ignore if there is no WINS server specified or if the
-@@ -719,7 +717,7 @@
- wins_ismyip = True;
- } else if( wins_srv_count() < 1 ) {
- DEBUG(3,("resolve_wins: WINS server resolution selected and no WINS servers listed.\n"));
-- return False;
-+ return NULL;
- } else {
- wins_ip = wins_srv_ip();
- wins_ismyip = ismyip(wins_ip);
-@@ -731,28 +729,32 @@
- interpret_addr(lp_socket_address()),
- True );
- if (sock != -1) {
-- int flags;
-- *return_iplist = name_query( sock, name,
-- name_type, False,
-- True, wins_ip,
-- return_count, &flags);
-- if(*return_iplist != NULL) {
-- close(sock);
-- return True;
-- }
-+ struct in_addr *addr;
-+ int return_count, flags;
-+
-+ addr = name_query(sock, name,
-+ name_type, False,
-+ True, wins_ip,
-+ &return_count, &flags);
- close(sock);
-+ if(addr != NULL) {
-+ struct sockaddr_list *salist;
-+
-+ salist = make_sin_list(addr, return_count);
-+ SAFE_FREE(addr);
-+ return salist;
-+ }
- }
- }
-
-- return False;
-+ return NULL;
- }
-
- /********************************************************
- Resolve via "lmhosts" method.
- *********************************************************/
-
--static BOOL resolve_lmhosts(const char *name, int name_type,
-- struct in_addr **return_iplist, int *return_count)
-+static struct sockaddr_list *resolve_lmhosts(const char *name, int name_type)
- {
- /*
- * "lmhosts" means parse the local lmhosts file.
-@@ -763,9 +765,6 @@
- int name_type2;
- struct in_addr return_ip;
-
-- *return_iplist = NULL;
-- *return_count = 0;
--
- DEBUG(3,("resolve_lmhosts: Attempting lmhosts lookup for name %s<0x%x>\n", name, name_type));
-
- fp = startlmhosts( LMHOSTSFILE );
-@@ -775,19 +774,12 @@
- ((name_type2 == -1) || (name_type == name_type2))
- ) {
- endlmhosts(fp);
-- *return_iplist = (struct in_addr *)malloc(sizeof(struct in_addr));
-- if(*return_iplist == NULL) {
-- DEBUG(3,("resolve_lmhosts: malloc fail !\n"));
-- return False;
-- }
-- **return_iplist = return_ip;
-- *return_count = 1;
-- return True;
-+ return make_sin_list(&return_ip, 1);
- }
- }
- endlmhosts(fp);
- }
-- return False;
-+ return NULL;
- }
-
-
-@@ -795,34 +787,45 @@
- Resolve via "hosts" method.
- *********************************************************/
-
--static BOOL resolve_hosts(const char *name,
-- struct in_addr **return_iplist, int *return_count)
-+static struct sockaddr_list *resolve_hosts(const char *name)
- {
- /*
- * "host" means do a localhost, or dns lookup.
- */
-+#ifdef HAVE_INET6
-+ struct addrinfo *ai, hints;
-+ struct sockaddr_list *ret;
-+
-+ DEBUG(3,("resolve_hosts: Attempting getaddrinfo for name %s<0x20>\n", name));
-+ memset(&hints, 0, sizeof(hints));
-+ hints.ai_socktype = SOCK_STREAM;
-+ if(getaddrinfo(name, NULL, &hints, &ai)) return NULL;
-+ ret = make_sa_list(ai);
-+ freeaddrinfo(ai);
-+ return ret;
-+#else
- struct hostent *hp;
-
-- *return_iplist = NULL;
-- *return_count = 0;
--
- DEBUG(3,("resolve_hosts: Attempting host lookup for name %s<0x20>\n", name));
--
-+
- if (((hp = sys_gethostbyname(name)) != NULL) && (hp->h_addr != NULL)) {
- int i = 0, j;
-+ struct in_addr addr;
-+ struct sockaddr_list *top = NULL, **cur = ⊤
-+
- while (hp->h_addr_list[i]) i++;
- DEBUG(10, ("%d addresses returned\n", i));
-- *return_iplist = (struct in_addr *)malloc(i*sizeof(struct in_addr));
-- if(*return_iplist == NULL) {
-- DEBUG(3,("resolve_hosts: malloc fail !\n"));
-- return False;
-- }
- for (j = 0; j < i; j++)
-- putip(&(*return_iplist)[j], (char *)hp->h_addr_list[j]);
-- *return_count = i;
-- return True;
-+ {
-+ memcpy(&addr.s_addr, hp->h_addr_list[j],
-+ sizeof(addr.s_addr));
-+ *cur = make_sin_list(&addr, 1);
-+ cur = &(*cur)->next;
-+ }
-+ return top;
- }
-- return False;
-+ return NULL;
-+#endif
- }
-
- /********************************************************
-@@ -830,49 +833,54 @@
- Use this function if the string is either an IP address, DNS
- or host name or NetBIOS name. This uses the name switch in the
- smb.conf to determine the order of name resolution.
-+
-+ WARNING: This function returns sockaddrs without the port set!
-+ Don't try to connect to these without first setting
-+ the port!
- *********************************************************/
-
--static BOOL internal_resolve_name(const char *name, int name_type,
-- struct in_addr **return_iplist, int *return_count)
-+static struct sockaddr_list *internal_resolve_name(const char *name,
-+ int name_type)
- {
- pstring name_resolve_list;
- fstring tok;
- const char *ptr;
-- BOOL allones = (strcmp(name,"255.255.255.255") == 0);
-- BOOL allzeros = (strcmp(name,"0.0.0.0") == 0);
-- BOOL is_address = is_ipaddress(name);
-- BOOL result = False;
-- struct in_addr *nodupes_iplist;
-- int i;
--
-- *return_iplist = NULL;
-- *return_count = 0;
--
-- if (allzeros || allones || is_address) {
-- *return_iplist = (struct in_addr *)malloc(sizeof(struct in_addr));
-- if(*return_iplist == NULL) {
-- DEBUG(3,("internal_resolve_name: malloc fail !\n"));
-- return False;
-- }
-- if(is_address) {
-- /* if it's in the form of an IP address then get the lib to interpret it */
-- if (((*return_iplist)->s_addr = inet_addr(name)) == 0xFFFFFFFF ){
-- DEBUG(1,("internal_resolve_name: inet_addr failed on %s\n", name));
-- return False;
-- }
-- } else {
-- (*return_iplist)->s_addr = allones ? 0xFFFFFFFF : 0;
-- *return_count = 1;
-- }
-- return True;
-- }
--
-+ struct sockaddr_list *salist = NULL, *cur;
-+
-+ if (is_ipaddress(name)) {
-+ /* if it's in the form of an IP address then get
-+ * the lib to interpret it */
-+ struct sockaddr *sa;
-+
-+ if(!(sa = get_numeric_addr(name))) return NULL;
-+ salist = (struct sockaddr_list *)malloc(sizeof(struct sockaddr_list));
-+ salist->next = NULL;
-+ salist->addr = sa;
-+
-+ /* This isn't kosher, but it would take a lot to make Samba
-+ * be truly AF-independent. */
-+#ifdef HAVE_INET6
-+ if( sa->sa_family == AF_INET6 )
-+ {
-+ salist->pfamily = PF_INET6;
-+ salist->len = sizeof(struct sockaddr_in6);
-+ } else
-+#endif
-+ {
-+ salist->pfamily = PF_INET;
-+ salist->len = sizeof(struct sockaddr_in);
-+ }
-+ return salist;
-+ }
-+
-+#if 0
- /* Check netbios name cache */
-
- if (namecache_fetch(name, name_type, return_iplist, return_count)) {
- /* This could be a negative response */
- return (*return_count > 0);
- }
-+#endif
-
- pstrcpy(name_resolve_list, lp_name_resolve_order());
- ptr = name_resolve_list;
-@@ -881,147 +889,177 @@
-
- while (next_token(&ptr, tok, LIST_SEP, sizeof(tok))) {
- if((strequal(tok, "host") || strequal(tok, "hosts"))) {
-- if (name_type == 0x20 && resolve_hosts(name, return_iplist, return_count)) {
-- result = True;
-- goto done;
-+ if (name_type == 0x20 && (salist = resolve_hosts(name)))
-+ {
-+ goto done;
- }
- } else if(strequal( tok, "lmhosts")) {
-- if (resolve_lmhosts(name, name_type, return_iplist, return_count)) {
-- result = True;
-- goto done;
-+ if ((salist=resolve_lmhosts(name, name_type))) {
-+ goto done;
- }
- } else if(strequal( tok, "wins")) {
- /* don't resolve 1D via WINS */
- if (name_type != 0x1D &&
-- resolve_wins(name, name_type, return_iplist, return_count)) {
-- result = True;
-- goto done;
-+ (salist=resolve_wins(name, name_type))) {
-+ goto done;
- }
- } else if(strequal( tok, "bcast")) {
-- if (name_resolve_bcast(name, name_type, return_iplist, return_count)) {
-- result = True;
-- goto done;
-+ if ((salist=name_resolve_bcast(name, name_type))) {
-+ goto done;
- }
- } else {
- DEBUG(0,("resolve_name: unknown name switch type %s\n", tok));
- }
- }
-
-- /* All of the resolve_* functions above have returned false. */
--
-- SAFE_FREE(*return_iplist);
-- return False;
--
- done:
-
- /* Remove duplicate entries. Some queries, notably #1c (domain
-- controllers) return the PDC in iplist[0] and then all domain
-- controllers including the PDC in iplist[1..n]. Iterating over
-- the iplist when the PDC is down will cause two sets of timeouts. */
--
-- if (*return_count && (nodupes_iplist =
-- (struct in_addr *)malloc(sizeof(struct in_addr) * (*return_count)))) {
-- int nodupes_count = 0;
--
-- /* Iterate over return_iplist looking for duplicates */
--
-- for (i = 0; i < *return_count; i++) {
-- BOOL is_dupe = False;
-- int j;
--
-- for (j = i + 1; j < *return_count; j++) {
-- if (ip_equal((*return_iplist)[i],
-- (*return_iplist)[j])) {
-- is_dupe = True;
-- break;
-- }
-- }
--
-- if (!is_dupe) {
--
-- /* This one not a duplicate */
--
-- nodupes_iplist[nodupes_count] = (*return_iplist)[i];
-- nodupes_count++;
-- }
-- }
--
-- /* Switcheroo with original list */
--
-- free(*return_iplist);
--
-- *return_iplist = nodupes_iplist;
-- *return_count = nodupes_count;
-+ controllers) return the PDC in the first node and then all domain
-+ controllers including the PDC in the remainder of the list.
-+ Iterating over the list when the PDC is down will cause two
-+ sets of timeouts. */
-+
-+ for (cur = salist; cur; cur = cur->next)
-+ {
-+ struct sockaddr_list *i;
-+
-+ for(i = cur; i->next; i = i->next)
-+ {
-+ if(sa_host_equal(cur->addr,i->next->addr))
-+ {
-+ struct sockaddr_list *del = i->next;
-+
-+ i->next = del->next;
-+ del->next = NULL;
-+ free_sockaddr_list(del);
-+ }
-+ }
- }
--
-- /* Display some debugging info */
--
-- DEBUG(10, ("internal_resolve_name: returning %d addresses: ",
-- *return_count));
--
-- for (i = 0; i < *return_count; i++)
-- DEBUGADD(10, ("%s ", inet_ntoa((*return_iplist)[i])));
--
-- DEBUG(10, ("\n"));
--
-- return result;
-+
-+ return salist;
- }
-
-+static BOOL internal_resolve_name_netbios(const char *name, int name_type,
-+ struct in_addr **return_iplist, int *return_count)
-+{
-+ struct sockaddr_list *salist, *sl;
-+ int i;
-+
-+ *return_iplist = NULL;
-+ *return_count = 0;
-+
-+ salist = internal_resolve_name(name, name_type);
-+ if(!salist) return False;
-+
-+ for(sl = salist; sl; sl = sl->next)
-+ if(sl->addr->sa_family == AF_INET) ++*return_count;
-+
-+ *return_iplist = (struct in_addr *)
-+ malloc(*return_count * sizeof(struct in_addr));
-+
-+ for(i = 0, sl = salist; i < *return_count; ++i)
-+ if(sl->addr->sa_family == AF_INET)
-+ *return_iplist[i] =
-+ ((struct sockaddr_in *)(sl->addr))->sin_addr;
-+
-+ free_sockaddr_list(salist);
-+
-+ return True;
-+}
-+
-+
- /********************************************************
-- Internal interface to resolve a name into one IP address.
-+ Internal interface to resolve a name into one IP address for NetBIOS.
- Use this function if the string is either an IP address, DNS
- or host name or NetBIOS name. This uses the name switch in the
- smb.conf to determine the order of name resolution.
- *********************************************************/
-
--BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type)
-+BOOL resolve_name_netbios(const char *name, struct in_addr *return_ip,
-+ int name_type)
- {
-- struct in_addr *ip_list = NULL;
-- int count = 0;
-+ struct sockaddr_list *salist;
-
- if (is_ipaddress(name)) {
- *return_ip = *interpret_addr2(name);
- return True;
- }
-
-- if(internal_resolve_name(name, name_type, &ip_list, &count)) {
-- int i;
-+ if((salist = internal_resolve_name(name, name_type))) {
-+ struct sockaddr_list *sl;
-+ char *ip_str;
-+
- /* only return valid addresses for TCP connections */
-- for (i=0; i<count; i++) {
-- char *ip_str = inet_ntoa(ip_list[i]);
-- if (ip_str &&
-+ for(sl = salist; sl; sl = sl->next) {
-+ if ( sl->addr->sa_family == AF_INET &&
-+ (ip_str = inet_ntoa(((struct sockaddr_in *)
-+ (sl->addr))->sin_addr)) &&
- strcmp(ip_str, "255.255.255.255") != 0 &&
- strcmp(ip_str, "0.0.0.0") != 0) {
-- *return_ip = ip_list[i];
-- SAFE_FREE(ip_list);
-+ *return_ip = ((struct sockaddr_in *)
-+ (sl->addr))->sin_addr;
-+ free_sockaddr_list(salist);
- return True;
- }
- }
-+ free_sockaddr_list(salist);
- }
-- SAFE_FREE(ip_list);
- return False;
- }
-
--/**************************************************************************
-- Resolve a name to a list of addresses
--**************************************************************************/
--BOOL resolve_name_2(const char *name, struct in_addr **return_ip, int *count, int name_type)
-+/********************************************************
-+ Function to resolve a name into a list of addresses for
-+ use with SMB. This uses the name switch in the smb.conf
-+ to determine the order of name resolution.
-+*********************************************************/
-+
-+struct sockaddr_list *resolve_name_smb(const char *name, int port)
- {
-+ struct sockaddr_list *salist;
-
-- return internal_resolve_name(name, name_type, return_ip, count);
-+ if((salist=internal_resolve_name(name, 0x20))) {
-+ struct sockaddr_list *sl = salist, *old = NULL;
-+ char *ip_str;
-
--}
-+ /* only return valid addresses for TCP connections */
-+ while(sl)
-+ {
-+ if ( sl->addr->sa_family == AF_INET &&
-+ (ip_str = inet_ntoa(((struct sockaddr_in *)
-+ (sl->addr))->sin_addr)) &&
-+ ( strcmp(ip_str, "255.255.255.255") == 0 ||
-+ strcmp(ip_str, "0.0.0.0") == 0 ) )
-+ {
-+ struct sockaddr_list *next = sl->next;
-+
-+ SAFE_FREE(sl->addr);
-+ SAFE_FREE(sl);
-+ if(old == NULL) salist = next;
-+ else old->next = next;
-+ sl = next;
-+ } else {
-+ if(port) set_sockaddr_port(sl->addr, port);
-+ old = sl;
-+ sl = sl->next;
-+ }
-+ }
-+ }
-+ return port ? salist : set_default_ports(salist);
-+}
-+
-
- /********************************************************
- resolve a name of format \\server_name or \\ipaddress
- into a name. also, cut the \\ from the front for us.
- *********************************************************/
-
--BOOL resolve_srv_name(const char* srv_name, fstring dest_host,
-- struct in_addr *ip)
-+struct sockaddr_list *resolve_srv_name(const char* srv_name,
-+ fstring dest_host, int port)
- {
-- BOOL ret;
- const char *sv_name = srv_name;
-+ struct in_addr ip;
-+ struct sockaddr_list *salist;
-
- DEBUG(10,("resolve_srv_name: %s\n", srv_name));
-
-@@ -1029,8 +1067,11 @@
- {
- extern pstring global_myname;
- fstrcpy(dest_host, global_myname);
-- ip = interpret_addr2("127.0.0.1");
-- return True;
-+ inet_aton("127.0.0.1", &ip);
-+ salist = make_sin_list(&ip, 1);
-+ if(port) set_sockaddr_port(salist->addr, port);
-+ else salist = set_default_ports(salist);
-+ return salist;
- }
-
- if (strnequal("\\\\", srv_name, 2))
-@@ -1042,18 +1083,24 @@
- /* treat the '*' name specially - it is a magic name for the PDC */
- if (strcmp(dest_host,"*") == 0) {
- extern pstring global_myname;
-- ret = resolve_name(lp_workgroup(), ip, 0x1B);
-- lookup_dc_name(global_myname, lp_workgroup(), ip, dest_host);
-- } else {
-- ret = resolve_name(dest_host, ip, 0x20);
-+
-+ if(resolve_name_netbios(lp_workgroup(), &ip, 0x1B))
-+ {
-+ lookup_dc_name(global_myname, lp_workgroup(),
-+ &ip, dest_host);
-+ return make_singlet_list( &ip, port );
-+ }
-+ return NULL;
- }
-+
-+ salist = resolve_name_smb(dest_host, port);
-
- if (is_ipaddress(dest_host))
- {
- fstrcpy(dest_host, "*SMBSERVER");
- }
-
-- return ret;
-+ return salist;
- }
-
-
-@@ -1066,12 +1113,12 @@
- struct in_addr *ip_list = NULL;
- int count = 0;
-
-- if (internal_resolve_name(group, 0x1D, &ip_list, &count)) {
-+ if (internal_resolve_name_netbios(group, 0x1D, &ip_list, &count)) {
- *master_ip = ip_list[0];
- SAFE_FREE(ip_list);
- return True;
- }
-- if(internal_resolve_name(group, 0x1B, &ip_list, &count)) {
-+ if(internal_resolve_name_netbios(group, 0x1B, &ip_list, &count)) {
- *master_ip = ip_list[0];
- SAFE_FREE(ip_list);
- return True;
-@@ -1309,7 +1356,7 @@
- struct in_addr *return_iplist = NULL;
-
- if (! *pserver)
-- return internal_resolve_name(group, name_type, ip_list, count);
-+ return internal_resolve_name_netbios(group, name_type, ip_list, count);
-
- p = pserver;
- while (next_token(&p,name,LIST_SEP,sizeof(name))) {
-@@ -1318,14 +1365,14 @@
- * Use 1C followed by 1B. This shouldn't work but with
- * broken WINS servers it might. JRA.
- */
-- if (!pdc_only && internal_resolve_name(group, 0x1C, ip_list, count))
-+ if (!pdc_only && internal_resolve_name_netbios(group, 0x1C, ip_list, count))
- return True;
-- return internal_resolve_name(group, 0x1B, ip_list, count);
-+ return internal_resolve_name_netbios(group, 0x1B, ip_list, count);
- }
- num_addresses++;
- }
- if (num_addresses == 0)
-- return internal_resolve_name(group, name_type, ip_list, count);
-+ return internal_resolve_name_netbios(group, name_type, ip_list, count);
-
- return_iplist = (struct in_addr *)malloc(num_addresses * sizeof(struct in_addr));
- if(return_iplist == NULL) {
-@@ -1337,7 +1384,7 @@
- while (next_token(&p,name,LIST_SEP,sizeof(name))) {
- struct in_addr *more_ip, *tmp;
- int count_more;
-- if (resolve_name_2( name, &more_ip, &count_more, 0x20) == False)
-+ if (internal_resolve_name_netbios( name, 0x20, &more_ip, &count_more ) == False)
- continue;
- tmp = (struct in_addr *)realloc(return_iplist,(num_addresses + count_more) * sizeof(struct in_addr));
- if (return_iplist == NULL) {
-@@ -1355,7 +1402,7 @@
- *ip_list = return_iplist;
- return (*count != 0);
- } else
-- return internal_resolve_name(group, name_type, ip_list, count);
-+ return internal_resolve_name_netbios(group, name_type, ip_list, count);
- }
-
- /********************************************************
-@@ -1364,5 +1411,5 @@
-
- BOOL get_lmb_list(struct in_addr **ip_list, int *count)
- {
-- return internal_resolve_name( MSBROWSE, 0x1, ip_list, count);
-+ return internal_resolve_name_netbios( MSBROWSE, 0x1, ip_list, count);
- }
-diff -ur samba-2.2.8a/source/libsmb/passchange.c samba-2.2.8a+IPv6-20030712/source/libsmb/passchange.c
---- samba-2.2.8a/source/libsmb/passchange.c 2000-01-07 01:55:34.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/libsmb/passchange.c 2003-07-12 22:28:30.000000000 -0400
-@@ -33,11 +33,11 @@
- {
- struct nmb_name calling, called;
- struct cli_state cli;
-- struct in_addr ip;
-+ struct sockaddr_list *dest_addrs;
-
- *err_str = '\0';
-
-- if(!resolve_name( remote_machine, &ip, 0x20)) {
-+ if(!(dest_addrs = resolve_name_smb(remote_machine, 0))) {
- slprintf(err_str, err_str_len-1, "unable to find an IP address for machine %s.\n",
- remote_machine );
- return False;
-@@ -45,9 +45,11 @@
-
- ZERO_STRUCT(cli);
-
-- if (!cli_initialise(&cli) || !cli_connect(&cli, remote_machine, &ip)) {
-+ if (!cli_initialise(&cli) ||
-+ !cli_connect(&cli, remote_machine, dest_addrs)) {
- slprintf(err_str, err_str_len-1, "unable to connect to SMB server on machine %s. Error was : %s.\n",
- remote_machine, cli_errstr(&cli) );
-+ free_sockaddr_list(dest_addrs);
- return False;
- }
-
-diff -ur samba-2.2.8a/source/nmbd/nmbd_synclists.c samba-2.2.8a+IPv6-20030712/source/nmbd/nmbd_synclists.c
---- samba-2.2.8a/source/nmbd/nmbd_synclists.c 2003-03-14 16:34:48.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/nmbd/nmbd_synclists.c 2003-07-12 22:28:30.000000000 -0400
-@@ -68,6 +68,7 @@
- extern fstring local_machine;
- fstring unix_workgroup;
- static struct cli_state cli;
-+ struct sockaddr_list *dest_addrs;
- uint32 local_type = local ? SV_TYPE_LOCAL_LIST_ONLY : 0;
- struct nmb_name called, calling;
-
-@@ -75,7 +76,9 @@
- * Patch from Andy Levine andyl@epicrealm.com.
- */
-
-- if (!cli_initialise(&cli) || !cli_set_port(&cli, 139) || !cli_connect(&cli, name, &ip)) {
-+ dest_addrs = make_singlet_list(&ip, 0);
-+ if (!cli_initialise(&cli) || !cli_connect(&cli, name, dest_addrs)) {
-+ free_sockaddr_list(dest_addrs);
- return;
- }
-
-diff -ur samba-2.2.8a/source/rpcclient/rpcclient.c samba-2.2.8a+IPv6-20030712/source/rpcclient/rpcclient.c
---- samba-2.2.8a/source/rpcclient/rpcclient.c 2003-03-14 16:34:49.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/rpcclient/rpcclient.c 2003-07-12 22:28:30.000000000 -0400
-@@ -743,7 +743,7 @@
-
- /* Resolve the IP address */
-
-- if (!resolve_name(server, &server_ip, 0x20)) {
-+ if (!resolve_name_netbios(server, &server_ip, 0x20)) {
- DEBUG(1,("Unable to resolve %s\n", server));
- return 1;
- }
-diff -ur samba-2.2.8a/source/rpc_client/cli_spoolss_notify.c samba-2.2.8a+IPv6-20030712/source/rpc_client/cli_spoolss_notify.c
---- samba-2.2.8a/source/rpc_client/cli_spoolss_notify.c 2003-03-14 16:34:48.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/rpc_client/cli_spoolss_notify.c 2003-07-12 22:28:30.000000000 -0400
-@@ -75,25 +75,14 @@
- return False;
- }
-
-- if(!resolve_name( remote_machine, &cli->dest_ip, 0x20)) {
-- DEBUG(0,("connect_to_client: Can't resolve address for %s\n", remote_machine));
-- cli_shutdown(cli);
-- return False;
-- }
--
-- if (ismyip(cli->dest_ip)) {
-- DEBUG(0,("connect_to_client: Machine %s is one of our addresses. Cannot add to ourselves.\n", remote_machine));
-- cli_shutdown(cli);
-- return False;
-- }
--
-- if (!cli_connect(cli, remote_machine, &cli->dest_ip)) {
-+ if (!cli_connect(cli, remote_machine, NULL)) {
- DEBUG(0,("connect_to_client: unable to connect to SMB server on machine %s. Error was : %s.\n", remote_machine, cli_errstr(cli) ));
- cli_shutdown(cli);
- return False;
- }
-
-- if (!attempt_netbios_session_request(cli, global_myname, remote_machine, &cli->dest_ip)) {
-+ if (!attempt_netbios_session_request(cli, global_myname,
-+ remote_machine)) {
- DEBUG(0,("connect_to_client: machine %s rejected the NetBIOS session request.\n",
- remote_machine));
- cli_shutdown(cli);
-diff -ur samba-2.2.8a/source/rpc_client/cli_trust.c samba-2.2.8a+IPv6-20030712/source/rpc_client/cli_trust.c
---- samba-2.2.8a/source/rpc_client/cli_trust.c 2003-03-14 16:34:48.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/rpc_client/cli_trust.c 2003-07-12 22:28:30.000000000 -0400
-@@ -53,27 +53,14 @@
- return False;
- }
-
-- if(!resolve_name( remote_machine, &cli.dest_ip, 0x20)) {
-- DEBUG(0,("modify_trust_password: Can't resolve address for %s\n", remote_machine));
-- cli_shutdown(&cli);
-- return False;
-- }
--
-- if (ismyip(cli.dest_ip)) {
-- DEBUG(0,("modify_trust_password: Machine %s is one of our addresses. Cannot add \
--to ourselves.\n", remote_machine));
-- cli_shutdown(&cli);
-- return False;
-- }
--
-- if (!cli_connect(&cli, remote_machine, &cli.dest_ip)) {
-+ if (!cli_connect(&cli, remote_machine, NULL)) {
- DEBUG(0,("modify_trust_password: unable to connect to SMB server on \
- machine %s. Error was : %s.\n", remote_machine, cli_errstr(&cli) ));
- cli_shutdown(&cli);
- return False;
- }
-
-- if (!attempt_netbios_session_request(&cli, global_myname, remote_machine, &cli.dest_ip)) {
-+ if (!attempt_netbios_session_request(&cli, global_myname, remote_machine)) {
- DEBUG(0,("modify_trust_password: machine %s rejected the NetBIOS session request.\n",
- remote_machine ));
- cli_shutdown(&cli);
-diff -ur samba-2.2.8a/source/smbd/password.c samba-2.2.8a+IPv6-20030712/source/smbd/password.c
---- samba-2.2.8a/source/smbd/password.c 2003-04-06 21:54:00.000000000 -0400
-+++ samba-2.2.8a+IPv6-20030712/source/smbd/password.c 2003-07-12 22:28:30.000000000 -0400
-@@ -1015,7 +1015,7 @@
- {
- struct cli_state *cli;
- fstring desthost;
-- struct in_addr dest_ip;
-+ struct sockaddr_list *dest_addrs;
- char *pserver;
- const char *p;
- BOOL connected_ok = False;
-@@ -1032,21 +1032,23 @@
- standard_sub_basic(desthost,sizeof(desthost));
- strupper(desthost);
-
-- if(!resolve_name( desthost, &dest_ip, 0x20)) {
-+ if(!(dest_addrs = resolve_name_smb(desthost, 0))) {
- DEBUG(1,("server_cryptkey: Can't resolve address for %s\n",desthost));
- continue;
- }
-
-+#if 0
- if (ismyip(dest_ip)) {
- DEBUG(1,("Password server loop - disabling password server %s\n",desthost));
- continue;
- }
-+#endif
-
-- if (cli_connect(cli, desthost, &dest_ip)) {
-+ if (cli_connect(cli, desthost, dest_addrs)) {
- DEBUG(3,("connected to password server %s\n",desthost));
- connected_ok = True;
- break;
-- }
-+ } else free_sockaddr_list(dest_addrs);
- }
-
- SAFE_FREE(pserver);
-@@ -1057,7 +1059,7 @@
- return NULL;
- }
-
-- if (!attempt_netbios_session_request(cli, global_myname, desthost, &dest_ip)) {
-+ if (!attempt_netbios_session_request(cli, global_myname, desthost)) {
- cli_shutdown(cli);
- return NULL;
- }
-@@ -1223,7 +1225,7 @@
- static BOOL connect_to_domain_password_server(struct cli_state **ppcli,
- char *server, unsigned char *trust_passwd)
- {
-- struct in_addr dest_ip;
-+ struct sockaddr_list *dest_addrs;
- fstring remote_machine;
- struct cli_state *pcli = NULL;
-
-@@ -1234,7 +1236,7 @@
- return False;
- }
-
-- if (is_ipaddress(server)) {
-+ if (is_ipv4address(server)) {
- struct in_addr to_ip;
-
- /* we shouldn't have 255.255.255.255 forthe IP address of a password server anyways */
-@@ -1256,18 +1258,20 @@
- standard_sub_basic(remote_machine,sizeof(remote_machine));
- strupper(remote_machine);
-
-- if(!resolve_name( remote_machine, &dest_ip, 0x20)) {
-+ if(!(dest_addrs = resolve_name_smb(remote_machine, 0))) {
- DEBUG(1,("connect_to_domain_password_server: Can't resolve address for %s\n", remote_machine));
- cli_shutdown(pcli);
- return False;
- }
-
-+#if 0
- if (ismyip(dest_ip)) {
- DEBUG(1,("connect_to_domain_password_server: Password server loop - not using password server %s\n",
- remote_machine));
- cli_shutdown(pcli);
- return False;
- }
-+#endif
-
- /* we use a mutex to prevent two connections at once - when a NT PDC gets
- two connections where one hasn't completed a negprot yet it will send a
-@@ -1278,15 +1282,16 @@
- return False;
- }
-
-- if (!cli_connect(pcli, remote_machine, &dest_ip)) {
-+ if (!cli_connect(pcli, remote_machine, dest_addrs)) {
- DEBUG(0,("connect_to_domain_password_server: unable to connect to SMB server on \
- machine %s. Error was : %s.\n", remote_machine, cli_errstr(pcli) ));
-+ free_sockaddr_list(dest_addrs);
- cli_shutdown(pcli);
- release_server_mutex();
- return False;
- }
-
-- if (!attempt_netbios_session_request(pcli, global_myname, remote_machine, &dest_ip)) {
-+ if (!attempt_netbios_session_request(pcli, global_myname, remote_machine)) {
- DEBUG(0,("connect_to_password_server: machine %s rejected the NetBIOS \
- session request. Error was : %s.\n", remote_machine, cli_errstr(pcli) ));
- cli_shutdown(pcli);
-diff -ur samba-2.2.8a/source/smbwrapper/smbw.c samba-2.2.8a+IPv6-20030712/source/smbwrapper/smbw.c
---- samba-2.2.8a/source/smbwrapper/smbw.c 2002-04-30 09:28:32.000000000 -0400
-+++ samba-2.2.8a+IPv6-20030712/source/smbwrapper/smbw.c 2003-07-12 22:28:30.000000000 -0400
-@@ -261,9 +261,7 @@
- {
- fstring server;
- char *p;
-- struct in_addr *ip_list = NULL;
-- int count = 0;
-- int i;
-+ struct sockaddr_list *wglist, *wg;
-
- /* first off see if an existing workgroup name exists */
- p = smbw_getshared("WORKGROUP");
-@@ -273,24 +271,29 @@
- if (smbw_server(server, "IPC$")) return p;
-
- /* go looking for workgroups */
-- if (!name_resolve_bcast(MSBROWSE, 1, &ip_list, &count)) {
-+ if (!(wglist = name_resolve_bcast(MSBROWSE, 1))) {
- DEBUG(1,("No workgroups found!"));
- return p;
- }
-
-- for (i=0;i<count;i++) {
-+ for(wg = wglist; wg; wg = wg->next)
-+ {
- static fstring name;
-- if (name_status_find("*", 0, 0x1d, ip_list[i], name)) {
-+
-+ if(wg->addr->sa_family != AF_INET) continue;
-+ if (name_status_find("*", 0, 0x1d, ((struct sockaddr_in *)
-+ (wg->addr))->sin_addr, name))
-+ {
- slprintf(server, sizeof(server), "%s#1D", name);
- if (smbw_server(server, "IPC$")) {
- smbw_setshared("WORKGROUP", name);
-- SAFE_FREE(ip_list);
-+ free_sockaddr_list(wglist);
- return name;
- }
- }
- }
-
-- SAFE_FREE(ip_list);
-+ free_sockaddr_list(wglist);
-
- return p;
- }
-@@ -448,9 +451,8 @@
- char *p, *server_n = server;
- fstring group;
- pstring ipenv;
-- struct in_addr ip;
-+ struct sockaddr_list *salist;
-
-- zero_ip(&ip);
- ZERO_STRUCT(c);
-
- get_auth_data_fn(server, share, &workgroup, &username, &password);
-@@ -501,13 +503,15 @@
- again:
- slprintf(ipenv,sizeof(ipenv)-1,"HOST_%s", server_n);
-
-- zero_ip(&ip);
-+ salist = resolve_name_smb((p=smbw_getshared(ipenv)) ? p : server_n, 0);
-+
- if ((p=smbw_getshared(ipenv))) {
- ip = *(interpret_addr2(p));
- }
-
- /* have to open a new connection */
-- if (!cli_initialise(&c) || !cli_connect(&c, server_n, &ip)) {
-+ if (!cli_initialise(&c) || !cli_connect(&c, server_n, salist)) {
-+ free_sockaddr_list(salist);
- errno = ENOENT;
- return NULL;
- }
-@@ -550,7 +554,7 @@
- return NULL;
- }
-
-- smbw_setshared(ipenv,inet_ntoa(ip));
-+ smbw_setshared(ipenv,print_sockaddr(c.connected_addr->addr));
-
- DEBUG(4,(" tconx ok\n"));
-
-diff -ur samba-2.2.8a/source/utils/locktest2.c samba-2.2.8a+IPv6-20030712/source/utils/locktest2.c
---- samba-2.2.8a/source/utils/locktest2.c 2002-04-30 09:28:37.000000000 -0400
-+++ samba-2.2.8a+IPv6-20030712/source/utils/locktest2.c 2003-07-12 22:28:30.000000000 -0400
-@@ -156,7 +156,6 @@
- struct nmb_name called, calling;
- char *server_n;
- fstring server;
-- struct in_addr ip;
- fstring myname;
- static int count;
-
-@@ -168,19 +167,14 @@
-
- server_n = server;
-
-- zero_ip(&ip);
--
- slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++);
-
- make_nmb_name(&calling, myname, 0x0);
- make_nmb_name(&called , server, 0x20);
-
- again:
-- zero_ip(&ip);
--
- /* have to open a new connection */
-- if (!(c=cli_initialise(NULL)) || (cli_set_port(c, 139) == 0) ||
-- !cli_connect(c, server_n, &ip)) {
-+ if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, NULL)) {
- DEBUG(0,("Connection to %s failed\n", server_n));
- return NULL;
- }
-diff -ur samba-2.2.8a/source/utils/locktest.c samba-2.2.8a+IPv6-20030712/source/utils/locktest.c
---- samba-2.2.8a/source/utils/locktest.c 2002-04-30 09:28:37.000000000 -0400
-+++ samba-2.2.8a+IPv6-20030712/source/utils/locktest.c 2003-07-12 22:28:30.000000000 -0400
-@@ -114,7 +114,6 @@
- struct nmb_name called, calling;
- char *server_n;
- fstring server;
-- struct in_addr ip;
- fstring myname;
- static int count;
-
-@@ -126,19 +125,14 @@
-
- server_n = server;
-
-- zero_ip(&ip);
--
- slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++);
-
- make_nmb_name(&calling, myname, 0x0);
- make_nmb_name(&called , server, 0x20);
-
- again:
-- zero_ip(&ip);
--
- /* have to open a new connection */
-- if (!(c=cli_initialise(NULL)) || (cli_set_port(c, 139) == 0) ||
-- !cli_connect(c, server_n, &ip)) {
-+ if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, NULL)) {
- DEBUG(0,("Connection to %s failed\n", server_n));
- return NULL;
- }
-diff -ur samba-2.2.8a/source/utils/masktest.c samba-2.2.8a+IPv6-20030712/source/utils/masktest.c
---- samba-2.2.8a/source/utils/masktest.c 2002-04-30 09:28:37.000000000 -0400
-+++ samba-2.2.8a+IPv6-20030712/source/utils/masktest.c 2003-07-12 22:28:30.000000000 -0400
-@@ -164,7 +165,6 @@
- struct nmb_name called, calling;
- char *server_n;
- char *server;
-- struct in_addr ip;
-
- server = share+2;
- share = strchr(server,'\\');
-@@ -175,17 +174,12 @@
-
- server_n = server;
-
-- zero_ip(&ip);
--
- make_nmb_name(&calling, "masktest", 0x0);
- make_nmb_name(&called , server, 0x20);
-
- again:
-- zero_ip(&ip);
--
- /* have to open a new connection */
-- if (!(c=cli_initialise(NULL)) || (cli_set_port(c, 139) == 0) ||
-- !cli_connect(c, server_n, &ip)) {
-+ if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, NULL)) {
- DEBUG(0,("Connection to %s failed\n", server_n));
- return NULL;
- }
-diff -ur samba-2.2.8a/source/utils/smbcacls.c samba-2.2.8a+IPv6-20030712/source/utils/smbcacls.c
---- samba-2.2.8a/source/utils/smbcacls.c 2003-03-14 16:34:49.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/utils/smbcacls.c 2003-07-12 22:28:30.000000000 -0400
-@@ -714,7 +714,6 @@
- {
- struct cli_state *c;
- struct nmb_name called, calling;
-- struct in_addr ip;
- extern pstring global_myname;
-
- fstrcpy(server,share+2);
-@@ -723,18 +722,13 @@
- *share = 0;
- share++;
-
-- zero_ip(&ip);
--
- make_nmb_name(&calling, global_myname, 0x0);
- make_nmb_name(&called , server, 0x20);
-
- again:
-- zero_ip(&ip);
--
- /* have to open a new connection */
-- if (!(c=cli_initialise(NULL)) || !cli_connect(c, server, &ip)) {
-+ if (!(c=cli_initialise(NULL)) || !cli_connect(c, server, NULL)) {
- DEBUG(0,("Connection to %s failed\n", server));
-- cli_shutdown(c);
- return NULL;
- }
-
-diff -ur samba-2.2.8a/source/utils/smbfilter.c samba-2.2.8a+IPv6-20030712/source/utils/smbfilter.c
---- samba-2.2.8a/source/utils/smbfilter.c 2002-02-01 17:15:14.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/utils/smbfilter.c 2003-07-12 22:28:30.000000000 -0400
-@@ -98,15 +98,17 @@
- }
-
-
--static void filter_child(int c, struct in_addr dest_ip)
-+static void filter_child(int c, struct sockaddr_list *dest_addrs)
- {
- int s;
-
- /* we have a connection from a new client, now connect to the server */
-- s = open_socket_out(SOCK_STREAM, &dest_ip, 139, LONG_CONNECT_TIMEOUT);
-+ s = open_socket_out(dest_addrs, NULL, LONG_CONNECT_TIMEOUT);
-+ free_sockaddr_list(dest_addrs);
-
- if (s == -1) {
-- DEBUG(0,("Unable to connect to %s\n", inet_ntoa(dest_ip)));
-+ DEBUG(0,("Unable to connect to %s\n",
-+ print_sockaddr(dest_addrs->addr)));
- exit(1);
- }
-
-@@ -152,7 +154,7 @@
- static void start_filter(char *desthost)
- {
- int s, c;
-- struct in_addr dest_ip;
-+ struct sockaddr_list *dest_addrs;
-
- CatchChild();
-
-@@ -168,7 +170,7 @@
- DEBUG(0,("listen failed\n"));
- }
-
-- if (!resolve_name(desthost, &dest_ip, 0x20)) {
-+ if (!(dest_addrs = resolve_name_smb(desthost, 0))) {
- DEBUG(0,("Unable to resolve host %s\n", desthost));
- exit(1);
- }
-@@ -188,7 +190,7 @@
- if (c != -1) {
- if (fork() == 0) {
- close(s);
-- filter_child(c, dest_ip);
-+ filter_child(c, dest_addrs);
- exit(0);
- } else {
- close(c);
-diff -ur samba-2.2.8a/source/utils/smbpasswd.c samba-2.2.8a+IPv6-20030712/source/utils/smbpasswd.c
---- samba-2.2.8a/source/utils/smbpasswd.c 2003-03-14 16:34:49.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/utils/smbpasswd.c 2003-07-12 22:28:30.000000000 -0400
-@@ -350,7 +350,7 @@
- struct ntuser_creds creds;
- struct cli_state cli;
- fstring acct_name;
-- struct in_addr dest_ip;
-+ struct sockaddr_list *dest_addrs = NULL;
- TALLOC_CTX *mem_ctx;
-
- /* rpc variables */
-@@ -379,7 +379,6 @@
-
- ZERO_STRUCT(cli);
- ZERO_STRUCT(creds);
-- ZERO_STRUCT(dest_ip); /* Make sure no nasty surprises */
-
- if (!(mem_ctx = talloc_init())) {
- DEBUG(0, ("Could not initialise talloc context\n"));
-@@ -414,19 +413,20 @@
- fprintf(stderr, "Unable to lookup the name for the domain controller for domain %s.\n", domain);
- return 1;
- }
-- dest_ip = ip_list[0];
-+ dest_addrs = make_singlet_list( &ip_list[0], 0 );
- }
-
- make_nmb_name(&called, pdc_name, 0x20);
- make_nmb_name(&calling, dns_to_netbios_name(global_myname), 0);
-
-- if (!cli_establish_connection(&cli, pdc_name, &dest_ip, &calling,
-+ if (!cli_establish_connection(&cli, pdc_name, dest_addrs, &calling,
- &called, "IPC$", "IPC", False, True)) {
- if (!NT_STATUS_IS_OK(cli_nt_error(&cli))) {
- DEBUG(0, ("Error connecting to %s - %s\n", pdc_name,cli_errstr(&cli)));
- } else {
- DEBUG(0, ("Error connecting to %s\n", pdc_name));
- }
-+ if( dest_addrs ) free_sockaddr_list( dest_addrs );
- goto done;
- }
-
-@@ -612,6 +612,9 @@
- if (cli.nt_pipe_fnum)
- cli_nt_session_close(&cli);
-
-+ if (cli.dest_addrs)
-+ free_sockaddr_list(cli.dest_addrs);
-+
- /* Display success or failure */
-
- if (retval != 0) {
-diff -ur samba-2.2.8a/source/utils/torture.c samba-2.2.8a+IPv6-20030712/source/utils/torture.c
---- samba-2.2.8a/source/utils/torture.c 2002-04-30 09:28:39.000000000 -0400
-+++ samba-2.2.8a+IPv6-20030712/source/utils/torture.c 2003-07-12 22:28:30.000000000 -0400
-@@ -134,16 +134,13 @@
- static BOOL open_nbt_connection(struct cli_state *c)
- {
- struct nmb_name called, calling;
-- struct in_addr ip;
-
- ZERO_STRUCTP(c);
-
- make_nmb_name(&calling, myname, 0x0);
- make_nmb_name(&called , host, 0x20);
-
-- zero_ip(&ip);
--
-- if (!cli_initialise(c) || !cli_connect(c, host, &ip)) {
-+ if (!cli_initialise(c) || !cli_connect(c, host, NULL)) {
- printf("Failed to connect with %s\n", host);
- return False;
- }
-diff -ur samba-2.2.8a/source/web/diagnose.c samba-2.2.8a+IPv6-20030712/source/web/diagnose.c
---- samba-2.2.8a/source/web/diagnose.c 2003-02-28 13:47:26.000000000 -0500
-+++ samba-2.2.8a+IPv6-20030712/source/web/diagnose.c 2003-07-12 22:28:30.000000000 -0400
-@@ -52,12 +52,16 @@
- BOOL smbd_running(void)
- {
- static struct cli_state cli;
-+ struct sockaddr_list *localaddrs;
- extern struct in_addr loopback_ip;
-
- if (!cli_initialise(&cli))
- return False;
-
-- if (!cli_connect(&cli, "localhost", &loopback_ip)) {
-+ localaddrs = make_singlet_list(&loopback_ip, 0);
-+ if (!cli_connect(&cli, "localhost", localaddrs))
-+ {
-+ free_sockaddr_list(localaddrs);
- cli_shutdown(&cli);
- return False;
- }
+++ /dev/null
-#
-# Conditional build:
-# _without_cups - without CUPS support
-# _with_ldap - with LDAP-based auth (instead of smbpasswd)
-# _with_ipv6 - with IPv6 support
-#
-%define vscan_version 0.3.4
-Summary: SMB server
-Summary(cs): Server SMB
-Summary(da): SMB server
-Summary(de): SMB-Server
-Summary(es): El servidor SMB
-Summary(fi): SMB-palvelin
-Summary(fr): Serveur SMB
-Summary(it): Server SMB
-Summary(ja): Samba SMB ¥µ¡¼¥Ð¡¼
-Summary(ko): »ï¹Ù SMB ¼¹ö
-Summary(pl): Serwer SMB
-Summary(pt_BR): Cliente e servidor SMB
-Summary(ru): SMB ËÌÉÅÎÔ É ÓÅÒ×ÅÒ
-Summary(tr): SMB sunucusu
-Summary(uk): SMB Ë̦¤ÎÔ ÔÁ ÓÅÒ×ÅÒ
-Summary(zh_CN): Samba ¿Í»§¶ËºÍ·þÎñÆ÷
-Name: samba
-Version: 2.2.8a
-Release: 5
-License: GPL v2
-Group: Networking/Daemons
-Source0: http://www.samba.org/samba/ftp/%{name}-%{version}.tar.bz2
-# Source0-md5: 51466fdd7b7125a5bd41608a76e8e7c8
-Source1: smb.init
-Source2: %{name}.pamd
-Source3: swat.inetd
-Source4: %{name}.sysconfig
-Source5: %{name}.logrotate
-Source6: smb.conf
-Source7: http://dl.sourceforge.net/openantivirus/%{name}-vscan-%{vscan_version}.tar.bz2
-# Source7-md5: acbcb28cff080dcf2ee732b7f2c0f949
-Patch1: %{name}-config.patch
-Patch2: %{name}-DESTDIR.patch
-Patch3: %{name}-manpages_PLD_fixes.patch
-Patch4: %{name}-smbprint.patch
-Patch5: %{name}-autoconf.patch
-Patch6: %{name}-smbadduser.patch
-Patch7: %{name}-nmbd_socket.patch
-Patch8: %{name}-vfs.patch
-Patch9: %{name}-quota.patch
-Patch10: http://v6web.litech.org/samba/%{name}-2.2.8a+IPv6-20030712.diff
-Patch11: %{name}-DESTDIR-fix.patch
-Patch12: %{name}-CIFS-extensions.patch
-Patch13: %{name}-allow-suid.patch
-URL: http://www.samba.org/
-BuildRequires: autoconf
-%{!?_without_cups:BuildRequires: cups-devel}
-BuildRequires: libtool >= 2:1.4d
-BuildRequires: ncurses-devel >= 5.2
-%{?_with_ldap:BuildRequires: openldap-devel}
-BuildRequires: openssl-devel >= 0.9.7c
-BuildRequires: pam-devel > 0.66
-BuildRequires: popt-devel
-BuildRequires: readline-devel >= 4.2
-Requires(post,preun): /sbin/chkconfig
-Requires: logrotate
-Requires: pam >= 0.77.3
-Requires: samba-common = %{version}
-BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-
-%define _sysconfdir /etc/samba
-%define _vfsdir /usr/lib/%{name}/vfs
-%define _libdir %{_sysconfdir}
-%define _localstatedir %{_var}/log/samba
-%define _sambahome /home/services/samba
-%if 0%{!?_without_cups:1}
-%define cups_serverbin %(cups-config --serverbin)
-%endif
-
-%description
-Samba provides an SMB server which can be used to provide network
-services to SMB (sometimes called "Lan Manager") clients, including
-various versions of MS Windows, OS/2, and other Linux machines. Samba
-also provides some SMB clients, which complement the built-in SMB
-filesystem in Linux. Samba uses NetBIOS over TCP/IP (NetBT) protocols
-and does NOT need NetBEUI (Microsoft Raw NetBIOS frame) protocol.
-
-This release is known as the "Locking Update" and has full support for
-Opportunistic File Locking. In addition this update includes native
-support for Microsoft encrypted passwords, improved browse list and
-WINS database management.
-
-Please refer to the WHATSNEW.txt document for fixup information. This
-binary release includes encrypted password support. Please read the
-smb.conf file and ENCRYPTION.txt in the docs directory for
-implementation details.
-
-%description -l cs
-Samba poskytuje server SMB, který lze pou¾ít pro poskytování sí»ových
-slu¾eb klientùm SMB (nìkdy nazývaných klienti "LAN mana¾er") vèetnì
-klientù rùzných verzí MS Windows, OS/2 a dal¹ích linuxových strojù.
-Samba té¾ poskytuje nìkteré klienty SMB, kteøí komplementují vestavìný
-souborový systém SMB v Linuxu. Samba pou¾ívá protokoly NetBIOS pøes
-TCP/IP (NetBT) a NEpotøebuje protokol NetBEUI (neformátovaný rámec
-NetBIOS od spoleènosti Microsoft.
-
-%description -l da
-Samba tilbyder en SMB server som kan bruges til at tilbyde netværk
-services til SMB (også kaldet "Lan Manager") klienter, incl.
-forskellige versioner af MS Windows, OS/2, og andre Linux maskiner.
-Samba tilbyder også SMB klienter, som udbygger det indbyggede SMB
-filsystem i Linux. Samba benytter NetBIOS over TCP/IP (NetBT)
-protocolen og kræver ikke NetBEUI (Microsoft Raw NetBIOS frame)
-protokollen.
-
-%description -l de
-Samba stellt einen SMB-Server zum Anbieten von Netzwerkdiensten für
-SMB-Clients (auch "Lan Manager" genannt) zur Verfügung, darunter
-verschiedenen Versionen von MS Windows-, OS/2- und anderen
-Linux-Rechnern. Samba enthält außerdem einige SMB-Clients, die das in
-Linux integrierte SMB-Dateisystem ergänzen. Samba benutzt
-NetBIOS-über-TCP/IP (NetBT)-Protokolle und benötigt KEIN NetBEUI
-(Microsoft Raw NetBIOS frame)-Protokoll.
-
-%description -l es
-Samba provee un servidor SMB que se puede usar para ofrecer servicios
-de red a clientes SMB (algunas veces se le llama de "Lan Manager"),
-incluyendo varias versiones de MS Windows, OS/2, y otras máquinas
-Linux. Samba también ofrece algunos clientes SMB, que complementan el
-sistema de archivos SMB de Linux. Samba usa el protocolo NetBIOS sobre
-TCP/IP (NetBT) y no necesita del protocolo NetBEUI (Microsoft Raw
-NetBIOS frame).
-
-%description -l fi
-Samba on SMB-palvelin, jota voidaan käyttää SMB-asiakasohjelmien
-verkkopalvelujen tarjoajana. SMB-protokollaa kutsutaan joskus "Lan
-Manager" protokollaksi ja asiakasohjelmat toimivat dosissa,
-Windowseissa, OS/2:ssa ja toisissa Linux-koneissa. Samban mukana on
-myös joitakin SMB-asiakasohjelmia, jotka täydentävät Linuxin
-kernelissä olevaa SMB-tiedostojärjestelmän tukea. Samba vaatii NetBIOS
-over TCP/IP (NetBT) protokollaa eikä tarvitse tai pysty käyttämään
-NetBEUI-protokollaa.
-
-%description -l it
-Samba fornisce un server SMB che puo` essere usato per fornire servizi
-di rete ai client SMB, incluse le versioni MS Windows, OS/2 e per
-altre macchine Linux. Samba fornisce anche i client SMB. Samba usa
-NetBIOS sopra TCP/IP e non ha bisogno del protocollo NetBEUI.
-
-%description -l ja
-Samba ¤Ï MS Windows ¤ÎÍÍ¡¹¤Ê¥Ð¡¼¥¸¥ç¥ó¡¢OS/2 ¤½¤·¤Æ¾¤Î Linux ¥Þ¥·¥ó
-¤ò´Þ¤à SMB (¤¿¤Þ¤Ë "Lan Manager" ¤È¸Æ¤Ð¤ì¤ë)
-¥¯¥é¥¤¥¢¥ó¥È¤Ë¥Í¥Ã¥È¥ï¡¼¥¯ ¥µ¡¼¥Ó¥¹¤òÄ󶡤¹¤ë¤¿¤á¤Ë»ÈÍѤµ¤ì¤ë SMB
-¥µ¡¼¥Ð¤òÄ󶡤·¤Þ¤¹¡£Samba ¤Ï NetBIOS over TCP/IP (NetBT)
-¥×¥í¥È¥³¥ë¤ò»ÈÍѤ·¡¢ NetBEUI(Microsoft Raw NetBIOS frame)
-¥×¥í¥È¥³¥ë¤ÏɬÍפ¢¤ê¤Þ¤»¤ó¡£
-
-Samba ¤Û¤È¤ó¤ÉÆ°ºî¤¹¤ë NT ¥É¥á¥¤¥ó¥³¥ó¥È¥í¡¼¥ë¤Îµ¡Ç½¤òÆÃħ¤È¤·¡¢
-¹¥¤¤Ê¥Ö¥é¥¦¥¶¤ò»È¤Ã¤Æ samba ¤Î smb.conf ¥Õ¥¡¥¤¥ë¤ò¥ê¥â¡¼¥È´ÉÍý¤¹¤ë
-¿·¤·¤¤ SWAT (Samba Web Administration Tool) ¤ò´Þ¤ß¤Þ¤¹¡£
-Ìܲ¼¤Î¤È¤³¤í¤³¤ì¤Ï inetd ¤òÄ̤·¤Æ TCP ¥Ý¡¼¥È 901 ¤Ç͸ú¤Ë¤Ê¤ê¤Þ¤¹¡£
-
-%description -l ko
-»ï¹Ù´Â MS Windows, OS/2, ȤÀº ´Ù¸¥ ¸®´ª½º ¸Ó½ÅÀ» Æ÷ÇÔÇÏ´Â SMB(ȤÀº
-"Lan Manager"¶ó°íµµ ºÒ¸²) Ŭ¶óÀ̾ðÆ®¸¦ ³×Æ®¿öÅ© ¼ºñ½º À§ÇØ »ç¿ëÇÒ ¼ö
-ÀÖ´Â SMB ¼¹ö¸¦ Á¦°øÇÑ´Ù. »ï¹Ù´Â TCP/IP ÇÁ·ÎÅäÄÝÀ» ÅëÇØ NetBIOS¸¦
-»ç¿ëÇÏ°í NetBEUI (Microsoft Raw NetBIOS ÇÁ·¹ÀÓ) ÇÁ·ÎÅäÄÝÀº ÇÊ¿äÇÏÁö
-¾Ê´Ù.
-
-»ï¹Ù-2.2 ÀÇ Æ¯Â¡Àº NT µµ¸ÞÀÎ ÄÁÆ®·ÑÀÇ ¼º´ÉÀ¸·Î ÀÛ¾÷À» ÇÏ°í, »õ·Î¿î
-SWAT(Samba Web Administration Tool)·Î À¥ºê¶ó¿ìÀú¸¦ »ç¿ëÇÏ¿© ¿ø°ÝÁö¿¡¼
-»ï¹ÙÀÇ smb.conf ÆÄÀÏÀ» °ü¸®Çϵµ·Ï ÇÑ´Ù. ÀÌ·¯ÇÑ °æ¿ì inetd µ¥¸óÀ» ÅëÇØ
-TCP 901 Æ÷Æ®¸¦ »ç¿ëÇÏ°Ô µÈ´Ù.
-
-ÃÖ±Ù Á¤º¸·Î WHATSNEW.txt ÆÄÀÏÀÇ ¹®¼¸¦ Âü°íÇϵµ·Ï ÇÑ´Ù. ¹ÙÀ̳ʸ®ÀÇ
-¸±¸®Áî´Â ¾ÏÈ£ÈµÈ Æнº¿öµå¸¦ Á¦°øÇÑ´Ù. ±¸Çö¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ Á¤º¸¸¦ ¾ò±â
-À§ÇØ docs µð·ºÅ丮³»¿¡ ÀÖ´Â smb.conf ÆÄÀÏ°ú ENCRYPTION.txt ÆÄÀÏÀ»
-Àо´Ù.
-
-%description -l pl
-Samba udostêpnia serwer SMB, który mo¿e byæ u¿yty w celu dostarczenia
-us³ug sieciowych (potocznie zwanych "Lan Manager"), dla klientów
-takich jak MS Windows, OS/2 a tak¿e maszyn linuksowych. W pakiecie
-znajduje siê równie¿ oprogramowanie klienckie. Samba u¿ywa protoko³u
-NetBIOS po TCP/IP (NetBT) i nie wymaga protoko³u NetBEUI. Ta wersja ma
-pe³ne wsparcie dla blokowania plików, a tak¿e wsparcie dla kodowania
-hase³ w standardzie MS i zarzadzania baz± WINS.
-
-%description -l pt_BR
-O Samba provê um servidor SMB que pode ser usado para oferecer
-serviços de rede a clientes SMB (algumas vezes chamado de "Lan
-Manager"), incluindo várias versões de MS Windows, OS/2, e outras
-máquinas Linux. O Samba também fornece alguns clientes SMB, que
-complementam o sistema de arquivos SMB do Linux. O Samba usa o
-protocolo NetBIOS sobre TCP/IP (NetBT) e não necessita do protocolo
-NetBEUI (Microsoft Raw NetBIOS frame).
-
-O Samba inclui a maioria das características de um servidor de
-Controle de Domínios NT e o SWAT (Samba Web Administration Tool), que
-permite que o arquivo smb.conf seja gerenciado remotamente através de
-um navegador. Atualmente isto está sendo habilitado na porta TCP 901
-via inetd.
-
-%description -l ru
-Samba ÐÒÅÄÏÓÔÁ×ÌÑÅÔ SMB-ÓÅÒ×ÅÒ, ËÏÔÏÒÙÊ ÍÏÖÅÔ ÂÙÔØ ÉÓÐÏÌØÚÏ×ÁÎ ÄÌÑ
-ÐÒÅÄÏÓÔÁ×ÌÅÎÉÑ ÓÅÔÅ×ÙÈ ÓÅÒ×ÉÓÏ× SMB (ÉÎÏÇÄÁ ÎÁÚÙ×ÁÅÍÙÍ "Lan Manager")
-ËÌÉÅÎÔÁÍ, ×ËÌÀÞÁÑ ÒÁÚÎÏÏÂÒÁÚÎÙÅ ×ÅÒÓÉÉ MS Windows, OS/2, É ÄÒÕÇÉÅ
-Linux-ÍÁÛÉÎÙ. Samba ÔÁËÖÅ ÐÒÅÄÏÓÔÁ×ÌÑÅÔ SMB-ËÌÉÅÎÔÏ×, ËÏÔÏÒÙÅ ÒÁÂÏÔÁÀÔ
-ÓÏ ×ÓÔÒÏÅÎÎÏÊ × Linux ÆÁÊÌÏ×ÏÊ ÓÉÓÔÅÍÏÊ SMB.
-
-Samba ÉÓÐÏÌØÚÕÅÔ ÐÒÏÔÏËÏÌ NetBIOS over TCP/IP (NetBT) É ÎÅ ÎÕÖÄÁÅÔÓÑ ×
-ÐÒÏÔÏËÏÌÅ NetBEUI (Microsoft Raw NetBIOS frame).
-
-Samba ÓÏÄÅÒÖÉÔ ÐÒÁËÔÉÞÅÓËÉ ÒÁÂÏÔÁÀÝÕÀ ÒÅÁÌÉÚÁÃÉÀ NT Domain Control É
-×ËÌÀÞÁÅÔ ÎÏ×ÙÊ SWAT (Samba Web Administration Tool), ËÏÔÏÒÙÊ ÐÏÚ×ÏÌÑÅÔ
-ÕÄÁÌÅÎÎÏ ÕÐÒÁ×ÌÑÔØ ËÏÎÆÉÇÕÒÁÃÉÏÎÎÙÍ ÆÁÊÌÏÍ smb.conf ÐÒÉ ÐÏÍÏÝÉ ×ÁÛÅÇÏ
-ÌÀÂÉÍÏÇÏ WEB-ÂÒÏÕÚÅÒÁ. ðÏËÁ ÞÔÏ ÏÎ ÒÁÚÒÅÛÅÎ ÞÅÒÅÚ inetd ÎÁ TCP-ÐÏÒÔÕ
-901.
-
-%description -l uk
-Samba ÎÁÄÁ¤ SMB-ÓÅÒ×ÅÒ, ÝÏ ÍÏÖÅ ÂÕÔÉ ×ÉËÏÒÉÓÔÁÎÉÊ ÄÌÑ ÎÁÄÁÎÎÑ
-ÍÅÒÅÖÅ×ÉÈ ÓÅÒ×¦Ó¦× SMB (ÝÏ §È ¦ÎÏĦ ÎÁÚÉ×ÁÀÔØ "Lan Manager") Ë̦¤ÎÔÁÍ,
-×ËÌÀÞÁÀÞÉ Ò¦ÚÎÏÍÁΦÔΦ ×ÅÒÓ¦§ MS Windows, OS/2, ÔÁ ¦ÎÛ¦ Linux-ÍÁÛÉÎÉ.
-Samba ÔÁËÏÖ ÎÁÄÁ¤ SMB-Ë̦¤ÎÔ¦×, ÝÏ ÐÒÁÃÀÀÔØ Ú ×ÂÕÄÏ×ÁÎÏÀ × Linux
-ÆÁÊÌÏ×ÏÀ ÓÉÓÔÅÍÏÀ SMB.
-
-Samba ×ÉËÏÒÉÓÔÏ×Õ¤ ÐÒÏÔÏËÏÌ NetBIOS over TCP/IP (NetBT) ÔÁ ÎÅ ÐÏÔÒÅÂÕ¤
-ÐÒÏÔÏËÏÌÕ NetBEUI (Microsoft Raw NetBIOS frame).
-
-Samba ͦÓÔÉÔØ ÍÁÊÖÅ ÐÒÁÃÀÀÞÕ ÒÅÁÌÉÚÁæÀ NT Domain Control ÔÁ ÎÏ×ÙÊ
-SWAT (Samba Web Administration Tool), ËÏÔÒÉÊ ÄÏÚ×ÏÌѤ צÄÄÁÌÅÎÏ
-ËÅÒÕ×ÁÔÉ ËÏÎƦÇÕÒÁæÊÎÉÍ ÆÁÊÌÏÍ smb.conf ÚÁ ÄÏÐÏÍÏÇÏÀ ×ÁÛÏÇÏ
-ÕÌÀÂÌÅÎÏÇÏ WEB-ÂÒÏÕÚÅÒÁ. ðÏËÉ ÝÏ ×¦Î ÄÏÚ×ÏÌÅÎÉÊ ÞÅÒÅÚ inetd ÎÁ
-TCP-ÐÏÒÔÕ 901.
-
-%package -n swat
-Summary: Samba Web Administration Tool
-Summary(es): Samba SWAT and Web documentation
-Summary(pl): Narzêdzie administracyjne serwisu Samba
-Summary(pt_BR): Samba SWAT e documentação Web
-Summary(ru): ðÒÏÇÒÁÍÍÁ ËÏÎÆÉÇÕÒÁÃÉÉ SMB-ÓÅÒ×ÅÒÁ Samba
-Summary(uk): ðÒÏÇÒÁÍÁ ËÏÎÆÉÇÕÒÁæ§ SMB-ÓÅÒ×ÅÒÁ Samba
-Group: Networking/Admin
-Requires: %{name}
-Requires: rc-inetd >= 0.8.2
-Requires: inetdaemon
-Provides: samba-swat
-Obsoletes: samba-swat
-
-%description -n swat
-swat allows a Samba administrator to configure the complex smb.conf
-file via a Web browser. In addition, a swat configuration page has
-help links to all the configurable options in the smb.conf file
-allowing an administrator to easily look up the effects of any change.
-
-%description -n swat -l pl
-swat pozwala na kompleksow± konfiguracjê smb.conf przy pomocy
-przegl±darki WWW.
-
-%description -n swat -l pt_BR
-SWAT - ferramentada Web de configuração do Samba.
-
-%description -n swat -l ru
-ðÁËÅÔ samba-swat ×ËÌÀÞÁÅÔ ÎÏ×ÙÊ SWAT (Samba Web Administration Tool),
-ÄÌÑ ÕÄÁÌÅÎÎÏÇÏ ÁÄÍÉÎÉÓÔÒÉÒÏ×ÁÎÉÑ ÆÁÊÌÁ smb.conf ÐÒÉ ÐÏÍÏÝÉ ×ÁÛÅÇÏ
-ÌÀÂÉÍÏÇÏ Web-ÂÒÁÕÚÅÒÁ.
-
-%description -n swat -l uk
-ðÁËÅÔ samba-swat ͦÓÔÉÔØ ÎÏ×ÉÊ SWAT (Samba Web Administration Tool),
-ÄÌÑ ÄÉÓÔÁÎæÊÎÏÇÏ ÁÄͦΦÓÔÒÕ×ÁÎÎÑ ÆÁÊÌÕ smb.conf ÚÁ ÄÏÐÏÍÏÇÏÀ ×ÁÛÏÇÏ
-ÕÌÀÂÌÅÎÏÇÏ Web-ÂÒÁÕÚÅÒÕ.
-
-%package client
-Summary: Samba client programs
-Summary(es): Cliente SMB de Samba
-Summary(ja): Samba (SMB) ¥¯¥é¥¤¥¢¥ó¥È¥×¥í¥°¥é¥à
-Summary(pl): Klienci serwera Samba
-Summary(pt_BR): Cliente SMB do samba
-Summary(ru): ëÌÉÅÎÔÓËÉÅ ÐÒÏÇÒÁÍÍÙ Samba (SMB)
-Summary(uk): ë̦¤ÎÔÓØ˦ ÐÒÏÇÒÁÍÉ Samba (SMB)
-Group: Applications/Networking
-Requires: samba-common = %{version}
-Obsoletes: smbfs
-
-%description client
-Samba-client provides some SMB clients, which complement the build-in
-SMB filesystem in Linux. These allow accessing of SMB shares and
-printing to SMB printers.
-
-%description client -l pt_BR
-O pacote samba-clientes prove alguns clientes SMB, que complementam o
-sistema de arquivos SMB do Linux. Eles permitem o acesso a shares SMB,
-e também, à impressoras SMB.
-
-%description client -l es
-Cliente SMB de Samba.
-
-%description client -l ja
-Samba-client ¤Ï Linux ¾å¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ë SMB ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤òÊ䤦 SMB
-¥¯¥é¥¤¥¢¥ó¥È¤òÄ󶡤·¤Þ¤¹¡£¤³¤ì¤é¤Ï SMB ¶¦Í¤Î¥¢¥¯¥»¥¹¤È SMB
-¥×¥ê¥ó¥¿¤Ø¤Î°õºþ¤òµö²Ä¤·¤Þ¤¹¡£
-
-%description client -l pl
-Samba-client dostarcza pewne programy które uzupe³niaj± system plików
-SMB zawarty w j±drze. Pozwala na wspó³dzielenie i drukowanie w sieci
-SMB.
-
-%description client -l pt_BR
-O pacote samba-clientes prove alguns clientes SMB, que complementam o
-sistema de arquivos SMB do Linux. Eles permitem o acesso a shares SMB,
-e também, à impressoras SMB.
-
-%description client -l ru
-ðÁËÅÔ samba-client ÐÒÅÄÏÓÔÁ×ÌÑÅÔ ÎÅËÏÔÏÒÙÅ ËÌÉÅÎÔÙ SMB ÄÌÑ ÒÁÂÏÔÙ ÓÏ
-×ÓÔÒÏÅÎÎÏÊ ÆÁÊÌÏ×ÏÊ ÓÉÓÔÅÍÏÊ SMB × Linux. üÔÉ ËÌÉÅÎÔÙ ÐÏÚ×ÏÌÑÀÔ
-ÐÏÌÕÞÁÔØ ÄÏÓÔÕÐ Ë ÒÁÚÄÅÌÑÅÍÙÍ ËÁÔÁÌÏÇÁÍ SMB É ÐÅÞÁÔØ ÎÁ SMB-ÐÒÉÎÔÅÒÙ.
-
-%description client -l uk
-ðÁËÅÔ samba-client ÎÁÄÁ¤ ÄÅÑ˦ Ë̦¤ÎÔÉ SMB ÄÌÑ ÒÏÂÏÔÉ Ú¦ ×ÂÕÄÏ×ÁÎÏÀ
-ÆÁÊÌÏ×ÏÀ ÓÉÓÔÅÍÏÀ SMB × Linux. 㦠Ë̦¤ÎÔÉ ÄÏÚ×ÏÌÑÀÔØ ÏÔÒÉÍÕ×ÁÔÉ ÄÏÓÔÕÐ
-ÄÏ ËÁÔÁÌÏÇ¦× ÓЦÌØÎÏÇÏ ×ÉËÏÒÉÓÔÁÎÎÑ SMB ÔÁ ÄÒÕË ÎÁ SMB-ÐÒ¦ÎÔÅÒÉ.
-
-%package common
-Summary: Files used by both Samba servers and clients
-Summary(es): Common files between samba and samba-clients
-Summary(ja): Samba ¥µ¡¼¥Ð¡¼¤È¥¯¥é¥¤¥¢¥ó¥È¤Ç»ÈÍѤµ¤ì¤ë¥×¥í¥°¥é¥à
-Summary(pl): Pliki u¿ywane przez serwer i klientów Samba
-Summary(pt_BR): Arquivos em comum entre samba e samba-clients
-Summary(ru): æÁÊÌÙ, ÉÓÐÏÌØÚÕÅÍÙÅ ËÁË ÓÅÒ×ÅÒÏÍ, ÔÁË É ËÌÉÅÎÔÏÍ Samba
-Summary(uk): æÁÊÌÉ, ÝÏ ×ÉËÏÒÉÓÔÏ×ÕÀÔØÓÑ ÑË ÓÅÒ×ÅÒÏÍ, ÔÁË ¦ Ë̦¤ÎÔÏÍ Samba
-Group: Networking/Daemons
-
-%description common
-Samba-common provides files necessary for both the server and client
-packages of Samba.
-
-%description common -l ja
-Samba-common ¤Ï Samba ¤Î¥µ¡¼¥Ð¤È¥¯¥é¥¤¥¢¥ó¥È¤ÎξÊý¤Î¥Ñ¥Ã¥±¡¼¥¸¤Ç
-»ÈÍѤµ¤ì¤ë¥Õ¥¡¥¤¥ë¤òÄ󶡤·¤Þ¤¹¡£
-
-%description common -l pl
-Samba-common dostarcza pliki niezbêdne zarówno dla serwera jak i
-klientów Samba.
-
-%description common -l pt_BR
-Arquivos em comum entre os pacotes samba e samba-clients.
-
-%description common -l ru
-Samba-common ÓÏÄÅÒÖÉÔ ÆÁÊÌÙ, ÎÅÏÂÈÏÄÉÍÙÅ ÄÌÑ ÒÁÂÏÔÙ ËÁË ËÌÉÅÎÔÁ, ÔÁË É
-ÓÅÒ×ÅÒÁ Samba.
-
-%description common -l uk
-Samba-common ͦÓÔÉÔØ ÆÁÊÌÉ, ÎÅÏÂȦÄΦ ÄÌÑ ÒÏÂÏÔÉ ÑË Ë̦¤ÎÔÁ, ÔÁË ¦
-ÓÅÒ×ÅÒÁ Samba.
-
-%package -n pam-pam_smbpass
-Summary: PAM Samba Password Module
-Summary(pl): Modu³ PAM smbpass
-Group: Base
-Obsoletes: pam_smbpass
-
-%description -n pam-pam_smbpass
-PAM module which can be used on conforming systems to keep the
-smbpasswd (Samba password) database in sync with the unix password
-file.
-
-%description -n pam-pam_smbpass -l pl
-Modu³ PAMa, który mo¿e byæ u¿ywany do trzymania pliku smbpasswd (has³a
-Samby) zsynchronizowanego z has³ami unixowymi.
-
-%package -n libsmbclient
-Summary: libsmbclient - samba client library
-Summary(pl): libsmbclient - biblioteka klienta samby
-Group: Libraries
-
-%description -n libsmbclient
-libsmbclient - library that allows to use samba clients functions.
-
-%description -n libsmbclient -l pl
-libsmbclient - biblioteka pozwalaj±ca korzystaæ z funcji klienta
-samby.
-
-%package -n libsmbclient-devel
-Summary: libsmbclient - samba client library
-Summary(pl): libsmbclient - biblioteka klienta samby
-Summary(pt_BR): Ferramentas de desenvolvimento para clientes samba
-Group: Development/Libraries
-Requires: libsmbclient = %{version}
-
-%description -n libsmbclient-devel
-Header files for libsmbclient.
-
-%description -n libsmbclient-devel -l pl
-Pliki nag³ówkowe dla libsmbclient.
-
-%description -n libsmbclient-devel -l pt_BR
-Arquivos de inclusão, bibliotecas e documentação necessários para
-desenvolver aplicativos clientes para o samba.
-
-%package -n cups-backend-smb
-Summary: CUPS backend for printing to SMB printers
-Summary(pl): Backend CUPS-a drukuj±cy na drukarkach SMB
-Group: Applications/Printing
-Requires: cups
-Requires: samba-client = %{version}
-
-%description -n cups-backend-smb
-CUPS backend for printing to SMB printers.
-
-%description -n cups-backend-smb -l pl
-Backend CUPS-a drukuj±cy na drukarkach SMB.
-
-%package vfs-audit
-Summary: VFS module to audit file access
-Summary(pl): Modu³ VFS do monitorowania operacji na plikach
-Group: Networking/Daemons
-Requires: samba = %{version}
-
-%description vfs-audit
-A simple module to audit file access to the syslog facility. The
-following operations are logged: share connect/disconnect, directory
-opens/create/remove, file open/close/rename/unlink/chmod.
-
-%description vfs-audit -l pl
-Prosty modu³ do monitorowania dostêpu do plików do sysloga.
-Monitorowane s± nastêpuj±ce operacje: pod³±czone/od³±czenie do zasobu,
-otwarcie/utworzenie/zmiana nazwy katalogu, otwarcie/zamknêcie/zmiana
-nazwy/skasowania/zmiana praw plików.
-
-%package vfs-block
-Summary: VFS module to block access to files
-Summary(pl): Modu³y VFS do blokowania dostêpu do plików
-Group: Networking/Daemons
-Requires: samba = %{version}
-
-%description vfs-block
-Sample module by Ronald Kuetemeier <ronald@kuetemeier.com> to block
-named symbolic link following. Note: Config file is in
-/etc/samba/samba-block.conf .
-
-%description vfs-block -l pl
-Przyk³adowy modu³ stworzony przez Ronald Kuetemeier
-<ronald@kuetemeier.com> do blokowania dostêpu do plików wskazywanych
-przez linki symboliczne. Plik konfiguracyjny w
-/etc/samba/samba-block.conf .
-
-%package vfs-recycle
-Summary: VFS module to add recycle bin facility to a samba share
-Summary(pl): Modu³ VFS dodaj±cy mo¿liwo¶æ kosza do zasobu samby
-Group: Networking/Daemons
-Requires: samba = %{version}
-
-%description vfs-recycle
-VFS module to add recycle bin facility to a samba share.
-
-%description vfs-recycle -l pl
-Modu³ VFS dodaj±cy mo¿liwo¶æ kosza do zasobu samby.
-
-%package vfs-vscan-clamav
-Summary: On-access virus scanning for samba using ClamAV
-Summary(pl): Skaner antywirusowy online wykorzystuj±cy ClamAV
-Group: Networking/Daemons
-Provides: %{name}-vscan
-Requires: clamav
-Requires: samba = %{version}
-
-%description vfs-vscan-clamav
-A vfs-module for samba to implement on-access scanning using the ClamAV
-antivirus software (which must be installed to use this).
-
-%description vfs-vscan-clamav -l pl
-Modu³ vfs do samby implementuj±cy skaning antywirusowy w czasie
-dostêpu do plików korzystaj±c z oprogramowania antywirusowego
-ClamAV (które musi byæ zainstalowane, aby wykorzystaæ ten modu³).
-
-%package vfs-vscan-fprot
-Summary: On-access virus scanning for samba using FPROT
-Summary(pl): Skaner antywirusowy online wykorzystuj±cy FPROT
-Group: Networking/Daemons
-Obsoletes: vscan-fprot
-Provides: %{name}-vscan
-Requires: samba = %{version}
-
-%description vfs-vscan-fprot
-A vfs-module for samba to implement on-access scanning using the FPROT
-antivirus software (which must be installed to use this).
-
-%description vfs-vscan-fprot -l pl
-Modu³ vfs do samby implementuj±cy skaning antywirusowy w czasie
-dostêpu do plików korzystaj±c z oprogramowania antywirusowego
-FPROT (które musi byæ zainstalowane, aby wykorzystaæ ten modu³).
-
-%package vfs-vscan-openantivirus
-Summary: On-access virus scanning for samba using OpenAntivirus
-Summary(pl): Modu³ VFS dodaj±cy obs³ugê antywirusa OpenAntiVirus
-Group: Networking/Daemons
-Obsoletes: vscan-openantivirus
-Provides: %{name}-vscan
-Requires: samba = %{version}
-
-%description vfs-vscan-openantivirus
-A vfs-module for samba to implement on-access scanning using the
-OpenAntivirus antivirus software (which must be installed to use
-this).
-
-%description vfs-vscan-openantivirus -l pl
-Modu³ vfs do samby implementuj±cy skaning antywirusowy w czasie
-dostêpu do plików korzystaj±c z oprogramowania antywirusowego
-OpenAntiVirus.org (które musi byæ zainstalowane, aby wykorzystaæ ten
-modu³).
-
-%package vfs-vscan-sophos
-Summary: On-access virus scanning for samba using Sophos
-Summary(pl): Modu³ VFS dodaj±cy obs³ugê antywirusa Sophos
-Group: Networking/Daemons
-Obsoletes: vscan-sophos
-Provides: %{name}-vscan
-Requires: samba = %{version}
-
-%description vfs-vscan-sophos
-A vfs-module for samba to implement on-access scanning using the
-Sophos antivirus software (which must be installed to use this).
-
-%description vfs-vscan-sophos -l pl
-Modu³ vfs do samby implementuj±cy skaning antywirusowy w czasie
-dostêpu do plików korzystaj±c z oprogramowania antywirusowego Sophos
-(które musi byæ zainstalowane, aby wykorzystaæ ten modu³).
-
-%package vfs-vscan-symantec
-Summary: On-access virus scanning for samba using Symantec
-Summary(pl): Skaner antywirusowy online wykorzystuj±cy Symantec
-Group: Networking/Daemons
-Obsoletes: vscan-symantec
-Provides: %{name}-vscan
-Requires: samba = %{version}
-
-%description vfs-vscan-symantec
-A vfs-module for samba to implement on-access scanning using the
-Symantec antivirus software (which must be installed to use this).
-
-%description vfs-vscan-symantec -l pl
-Modu³ vfs do samby implementuj±cy skaning antywirusowy w czasie
-dostêpu do plików korzystaj±c z oprogramowania antywirusowego firmy
-Symantec (które musi byæ zainstalowane, aby wykorzystaæ ten modu³).
-
-%package vfs-vscan-trend
-Summary: On-access virus scanning for samba using Trend
-Summary(pl): Modu³ VFS dodaj±cy obs³ugê antywirusa Trend
-Group: Networking/Daemons
-Obsoletes: vscan-trend
-Provides: %{name}-vscan
-Requires: samba = %{version}
-
-%description vfs-vscan-trend
-A vfs-module for samba to implement on-access scanning using the Trend
-antivirus software (which must be installed to use this).
-
-%description vfs-vscan-trend -l pl
-Modu³ vfs do samby implementuj±cy skaning antywirusowy w czasie
-dostêpu do plików korzystaj±c z oprogramowania antywirusowego Trend
-(które musi byæ zainstalowane, aby wykorzystaæ ten modu³).
-
-%prep
-%setup -q
-%patch1 -p1
-%patch2 -p1
-%patch3 -p1
-%patch4 -p1
-%patch5 -p1
-#%patch6 -p2
-%patch7 -p1
-#%patch8 -p1
-#%patch9 -p1
-%{?_with_ipv6:%patch10 -p1}
-%patch11 -p1
-#%patch12 -p1
-%patch13 -p1
-
-cd examples/VFS
-tar xjf %{SOURCE7}
-
-%build
-cd source
-%{__autoconf}
-%configure \
- --with-acl-support \
- --with-automount \
- --with-libsmbclient \
- --with-lockdir=/var/lock/samba \
- --with-mmap \
- --with-msdfs \
- --with-netatalk \
- --without-smbwrapper \
- --with-pam \
- --with-piddir=/var/run \
- --with-privatedir=%{_libdir} \
- --with-quotas \
- --with-readline \
- --with-smbmount \
- --with-ssl \
- --with-sslinc=%{_prefix} \
- --with-swatdir=%{_datadir}/swat \
- --with-syslog \
- --with-utmp \
- --with-vfs \
- %{?_with_ipv6:--with-ipv6} \
- %{?_with_ldap:--with-ldapsam}
-
-# --with-acl-support \
-mv Makefile Makefile.old
-sed -e "s#-symbolic##g" Makefile.old > Makefile
-
-%{__make} everything pam_smbpass
-
-cd ../examples/VFS
-%{__autoconf}
-%configure
-%{__make}
-mv README{,.vfs}
-
-cd samba-vscan-%{vscan_version}
-# use autoconf?
-./configure
-%{__make}
-
-%install
-rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,pam.d,security,sysconfig/rc-inetd} \
- $RPM_BUILD_ROOT/var/{lock,log,log/archiv,spool}/samba \
- $RPM_BUILD_ROOT/{sbin,lib/security,%{_libdir},%{_vfsdir},%{_includedir},%{_sambahome}}
-
-cd source
-%{__make} install \
- DESTDIR=$RPM_BUILD_ROOT
-install script/mksmbpasswd.sh /$RPM_BUILD_ROOT%{_sbindir}
-cd ..
-
-ln -sf %{_bindir}/smbmount $RPM_BUILD_ROOT/sbin/mount.smbfs
-
-install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/smb
-install %{SOURCE2} $RPM_BUILD_ROOT/etc/pam.d/samba
-install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/rc-inetd/swat
-install %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/samba
-install %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/samba
-install %{SOURCE6} $RPM_BUILD_ROOT%{_libdir}/smb.conf
-
-install source/nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/lib/libnss_winbind.so.2
-install source/nsswitch/pam_winbind.so $RPM_BUILD_ROOT/lib/security/
-install source/bin/pam_smbpass.so $RPM_BUILD_ROOT/lib/security/
-install source/bin/wbinfo $RPM_BUILD_ROOT%{_bindir}
-
-install source/bin/libsmbclient.so $RPM_BUILD_ROOT/lib/libsmbclient.so.0
-ln -s libsmbclient.so.0 $RPM_BUILD_ROOT/lib/libsmbclient.so
-
-install source/include/libsmbclient.h $RPM_BUILD_ROOT%{_includedir}
-
-# przyk³adowe modu³y VFS
-install examples/VFS/{*.so,block/*.so,recycle/*.so} $RPM_BUILD_ROOT%{_vfsdir}
-install examples/VFS/block/samba-block.conf examples/VFS/recycle/recycle.conf $RPM_BUILD_ROOT%{_sysconfdir}
-
-# modu³y vscan
-install examples/VFS/samba-vscan-%{vscan_version}/*.so $RPM_BUILD_ROOT%{_vfsdir}
-install examples/VFS/samba-vscan-%{vscan_version}/*/*.conf $RPM_BUILD_ROOT%{_sysconfdir}
-
-touch $RPM_BUILD_ROOT/var/lock/samba/{STATUS..LCK,wins.dat,browse.dat}
-
-echo 127.0.0.1 localhost > $RPM_BUILD_ROOT%{_libdir}/lmhosts
-
-%if 0%{!?_without_cups:1}
-install -d $RPM_BUILD_ROOT%{cups_serverbin}/backend
-ln -s %{_bindir}/smbspool $RPM_BUILD_ROOT%{cups_serverbin}/backend/smb
-%endif
-
-> $RPM_BUILD_ROOT%{_libdir}/smbusers
-> $RPM_BUILD_ROOT/etc/security/blacklist.samba
-
-rm -f docs/faq/*.{sgml,txt}
-rm -f docs/htmldocs/*.[0-9].html
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%post
-/sbin/chkconfig --add smb
-if [ -r /var/lock/subsys/smb ]; then
- /etc/rc.d/init.d/smb restart >&2
-else
- echo "Run \"/etc/rc.d/init.d/smb start\" to start Samba daemons."
-fi
-
-%preun
-if [ "$1" = "0" ]; then
- if [ -r /var/lock/subsys/smb ]; then
- /etc/rc.d/init.d/smb stop >&2
- fi
- /sbin/chkconfig --del smb
-fi
-
-%post -n swat
-if [ -f /var/lock/subsys/rc-inetd ]; then
- /etc/rc.d/init.d/rc-inetd reload 1>&2
-else
- echo "Type \"/etc/rc.d/init.d/rc-inetd start\" to start inet server" 1>&2
-fi
-
-%postun -n swat
-if [ -f /var/lock/subsys/rc-inetd ]; then
- /etc/rc.d/init.d/rc-inetd reload
-fi
-
-%triggerpostun -- samba < 1.9.18p7
-if [ "$1" != "0" ]; then
- /sbin/chkconfig --add smb
-fi
-
-%triggerpostun -- samba < 2.0.5a-3
-if [ "$1" != "0" ]; then
- [ ! -d /var/lock/samba ] && mkdir -m 0755 /var/lock/samba
- [ ! -d /var/spool/samba ] && mkdir -m 1777 /var/spool/samba
-fi
-
-%files
-%defattr(644,root,root,755)
-%doc source/nsswitch/README examples/VFS/README.vfs
-%attr(755,root,root) %{_sbindir}/nmbd
-%attr(755,root,root) %{_sbindir}/smbd
-%attr(755,root,root) %{_sbindir}/winbindd
-%attr(755,root,root) %{_sbindir}/mksmbpasswd.sh
-%attr(755,root,root) %{_bindir}/smbstatus
-%attr(755,root,root) %{_bindir}/smbpasswd
-%attr(755,root,root) %{_bindir}/smbcontrol
-%attr(755,root,root) %{_bindir}/tdbbackup
-
-%attr(755,root,root) /lib/libnss_*
-%attr(755,root,root) /lib/security/pam_winbind.so
-
-%attr(600,root,root) %config(noreplace) %verify(not size mtime md5) %{_libdir}/smbusers
-%attr(754,root,root) /etc/rc.d/init.d/smb
-%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/sysconfig/samba
-%attr(640,root,root) /etc/logrotate.d/samba
-%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/pam.d/samba
-%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/security/blacklist.samba
-%{_mandir}/man1/smbstatus.1*
-%{_mandir}/man1/smbcontrol.1*
-%{_mandir}/man5/smbpasswd.5*
-%{_mandir}/man7/samba.7*
-%{_mandir}/man8/nmbd.8*
-%{_mandir}/man8/smbd.8*
-%{_mandir}/man8/smbpasswd.8*
-%{_mandir}/man8/pdbedit.8*
-%{_mandir}/man8/winbindd.8*
-
-%dir %{_sambahome}
-%dir /var/lock/samba
-%ghost /var/lock/samba/*
-
-%attr(0750,root,root) %dir /var/log/samba
-%attr(0750,root,root) %dir /var/log/archiv/samba
-%attr(1777,root,root) %dir /var/spool/samba
-
-%files client
-%defattr(644,root,root,755)
-%attr(755,root,root) /sbin/mount.smbfs
-%attr(755,root,root) %{_bindir}/smbmount
-%attr(755,root,root) %{_bindir}/smbmnt
-%attr(755,root,root) %{_bindir}/smbumount
-%{_mandir}/man8/smbmnt.8*
-%{_mandir}/man8/smbmount.8*
-%{_mandir}/man8/smbumount.8*
-%attr(755,root,root) %{_bindir}/nmblookup
-%attr(755,root,root) %{_bindir}/smbclient
-%attr(755,root,root) %{_bindir}/smbtar
-%attr(755,root,root) %{_bindir}/smbcacls
-%{_mandir}/man1/smbtar.1*
-%{_mandir}/man1/smbclient.1*
-%{_mandir}/man1/nmblookup.1*
-%{_mandir}/man1/smbcacls.1*
-%{_mandir}/man1/smbsh.1*
-%attr(755,root,root) %{_bindir}/rpcclient
-%{_mandir}/man1/rpcclient.1*
-%attr(755,root,root) %{_bindir}/wbinfo
-%{_mandir}/man1/wbinfo.1*
-%attr(755,root,root) %{_bindir}/findsmb
-%{_mandir}/man1/findsmb.1*
-
-%files common
-%defattr(644,root,root,755)
-%doc README Manifest WHATSNEW.txt
-%doc Roadmap docs/faq docs/Registry/*
-%doc docs/textdocs/* docs/htmldocs/*.* docs/{history,announce,THANKS}
-%dir %{_libdir}
-%config(noreplace) %verify(not size mtime md5) %{_libdir}/smb.conf
-%config(noreplace) %verify(not size mtime md5) %{_libdir}/lmhosts
-%attr(755,root,root) %{_bindir}/make_smbcodepage
-%attr(755,root,root) %{_bindir}/make_unicodemap
-%attr(755,root,root) %{_bindir}/testparm
-%attr(755,root,root) %{_bindir}/testprns
-%attr(755,root,root) %{_bindir}/make_printerdef
-%{_libdir}/codepages
-%{_mandir}/man1/make_smbcodepage.1*
-%{_mandir}/man1/make_unicodemap.1*
-%{_mandir}/man1/testparm.1*
-%{_mandir}/man1/testprns.1*
-%{_mandir}/man5/smb.conf.5*
-%{_mandir}/man5/lmhosts.5*
-
-%files -n swat
-%defattr(644,root,root,755)
-%doc swat/README* swat/help/*
-%attr(755,root,root) %{_sbindir}/swat
-%{_datadir}/swat
-%{_mandir}/man8/swat.8*
-%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/sysconfig/rc-inetd/swat
-
-%files -n pam-pam_smbpass
-%defattr(644,root,root,755)
-%doc source/pam_smbpass/{CHAN*,README,TODO} source/pam_smbpass/samples
-%attr(755,root,root) /lib/security/pam_smbpass.so
-
-%files -n libsmbclient
-%defattr(644,root,root,755)
-%attr(755,root,root) /lib/libsmbclient.so.*
-
-%files -n libsmbclient-devel
-%defattr(644,root,root,755)
-%{_includedir}/libsmbclient.h
-%attr(755,root,root) /lib/libsmbclient.so
-
-%if 0%{!?_without_cups:1}
-%files -n cups-backend-smb
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_bindir}/smbspool
-%attr(755,root,root) %{cups_serverbin}/backend/smb
-%{_mandir}/man8/smbspool.8*
-%endif
-
-%files vfs-block
-%defattr(644,root,root,755)
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/samba-block.conf
-%attr(755,root,root) %{_vfsdir}/block.so
-
-%files vfs-audit
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_vfsdir}/audit.so
-
-%files vfs-recycle
-%defattr(644,root,root,755)
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/recycle.conf
-%attr(755,root,root) %{_vfsdir}/recycle.so
-%doc examples/VFS/recycle/README
-
-%files vfs-vscan-clamav
-%defattr(644,root,root,755)
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/vscan-clamav.conf
-%attr(755,root,root) %{_vfsdir}/vscan-clamav.so
-%doc examples/VFS/%{name}-vscan-%{vscan_version}/{INSTALL,FAQ}
-
-%files vfs-vscan-fprot
-%defattr(644,root,root,755)
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/vscan-fprotd.conf
-%attr(755,root,root) %{_vfsdir}/vscan-fprotd.so
-%doc examples/VFS/%{name}-vscan-%{vscan_version}/{INSTALL,FAQ}
-
-%files vfs-vscan-openantivirus
-%defattr(644,root,root,755)
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/vscan-oav.conf
-%attr(755,root,root) %{_vfsdir}/vscan-oav.so
-%doc examples/VFS/%{name}-vscan-%{vscan_version}/{INSTALL,FAQ}
-
-%files vfs-vscan-sophos
-%defattr(644,root,root,755)
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/vscan-sophos.conf
-%attr(755,root,root) %{_vfsdir}/vscan-sophos.so
-%doc examples/VFS/%{name}-vscan-%{vscan_version}/{INSTALL,FAQ}
-
-%files vfs-vscan-symantec
-%defattr(644,root,root,755)
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/vscan-icap.conf
-%attr(755,root,root) %{_vfsdir}/vscan-icap.so
-%doc examples/VFS/%{name}-vscan-%{vscan_version}/{INSTALL,FAQ}
-
-%files vfs-vscan-trend
-%defattr(644,root,root,755)
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/vscan-trend.conf
-%attr(755,root,root) %{_vfsdir}/vscan-trend.so
-%doc examples/VFS/%{name}-vscan-%{vscan_version}/{INSTALL,FAQ}