G'day,

I figured some others might benefit from this patch.  It allows you to use
the samba style @netgroup names in hosts allow and hosts deny.

I've tested it on solaris and linux with no apparent problems..

I'll get rid of the static string in a couple of days when I have to worry
about trying to get this into prod .. but with any luck someone else may have 
done that for me.. :)

--- access.c    2003-07-30 16:12:27.000000000 +1000
+++ ../rsync-2.6.0-Linux/access.c       2004-01-31 23:15:37.000000000 +1100
@@ -22,10 +22,31 @@
   */
 
 #include "rsync.h"
+#include <netdb.h>
 
 
 static int match_hostname(char *host, char *tok)
 {
+       char netgroup[512];
+       char *machinep;
+       char *userp;
+       char *domainp;
+
+       if(strlen(tok)){
+               if(tok[0]=='@'){
+                       strcpy(netgroup, "");
+                       sscanf(tok, "@%s", netgroup);
+                       setnetgrent(netgroup);
+                       while(getnetgrent(&machinep, &userp, &domainp)){
+                               if(machinep!=NULL){
+                                       if(strcmp(host, machinep)==0){
+                                               return(1);
+                                       }
+                               }
+                       }
+               }
+       }
        if (!host || !*host) return 0;
        return wildmatch(tok, host);
}

Travis

http://www.deakin.edu.au/~travis/sig.html
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to