Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37839328
en ru br
ALT Linux repositórios
S:3.2.8-alt2
5.0: 3.2.1-alt7
4.1: 3.2.1-alt5.M41.1
4.0: 3.2.1-alt6.M40.1
3.0: 3.1.0-alt1b

Group :: Rede/Outros
RPM: redirector

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: redirector-3.2.1-alt7.patch
Download


 Makefile      |    4 +-
 check_urls.c  |    4 +-
 get_opt.c     |    4 +-
 id.c          |   14 +++++-----
 init_vars.c   |   18 ++++++------
 ip.c          |    6 ++--
 load_cache.c  |    4 +-
 load_urls.c   |    4 +-
 parse_input.c |    6 ++--
 pcre.c        |    8 +++---
 prune_urls.c  |   12 ++++----
 raw_change.c  |    2 +-
 redirect.c    |    2 +-
 redirector.c  |    2 +-
 vars.h        |   78 ++++++++++++++++++++++++++++----------------------------
 15 files changed, 84 insertions(+), 84 deletions(-)
diff --git a/Makefile b/Makefile
index be5d296..c1b1d5f 100644
--- a/Makefile
+++ b/Makefile
@@ -16,8 +16,8 @@ MAKE-CACHE_OBJ= load_urls.o prune_urls.o write_cache.o need_cache_update.o ${COM
 	${CC} ${INCLUDE} -c $<
 
 all: clean ${REDIRECTOR_OBJ} ${MAKE-CACHE_OBJ}
-	${CC} ${INCLUDE} -o redirector redirector.c ${LIBS} ${REDIRECTOR_OBJ}
-	${CC} ${INCLUDE} -o make-cache make-cache.c ${LIBS} ${MAKE-CACHE_OBJ}
+	${CC} ${INCLUDE} -o redirector redirector.c ${REDIRECTOR_OBJ} ${LIBS}
+	${CC} ${INCLUDE} -o make-cache make-cache.c ${MAKE-CACHE_OBJ} ${LIBS}
 
 clean:
 	rm -f ${REDIRECTOR_OBJ} ${MAKE-CACHE_OBJ} redirector make-cache OUT
diff --git a/check_urls.c b/check_urls.c
index 328b391..72a0d33 100644
--- a/check_urls.c
+++ b/check_urls.c
@@ -6,7 +6,7 @@
 
 /******************************************
  ******** Check url by urls rules *********/
- int check_url(unsigned char **list,int count)
+ int check_url(char **list,int count)
  {
 
   char *ret,*k,*k1;
@@ -16,7 +16,7 @@
   printf("Look for %s in %p list\n",i_url->twoleveldomen,list);
   #endif
   
-   ret=bsearch((char*)&i_url->twoleveldomen,list,count,sizeof(unsigned char*),cmp_urls_bs);
+   ret=bsearch((char*)&i_url->twoleveldomen,list,count,sizeof(char*),cmp_urls_bs);
 
    if(ret)
     {
diff --git a/get_opt.c b/get_opt.c
index 0ec2d8f..6fcc9b8 100644
--- a/get_opt.c
+++ b/get_opt.c
@@ -218,7 +218,7 @@ while (!feof(conf))
       }
 
     	//Add memory line
-	change_from=(unsigned char **)realloc(change_from,(1+change_count)*sizeof(char**));
+	change_from=(char **)realloc(change_from,(1+change_count)*sizeof(char**));
 	if (change_from==NULL) 
 	   {
 	    err_mes("Error: Can't allocate memory for change_from\n");
@@ -242,7 +242,7 @@ while (!feof(conf))
        exit(-1);
       }
     	//Add memory line
-	change_to=(unsigned char **)realloc(change_to,(1+change_count)*sizeof(char**));
+	change_to=(char **)realloc(change_to,(1+change_count)*sizeof(char**));
 	if (change_from==NULL) 
 	   {
 	    err_mes("Error: Can't allocate memory for change_to\n");
diff --git a/id.c b/id.c
index afaf9cd..0dbc6a4 100644
--- a/id.c
+++ b/id.c
@@ -4,7 +4,7 @@
 #include <string.h>
 #include "vars.h"
 
-int add_id(char *string,unsigned char ***id_list,unsigned int *count)
+int add_id(char *string,char ***id_list,unsigned int *count)
 {
  char tmp[ML_CFG],etmp[ML_ETMP], *k;
  FILE *fp;
@@ -83,14 +83,14 @@ int add_id(char *string,unsigned char ***id_list,unsigned int *count)
       exit(-1);
      }
   //Add memory
-  *id_list=(unsigned char**)realloc(*id_list,(1+(*count))*sizeof(unsigned char*));
+  *id_list=(char**)realloc(*id_list,(1+(*count))*sizeof(char*));
 	   if (*id_list==NULL)
 	   {
 	    err_mes("Error: Can't allocate memory(realoc) for allow_id\n");
 	    exit(-1);
            }
 
-      (*id_list)[(*count)]=(unsigned char*)strdup(string);
+      (*id_list)[(*count)]=(char*)strdup(string);
 	   if ((*id_list)[(*count)]==NULL)
 	   {
 	    err_mes("Error: Can't allocate memory(strdup) for allow_id\n");
@@ -102,13 +102,13 @@ int add_id(char *string,unsigned char ***id_list,unsigned int *count)
    
 }
 
-int sort_id(unsigned char ***id_list,unsigned int *count)
+int sort_id(char ***id_list,unsigned int *count)
 {
  #ifdef DEBUG_ID
  int i;
  #endif
  
- qsort(*id_list,*count,sizeof(unsigned char*),cmp_urls);
+ qsort(*id_list,*count,sizeof(char*),cmp_urls);
 
  
  #ifdef DEBUG_ID
@@ -124,9 +124,9 @@ int sort_id(unsigned char ***id_list,unsigned int *count)
 /**********************************************
  *********** Find in allow_id list ************/
  
- int check_id(unsigned char **id_list,unsigned int count)
+ int check_id(char **id_list,unsigned int count)
 {
-  if (bsearch(&input_ident, id_list, count, sizeof(unsigned char*),cmp_urls))
+  if (bsearch(&input_ident, id_list, count, sizeof(char*),cmp_urls))
        return(1);   //Found
   else return (0);  //Not Found
 }
diff --git a/init_vars.c b/init_vars.c
index 5113002..99acf83 100644
--- a/init_vars.c
+++ b/init_vars.c
@@ -3,17 +3,17 @@
 
 void init_vars(void)
 {
- input_ident=(unsigned char*)malloc(ML_IDENT*sizeof(unsigned char));
- input_ident_un=(unsigned char*)malloc(ML_IDENT*sizeof(unsigned char));
- input_ip=(unsigned char*)malloc(8*sizeof(unsigned char));
- input_url=(unsigned char*)malloc(ML_URL*sizeof(unsigned char));
+ input_ident=(char*)malloc(ML_IDENT*sizeof(char));
+ input_ident_un=(char*)malloc(ML_IDENT*sizeof(char));
+ input_ip=(char*)malloc(8*sizeof(char));
+ input_url=(char*)malloc(ML_URL*sizeof(char));
  #ifdef CASE_INDEPENDENT
- input_url_uc=(unsigned char*)malloc(ML_URL*sizeof(unsigned char)); 
+ input_url_uc=(char*)malloc(ML_URL*sizeof(char)); 
  #endif
- input_url_un=(unsigned char*)malloc(ML_URL*sizeof(unsigned char));
- input_method=(unsigned char*)malloc(ML_METHOD*sizeof(unsigned char));
- input_host=(unsigned char*)malloc(ML_HOST*sizeof(unsigned char));
- change_reason=(unsigned char*)malloc((ML_URL+ML_FILE_NAME)*sizeof(unsigned char));
+ input_url_un=(char*)malloc(ML_URL*sizeof(char));
+ input_method=(char*)malloc(ML_METHOD*sizeof(char));
+ input_host=(char*)malloc(ML_HOST*sizeof(char));
+ change_reason=(char*)malloc((ML_URL+ML_FILE_NAME)*sizeof(char));
 
  i_url=malloc(sizeof(struct p_url)+1);
 
diff --git a/ip.c b/ip.c
index caa80f0..9944d97 100644
--- a/ip.c
+++ b/ip.c
@@ -3,7 +3,7 @@
 #include <string.h>
 #include "vars.h"
 
-int add_ip(char *string,unsigned char **ip_list,unsigned int *count)
+int add_ip(char *string,char **ip_list,unsigned int *count)
 {
  char *k,*k1,tmp[ML_CFG],etmp[ML_ETMP];
  int z,i;
@@ -57,7 +57,7 @@ int add_ip(char *string,unsigned char **ip_list,unsigned int *count)
    }														 
   
   //Add memory
-  *ip_list=(unsigned char*)realloc(*ip_list,(8*(1 +  *count))*sizeof(unsigned char));
+  *ip_list=(char*)realloc(*ip_list,(8*(1 +  *count))*sizeof(char));
     if (*ip_list==NULL)
        {
         err_mes("Error: Can't allocate memory for allow_ip\n");
@@ -432,7 +432,7 @@ int add_ip(char *string,unsigned char **ip_list,unsigned int *count)
 /********************************************************
  ******* Check of hit input IP to ip_list *******/
 
- int check_ip(unsigned char *ip_list,unsigned int last)
+ int check_ip(char *ip_list,unsigned int last)
  {
   int z;
 
diff --git a/load_cache.c b/load_cache.c
index 1fc7ac9..03a4559 100644
--- a/load_cache.c
+++ b/load_cache.c
@@ -5,7 +5,7 @@
 #include <errno.h>
 #include "vars.h"
 
- int load_cache(unsigned char ***list,unsigned int *count, unsigned char *cache_name)
+ int load_cache(char ***list,unsigned int *count, char *cache_name)
   {
    char etmp[ML_ETMP],*k;
    unsigned int i,size;
@@ -79,7 +79,7 @@
    #endif
 
    // set pointer to pointer table
-    *list=(unsigned char **)(mem+sizeof(int));
+    *list=(char **)(mem+sizeof(int));
 
    // Calc first string
    k=(char *)(mem+sizeof(int)+(*count)*sizeof(char*));
diff --git a/load_urls.c b/load_urls.c
index f38323c..8eaad5f 100644
--- a/load_urls.c
+++ b/load_urls.c
@@ -119,7 +119,7 @@ int load_urls(int section,char *file_name)
      }    
     
      //Add memory line
-     redir[section]->ban_urls=(unsigned char **)realloc(redir[section]->ban_urls,(1+redir[section]->ban_urls_count)*sizeof(unsigned char *));
+     redir[section]->ban_urls=(char **)realloc(redir[section]->ban_urls,(1+redir[section]->ban_urls_count)*sizeof(char *));
      if (redir[section]->ban_urls==NULL)
          {
           err_mes("MAKE-CACHE: ERROR: Can't allocate memory for urls\n");
@@ -127,7 +127,7 @@ int load_urls(int section,char *file_name)
          }
 
 
-     redir[section]->ban_urls[redir[section]->ban_urls_count]=(unsigned char*)strdup(tmp);
+     redir[section]->ban_urls[redir[section]->ban_urls_count]=(char*)strdup(tmp);
      if (redir[section]->ban_urls[redir[section]->ban_urls_count]==NULL)
          {
           err_mes("MAKE-CACHE: ERROR: Can't allocate memory for urls\n");
diff --git a/parse_input.c b/parse_input.c
index 27d6292..3e4bfef 100644
--- a/parse_input.c
+++ b/parse_input.c
@@ -3,10 +3,10 @@
 #include <string.h>
 #include "vars.h"
 
-int parse_input(unsigned char *str)
+int parse_input(char *str)
 {
-   unsigned char *k,hex[3],*k1;
-   unsigned char tmp[4];
+   char *k,hex[3],*k1;
+   char tmp[4];
    int c,x;
 
    #ifdef DEBUG_PARSE_UNPUT
diff --git a/pcre.c b/pcre.c
index e882d02..473f1ec 100644
--- a/pcre.c
+++ b/pcre.c
@@ -13,7 +13,7 @@ int load_pcre_file(int section)
     FILE *fp;
     char tmp[ML_URL],etmp[ML_ETMP];
     const char *errstr; 
-    unsigned int errchar; 
+    int errchar; 
 
 
     //Set pointer
@@ -95,9 +95,9 @@ int load_pcre_file(int section)
  
  int check_pcre(int section)
  {
-   unsigned int i;
-   unsigned int vector[ML_PCRE_VARS];
-   unsigned int vecsize=ML_PCRE_VARS;
+   int i;
+   int vector[ML_PCRE_VARS];
+   int vecsize=ML_PCRE_VARS;
    
     for (i=0;i<redir[section]->ban_pcre_count;i++)
     
diff --git a/prune_urls.c b/prune_urls.c
index 6778ae4..591a71a 100644
--- a/prune_urls.c
+++ b/prune_urls.c
@@ -23,7 +23,7 @@ int prune_urls(int section)
  printf("\n***** PRUNE DOWN \"%s\" SECTION *****\n",redir[section]->name);
  #endif
 
- qsort(redir[section]->ban_urls,redir[section]->ban_urls_count,sizeof(unsigned char*),cmp_urls);
+ qsort(redir[section]->ban_urls,redir[section]->ban_urls_count,sizeof(char*),cmp_urls);
 
   #ifdef DEBUG_PRUNE_URLS
   printf("\n=== SORTED \"%s\" SECTION (%i elements)===\n",redir[section]->name,redir[section]->ban_urls_count);
@@ -95,7 +95,7 @@ int prune_urls(int section)
     if (redir[section]->ban_urls[i])
 	 redir[section]->ban_urls[l++]=redir[section]->ban_urls[i];
    redir[section]->ban_urls_count=l;
-//   redir[section]->ban_urls=(unsigned char **)realloc(redir[section]->ban_urls,(1+redir[section]->ban_urls_count)*sizeof(unsigned char *));
+//   redir[section]->ban_urls=(char **)realloc(redir[section]->ban_urls,(1+redir[section]->ban_urls_count)*sizeof(char *));
 
 
   #ifdef DEBUG_PRUNE_URLS
@@ -137,7 +137,7 @@ int prune_urls(int section)
     if (redir[section]->ban_urls[i])
 	 redir[section]->ban_urls[l++]=redir[section]->ban_urls[i];
    redir[section]->ban_urls_count=l;
-//   redir[section]->ban_urls=(unsigned char **)realloc(redir[section]->ban_urls,(1+redir[section]->ban_urls_count)*sizeof(unsigned char *));
+//   redir[section]->ban_urls=(char **)realloc(redir[section]->ban_urls,(1+redir[section]->ban_urls_count)*sizeof(char *));
 
 
   #ifdef DEBUG_PRUNE_URLS
@@ -179,7 +179,7 @@ int prune_urls(int section)
     if (redir[section]->ban_urls[i])
 	 redir[section]->ban_urls[l++]=redir[section]->ban_urls[i];
    redir[section]->ban_urls_count=l;
-//   redir[section]->ban_urls=(unsigned char **)realloc(redir[section]->ban_urls,(1+redir[section]->ban_urls_count)*sizeof(unsigned char *));
+//   redir[section]->ban_urls=(char **)realloc(redir[section]->ban_urls,(1+redir[section]->ban_urls_count)*sizeof(char *));
 
 
   #ifdef DEBUG_PRUNE_URLS
@@ -218,7 +218,7 @@ int prune_urls(int section)
 	 k1=strchr(redir[section]->ban_urls[i],0);
 	 
 	 
-         redir[section]->ban_urls[l]=(unsigned char *)realloc(redir[section]->ban_urls[l],(z+k1-k+1)*sizeof(unsigned char));	 
+         redir[section]->ban_urls[l]=(char *)realloc(redir[section]->ban_urls[l],(z+k1-k+1)*sizeof(char));	 
 
 	 memcpy(&redir[section]->ban_urls[l][z],k+1,k1-k);
 	 
@@ -241,7 +241,7 @@ int prune_urls(int section)
     if (redir[section]->ban_urls[i])
 	 redir[section]->ban_urls[l++]=redir[section]->ban_urls[i];
    redir[section]->ban_urls_count=l;
-//   redir[section]->ban_urls=(unsigned char **)realloc(redir[section]->ban_urls,(1+redir[section]->ban_urls_count)*sizeof(unsigned char *));
+//   redir[section]->ban_urls=(char **)realloc(redir[section]->ban_urls,(1+redir[section]->ban_urls_count)*sizeof(char *));
 
   #ifdef DEBUG_PRUNE_URLS
   printf("\n=== AFTER PACK (%i elements)===\n",redir[section]->ban_urls_count);
diff --git a/raw_change.c b/raw_change.c
index b9cce62..c921899 100644
--- a/raw_change.c
+++ b/raw_change.c
@@ -9,7 +9,7 @@
 int raw_change(void)
 {
  int i,next_flag;
- unsigned char *k,*k1,*k2,*k3;
+ char *k,*k1,*k2,*k3;
  
  
  #ifdef DEBUG_RAW_CHANGE
diff --git a/redirect.c b/redirect.c
index 281ea0f..fa35fd0 100644
--- a/redirect.c
+++ b/redirect.c
@@ -24,7 +24,7 @@ int redirect(int section)
 
  if (!redir[section]->log_flag)
   {
-    fprintf(change_log,"%s %s: %d.%d.%d.%d %s %s %s\n", now(),redir[section]->name,input_ip[0],input_ip[1],input_ip[2],input_ip[3],input_ident_un,input_url,change_reason);
+	  fprintf(change_log,"%s %s: %d.%d.%d.%d %s %s %s\n", now(),redir[section]->name,(unsigned char)input_ip[0],(unsigned char)input_ip[1],(unsigned char)input_ip[2],(unsigned char)input_ip[3],input_ident_un,input_url,change_reason);
     fflush (change_log);
   }
 
diff --git a/redirector.c b/redirector.c
index d413e90..d6f37f3 100644
--- a/redirector.c
+++ b/redirector.c
@@ -11,7 +11,7 @@
 {
 
   int z;
-  unsigned char etmp[ML_ETMP],str[ML_URL];
+  char etmp[ML_ETMP],str[ML_URL];
   int flag;	 
 
     //Init some vars
diff --git a/vars.h b/vars.h
index a315692..cde760a 100644
--- a/vars.h
+++ b/vars.h
@@ -48,22 +48,22 @@
 
 FILE *change_log;
 
-unsigned char *input_ident;
-unsigned char *input_ident_un;
-unsigned char *input_ip;
-unsigned char *input_url;
-unsigned char *input_url_un;
+char *input_ident;
+char *input_ident_un;
+char *input_ip;
+char *input_url;
+char *input_url_un;
 
 #ifdef CASE_INDEPENDENT
-unsigned char *input_url_uc;
+char *input_url_uc;
 #endif
 
-unsigned char *input_method;
-unsigned char *input_host;
+char *input_method;
+char *input_host;
 //unsigned int input_separator;
 struct p_url  *i_url;
 
-unsigned char *change_reason;
+char *change_reason;
 
 
  /*****************************************************************
@@ -73,38 +73,38 @@ unsigned char *change_reason;
   *****************************************************************/
 struct p_url
     {  
-     unsigned char protocol[ML_PROTOKOL];
-     unsigned char twoleveldomen[ML_2LD];
-     unsigned char port[ML_PORT];
-     unsigned char subdomen[ML_SUBDOMEN];
-     unsigned char dirs[ML_DIRS];
+     char protocol[ML_PROTOKOL];
+     char twoleveldomen[ML_2LD];
+     char port[ML_PORT];
+     char subdomen[ML_SUBDOMEN];
+     char dirs[ML_DIRS];
     };
 
 //GLOBAL OPTIONS
-unsigned char *err_log;   // Error log path
-unsigned char *chg_log;   // Change log path
-unsigned char *makecache; // make-cache program 
+char *err_log;   // Error log path
+char *chg_log;   // Change log path
+char *makecache; // make-cache program 
 
-unsigned char *work_ip; 	//Work ip
+char *work_ip; 	//Work ip
 unsigned int  work_ip_count;  	//Work ip count
 unsigned int  work_ip_flag;     //Work ip flag
 
-unsigned char *allow_ip; 	//Allow ip
+char *allow_ip; 	//Allow ip
 unsigned int  allow_ip_count;  	//Allow ip count
 
-unsigned char **work_id;	//Work id
+char **work_id;	//Work id
 unsigned int  work_id_count;	//Work id count
 unsigned int  work_id_flag;	//Work id flag
 
-unsigned char **allow_id;	//Allow id
+char **allow_id;	//Allow id
 unsigned int  allow_id_count;	//Allow id count
 
-unsigned char *allow_urls_file; //Allow urls file name
-unsigned char **allow_urls;	//Allow urls
+char *allow_urls_file; //Allow urls file name
+char **allow_urls;	//Allow urls
 unsigned int allow_urls_count;	//Allow urls count
 
-unsigned char **change_from;    //
-unsigned char **change_to;      // Change data
+char **change_from;    //
+char **change_to;      // Change data
 unsigned int change_count;      //
 int raw_change_log_flag;        //
 
@@ -114,7 +114,7 @@ unsigned int sections_count;    //Count of sections in config
 unsigned int sections_count;    //Count of sections in config
 struct section
      {
-	unsigned char *name;	//Header name
+	char *name;	//Header name
 	char *ban_dir;		//Ban lists dir
 	char *url;		//Url to change
 	char revers;		// revers flag
@@ -125,25 +125,25 @@ struct section
 	
 	char log_flag;		//Write to log or not
 
-	unsigned char *work_ip; 	//Work ip
+	char *work_ip; 	//Work ip
 	unsigned int  work_ip_count;  	//Work ip count
         unsigned int  work_ip_flag;     //Work ip flag 
 
-	unsigned char *allow_ip; 	//Allow ip
+	char *allow_ip; 	//Allow ip
 	unsigned int  allow_ip_count;  	//Allow ip count
 
-	unsigned char **work_id;	//Work id
+	char **work_id;	//Work id
 	unsigned int  work_id_count;	//Work id count
 	unsigned int  work_id_flag;     //Work id flag
 
-	unsigned char **allow_id;	//Allow id
+	char **allow_id;	//Allow id
 	unsigned int  allow_id_count;	//Allow id count
 
 	pcre **ban_pcre;	    	//Ban PCRE patterns
 	pcre_extra **ban_pcre_s; 	//Ban PCRE optimization
 	unsigned int ban_pcre_count;     //Ban PCRE patterns count        
 
-	unsigned char **ban_urls;	//Ban urls lists area
+	char **ban_urls;	//Ban urls lists area
 	unsigned int ban_urls_count;	//Counter urls elements
 
      } **redir;
@@ -159,22 +159,22 @@ int cmp_urls(const void *, const void *);
 int cache2url(struct p_url *,char *);
 int need_cache_update(char*,char*);
 int write_cache(int,char*,char*);
-int load_cache(unsigned char ***,unsigned int*,unsigned char *);
+int load_cache(char ***,unsigned int*,char *);
 int load_pcre_file(int);
 int check_pcre(int);
-int parse_input(unsigned char *);
+int parse_input(char *);
 void init_vars(void);
-int check_url(unsigned char**,int count);
+int check_url(char**,int count);
 int cmp_urls_bs(const void *, const void *);
 int cmp_urls_sub(const void *, const void *);
 int cmp_urls_dirs(const void *, const void *);
 int cmp_urls_port(const void *, const void *);
 int run_make_cache(char*);
-int add_ip(char *,unsigned char **,unsigned int* );
-int check_ip(unsigned char *,unsigned int );
-int add_id(char *,unsigned char ***,unsigned int* );
-int sort_id(unsigned char ***,unsigned int* );
-int check_id(unsigned char **,unsigned int);
+int add_ip(char *,char **,unsigned int* );
+int check_ip(char *,unsigned int );
+int add_id(char *,char ***,unsigned int* );
+int sort_id(char ***,unsigned int* );
+int check_id(char **,unsigned int);
 int prepare_new_url(int);
 int add_new_url (int, char *, int);
 int redirect(int);
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009