Updated the FSF's address to an even newer one.
[rsync/rsync.git] / clientname.c
index ed8e97f..9ac5ed5 100644 (file)
@@ -1,40 +1,35 @@
-/* -*- c-file-style: "linux" -*-
-
-   rsync -- fast file replication program
-
-   Copyright (C) 1992-2001 by Andrew Tridgell <tridge@samba.org>
-   Copyright (C) 2001, 2002 by Martin Pool <mbp@samba.org>
-
-   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 2 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, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-/**
- * @file clientname.c
- *
+/*
  * Functions for looking up the remote name or addr of a socket.
  *
+ * Copyright (C) 1992-2001 Andrew Tridgell <tridge@samba.org>
+ * Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
+ * Copyright (C) 2002, 2003, 2004 Wayne Davison
+ *
+ * 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 2 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/*
  * This file is now converted to use the new-style getaddrinfo()
  * interface, which supports IPv6 but is also supported on recent
  * IPv4-only machines.  On systems that don't have that interface, we
  * emulate it using the KAME implementation.
- **/
+ */
 
 #include "rsync.h"
 
 static const char default_name[] = "UNKNOWN";
-extern int am_daemon;
 extern int am_server;
 
 
@@ -132,7 +127,7 @@ char *client_name(int fd)
                        ss_len = sizeof (struct sockaddr_in);
                        memcpy(&ss, answer->ai_addr, ss_len);
                        break;
-#if INET6
+#ifdef INET6
                case AF_INET6:
                        ss_len = sizeof (struct sockaddr_in6);
                        memcpy(&ss, answer->ai_addr, ss_len);
@@ -172,7 +167,7 @@ void client_sockaddr(int fd,
                exit_cleanup(RERR_SOCKETIO);
        }
 
-#if INET6
+#ifdef INET6
        if (get_sockaddr_family(ss) == AF_INET6 &&
            IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)ss)->sin6_addr)) {
                /* OK, so ss is in the IPv6 family, but it is really
@@ -189,7 +184,7 @@ void client_sockaddr(int fd,
                memset(sin, 0, sizeof *sin);
                sin->sin_family = AF_INET;
                *ss_len = sizeof (struct sockaddr_in);
-#if HAVE_SOCKADDR_IN_LEN
+#ifdef HAVE_SOCKADDR_IN_LEN
                sin->sin_len = *ss_len;
 #endif
                sin->sin_port = sin6.sin6_port;
@@ -261,7 +256,7 @@ int compare_addrinfo_sockaddr(const struct addrinfo *ai,
                              sizeof sin1->sin_addr);
        }
 
-#if INET6
+#ifdef INET6
        if (ss_family == AF_INET6) {
                const struct sockaddr_in6 *sin1, *sin2;
 
@@ -278,7 +273,7 @@ int compare_addrinfo_sockaddr(const struct addrinfo *ai,
                           sizeof sin1->sin6_addr))
                        return 1;
 
-#if HAVE_SOCKADDR_IN6_SCOPE_ID
+#ifdef HAVE_SOCKADDR_IN6_SCOPE_ID
                if (sin1->sin6_scope_id != sin2->sin6_scope_id)
                        return 1;
 #endif
@@ -321,7 +316,6 @@ int check_name(int fd,
                return error;
        }
 
-
        /* Given all these results, we expect that one of them will be
         * the same as ss.  The comparison is a bit complicated. */
        for (res = res0; res; res = res->ai_next) {