mirror of
				https://github.com/3proxy/3proxy.git
				synced 2025-11-04 15:52:39 +08:00 
			
		
		
		
	do not use "my" prefix for memory functions in pluginlink
This commit is contained in:
		
							parent
							
								
									cb217d79c1
								
							
						
					
					
						commit
						336b411ea2
					
				@ -68,7 +68,7 @@ int savecounters(void)
 | 
				
			|||||||
    tc = tc->next;
 | 
					    tc = tc->next;
 | 
				
			||||||
    f=NULL;
 | 
					    f=NULL;
 | 
				
			||||||
    if(strcmp(tcd->comment,"ldapcounters")==0) {
 | 
					    if(strcmp(tcd->comment,"ldapcounters")==0) {
 | 
				
			||||||
      tmpbuf=mypluginlink->myalloc(strlen(pat_file)+strlen(ldap_dircount)+strlen(tcd->ace->users->user));
 | 
					      tmpbuf=mypluginlink->malloc(strlen(pat_file)+strlen(ldap_dircount)+strlen(tcd->ace->users->user));
 | 
				
			||||||
      sprintf(tmpbuf,pat_file,ldap_dircount,tcd->ace->users->user);
 | 
					      sprintf(tmpbuf,pat_file,ldap_dircount,tcd->ace->users->user);
 | 
				
			||||||
      f=fopen(tmpbuf,"w+b");
 | 
					      f=fopen(tmpbuf,"w+b");
 | 
				
			||||||
      fseek(f,0,SEEK_SET);
 | 
					      fseek(f,0,SEEK_SET);
 | 
				
			||||||
@ -76,7 +76,7 @@ int savecounters(void)
 | 
				
			|||||||
					(unsigned long)tcd->cleared,(unsigned long)tcd->updated);
 | 
										(unsigned long)tcd->cleared,(unsigned long)tcd->updated);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      fclose(f);
 | 
					      fclose(f);
 | 
				
			||||||
      mypluginlink->myfree(tmpbuf);
 | 
					      mypluginlink->free(tmpbuf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -194,15 +194,15 @@ int h_ldapconnect(int argc, unsigned char ** argv)
 | 
				
			|||||||
   return 1;
 | 
					   return 1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 ldap_serv=mypluginlink->mystrdup(argv[1]);
 | 
					 ldap_serv=mypluginlink->strdup(argv[1]);
 | 
				
			||||||
 ldap_user=mypluginlink->mystrdup(argv[2]);  
 | 
					 ldap_user=mypluginlink->strdup(argv[2]);  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 ld = ldap_init( ldap_serv, 389 );
 | 
					 ld = ldap_init( ldap_serv, 389 );
 | 
				
			||||||
 ldap_unbind_s(ld);
 | 
					 ldap_unbind_s(ld);
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
 if (argc == 4) 
 | 
					 if (argc == 4) 
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
   ldap_pass= mypluginlink->mystrdup(argv[3]);   
 | 
					   ldap_pass= mypluginlink->strdup(argv[3]);   
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 else
 | 
					 else
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@ -220,7 +220,7 @@ int h_access(int argc, unsigned char ** argv)
 | 
				
			|||||||
   fprintf(stderr, "Error in ldapaccess: See documentation of ldapauth plugin.\n");		
 | 
					   fprintf(stderr, "Error in ldapaccess: See documentation of ldapauth plugin.\n");		
 | 
				
			||||||
   return 1;
 | 
					   return 1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 ldap_access=mypluginlink->mystrdup(argv[1]);
 | 
					 ldap_access=mypluginlink->strdup(argv[1]);
 | 
				
			||||||
 return 0;
 | 
					 return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
/* --------------------------------------------------------------------------
 | 
					/* --------------------------------------------------------------------------
 | 
				
			||||||
@ -233,7 +233,7 @@ int h_sbase(int argc, unsigned char ** argv)
 | 
				
			|||||||
   fprintf(stderr, "Error in ldapsbase: See documentation of ldapauth plugin.\n");		
 | 
					   fprintf(stderr, "Error in ldapsbase: See documentation of ldapauth plugin.\n");		
 | 
				
			||||||
   return 1;
 | 
					   return 1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  ldap_sbase=mypluginlink->mystrdup(argv[1]);   
 | 
					  ldap_sbase=mypluginlink->strdup(argv[1]);   
 | 
				
			||||||
 return 0;
 | 
					 return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
/* --------------------------------------------------------------------------	
 | 
					/* --------------------------------------------------------------------------	
 | 
				
			||||||
@ -245,7 +245,7 @@ int h_userenv(int argc, unsigned char ** argv)
 | 
				
			|||||||
   fprintf(stderr, "Error in ldapsbase: See documentation of ldapauth plugin.\n");		
 | 
					   fprintf(stderr, "Error in ldapsbase: See documentation of ldapauth plugin.\n");		
 | 
				
			||||||
   return 1;
 | 
					   return 1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  ldap_userenv=mypluginlink->mystrdup(argv[1]);   
 | 
					  ldap_userenv=mypluginlink->strdup(argv[1]);   
 | 
				
			||||||
  return 0;
 | 
					  return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
/* --------------------------------------------------------------------------
 | 
					/* --------------------------------------------------------------------------
 | 
				
			||||||
@ -309,11 +309,11 @@ int h_trafgroup(int argc, unsigned char ** argv)
 | 
				
			|||||||
  bandwidth = atoi((char *)argv[4]);
 | 
					  bandwidth = atoi((char *)argv[4]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* name ldap group */
 | 
					  /* name ldap group */
 | 
				
			||||||
  tmpbuf=mypluginlink->myalloc(strlen(pat_group)+strlen(ldap_group_attr)+strlen(argv[1]));
 | 
					  tmpbuf=mypluginlink->malloc(strlen(pat_group)+strlen(ldap_group_attr)+strlen(argv[1]));
 | 
				
			||||||
  sprintf(tmpbuf,pat_group,ldap_group_attr,argv[1]);
 | 
					  sprintf(tmpbuf,pat_group,ldap_group_attr,argv[1]);
 | 
				
			||||||
  rc = ldap_search_s( ld, ldap_sbase, LDAP_SCOPE_SUBTREE,
 | 
					  rc = ldap_search_s( ld, ldap_sbase, LDAP_SCOPE_SUBTREE,
 | 
				
			||||||
                                        			tmpbuf, attrs, 0, &res );
 | 
					                                        			tmpbuf, attrs, 0, &res );
 | 
				
			||||||
  mypluginlink->myfree(tmpbuf);
 | 
					  mypluginlink->free(tmpbuf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  rc=ldap_count_entries(ld,res);
 | 
					  rc=ldap_count_entries(ld,res);
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
@ -331,7 +331,7 @@ int h_trafgroup(int argc, unsigned char ** argv)
 | 
				
			|||||||
             
 | 
					             
 | 
				
			||||||
             /* -------------bandlim----------
 | 
					             /* -------------bandlim----------
 | 
				
			||||||
             create user list 	    */  
 | 
					             create user list 	    */  
 | 
				
			||||||
             newuserlist = (*mypluginlink->myalloc)(sizeof (struct userlist));
 | 
					             newuserlist = (*mypluginlink->malloc)(sizeof (struct userlist));
 | 
				
			||||||
             if (usercaselow  > 0)
 | 
					             if (usercaselow  > 0)
 | 
				
			||||||
                #ifdef _WIN32
 | 
					                #ifdef _WIN32
 | 
				
			||||||
                { CharLower(vals[0]); }
 | 
					                { CharLower(vals[0]); }
 | 
				
			||||||
@ -339,15 +339,15 @@ int h_trafgroup(int argc, unsigned char ** argv)
 | 
				
			|||||||
                { lower(vals[0]); }
 | 
					                { lower(vals[0]); }
 | 
				
			||||||
                #endif
 | 
					                #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
             newuserlist->user = (*mypluginlink->mystrdup)(vals[0]);
 | 
					             newuserlist->user = (*mypluginlink->strdup)(vals[0]);
 | 
				
			||||||
             newuserlist->next = NULL; 
 | 
					             newuserlist->next = NULL; 
 | 
				
			||||||
             /*create user rule */
 | 
					             /*create user rule */
 | 
				
			||||||
             newace = (*mypluginlink->myalloc)(sizeof (struct ace));
 | 
					             newace = (*mypluginlink->malloc)(sizeof (struct ace));
 | 
				
			||||||
             memset(newace, 0, sizeof(struct ace));
 | 
					             memset(newace, 0, sizeof(struct ace));
 | 
				
			||||||
             newace->users = newuserlist;
 | 
					             newace->users = newuserlist;
 | 
				
			||||||
             newace->action = BANDLIM;
 | 
					             newace->action = BANDLIM;
 | 
				
			||||||
             /*create user bandlim */
 | 
					             /*create user bandlim */
 | 
				
			||||||
             newbandlim =(*mypluginlink->myalloc)(sizeof (struct bandlim));
 | 
					             newbandlim =(*mypluginlink->malloc)(sizeof (struct bandlim));
 | 
				
			||||||
             memset(newbandlim, 0, sizeof(struct bandlim));
 | 
					             memset(newbandlim, 0, sizeof(struct bandlim));
 | 
				
			||||||
             newbandlim->rate = bandwidth;
 | 
					             newbandlim->rate = bandwidth;
 | 
				
			||||||
             newbandlim->ace = newace;
 | 
					             newbandlim->ace = newace;
 | 
				
			||||||
@ -356,29 +356,29 @@ int h_trafgroup(int argc, unsigned char ** argv)
 | 
				
			|||||||
             
 | 
					             
 | 
				
			||||||
             /* -------------counters----------
 | 
					             /* -------------counters----------
 | 
				
			||||||
             create user list */	     
 | 
					             create user list */	     
 | 
				
			||||||
             newuserlist = (*mypluginlink->myalloc)(sizeof (struct userlist));
 | 
					             newuserlist = (*mypluginlink->malloc)(sizeof (struct userlist));
 | 
				
			||||||
             if (usercaselow  > 0)
 | 
					             if (usercaselow  > 0)
 | 
				
			||||||
                #ifdef _WIN32
 | 
					                #ifdef _WIN32
 | 
				
			||||||
                { CharLower(vals[0]); }
 | 
					                { CharLower(vals[0]); }
 | 
				
			||||||
                #else
 | 
					                #else
 | 
				
			||||||
                { lower(vals[0]);  }
 | 
					                { lower(vals[0]);  }
 | 
				
			||||||
                #endif
 | 
					                #endif
 | 
				
			||||||
             newuserlist->user = (*mypluginlink->mystrdup)(vals[0]);
 | 
					             newuserlist->user = (*mypluginlink->strdup)(vals[0]);
 | 
				
			||||||
             newuserlist->next = NULL; 
 | 
					             newuserlist->next = NULL; 
 | 
				
			||||||
             /*create user rule */
 | 
					             /*create user rule */
 | 
				
			||||||
             newace = (*mypluginlink->myalloc)(sizeof (struct ace));
 | 
					             newace = (*mypluginlink->malloc)(sizeof (struct ace));
 | 
				
			||||||
             memset(newace, 0, sizeof(struct ace));
 | 
					             memset(newace, 0, sizeof(struct ace));
 | 
				
			||||||
             newace->users = newuserlist;
 | 
					             newace->users = newuserlist;
 | 
				
			||||||
             newace->action = COUNTIN;
 | 
					             newace->action = COUNTIN;
 | 
				
			||||||
             /*create user counter */
 | 
					             /*create user counter */
 | 
				
			||||||
             newtrafcount =(*mypluginlink->myalloc)(sizeof (struct trafcount));
 | 
					             newtrafcount =(*mypluginlink->malloc)(sizeof (struct trafcount));
 | 
				
			||||||
             memset(newtrafcount, 0, sizeof(struct trafcount));
 | 
					             memset(newtrafcount, 0, sizeof(struct trafcount));
 | 
				
			||||||
             newtrafcount->ace = newace;
 | 
					             newtrafcount->ace = newace;
 | 
				
			||||||
             newtrafcount->type=rtype;
 | 
					             newtrafcount->type=rtype;
 | 
				
			||||||
             newtrafcount->traflim64  = traflimit;
 | 
					             newtrafcount->traflim64  = traflimit;
 | 
				
			||||||
             newtrafcount->comment=(*mypluginlink->mystrdup)("ldapcounters");
 | 
					             newtrafcount->comment=(*mypluginlink->strdup)("ldapcounters");
 | 
				
			||||||
             newtrafcount->number=0;
 | 
					             newtrafcount->number=0;
 | 
				
			||||||
             tmpbuf=(*mypluginlink->myalloc)(strlen(pat_file)+strlen(ldap_dircount)+strlen(vals[0]));
 | 
					             tmpbuf=(*mypluginlink->malloc)(strlen(pat_file)+strlen(ldap_dircount)+strlen(vals[0]));
 | 
				
			||||||
             sprintf(tmpbuf,pat_file,ldap_dircount,vals[0]);
 | 
					             sprintf(tmpbuf,pat_file,ldap_dircount,vals[0]);
 | 
				
			||||||
             f=NULL;
 | 
					             f=NULL;
 | 
				
			||||||
             f=fopen(tmpbuf,"rb");
 | 
					             f=fopen(tmpbuf,"rb");
 | 
				
			||||||
@ -396,7 +396,7 @@ int h_trafgroup(int argc, unsigned char ** argv)
 | 
				
			|||||||
               newtrafcount->updated=rcounter.updated;
 | 
					               newtrafcount->updated=rcounter.updated;
 | 
				
			||||||
               fclose(f);
 | 
					               fclose(f);
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
             mypluginlink->myfree(tmpbuf);   
 | 
					             mypluginlink->free(tmpbuf);   
 | 
				
			||||||
 | 
					
 | 
				
			||||||
             newtrafcount->next = mypluginlink->conf->trafcounter;
 | 
					             newtrafcount->next = mypluginlink->conf->trafcounter;
 | 
				
			||||||
             mypluginlink->conf->trafcounter = newtrafcount;
 | 
					             mypluginlink->conf->trafcounter = newtrafcount;
 | 
				
			||||||
@ -422,8 +422,8 @@ int h_attrsgroup(int argc, unsigned char ** argv)
 | 
				
			|||||||
   fprintf(stderr, "Error in ldapattr: See documentation of ldapauth plugin.\n");		
 | 
					   fprintf(stderr, "Error in ldapattr: See documentation of ldapauth plugin.\n");		
 | 
				
			||||||
   return 1;
 | 
					   return 1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  attrs[0]=mypluginlink->mystrdup(argv[1]);
 | 
					  attrs[0]=mypluginlink->strdup(argv[1]);
 | 
				
			||||||
  ldap_group_attr=mypluginlink->mystrdup(argv[2]);   
 | 
					  ldap_group_attr=mypluginlink->strdup(argv[2]);   
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
  if(argc == 4)
 | 
					  if(argc == 4)
 | 
				
			||||||
   { usercaselow=atoi(argv[3]); }
 | 
					   { usercaselow=atoi(argv[3]); }
 | 
				
			||||||
@ -439,7 +439,7 @@ int h_dircount(int argc, unsigned char ** argv)
 | 
				
			|||||||
   fprintf(stderr, "Error in ldapdircount: See documentation of ldapauth plugin.\n");		
 | 
					   fprintf(stderr, "Error in ldapdircount: See documentation of ldapauth plugin.\n");		
 | 
				
			||||||
   return 1;
 | 
					   return 1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  ldap_dircount=mypluginlink->mystrdup(argv[1]);
 | 
					  ldap_dircount=mypluginlink->strdup(argv[1]);
 | 
				
			||||||
  return 0;
 | 
					  return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -460,15 +460,15 @@ PLUGINAPI int PLUGINCALL start(struct pluginlink * pluginlink,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 if (already_loaded != 0)
 | 
					 if (already_loaded != 0)
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
    pluginlink->myfree(ldap_access);
 | 
					    pluginlink->free(ldap_access);
 | 
				
			||||||
    pluginlink->myfree(ldap_sbase);
 | 
					    pluginlink->free(ldap_sbase);
 | 
				
			||||||
    pluginlink->myfree(ldap_serv);
 | 
					    pluginlink->free(ldap_serv);
 | 
				
			||||||
    pluginlink->myfree(ldap_user);
 | 
					    pluginlink->free(ldap_user);
 | 
				
			||||||
    pluginlink->myfree(ldap_pass);
 | 
					    pluginlink->free(ldap_pass);
 | 
				
			||||||
    pluginlink->myfree(ldap_userenv);
 | 
					    pluginlink->free(ldap_userenv);
 | 
				
			||||||
    pluginlink->myfree(ldap_dircount);
 | 
					    pluginlink->free(ldap_dircount);
 | 
				
			||||||
    pluginlink->myfree(ldap_group_attr);
 | 
					    pluginlink->free(ldap_group_attr);
 | 
				
			||||||
    pluginlink->myfree(attrs[0]);
 | 
					    pluginlink->free(attrs[0]);
 | 
				
			||||||
    return (0);
 | 
					    return (0);
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -84,10 +84,10 @@ static void pcre_data_free(struct pcre_filter_data *pcrefd){
 | 
				
			|||||||
	pthread_mutex_lock(&pcre_mutex);
 | 
						pthread_mutex_lock(&pcre_mutex);
 | 
				
			||||||
	pcrefd->users--;
 | 
						pcrefd->users--;
 | 
				
			||||||
	if(!pcrefd->users){
 | 
						if(!pcrefd->users){
 | 
				
			||||||
		if(pcrefd->re) pl->myfree(pcrefd->re);
 | 
							if(pcrefd->re) pl->free(pcrefd->re);
 | 
				
			||||||
		if(pcrefd->acl) pl->freeacl(pcrefd->acl);
 | 
							if(pcrefd->acl) pl->freeacl(pcrefd->acl);
 | 
				
			||||||
		if(pcrefd->replace) pl->myfree(pcrefd->replace);
 | 
							if(pcrefd->replace) pl->free(pcrefd->replace);
 | 
				
			||||||
		pl->myfree(pcrefd);
 | 
							pl->free(pcrefd);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pthread_mutex_unlock(&pcre_mutex);
 | 
						pthread_mutex_unlock(&pcre_mutex);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -167,7 +167,7 @@ static FILTER_ACTION pcre_filter_buffer(void *fc, struct clientparam *param, uns
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		tmpbuf =  (*pl->myalloc)(replen);
 | 
							tmpbuf =  (*pl->malloc)(replen);
 | 
				
			||||||
		if(!tmpbuf) return CONTINUE;
 | 
							if(!tmpbuf) return CONTINUE;
 | 
				
			||||||
		for(target = tmpbuf, replace = pcrefd->replace; *replace; ){
 | 
							for(target = tmpbuf, replace = pcrefd->replace; *replace; ){
 | 
				
			||||||
			if(*replace == '\\' && *(replace +1)){
 | 
								if(*replace == '\\' && *(replace +1)){
 | 
				
			||||||
@ -188,18 +188,18 @@ static FILTER_ACTION pcre_filter_buffer(void *fc, struct clientparam *param, uns
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		memcpy(target, *buf_p + ovector[1], *length_p - ovector[1]);
 | 
							memcpy(target, *buf_p + ovector[1], *length_p - ovector[1]);
 | 
				
			||||||
		if((ovector[0] + replen + 1) > *bufsize_p){
 | 
							if((ovector[0] + replen + 1) > *bufsize_p){
 | 
				
			||||||
			newbuf = (*pl->myalloc)(ovector[0] + replen + 1);
 | 
								newbuf = (*pl->malloc)(ovector[0] + replen + 1);
 | 
				
			||||||
			if(!newbuf){
 | 
								if(!newbuf){
 | 
				
			||||||
				(*pl->myfree)(tmpbuf);
 | 
									(*pl->free)(tmpbuf);
 | 
				
			||||||
				return CONTINUE;
 | 
									return CONTINUE;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			memcpy(newbuf, *buf_p, ovector[0]);
 | 
								memcpy(newbuf, *buf_p, ovector[0]);
 | 
				
			||||||
			(*pl->myfree)(*buf_p);
 | 
								(*pl->free)(*buf_p);
 | 
				
			||||||
			*buf_p = (unsigned char *)newbuf;
 | 
								*buf_p = (unsigned char *)newbuf;
 | 
				
			||||||
			*bufsize_p = ovector[0] + replen + 1;
 | 
								*bufsize_p = ovector[0] + replen + 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		memcpy(*buf_p + ovector[0], tmpbuf, replen);
 | 
							memcpy(*buf_p + ovector[0], tmpbuf, replen);
 | 
				
			||||||
		(*pl->myfree)(tmpbuf);
 | 
							(*pl->free)(tmpbuf);
 | 
				
			||||||
		(*buf_p)[ovector[0] + replen] = 0;
 | 
							(*buf_p)[ovector[0] + replen] = 0;
 | 
				
			||||||
		*length_p = ovector[0] + replen;
 | 
							*length_p = ovector[0] + replen;
 | 
				
			||||||
		if(ovector[0] + replen <= offset){
 | 
							if(ovector[0] + replen <= offset){
 | 
				
			||||||
@ -237,7 +237,7 @@ static int h_pcre(int argc, unsigned char **argv){
 | 
				
			|||||||
	if(!strncmp((char *)argv[0], "pcre_rewrite", 12)) {
 | 
						if(!strncmp((char *)argv[0], "pcre_rewrite", 12)) {
 | 
				
			||||||
		int i,j;
 | 
							int i,j;
 | 
				
			||||||
		offset = 5;
 | 
							offset = 5;
 | 
				
			||||||
		replace = pl->mystrdup((char *)argv[4]);
 | 
							replace = pl->strdup((char *)argv[4]);
 | 
				
			||||||
		if(!replace) return 9;
 | 
							if(!replace) return 9;
 | 
				
			||||||
		for(i=0, j=0; replace[i]; i++, j++){
 | 
							for(i=0, j=0; replace[i]; i++, j++){
 | 
				
			||||||
			if(replace[i] == '\\'){
 | 
								if(replace[i] == '\\'){
 | 
				
			||||||
@ -270,19 +270,19 @@ static int h_pcre(int argc, unsigned char **argv){
 | 
				
			|||||||
	if(*argv[3] && !(*argv[3] == '*' && !argv[3][1]) ){
 | 
						if(*argv[3] && !(*argv[3] == '*' && !argv[3][1]) ){
 | 
				
			||||||
		re = pcre_compile((char *)argv[3], pcre_options, &errptr, &offset, NULL);
 | 
							re = pcre_compile((char *)argv[3], pcre_options, &errptr, &offset, NULL);
 | 
				
			||||||
		if(!re) {
 | 
							if(!re) {
 | 
				
			||||||
			pl->myfree(acl);
 | 
								pl->free(acl);
 | 
				
			||||||
			if(replace) pl->myfree(replace);
 | 
								if(replace) pl->free(replace);
 | 
				
			||||||
			return 3;
 | 
								return 3;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	flt = pl->myalloc(sizeof(struct pcre_filter_data));
 | 
						flt = pl->malloc(sizeof(struct pcre_filter_data));
 | 
				
			||||||
	newf = pl->myalloc(sizeof(struct filter));
 | 
						newf = pl->malloc(sizeof(struct filter));
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if(!flt || !newf) {
 | 
						if(!flt || !newf) {
 | 
				
			||||||
		pl->myfree(acl);
 | 
							pl->free(acl);
 | 
				
			||||||
		pl->myfree(re);
 | 
							pl->free(re);
 | 
				
			||||||
		if(replace) pl->myfree(replace);
 | 
							if(replace) pl->free(replace);
 | 
				
			||||||
		if(flt) pl->myfree(flt);
 | 
							if(flt) pl->free(flt);
 | 
				
			||||||
		return 4;
 | 
							return 4;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	memset(flt, 0, sizeof(struct pcre_filter_data));
 | 
						memset(flt, 0, sizeof(struct pcre_filter_data));
 | 
				
			||||||
@ -367,11 +367,11 @@ PLUGINAPI int PLUGINCALL pcre_plugin (struct pluginlink * pluginlink,
 | 
				
			|||||||
	pl = pluginlink;
 | 
						pl = pluginlink;
 | 
				
			||||||
	pcre_options = 0;
 | 
						pcre_options = 0;
 | 
				
			||||||
	if(!pcre_loaded){
 | 
						if(!pcre_loaded){
 | 
				
			||||||
		pcre_malloc = pl->myalloc;
 | 
							pcre_malloc = pl->malloc;
 | 
				
			||||||
		pcre_free = pl->myfree;
 | 
							pcre_free = pl->free;
 | 
				
			||||||
		pcre_loaded = 1;
 | 
							pcre_loaded = 1;
 | 
				
			||||||
		pthread_mutex_init(&pcre_mutex, NULL);
 | 
							pthread_mutex_init(&pcre_mutex, NULL);
 | 
				
			||||||
		regexp_symbols[6].value = pl->myfree;
 | 
							regexp_symbols[6].value = pl->free;
 | 
				
			||||||
		regexp_symbols[6].next = pl->symbols.next;
 | 
							regexp_symbols[6].next = pl->symbols.next;
 | 
				
			||||||
		pl->symbols.next = regexp_symbols;
 | 
							pl->symbols.next = regexp_symbols;
 | 
				
			||||||
		pcre_commandhandlers[3].next = pl->commandhandlers->next;
 | 
							pcre_commandhandlers[3].next = pl->commandhandlers->next;
 | 
				
			||||||
@ -386,7 +386,7 @@ PLUGINAPI int PLUGINCALL pcre_plugin (struct pluginlink * pluginlink,
 | 
				
			|||||||
			tmpflt = flt->next;
 | 
								tmpflt = flt->next;
 | 
				
			||||||
			if(flt->data)
 | 
								if(flt->data)
 | 
				
			||||||
				pcre_data_free((struct pcre_filter_data *)flt->data);
 | 
									pcre_data_free((struct pcre_filter_data *)flt->data);
 | 
				
			||||||
			pl->myfree(flt);
 | 
								pl->free(flt);
 | 
				
			||||||
			if(flt == pcre_last_filter) break;
 | 
								if(flt == pcre_last_filter) break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
@ -131,8 +131,8 @@ PLUGINAPI int PLUGINCALL start(struct pluginlink * pluginlink, int argc, unsigne
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
 if(argc < 2) return 1;
 | 
					 if(argc < 2) return 1;
 | 
				
			||||||
 pl = pluginlink;
 | 
					 pl = pluginlink;
 | 
				
			||||||
 if(service) pl->myfree(service);
 | 
					 if(service) pl->free(service);
 | 
				
			||||||
 service=(unsigned char *)pl->mystrdup((char *)argv[1]); 
 | 
					 service=(unsigned char *)pl->strdup((char *)argv[1]); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 if (already_loaded) { return (0); }
 | 
					 if (already_loaded) { return (0); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -44,7 +44,7 @@ char **load_string(FILE *f,int max_count_str, int *countloadstr,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 /*create table for old strings */
 | 
					 /*create table for old strings */
 | 
				
			||||||
 old_table=(char **)mypl->myalloc(max_count_str*sizeof(char *));
 | 
					 old_table=(char **)mypl->malloc(max_count_str*sizeof(char *));
 | 
				
			||||||
 memset(old_table,0,max_count_str*sizeof(char *)); 
 | 
					 memset(old_table,0,max_count_str*sizeof(char *)); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 /*load from file new  strings */
 | 
					 /*load from file new  strings */
 | 
				
			||||||
@ -77,13 +77,13 @@ char **load_string(FILE *f,int max_count_str, int *countloadstr,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
         cstr=cstr+(int)strlen(tmpbuf1)+1;
 | 
					         cstr=cstr+(int)strlen(tmpbuf1)+1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         p = (char *)mypl->myalloc(cstr);
 | 
					         p = (char *)mypl->malloc(cstr);
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
         if (pt!=NULL)
 | 
					         if (pt!=NULL)
 | 
				
			||||||
          { 
 | 
					          { 
 | 
				
			||||||
            strcpy(p, pt);  
 | 
					            strcpy(p, pt);  
 | 
				
			||||||
            strcat(p, tmpbuf1);  
 | 
					            strcat(p, tmpbuf1);  
 | 
				
			||||||
            mypl->myfree(pt); 
 | 
					            mypl->free(pt); 
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
         else   
 | 
					         else   
 | 
				
			||||||
          {  strcpy(p, tmpbuf1);  }
 | 
					          {  strcpy(p, tmpbuf1);  }
 | 
				
			||||||
@ -104,9 +104,9 @@ char **load_string(FILE *f,int max_count_str, int *countloadstr,
 | 
				
			|||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if(pt)mypl->myfree(pt);
 | 
					  if(pt)mypl->free(pt);
 | 
				
			||||||
  *countloadstr=i;
 | 
					  *countloadstr=i;
 | 
				
			||||||
  if (i==0) { mypl->myfree(old_table); old_table=NULL; }
 | 
					  if (i==0) { mypl->free(old_table); old_table=NULL; }
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
 return old_table;
 | 
					 return old_table;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -124,9 +124,9 @@ static int restore_old_table(void * v)
 | 
				
			|||||||
    for(i=0; i < count_str_proxy_in_3proxy; i++){
 | 
					    for(i=0; i < count_str_proxy_in_3proxy; i++){
 | 
				
			||||||
       p=mypl->proxy_table[i];
 | 
					       p=mypl->proxy_table[i];
 | 
				
			||||||
       mypl->proxy_table[i]=old_proxy_table[i];
 | 
					       mypl->proxy_table[i]=old_proxy_table[i];
 | 
				
			||||||
       mypl->myfree(p);
 | 
					       mypl->free(p);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    mypl->myfree(old_proxy_table);
 | 
					    mypl->free(old_proxy_table);
 | 
				
			||||||
    old_proxy_table = NULL;
 | 
					    old_proxy_table = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -140,9 +140,9 @@ static int restore_old_table(void * v)
 | 
				
			|||||||
   for(i=0; i < count_str_admin_in_3proxy; i++){
 | 
					   for(i=0; i < count_str_admin_in_3proxy; i++){
 | 
				
			||||||
       p=mypl->admin_table[i];
 | 
					       p=mypl->admin_table[i];
 | 
				
			||||||
       mypl->admin_table[i]=old_admin_table[i];
 | 
					       mypl->admin_table[i]=old_admin_table[i];
 | 
				
			||||||
       mypl->myfree(p);
 | 
					       mypl->free(p);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    mypl->myfree(old_admin_table);
 | 
					    mypl->free(old_admin_table);
 | 
				
			||||||
    old_admin_table = NULL;
 | 
					    old_admin_table = NULL;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 /*return 1  delete job, 0 no delete!!! :)*/
 | 
					 /*return 1  delete job, 0 no delete!!! :)*/
 | 
				
			||||||
 | 
				
			|||||||
@ -74,7 +74,7 @@ static void killtrafcorrect() {
 | 
				
			|||||||
	while (p) {
 | 
						while (p) {
 | 
				
			||||||
		d = p;
 | 
							d = p;
 | 
				
			||||||
		p = p->next;
 | 
							p = p->next;
 | 
				
			||||||
		pl->myfree(d);
 | 
							pl->free(d);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -94,7 +94,7 @@ int h_trafcorrect(int argc, unsigned char ** argv) {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			return 1;
 | 
								return 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		newitem = (struct trafcorrect *)pl->myalloc(sizeof(struct trafcorrect));
 | 
							newitem = (struct trafcorrect *)pl->malloc(sizeof(struct trafcorrect));
 | 
				
			||||||
		newitem->next = NULL;
 | 
							newitem->next = NULL;
 | 
				
			||||||
		newitem->type = MULTIPLAY;
 | 
							newitem->type = MULTIPLAY;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -112,7 +112,7 @@ int h_trafcorrect(int argc, unsigned char ** argv) {
 | 
				
			|||||||
		newitem->coeff = atof((char *)argv[4]);
 | 
							newitem->coeff = atof((char *)argv[4]);
 | 
				
			||||||
		/* ďđîâĺđęŕ íŕ ęîđđĺęňíîńňü ââîäŕ */
 | 
							/* ďđîâĺđęŕ íŕ ęîđđĺęňíîńňü ââîäŕ */
 | 
				
			||||||
		if ((newitem->port>65535) | (newitem->coeff<=0) | (newitem->coeff>100)) {
 | 
							if ((newitem->port>65535) | (newitem->coeff<=0) | (newitem->coeff>100)) {
 | 
				
			||||||
			pl->myfree(newitem);
 | 
								pl->free(newitem);
 | 
				
			||||||
			if(DBGLEVEL == 1)fprintf(stdout, "Port must be 0<p<65535 and coefficient must be 0<c<100.\n");
 | 
								if(DBGLEVEL == 1)fprintf(stdout, "Port must be 0<p<65535 and coefficient must be 0<c<100.\n");
 | 
				
			||||||
			return 2;
 | 
								return 2;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -130,7 +130,7 @@ int h_trafcorrect(int argc, unsigned char ** argv) {
 | 
				
			|||||||
			return 1;
 | 
								return 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		newitem = (struct trafcorrect *)pl->myalloc(sizeof(struct trafcorrect));	
 | 
							newitem = (struct trafcorrect *)pl->malloc(sizeof(struct trafcorrect));	
 | 
				
			||||||
		newitem->next = NULL;
 | 
							newitem->next = NULL;
 | 
				
			||||||
		newitem->type = IPCORRECT;
 | 
							newitem->type = IPCORRECT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -158,7 +158,7 @@ int h_trafcorrect(int argc, unsigned char ** argv) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ((newitem->port>65535) | (newitem->psize<=0)) {
 | 
							if ((newitem->port>65535) | (newitem->psize<=0)) {
 | 
				
			||||||
			pl->myfree(newitem);
 | 
								pl->free(newitem);
 | 
				
			||||||
			if(DBGLEVEL == 1)fprintf(stdout, "Port must be 0<p<65535.\n");
 | 
								if(DBGLEVEL == 1)fprintf(stdout, "Port must be 0<p<65535.\n");
 | 
				
			||||||
			return 2;
 | 
								return 2;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -62,8 +62,8 @@ static FILTER_ACTION transparent_filter_client(void *fo, struct clientparam * pa
 | 
				
			|||||||
	param->sincl = param->srv->intsa;
 | 
						param->sincl = param->srv->intsa;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	pl->myinet_ntop(*SAFAMILY(¶m->req), SAADDR(¶m->req), (char *)addrbuf, sizeof(addrbuf));
 | 
						pl->myinet_ntop(*SAFAMILY(¶m->req), SAADDR(¶m->req), (char *)addrbuf, sizeof(addrbuf));
 | 
				
			||||||
	if(param->hostname) pl->myfree(param->hostname);
 | 
						if(param->hostname) pl->free(param->hostname);
 | 
				
			||||||
	param->hostname = pl->mystrdup(addrbuf);
 | 
						param->hostname = pl->strdup(addrbuf);
 | 
				
			||||||
	param->sinsr = param->req;
 | 
						param->sinsr = param->req;
 | 
				
			||||||
	return PASS;
 | 
						return PASS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user