Diff for /embedaddon/rsync/access.c between versions 1.1.1.3 and 1.1.1.4

version 1.1.1.3, 2016/11/01 09:54:32 version 1.1.1.4, 2021/03/17 00:32:36
Line 2 Line 2
  * Routines to authenticate access to a daemon (hosts allow/deny).   * Routines to authenticate access to a daemon (hosts allow/deny).
  *   *
  * Copyright (C) 1998 Andrew Tridgell   * Copyright (C) 1998 Andrew Tridgell
 * Copyright (C) 2004-2015 Wayne Davison * Copyright (C) 2004-2020 Wayne Davison
  *   *
  * This program is free software; you can redistribute it and/or modify   * 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   * it under the terms of the GNU General Public License as published by
Line 19 Line 19
  */   */
   
 #include "rsync.h"  #include "rsync.h"
   #include "ifuncs.h"
   
 static int allow_forward_dns;  static int allow_forward_dns;
   
Line 33  static int match_hostname(const char **host_ptr, const Line 34  static int match_hostname(const char **host_ptr, const
         if (!host || !*host)          if (!host || !*host)
                 return 0;                  return 0;
   
   #ifdef HAVE_INNETGR
           if (*tok == '@' && tok[1])
                   return innetgr(tok + 1, host, NULL, NULL);
   #endif
   
         /* First check if the reverse-DNS-determined hostname matches. */          /* First check if the reverse-DNS-determined hostname matches. */
         if (iwildmatch(tok, host))          if (iwildmatch(tok, host))
                 return 1;                  return 1;
Line 52  static int match_hostname(const char **host_ptr, const Line 58  static int match_hostname(const char **host_ptr, const
                 if (strcmp(addr, inet_ntoa(*(struct in_addr*)(hp->h_addr_list[i]))) == 0) {                  if (strcmp(addr, inet_ntoa(*(struct in_addr*)(hp->h_addr_list[i]))) == 0) {
                         /* If reverse lookups are off, we'll use the conf-specified                          /* If reverse lookups are off, we'll use the conf-specified
                          * hostname in preference to UNDETERMINED. */                           * hostname in preference to UNDETERMINED. */
                        if (host == undetermined_hostname) {                        if (host == undetermined_hostname)
                                if (!(*host_ptr = strdup(tok)))                                *host_ptr = strdup(tok);
                                        *host_ptr = undetermined_hostname; 
                        } 
                         return 1;                          return 1;
                 }                  }
         }          }
Line 158  static int match_address(const char *addr, const char  Line 162  static int match_address(const char *addr, const char 
                 break;                  break;
   
 #ifdef INET6  #ifdef INET6
        case PF_INET6:        case PF_INET6: {
            { 
                 struct sockaddr_in6 *sin6a, *sin6t;                  struct sockaddr_in6 *sin6a, *sin6t;
   
                 sin6a = (struct sockaddr_in6 *)resa->ai_addr;                  sin6a = (struct sockaddr_in6 *)resa->ai_addr;
Line 171  static int match_address(const char *addr, const char  Line 174  static int match_address(const char *addr, const char 
                 addrlen = 16;                  addrlen = 16;
   
 #ifdef HAVE_SOCKADDR_IN6_SCOPE_ID  #ifdef HAVE_SOCKADDR_IN6_SCOPE_ID
                if (sin6t->sin6_scope_id &&                if (sin6t->sin6_scope_id && sin6a->sin6_scope_id != sin6t->sin6_scope_id) {
                    sin6a->sin6_scope_id != sin6t->sin6_scope_id) { 
                         ret = 0;                          ret = 0;
                         goto out;                          goto out;
                 }                  }
 #endif  #endif
   
                 break;                  break;
            }        }
 #endif  #endif
         default:          default:
            rprintf(FLOG, "unknown family %u\n", rest->ai_family);                rprintf(FLOG, "unknown family %u\n", rest->ai_family);
            ret = 0;                ret = 0;
            goto out;                goto out;
         }          }
   
         bits = -1;          bits = -1;
Line 242  static int access_match(const char *list, const char * Line 244  static int access_match(const char *list, const char *
 {  {
         char *tok;          char *tok;
         char *list2 = strdup(list);          char *list2 = strdup(list);
   
         if (!list2)  
                 out_of_memory("access_match");  
   
         strlower(list2);          strlower(list2);
   

Removed from v.1.1.1.3  
changed lines
  Added in v.1.1.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>