Add "include" and "include from" rsyncd.conf options. Contributed
authorDavid Dykstra <dwd@samba.org>
Mon, 23 Nov 1998 21:54:01 +0000 (21:54 +0000)
committerDavid Dykstra <dwd@samba.org>
Mon, 23 Nov 1998 21:54:01 +0000 (21:54 +0000)
by Dennis Gilbert <dennis@oit.pdx.edu>.

clientserver.c
exclude.c
loadparm.c
rsyncd.conf.yo

index 299e771..1cc6437 100644 (file)
@@ -187,6 +187,12 @@ static int rsync_module(int fd, int i)
                gid = atoi(p);
        }
 
                gid = atoi(p);
        }
 
+       p = lp_include_from(i);
+       add_exclude_file(p, 1, 1);
+
+       p = lp_include(i);
+       add_include_line(p);
+
        p = lp_exclude_from(i);
        add_exclude_file(p, 1, 0);
 
        p = lp_exclude_from(i);
        add_exclude_file(p, 1, 0);
 
index 9b32554..109ee8d 100644 (file)
--- a/exclude.c
+++ b/exclude.c
@@ -301,6 +301,17 @@ void add_exclude_line(char *p)
        free(p);
 }
 
        free(p);
 }
 
+void add_include_line(char *p)
+{
+       char *tok;
+       if (!p || !*p) return;
+       p = strdup(p);
+       if (!p) out_of_memory("add_include_line");
+       for (tok=strtok(p," "); tok; tok=strtok(NULL," "))
+               add_exclude(tok, 1);
+       free(p);
+}
+
 
 static char *cvs_ignore_list[] = {
   "RCS","SCCS","CVS","CVS.adm","RCSLOG","cvslog.*",
 
 static char *cvs_ignore_list[] = {
   "RCS","SCCS","CVS","CVS.adm","RCSLOG","cvslog.*",
index 03440fe..8bd5cf2 100644 (file)
@@ -129,6 +129,8 @@ typedef struct
        char *secrets_file;
        char *exclude;
        char *exclude_from;
        char *secrets_file;
        char *exclude;
        char *exclude_from;
+       char *include;
+       char *include_from;
        char *log_format;
        char *refuse_options;
        char *dont_compress;
        char *log_format;
        char *refuse_options;
        char *dont_compress;
@@ -154,6 +156,8 @@ static service sDefault =
        NULL,    /* secrets file */
        NULL,    /* exclude */
        NULL,    /* exclude from */
        NULL,    /* secrets file */
        NULL,    /* exclude */
        NULL,    /* exclude from */
+       NULL,    /* include */
+       NULL,    /* include from */
        "%o %h [%a] %m (%u) %f %l",    /* log format */
        NULL,    /* refuse options */
        "*.gz *.tgz *.zip *.z *.rpm *.deb",    /* dont compress */
        "%o %h [%a] %m (%u) %f %l",    /* log format */
        NULL,    /* refuse options */
        "*.gz *.tgz *.zip *.z *.rpm *.deb",    /* dont compress */
@@ -263,6 +267,8 @@ static struct parm_struct parm_table[] =
   {"secrets file",     P_STRING,  P_LOCAL,  &sDefault.secrets_file,NULL,   0},
   {"exclude",          P_STRING,  P_LOCAL,  &sDefault.exclude,     NULL,   0},
   {"exclude from",     P_STRING,  P_LOCAL,  &sDefault.exclude_from,NULL,   0},
   {"secrets file",     P_STRING,  P_LOCAL,  &sDefault.secrets_file,NULL,   0},
   {"exclude",          P_STRING,  P_LOCAL,  &sDefault.exclude,     NULL,   0},
   {"exclude from",     P_STRING,  P_LOCAL,  &sDefault.exclude_from,NULL,   0},
+  {"include",          P_STRING,  P_LOCAL,  &sDefault.include,     NULL,   0},
+  {"include from",     P_STRING,  P_LOCAL,  &sDefault.include_from,NULL,   0},
   {"transfer logging", P_BOOL,    P_LOCAL,  &sDefault.transfer_logging,NULL,0},
   {"log format",       P_STRING,  P_LOCAL,  &sDefault.log_format,  NULL,   0},
   {"refuse options",   P_STRING,  P_LOCAL,  &sDefault.refuse_options,NULL, 0},
   {"transfer logging", P_BOOL,    P_LOCAL,  &sDefault.transfer_logging,NULL,0},
   {"log format",       P_STRING,  P_LOCAL,  &sDefault.log_format,  NULL,   0},
   {"refuse options",   P_STRING,  P_LOCAL,  &sDefault.refuse_options,NULL, 0},
@@ -338,6 +344,8 @@ FN_LOCAL_STRING(lp_auth_users, auth_users)
 FN_LOCAL_STRING(lp_secrets_file, secrets_file)
 FN_LOCAL_STRING(lp_exclude, exclude)
 FN_LOCAL_STRING(lp_exclude_from, exclude_from)
 FN_LOCAL_STRING(lp_secrets_file, secrets_file)
 FN_LOCAL_STRING(lp_exclude, exclude)
 FN_LOCAL_STRING(lp_exclude_from, exclude_from)
+FN_LOCAL_STRING(lp_include, include)
+FN_LOCAL_STRING(lp_include_from, include_from)
 FN_LOCAL_STRING(lp_log_format, log_format)
 FN_LOCAL_STRING(lp_refuse_options, refuse_options)
 FN_LOCAL_STRING(lp_dont_compress, dont_compress)
 FN_LOCAL_STRING(lp_log_format, log_format)
 FN_LOCAL_STRING(lp_refuse_options, refuse_options)
 FN_LOCAL_STRING(lp_dont_compress, dont_compress)
@@ -460,7 +468,7 @@ static int map_parameter(char *parmname)
       if (strwicmp(parm_table[iIndex].label, parmname) == 0)
          return(iIndex);
 
       if (strwicmp(parm_table[iIndex].label, parmname) == 0)
          return(iIndex);
 
-   rprintf(FERROR, "Unknown parameter encountered: \"%s\"\n", parmname);
+   rprintf(FERROR, "Unknown Parameter encountered: \"%s\"\n", parmname);
    return(-1);
 }
 
    return(-1);
 }
 
@@ -572,7 +580,7 @@ static BOOL lp_do_parameter(int snum, char *parmname, char *parmvalue)
 
    if (parmnum < 0)
      {
 
    if (parmnum < 0)
      {
-       rprintf(FERROR, "Ignoring unknown parameter \"%s\"\n", parmname);
+       rprintf(FERROR, "IGNORING unknown parameter \"%s\"\n", parmname);
        return(True);
      }
 
        return(True);
      }
 
index 83209ee..6aae929 100644 (file)
@@ -176,6 +176,20 @@ equivalent to the client specifying the --exclude-from option with a
 equivalent file. See also the note about security for the exclude
 option above.
 
 equivalent file. See also the note about security for the exclude
 option above.
 
+dit(bf(include)) The "include" option allows you to specify a space
+separated list of patterns which rsync should not exclude. This is
+equivalent to the client specifying these patterns with the --include
+option. This is useful as it allows you to build up quite complex
+exclude/include rules.
+
+See the section of exclude patterns for information  on the syntax of
+this option.
+
+dit(bf(include from)) The "include from" option specifies a filename
+on the server that contains include patterns, one per line. This is
+equivalent to the client specifying the --include-from option with a
+equivalent file.
+
 dit(bf(auth users)) The "auth users" option specifies a comma
 and space separated list of usernames that will be allowed to connect
 to this module. The usernames do not need to exist on the local
 dit(bf(auth users)) The "auth users" option specifies a comma
 and space separated list of usernames that will be allowed to connect
 to this module. The usernames do not need to exist on the local