From a97b33baad5bbce7e8004346aa3a812ec4f91f0e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 27 Oct 2007 21:15:07 +0200 Subject: Two patches Hi! Can you check and push them? Thanks, Volker From b488af5905e2dee12a1a72a3b40801ae5c26f24f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 27 Oct 2007 14:20:09 +0200 Subject: [PATCH] Fix some warnings and errors (This used to be commit e17d3e10e860c96b6d5208e5fe51e43b8e58c174) --- source3/Makefile.in | 5 +++-- source3/client/smbmount.c | 10 +++++----- source3/client/smbumount.c | 2 +- source3/include/interfaces.h | 36 ++++++++++++++++++++++++++++++++++++ source3/lib/interfaces.c | 4 ++-- source3/lib/replace/getpass.c | 1 + source3/smbd/server.c | 2 +- source3/winbindd/idmap_ad.c | 2 +- 8 files changed, 50 insertions(+), 12 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index a559d63f3e..98fd8f8fe4 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -269,11 +269,12 @@ TALLOC_OBJ = lib/talloc/talloc.o LIB_WITHOUT_PROTO_OBJ = $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) $(TALLOC_OBJ) \ lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \ - lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o + lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o \ + lib/interfaces.o LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \ lib/interface.o lib/md4.o \ - lib/interfaces.o lib/pidfile.o \ + lib/pidfile.o \ lib/signal.o lib/system.o lib/sendfile.o lib/time.o \ lib/ufc.o lib/genrand.o lib/username.o \ lib/util_pw.o lib/access.o lib/smbrun.o \ diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index 95adc9a8f2..7636adb2a7 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -37,7 +37,7 @@ static pstring mpoint; static pstring service; static pstring options; -static struct in_addr dest_ip; +static struct sockaddr_storage dest_ip; static bool have_ip; static int smb_port = 0; static bool got_user; @@ -122,7 +122,7 @@ static struct cli_state *do_connection(char *the_service) struct cli_state *c; struct nmb_name called, calling; char *server_n; - struct in_addr ip; + struct sockaddr_storage ip; pstring server; char *share; @@ -146,7 +146,7 @@ static struct cli_state *do_connection(char *the_service) make_nmb_name(&called , server, 0x20); again: - zero_ip_v4(&ip); + zero_addr(&ip, INADDR_ANY); if (have_ip) ip = dest_ip; /* have to open a new connection */ @@ -798,8 +798,8 @@ static void parse_mount_smb(int argc, char **argv) } else if(!strcmp(opts, "debug")) { DEBUGLEVEL = val; } else if(!strcmp(opts, "ip")) { - dest_ip = *interpret_addr2(opteq+1); - if (is_zero_ip_v4(dest_ip)) { + if (!interpret_string_addr(&dest_ip, opteq+1, + 0)) { fprintf(stderr,"Can't resolve address %s\n", opteq+1); exit(1); } diff --git a/source3/client/smbumount.c b/source3/client/smbumount.c index 4be54b6793..1664e4b555 100644 --- a/source3/client/smbumount.c +++ b/source3/client/smbumount.c @@ -80,7 +80,7 @@ umount_ok(const char *mount_point) static char * canonicalize (char *path) { - char *canonical = malloc (PATH_MAX + 1); + char *canonical = (char*)malloc (PATH_MAX + 1); if (!canonical) { fprintf(stderr, "Error! Not enough memory!\n"); diff --git a/source3/include/interfaces.h b/source3/include/interfaces.h index 66ea151f02..b9d900053d 100644 --- a/source3/include/interfaces.h +++ b/source3/include/interfaces.h @@ -1,8 +1,31 @@ +/* + Unix SMB/CIFS implementation. + Machine customisation and include handling + Copyright (C) Jeremy Allison 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ /* This structure is used by lib/interfaces.c to return the list of network interfaces on the machine */ +#ifndef _INTERFACES_H +#define _INTERFACES_H + +#include "lib/replace/replace.h" + #define MAX_INTERFACES 128 struct iface_struct { @@ -12,3 +35,16 @@ struct iface_struct { struct sockaddr_storage netmask; struct sockaddr_storage bcast; }; + +bool make_netmask(struct sockaddr_storage *pss_out, + const struct sockaddr_storage *pss_in, + unsigned long masklen); +void make_bcast(struct sockaddr_storage *pss_out, + const struct sockaddr_storage *pss_in, + const struct sockaddr_storage *nmask); +void make_net(struct sockaddr_storage *pss_out, + const struct sockaddr_storage *pss_in, + const struct sockaddr_storage *nmask); +int get_interfaces(struct iface_struct *ifaces, int max_interfaces); + +#endif diff --git a/source3/lib/interfaces.c b/source3/lib/interfaces.c index 48fe249034..38abb9299b 100644 --- a/source3/lib/interfaces.c +++ b/source3/lib/interfaces.c @@ -140,7 +140,7 @@ bool make_netmask(struct sockaddr_storage *pss_out, static void make_bcast_or_net(struct sockaddr_storage *pss_out, const struct sockaddr_storage *pss_in, const struct sockaddr_storage *nmask, - bool make_bcast) + bool make_bcast_p) { unsigned int i = 0, len = 0; char *pmask = NULL; @@ -162,7 +162,7 @@ static void make_bcast_or_net(struct sockaddr_storage *pss_out, } for (i = 0; i < len; i++, p++, pmask++) { - if (make_bcast) { + if (make_bcast_p) { *p = (*p & *pmask) | (*pmask ^ 0xff); } else { /* make_net */ diff --git a/source3/lib/replace/getpass.c b/source3/lib/replace/getpass.c index 1d13461573..d91d029f6a 100644 --- a/source3/lib/replace/getpass.c +++ b/source3/lib/replace/getpass.c @@ -21,6 +21,7 @@ not, see . */ #include "system/filesys.h" #include "system/wait.h" #include "system/terminal.h" +#include "system/passwd.h" /* * Define additional missing types diff --git a/source3/smbd/server.c b/source3/smbd/server.c index abad0efc3d..bcf997f2d2 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -369,7 +369,7 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ open_socket_in(SOCK_STREAM, port, 0, ifss, True); if(s == -1) { - return false; + continue; } /* ready to listen */ diff --git a/source3/winbindd/idmap_ad.c b/source3/winbindd/idmap_ad.c index 0d190eb4a1..50f7914f85 100644 --- a/source3/winbindd/idmap_ad.c +++ b/source3/winbindd/idmap_ad.c @@ -60,7 +60,7 @@ static ADS_STRUCT *ad_idmap_cached_connection_internal(void) ADS_STATUS status; bool local = False; fstring dc_name; - struct in_addr dc_ip; + struct sockaddr_storage dc_ip; if (ad_idmap_ads != NULL) { -- cgit