innetgr revised netgroup patch against 2.6.0

jw schultz jw at pegasys.ws
Sun Feb 1 21:26:25 GMT 2004


On Sun, Feb 01, 2004 at 11:25:22PM +1100, Travis Freeland wrote:
> 
> innetgr.. much easier..

Much cleaner.  But the code could be tightened further.
I've provided an example.  Note also formatting changes.

Also, we use tabs, not spaces for indent.  If that is your
mailer either fix the config or use text/plain (not x-diff)
attachments.

> Had a look for the user section but didn't find it in my 15 seconds of 
> looking..

Do the user, user+host and the autoconf and I'll consider
this for CVS.

> --- access.c    2003-07-30 16:12:27.000000000 +1000
> +++ ../rsync-2.6.0-Linux/access.c       2004-02-01 23:21:12.000000000 +1100
> @@ -22,10 +22,21 @@
>    */
> 
>  #include "rsync.h"
> +#include <netdb.h>
> 
> 
>  static int match_hostname(char *host, char *tok)
>  {
> +       char *netgroup;
> +
> +       if(strlen(tok)>1){
> +               if(tok[0]=='@'){
> +                       netgroup=tok+1;
> +                       if(innetgr(netgroup, host, NULL, NULL)){
> +                               return(1);
> +                       }
> +               }
> +       }
>         if (!host || !*host) return 0;
>         return wildmatch(tok, host);
>  }

--- access.c    2003-07-30 16:12:27.000000000 +1000
+++ ../rsync-2.6.0-Linux/access.c       2004-02-01 23:21:12.000000000 +1100
@@ -22,10 +22,21 @@
   */

 #include "rsync.h"
+#include <netdb.h>


 static int match_hostname(char *host, char *tok)
 {
+ 	if (tok[0] == '@' && tok[1]) {
+		if (innetgr(&tok[1], host, NULL, NULL))
+			return(1);
+	}
        if (!host || !*host) return 0;
        return wildmatch(tok, host);
 }

-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw at pegasys.ws

		Remember Cernan and Schmitt


More information about the rsync mailing list