mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 10:35:40 +08:00
rename memory functions in pluginlink
This commit is contained in:
parent
e7e7d2fddf
commit
22cf9254c5
@ -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->malloc(strlen(pat_file)+strlen(ldap_dircount)+strlen(tcd->ace->users->user));
|
tmpbuf=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->free(tmpbuf);
|
free(tmpbuf);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,15 +194,15 @@ int h_ldapconnect(int argc, unsigned char ** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ldap_serv=mypluginlink->strdup(argv[1]);
|
ldap_serv=strdup(argv[1]);
|
||||||
ldap_user=mypluginlink->strdup(argv[2]);
|
ldap_user=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->strdup(argv[3]);
|
ldap_pass= 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->strdup(argv[1]);
|
ldap_access=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->strdup(argv[1]);
|
ldap_sbase=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->strdup(argv[1]);
|
ldap_userenv=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->malloc(strlen(pat_group)+strlen(ldap_group_attr)+strlen(argv[1]));
|
tmpbuf=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->free(tmpbuf);
|
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->malloc)(sizeof (struct userlist));
|
newuserlist = (*mypluginlink->mallocfunc)(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->strdup)(vals[0]);
|
newuserlist->user = (*mypluginlink->strdupfunc)(vals[0]);
|
||||||
newuserlist->next = NULL;
|
newuserlist->next = NULL;
|
||||||
/*create user rule */
|
/*create user rule */
|
||||||
newace = (*mypluginlink->malloc)(sizeof (struct ace));
|
newace = (*mypluginlink->mallocfunc)(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->malloc)(sizeof (struct bandlim));
|
newbandlim =(*mypluginlink->mallocfunc)(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->malloc)(sizeof (struct userlist));
|
newuserlist = (*mypluginlink->mallocfunc)(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->strdup)(vals[0]);
|
newuserlist->user = (*mypluginlink->strdupfunc)(vals[0]);
|
||||||
newuserlist->next = NULL;
|
newuserlist->next = NULL;
|
||||||
/*create user rule */
|
/*create user rule */
|
||||||
newace = (*mypluginlink->malloc)(sizeof (struct ace));
|
newace = (*mypluginlink->mallocfunc)(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->malloc)(sizeof (struct trafcount));
|
newtrafcount =(*mypluginlink->mallocfunc)(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->strdup)("ldapcounters");
|
newtrafcount->comment=(*mypluginlink->strdupfunc)("ldapcounters");
|
||||||
newtrafcount->number=0;
|
newtrafcount->number=0;
|
||||||
tmpbuf=(*mypluginlink->malloc)(strlen(pat_file)+strlen(ldap_dircount)+strlen(vals[0]));
|
tmpbuf=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->free(tmpbuf);
|
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->strdup(argv[1]);
|
attrs[0]=strdup(argv[1]);
|
||||||
ldap_group_attr=mypluginlink->strdup(argv[2]);
|
ldap_group_attr=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->strdup(argv[1]);
|
ldap_dircount=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->free(ldap_access);
|
free(ldap_access);
|
||||||
pluginlink->free(ldap_sbase);
|
free(ldap_sbase);
|
||||||
pluginlink->free(ldap_serv);
|
free(ldap_serv);
|
||||||
pluginlink->free(ldap_user);
|
free(ldap_user);
|
||||||
pluginlink->free(ldap_pass);
|
free(ldap_pass);
|
||||||
pluginlink->free(ldap_userenv);
|
free(ldap_userenv);
|
||||||
pluginlink->free(ldap_dircount);
|
free(ldap_dircount);
|
||||||
pluginlink->free(ldap_group_attr);
|
free(ldap_group_attr);
|
||||||
pluginlink->free(attrs[0]);
|
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->free(pcrefd->re);
|
if(pcrefd->re) pl->freefunc(pcrefd->re);
|
||||||
if(pcrefd->acl) pl->freeacl(pcrefd->acl);
|
if(pcrefd->acl) pl->freeacl(pcrefd->acl);
|
||||||
if(pcrefd->replace) pl->free(pcrefd->replace);
|
if(pcrefd->replace) pl->freefunc(pcrefd->replace);
|
||||||
pl->free(pcrefd);
|
pl->freefunc(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->malloc)(replen);
|
tmpbuf = pl->mallocfunc(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->malloc)(ovector[0] + replen + 1);
|
newbuf = pl->mallocfunc(ovector[0] + replen + 1);
|
||||||
if(!newbuf){
|
if(!newbuf){
|
||||||
(*pl->free)(tmpbuf);
|
pl->freefunc(tmpbuf);
|
||||||
return CONTINUE;
|
return CONTINUE;
|
||||||
}
|
}
|
||||||
memcpy(newbuf, *buf_p, ovector[0]);
|
memcpy(newbuf, *buf_p, ovector[0]);
|
||||||
(*pl->free)(*buf_p);
|
pl->freefunc(*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->free)(tmpbuf);
|
pl->freefunc(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->strdup((char *)argv[4]);
|
replace = pl->strdupfunc((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->free(acl);
|
pl->freefunc(acl);
|
||||||
if(replace) pl->free(replace);
|
if(replace) pl->freefunc(replace);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flt = pl->malloc(sizeof(struct pcre_filter_data));
|
flt = pl->mallocfunc(sizeof(struct pcre_filter_data));
|
||||||
newf = pl->malloc(sizeof(struct filter));
|
newf = pl->mallocfunc(sizeof(struct filter));
|
||||||
|
|
||||||
if(!flt || !newf) {
|
if(!flt || !newf) {
|
||||||
pl->free(acl);
|
pl->freefunc(acl);
|
||||||
pl->free(re);
|
pl->freefunc(re);
|
||||||
if(replace) pl->free(replace);
|
if(replace) pl->freefunc(replace);
|
||||||
if(flt) pl->free(flt);
|
if(flt) pl->freefunc(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->malloc;
|
pcre_malloc = pl->mallocfunc;
|
||||||
pcre_free = pl->free;
|
pcre_free = pl->freefunc;
|
||||||
pcre_loaded = 1;
|
pcre_loaded = 1;
|
||||||
pthread_mutex_init(&pcre_mutex, NULL);
|
pthread_mutex_init(&pcre_mutex, NULL);
|
||||||
regexp_symbols[6].value = pl->free;
|
regexp_symbols[6].value = pl->freefunc;
|
||||||
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->free(flt);
|
pl->freefunc(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->free(service);
|
if(service) free(service);
|
||||||
service=(unsigned char *)pl->strdup((char *)argv[1]);
|
service=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->malloc(max_count_str*sizeof(char *));
|
old_table=(char **)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->malloc(cstr);
|
p = (char *)malloc(cstr);
|
||||||
|
|
||||||
if (pt!=NULL)
|
if (pt!=NULL)
|
||||||
{
|
{
|
||||||
strcpy(p, pt);
|
strcpy(p, pt);
|
||||||
strcat(p, tmpbuf1);
|
strcat(p, tmpbuf1);
|
||||||
mypl->free(pt);
|
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->free(pt);
|
if(pt)free(pt);
|
||||||
*countloadstr=i;
|
*countloadstr=i;
|
||||||
if (i==0) { mypl->free(old_table); old_table=NULL; }
|
if (i==0) { 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->free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
mypl->free(old_proxy_table);
|
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->free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
mypl->free(old_admin_table);
|
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->free(d);
|
free(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ int h_trafcorrect(int argc, unsigned char ** argv) {
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
newitem = (struct trafcorrect *)pl->malloc(sizeof(struct trafcorrect));
|
newitem = (struct trafcorrect *)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->free(newitem);
|
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->malloc(sizeof(struct trafcorrect));
|
newitem = (struct trafcorrect *)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->free(newitem);
|
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->free(param->hostname);
|
if(param->hostname) pl->freefunc(param->hostname);
|
||||||
param->hostname = pl->strdup(addrbuf);
|
param->hostname = pl->strdupfunc(addrbuf);
|
||||||
param->sinsr = param->req;
|
param->sinsr = param->req;
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
@ -138,6 +138,11 @@ void daemonize(void);
|
|||||||
|
|
||||||
#define DEFLOGFORMAT "G%y%m%d%H%M%S.%. %p %E %U %C:%c %R:%r %O %I %h %T"
|
#define DEFLOGFORMAT "G%y%m%d%H%M%S.%. %p %E %U %C:%c %R:%r %O %I %h %T"
|
||||||
|
|
||||||
|
#define myalloc malloc
|
||||||
|
#define myfree free
|
||||||
|
#define myrealloc realloc
|
||||||
|
#define mystrdup strdup
|
||||||
|
|
||||||
extern RESOLVFUNC resolvfunc;
|
extern RESOLVFUNC resolvfunc;
|
||||||
|
|
||||||
extern int wday;
|
extern int wday;
|
||||||
|
@ -237,7 +237,7 @@ CLEANRET:
|
|||||||
int repcode;
|
int repcode;
|
||||||
|
|
||||||
sasize = sizeof(sin);
|
sasize = sizeof(sin);
|
||||||
if(command != 3) so._getsockname(param->remsock, (struct sockaddr *)&sin, &sasize);
|
if(command != 3 && param->remsock != INVALID_SOCKET) so._getsockname(param->remsock, (struct sockaddr *)&sin, &sasize);
|
||||||
else so._getsockname(param->clisock, (struct sockaddr *)&sin, &sasize);
|
else so._getsockname(param->clisock, (struct sockaddr *)&sin, &sasize);
|
||||||
#if SOCKSTRACE > 0
|
#if SOCKSTRACE > 0
|
||||||
fprintf(stderr, "Sending confirmation to client with code %d for %s with %s:%hu\n",
|
fprintf(stderr, "Sending confirmation to client with code %d for %s with %s:%hu\n",
|
||||||
|
@ -197,11 +197,6 @@ typedef void * (*EXTENDFUNC) (struct node *node);
|
|||||||
typedef void (*CBFUNC)(void *cb, char * buf, int inbuf);
|
typedef void (*CBFUNC)(void *cb, char * buf, int inbuf);
|
||||||
typedef void (*PRINTFUNC) (struct node *node, CBFUNC cbf, void*cb);
|
typedef void (*PRINTFUNC) (struct node *node, CBFUNC cbf, void*cb);
|
||||||
|
|
||||||
#define myalloc malloc
|
|
||||||
#define myfree free
|
|
||||||
#define myrealloc realloc
|
|
||||||
#define mystrdup strdup
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
#define PLUGINAPI __declspec(dllexport)
|
#define PLUGINAPI __declspec(dllexport)
|
||||||
@ -754,10 +749,10 @@ struct pluginlink {
|
|||||||
void (*decodeurl)(unsigned char *s, int allowcr);
|
void (*decodeurl)(unsigned char *s, int allowcr);
|
||||||
int (*parsestr) (unsigned char *str, unsigned char **argm, int nitems, unsigned char ** buff, int *inbuf, int *bufsize);
|
int (*parsestr) (unsigned char *str, unsigned char **argm, int nitems, unsigned char ** buff, int *inbuf, int *bufsize);
|
||||||
struct ace * (*make_ace) (int argc, unsigned char ** argv);
|
struct ace * (*make_ace) (int argc, unsigned char ** argv);
|
||||||
void * (*malloc)(size_t size);
|
void * (*mallocfunc)(size_t size);
|
||||||
void (*free)(void *ptr);
|
void (*freefunc)(void *ptr);
|
||||||
void *(*realloc)(void *ptr, size_t size);
|
void *(*reallocfunc)(void *ptr, size_t size);
|
||||||
char * (*strdup)(const char *str);
|
char * (*strdupfunc)(const char *str);
|
||||||
TRAFCOUNTFUNC trafcountfunc;
|
TRAFCOUNTFUNC trafcountfunc;
|
||||||
char ** proxy_table;
|
char ** proxy_table;
|
||||||
struct schedule ** schedule;
|
struct schedule ** schedule;
|
||||||
|
Loading…
Reference in New Issue
Block a user