]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
The %u doesn't have to be the last item of the Require statement in sarg.conf.
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Sun, 27 Dec 2009 16:02:47 +0000 (16:02 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Sun, 27 Dec 2009 16:02:47 +0000 (16:02 +0000)
auth.c

diff --git a/auth.c b/auth.c
index e79b88182a63126b09c144d26973c11788d870b5..932dabf8f5020cb7498de227759475c1492bd20a 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -30,7 +30,7 @@ void htaccess(const char *name)
 {
    char htname[MAXLEN];
    FILE *fp_auth;
-   struct getwordstruct gwarea;
+   int i;
 
    if(!UserAuthentication)
       return;
@@ -41,11 +41,6 @@ void htaccess(const char *name)
       exit(1);
    }
 
-   getword_start(&gwarea,Require);
-   if (getword(buf,sizeof(buf),&gwarea,'%')<0) {
-      printf("SARG: The \"Require\" entry of your sarg.conf file is too long for your %s file.\n",htname);
-      exit(1);
-   }
    fprintf(fp_auth,"AuthUserFile %s\n",AuthUserFile);
    if(strchr(AuthName,'\"') == 0)
       fprintf(fp_auth,"AuthName \"%s\"\n",AuthName);
@@ -53,8 +48,13 @@ void htaccess(const char *name)
       fprintf(fp_auth,"AuthName %s\n",AuthName);
    fprintf(fp_auth,"AuthType %s\n",AuthType);
    fputs("<Limit GET POST>\nRequire ",fp_auth);
-   fputs(buf,fp_auth);
-   fputs(name,fp_auth);
+   for (i=0 ; Require[i] ; i++)
+      if (Require[i]=='%' && Require[i+1]=='u') {
+         fputs(name,fp_auth);
+         i++;
+      } else {
+         fputc(Require[i],fp_auth);
+   }
    fputs("\n</LIMIT>\n",fp_auth);
 
    fclose(fp_auth);