Uploaded image for project: 'Subversion'
  1. Subversion
  2. SVN-2185

Would be nice if groups where easier to recurse.

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Trivial
    • Resolution: Duplicate
    • 1.1.x
    • unscheduled
    • mod_authz_svn
    • None

    Description

      One often has configs like
      
      [groups]
      @class5 = peter, fred, mary
      @class4 = @class5, joan
      @class3 = @class4, brian
      @all = @class3, ape, nut, mies
      
      [/]
      * = 
      
      [/docs]
      rw = @all
      
      [/docs/clearances]
      * = 
      rw = @class3
      
      [/docs/clearances/secret]
      * = 
      rw = @class4
      
      Though the expansion ought to be done at run time -- I found the small change below to 
      group_countains_user() to make the files a LOT more readable.
      
      
      static int _group_contains_user(int depth, svn_config_t *cfg,
          const char *group, const char *user, apr_pool_t *pool)
      {
          const char *value;  
          apr_array_header_t *list;
          int i;
      
          /* Ideally we do this expansion at read-in time of course.
           */
          if (depth > 50) {   
              ap_log_perror(APLOG_MARK, APLOG_ERR, 0, pool, "Groups recurse too deep");
              return 0;
          }
      
          svn_config_get(cfg, &value, "groups", group, "");
          list = svn_cstring_split(value, "|", TRUE, pool);   /* XXX changed - utf8 string for OTAN XXX */
      
          for (i = 0; i < list->nelts; i++) {
             const char *group_user = APR_ARRAY_IDX(list, i, char *);
              if (*group_user == '@') {
                      if (_group_contains_user(depth+1,cfg, group_user+1, user, pool))
                              return 1;
              }
              else if (!strcmp(user, group_user))
                 return 1;
          }
          return 0;
      }
      
      static int group_contains_user(svn_config_t *cfg,
          const char *group, const char *user, apr_pool_t *pool)
      {
         return _group_contains_user(0,cfg, group, user, pool);
      }
      

      Original issue reported by dirkx

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              subversion-importer Subversion Importer
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: