Clearing LdapPlugin compilation issues

This commit is contained in:
z3APA3A 2018-04-06 17:45:18 +03:00
parent f8557187cd
commit 5c9bb58a81
3 changed files with 24 additions and 24 deletions

View File

@ -4,4 +4,4 @@ ldapauth$(OBJSUFFICS): ldapauth.c
$(CC) $(DCFLAGS) $(CFLAGS) ldapauth.c $(CC) $(DCFLAGS) $(CFLAGS) ldapauth.c
$(BUILDDIR)ldapauth$(DLSUFFICS): ldapauth$(OBJSUFFICS) $(BUILDDIR)ldapauth$(DLSUFFICS): ldapauth$(OBJSUFFICS)
$(LN) $(LNOUT)../../$(BUILDDIR)ldapauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) $(LIBSPREFIX)ladp$(LIBSSUFFIX) ldapauth$(OBJSUFFICS) $(LN) $(LNOUT)../../$(BUILDDIR)ldapauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) $(LIBSPREFIX)ldap$(LIBSSUFFIX) ldapauth$(OBJSUFFICS)

View File

@ -1,25 +1,15 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <time.h> #include <time.h>
#include <ldap.h>
#ifndef _WIN32 #ifndef _WIN32
#include <ctype.h> #include <ctype.h>
#endif #endif
#include "../../proxy.h"
#include "../../structures.h" #include "../../structures.h"
#define LDAP_DEPRECATED 1
struct counter_record #include <ldap.h>
{
unsigned long traf;
unsigned long trafgb;
time_t cleared;
time_t updated;
};
int already_loaded = 0; int already_loaded = 0;
@ -62,7 +52,7 @@ void lower (char *string)
#endif #endif
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
int savecouters(void) int savecounters(void)
{ {
struct trafcount *tc=mypluginlink->conf->trafcounter; struct trafcount *tc=mypluginlink->conf->trafcounter;
struct trafcount *tcd; struct trafcount *tcd;
@ -82,8 +72,8 @@ int savecouters(void)
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);
fprintf(f,"%10lu %10lu %lu %lu\n",tcd->trafgb,tcd->traf, fprintf(f,"%"PRINTF_INT64_MODIFIER"u %lu %lu\n",tcd->traf64,
tcd->cleared,tcd->updated); (unsigned long)tcd->cleared,(unsigned long)tcd->updated);
fclose(f); fclose(f);
mypluginlink->myfree(tmpbuf); mypluginlink->myfree(tmpbuf);
@ -385,8 +375,7 @@ int h_trafgroup(int argc, unsigned char ** argv)
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->traflimgb =(traflimit/(1024*4)); newtrafcount->traflim64 = traflimit;
newtrafcount->traflim = ((traflimit - (newtrafcount->traflimgb*(1024*4)))*(1024*1024));
newtrafcount->comment=(*mypluginlink->mystrdup)("ldapcounters"); newtrafcount->comment=(*mypluginlink->mystrdup)("ldapcounters");
newtrafcount->number=0; newtrafcount->number=0;
tmpbuf=(*mypluginlink->myalloc)(strlen(pat_file)+strlen(ldap_dircount)+strlen(vals[0])); tmpbuf=(*mypluginlink->myalloc)(strlen(pat_file)+strlen(ldap_dircount)+strlen(vals[0]));
@ -398,12 +387,11 @@ int h_trafgroup(int argc, unsigned char ** argv)
fseek(f,0,SEEK_SET); fseek(f,0,SEEK_SET);
fgets(buf, 256, f); fgets(buf, 256, f);
sscanf(buf,"%10lu %10lu %lu %lu\n",&rcounter.trafgb, &rcounter.traf, sscanf(buf,"%"PRINTF_INT64_MODIFIER"u %lu %lu\n",&rcounter.traf64,
&rcounter.cleared, &rcounter.updated); &rcounter.cleared, &rcounter.updated);
newtrafcount->trafgb=rcounter.trafgb; newtrafcount->traf64=rcounter.traf64;
newtrafcount->traf=rcounter.traf;
newtrafcount->cleared=rcounter.cleared; newtrafcount->cleared=rcounter.cleared;
newtrafcount->updated=rcounter.updated; newtrafcount->updated=rcounter.updated;
fclose(f); fclose(f);
@ -565,7 +553,7 @@ PLUGINAPI int PLUGINCALL start(struct pluginlink * pluginlink,
/*create job shedule for processing reload, save counters to file */ /*create job shedule for processing reload, save counters to file */
memset(&myschedule,0,sizeof(struct schedule)); memset(&myschedule,0,sizeof(struct schedule));
myschedule.type=MINUTELY; myschedule.type=MINUTELY;
myschedule.function=savecouters; myschedule.function=savecounters;
myschedule.next = *pluginlink->schedule; myschedule.next = *pluginlink->schedule;
*pluginlink->schedule=&myschedule; *pluginlink->schedule=&myschedule;

View File

@ -76,6 +76,18 @@ int
#endif #endif
#define ALLOW 0
#define DENY 1
#define REDIRECT 2
#define BANDLIM 3
#define NOBANDLIM 4
#define COUNTIN 5
#define NOCOUNTIN 6
#define COUNTOUT 7
#define NOCOUNTOUT 8
#define CONNLIM 9
#define NOCONNLIM 10
#define CONNECT 0x00000001 #define CONNECT 0x00000001
#define BIND 0x00000002 #define BIND 0x00000002
#define UDPASSOC 0x00000004 #define UDPASSOC 0x00000004