Create the file isdn.conf

some bug fixes for pid and lock file
make the prefix of the code in `isdn.conf' variable
This commit is contained in:
luethje 1997-04-08 21:56:42 +00:00
parent 3265275d41
commit d38c0170dd
9 changed files with 158 additions and 78 deletions

View File

@ -1,4 +1,4 @@
## $Id: Makefile.in,v 1.9 1997/04/08 00:02:05 luethje Exp $
## $Id: Makefile.in,v 1.10 1997/04/08 21:56:42 luethje Exp $
##
## ISDN accounting for isdn4linux.
##
@ -19,6 +19,11 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Log: Makefile.in,v $
## Revision 1.10 1997/04/08 21:56:42 luethje
## Create the file isdn.conf
## some bug fixes for pid and lock file
## make the prefix of the code in `isdn.conf' variable
##
## Revision 1.9 1997/04/08 00:02:05 luethje
## Bugfix: isdnlog is running again ;-)
## isdnlog creates now a file like /var/lock/LCK..isdnctrl0
@ -59,6 +64,7 @@
.SUFFIXES: .c .o
SHELL := /bin/sh
GENCONF := install/genconf
#
# autoconf generic stuff
@ -82,6 +88,7 @@ MAN8DIR := $(MANDIR)/man8
MAN1EXT := .1
MAN8EXT := .8
SRCDIR := @srcdir@
#
# end of autoconf generic stuff
#
@ -89,22 +96,35 @@ SRCDIR := @srcdir@
#
# autoconf isdnlog specific stuff
#
INSTALL := @INSTALL@
INSTALL := @INSTALL@
INSTALL_DIR := $(INSTALL) -m 0755 -o 0 -g 0 -d
INSTALL_SBIN := $(INSTALL) -m 0700 -o 0 -g 0
INSTALL_BIN := $(INSTALL) -m 0755 -o 0 -g 0
INSTALL_DATA := $(INSTALL) -m 0644 -o 0 -g 0
LIBISDNDIR := @LIBISDNDIR@
I4LCONFDIR := @I4LCONFDIR@
LIBISDNDIR := @LIBISDNDIR@
I4LCONFDIR := @I4LCONFDIR@
CONFFILE := @CONFFILE@
OLDCONFDIR := @OLDCONFDIR@
LIBAREA := @LIBAREA@
RUNDIR := @RUNDIR@
DBMLIB := @DBMLIB@
POSTGRES := @POSTGRES@
POSTGRESDIR := @POSTGRESDIR@
POSTGRESDIR := @POSTGRESDIR@
SERV_PORT := @SERV_PORT@
USERFILE := @USERFILE@
DEFS :=
DEFS :=
export LOGFILE := @LOGFILE@
export COUNTRYCODE := @COUNTRYCODE@
export COUNTRYPREFIX := @COUNTRYPREFIX@
export AREACODE := @AREACODE@
export AREAPREFIX := @AREAPREFIX@
export ILABEL := %b %e %T %ICall to tei %t from %N2 on %n2
export OLABEL := %b %e %T %Itei %t calling %N2 with %n2
export CHARGEMAX := 1000.00
ifndef ROOTDIR
export ROOTDIR=$(shell pwd)
@ -142,7 +162,7 @@ SERVICEFILE = /etc/services
# DON'T EDIT BELOW THIS LINE
######################################################################
VERSION = 2.99.5
VERSION = 2.99.6
ifeq ($(POSTGRES),1)
DEFS += -DPOSTGRES
@ -232,8 +252,9 @@ installdirs: rootperm
install: depend all rootperm installdirs
if ps -x | fgrep $(ISDNLOG) >/dev/null; then kill `cat $(RUNDIR)/isdnlog.pid`; fi
-test ! -d $(OLDCONFDIR) || cp -auv $(OLDCONFDIR)/* $(I4LCONFDIR) \
&& isdnlog/bin/isdnlog /dev/null 1>/dev/null 2>&1)
-test ! -d $(OLDCONFDIR) || (cp -auv $(OLDCONFDIR)/* $(I4LCONFDIR) \
&& $(ISDNREP) 1>/dev/null 2>&1)
$(GENCONF) $(I4LCONFDIR)/$(CONFFILE)
$(INSTALL_BIN) $(ISDNLOG) $(SBINDIR)
$(INSTALL_BIN) $(ISDNREP) $(BINDIR)
$(INSTALL_BIN) $(ISDNCONF) $(BINDIR)
@ -284,36 +305,6 @@ $(ISDNCONF): $(ISDNCONF_OBJS)
tools/tools.h: $(LIBISDNDIR)/libisdn.h $(PREFIXDIR)/policy.h
touch tools/tools.h
isdnlog/isdnlog.o: isdnlog/isdnlog.c isdnlog/isdnlog.h tools/tools.h \
connect/socket.h
isdnlog/processor.o: isdnlog/processor.c isdnlog/isdnlog.h tools/tools.h \
connect/socket.h
isdnlog/functions.o: isdnlog/functions.c isdnlog/isdnlog.h tools/tools.h \
connect/socket.h
isdnlog/server.o: isdnlog/server.c isdnlog/isdnlog.h tools/tools.h \
connect/socket.h
isdnlog/start_prog.o: isdnlog/start_prog.c isdnlog/isdnlog.h tools/tools.h
isdnlog/user_access.o: isdnlog/user_access.c isdnlog/isdnlog.h tools/tools.h
tools/tools.o: tools/tools.c tools/tools.h
tools/isdnconf.o: tools/isdnconf.c tools/tools.h
isdnrep/rep_main.o: isdnrep/rep_main.c isdnrep/isdnrep.h tools/tools.h
isdnconf/isdnconf.o: isdnconf/isdnconf.c isdnconf/isdnconf.h tools/tools.h
isdnrep/cheap.o: isdnrep/cheap.c isdnrep/isdnrep.h tools/tools.h
connect/conv_address.o: connect/conv_address.c connect/socket.h tools/tools.h
connect/socket.o: connect/socket.c connect/socket.h tools/tools.h
connect/connect.o: connect/connect.c connect/socket.h tools/tools.h
depend: .depend
.depend:

20
isdnlog/configure vendored
View File

@ -541,6 +541,7 @@ LIBISDNDIR=../lib
I4LCONFDIR=$CONFIG_I4LCONFDIR
OLDCONFDIR=$CONFIG_ISDNLOG_OLDI4LCONFDIR
OLDCONFFILE=$CONFIG_ISDNLOG_OLDI4LCONFFILE
CONFFILE=$CONFIG_CONFFILE
RUNDIR=$CONFIG_RUNDIR
SERV_PORT=$CONFIG_ISDNLOG_SERV_PORT
USERFILE=$CONFIG_ISDNLOG_USERFILE
@ -549,17 +550,22 @@ CHARGEFILE=$CONFIG_ISDNLOG_CHARGEFILE
RELOADCMD=$CONFIG_ISDNLOG_RELOADCMD
STOPCMD=$CONFIG_ISDNLOG_STOPCMD
REBOOTCMD=$CONFIG_ISDNLOG_REBOOTCMD
COUNTRYCODE=$CONFIG_COUNTRYCODE
COUNTRYPREFIX=$CONFIG_COUNTRY_PREFIX
AREACODE=$CONFIG_AREACODE
AREAPREFIX=$CONFIG_AREA_PREFIX
if test "$CONFIG_LIB_AREACODE" = "y" ; then
ALIB=area
fi
else
LIBISDNDIR="../lib"
I4LCONFDIR="/etc/isdn"
OLDCONFDIR="/etc/isdnlog"
OLDCONFFILE="isdnlog.conf"
CONFFILE="isdn.conf"
RUNDIR="/var/run"
ALIB=area
SERV_PORT=20011
@ -570,6 +576,10 @@ RELOADCMD=reload
STOPCMD=stop
REBOOTCMD=/sbin/reboot
CONFIG_ISDNLOG_POSTGRESDIR=""
COUNTRYCODE="49"
COUNTRYPREFIX="+"
AREACODE=""
AREAPREFIX="0"
fi
@ -1939,6 +1949,14 @@ s%@LIBAREA@%$LIBAREA%g
s%@RUNDIR@%$RUNDIR%g
s%@SERV_PORT@%$SERV_PORT%g
s%@USERFILE@%$USERFILE%g
s%@OLDCONFDIR@%$OLDCONFDIR%g
s%@CONFFILE@%$CONFIG_CONFFILE%g
s%@LOGFILE@%$LOGFILE%g
s%@COUNTRYCODE@%$COUNTRYCODE%g
s%@COUNTRYPREFIX@%$COUNTRYPREFIX%g
s%@AREACODE@%$AREACODE%g
s%@AREAPREFIX@%$AREAPREFIX%g
CEOF
EOF

View File

@ -25,6 +25,11 @@ CHARGEFILE=$CONFIG_ISDNLOG_CHARGEFILE
RELOADCMD=$CONFIG_ISDNLOG_RELOADCMD
STOPCMD=$CONFIG_ISDNLOG_STOPCMD
REBOOTCMD=$CONFIG_ISDNLOG_REBOOTCMD
COUNTRYCODE=$CONFIG_COUNTRYCODE
COUNTRYPREFIX=$CONFIG_COUNTRY_PREFIX
AREACODE=$CONFIG_AREACODE
AREAPREFIX=$CONFIG_AREA_PREFIX
if test "$CONFIG_LIB_AREACODE" = "y" ; then
ALIB=area
fi
@ -49,6 +54,10 @@ RELOADCMD=reload
STOPCMD=stop
REBOOTCMD=/sbin/reboot
CONFIG_ISDNLOG_POSTGRESDIR=""
COUNTRYCODE="49"
COUNTRYPREFIX="+"
AREACODE=""
AREAPREFIX="0"
fi

View File

@ -1,4 +1,4 @@
/* $Id: isdnlog.c,v 1.6 1997/04/08 00:02:14 luethje Exp $
/* $Id: isdnlog.c,v 1.7 1997/04/08 21:56:48 luethje Exp $
*
* ISDN accounting for isdn4linux. (log-module)
*
@ -19,6 +19,11 @@
* along with this program; if not, write to the Free Software
*
* $Log: isdnlog.c,v $
* Revision 1.7 1997/04/08 21:56:48 luethje
* Create the file isdn.conf
* some bug fixes for pid and lock file
* make the prefix of the code in `isdn.conf' variable
*
* Revision 1.6 1997/04/08 00:02:14 luethje
* Bugfix: isdnlog is running again ;-)
* isdnlog creates now a file like /var/lock/LCK..isdnctrl0
@ -132,15 +137,19 @@ static void loop(void)
if (NewClient) {
/* Damit sich der neue Client anmelden kann, ohne
das was anderes dazwischen funkt ... */
FD_SET(sockets[NewClient].descriptor, &readmask);
if (sockets[NewClient].descriptor >= 0)
FD_SET(sockets[NewClient].descriptor, &readmask);
NewClient = 0;
}
else {
for (Cnt = 0; Cnt < queuenumber; Cnt++)
FD_SET(sockets[Cnt].descriptor, &readmask);
if (sockets[Cnt].descriptor >= 0)
FD_SET(sockets[Cnt].descriptor, &readmask);
for (Cnt = first_descr; Cnt < queuenumber; Cnt++)
FD_SET(sockets[Cnt].descriptor, &exceptmask);
if (sockets[Cnt].descriptor >= 0)
FD_SET(sockets[Cnt].descriptor, &exceptmask);
} /* else */
if (newcps && ((ifo[0].u & ISDN_USAGE_MASK) + (ifo[1].u & ISDN_USAGE_MASK)))

View File

@ -1,4 +1,4 @@
/* $Id: isdnrep.c,v 1.8 1997/04/06 21:03:37 luethje Exp $
/* $Id: isdnrep.c,v 1.9 1997/04/08 21:56:53 luethje Exp $
*
* ISDN accounting for isdn4linux. (Report-module)
*
@ -20,6 +20,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnrep.c,v $
* Revision 1.9 1997/04/08 21:56:53 luethje
* Create the file isdn.conf
* some bug fixes for pid and lock file
* make the prefix of the code in `isdn.conf' variable
*
* Revision 1.8 1997/04/06 21:03:37 luethje
* switch -f is working again
* currency_factor is float again ;-)
@ -1352,9 +1357,9 @@ static int n_match(char *Pattern, char* Number, char* version)
if (!strcmp(version,LOG_VERSION_1))
{
if ((RetCode = match(Pattern, Number,0)) != 0 &&
!strncmp(Pattern,S_AREA_PREFIX,strlen(S_AREA_PREFIX)) )
!strncmp(Pattern,areaprefix,strlen(areaprefix)) )
{
sprintf(s,"*%s%s",myarea/*+strlen(S_AREA_PREFIX)*/,Pattern);
sprintf(s,"*%s%s",myarea/*+strlen(areaprefix)*/,Pattern);
RetCode = match(s,Number,0);
}
}

View File

@ -1,4 +1,4 @@
/* $Id: tools.c,v 1.5 1997/04/06 21:17:46 luethje Exp $
/* $Id: tools.c,v 1.6 1997/04/08 21:56:59 luethje Exp $
*
* ISDN accounting for isdn4linux. (Utilities)
*
@ -19,6 +19,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: tools.c,v $
* Revision 1.6 1997/04/08 21:56:59 luethje
* Create the file isdn.conf
* some bug fixes for pid and lock file
* make the prefix of the code in `isdn.conf' variable
*
* Revision 1.5 1997/04/06 21:17:46 luethje
* Bugfix von Andreas Jaeger.
*
@ -389,7 +394,7 @@ char *vnum(int chan, int who)
register int flag = C_NO_WARN | C_NO_EXPAND;
auto char *ptr;
auto int ll;
auto int prefix = strlen(S_COUNTRY_PREFIX);
auto int prefix = strlen(countryprefix);
if (++retnum == MAXRET)

View File

@ -120,6 +120,17 @@ Dann wird nach der Datei /etc/myinclude gesucht. Es ist voellig
unabhaengig davon, in welchem Verzeichnis das Programm gestartet wurde,
das die Konfigurationsdatei lesen soll.
In der Include Datei muessen immer genau so viele gescheifte Klammern
zugehen, wie aufgemacht worden sind. Eine Datei darf nich folgenden Inhalt
haben:
[TEST1]
testinhalt = 5
{
Dieses wird leider nicht gut erkannt und kann zur Zeit noch zum Absturz fuehren.
Auf jeden Fall wird so die Konfigurationsdatei nicht sauber eingelesen!!!
ACHTUNG:
Wenn Dateien rekursiv eingebunden werden, fuehrt dieses mit Sicherheit
zum Absturz des Programmes. Dieses wird von der Library nicht verhindert.

View File

@ -1,4 +1,4 @@
/* $Id: isdntools.c,v 1.9 1997/04/08 00:02:24 luethje Exp $
/* $Id: isdntools.c,v 1.10 1997/04/08 21:57:04 luethje Exp $
*
* ISDN accounting for isdn4linux. (Utilities)
*
@ -19,6 +19,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdntools.c,v $
* Revision 1.10 1997/04/08 21:57:04 luethje
* Create the file isdn.conf
* some bug fixes for pid and lock file
* make the prefix of the code in `isdn.conf' variable
*
* Revision 1.9 1997/04/08 00:02:24 luethje
* Bugfix: isdnlog is running again ;-)
* isdnlog creates now a file like /var/lock/LCK..isdnctrl0
@ -230,7 +235,7 @@ char *expand_number(char *s)
if (*Ptr == '+')
{
strcpy(Help,S_COUNTRY_PREFIX);
strcpy(Help,countryprefix);
Ptr++;
}
@ -253,20 +258,20 @@ char *expand_number(char *s)
Ptr++;
}
if (Help[0] == '*' || !strncmp(Help,S_COUNTRY_PREFIX,strlen(S_COUNTRY_PREFIX)))
if (Help[0] == '*' || !strncmp(Help,countryprefix,strlen(countryprefix)))
{
strcpy(Num,Help);
}
else
if (!strncmp(Help,S_AREA_PREFIX,strlen(S_AREA_PREFIX)))
if (!strncmp(Help,areaprefix,strlen(areaprefix)))
{
strcpy(Num,mycountry);
strcat(Num,Help+strlen(S_AREA_PREFIX));
strcat(Num,Help+strlen(areaprefix));
}
else
{
strcpy(Num,mycountry);
strcat(Num,myarea/*+strlen(S_AREA_PREFIX)*/);
strcat(Num,myarea/*+strlen(areaprefix)*/);
strcat(Num,Help);
}
@ -354,14 +359,15 @@ int handle_runfiles(const char *_progname, char **_devices, int flag)
while (*_devices != NULL)
{
append_element(&devices,*_devices);
Ptr = strrchr(*_devices,C_SLASH);
append_element(&devices,Ptr?Ptr+1:*_devices);
_devices++;
}
}
if (flag == START_PROG)
{
sprintf(string,"%s%c%s.pid",RUNDIR,C_SLASH,progname);
sprintf(string,"%s%c%s.%s.pid",RUNDIR,C_SLASH,progname,devices[0]);
if ((RetCode = create_runfile(string,"%d\n")) != 0)
{
@ -470,11 +476,11 @@ static int create_runfile(const char *file, const char *format)
muss von jedem Programm aufgerufen werden!!!
*/
#define _MAX_VARS 3
#define _MAX_VARS 5
int Set_Codes(section* Section)
{
static char *ptr[_MAX_VARS] = {NULL,NULL,NULL};
static char *ptr[_MAX_VARS] = {NULL,NULL,NULL,NULL,NULL};
int i;
int RetCode = 0;
entry *Entry;
@ -484,7 +490,10 @@ int Set_Codes(section* Section)
for (i=0; i < _MAX_VARS; i++)
if (ptr[i] != NULL)
{
free(ptr[i]);
ptr[i] = NULL;
}
if ((SPtr = Get_Section(Section,CONF_SEC_GLOBAL)) == NULL)
return -1;
@ -504,17 +513,25 @@ int Set_Codes(section* Section)
}
#endif
if ((Entry = Get_Entry(SPtr->entries,CONF_ENT_COUNTRY_PREFIX)) != NULL &&
Entry->value != NULL )
ptr[1] = countryprefix = strdup(Entry->value);
if ((Entry = Get_Entry(SPtr->entries,CONF_ENT_AREA_PREFIX)) != NULL &&
Entry->value != NULL )
ptr[2] = areaprefix = strdup(Entry->value);
if ((Entry = Get_Entry(SPtr->entries,CONF_ENT_AREA)) != NULL &&
Entry->value != NULL )
{
ptr2 = Entry->value;
if (strncmp(Entry->value,S_AREA_PREFIX,strlen(S_AREA_PREFIX)))
ptr[1] = myarea = strdup(ptr2);
if (strncmp(Entry->value,areaprefix,strlen(areaprefix)))
ptr[3] = myarea = strdup(ptr2);
else
ptr[1] = myarea = strdup(ptr2+strlen(S_AREA_PREFIX));
ptr[3] = myarea = strdup(ptr2+strlen(areaprefix));
if (ptr[1] != NULL)
if (ptr[3] != NULL)
RetCode++;
else
print_msg("Error: Variable `%s' are not set!\n",CONF_ENT_AREA);
@ -525,14 +542,14 @@ int Set_Codes(section* Section)
{
ptr2 = Entry->value;
if (strncmp(Entry->value,S_COUNTRY_PREFIX,strlen(S_COUNTRY_PREFIX)))
if (strncmp(Entry->value,countryprefix,strlen(countryprefix)))
{
sprintf(s,"%s%s",S_COUNTRY_PREFIX,
sprintf(s,"%s%s",countryprefix,
Entry->value[0]=='+'?(Entry->value)+1:Entry->value);
ptr2 = s;
}
if ((ptr[2] = mycountry = strdup(ptr2)) != NULL)
if ((ptr[4] = mycountry = strdup(ptr2)) != NULL)
RetCode++;
else
print_msg("Error: Variable `%s' are not set!\n",CONF_ENT_COUNTRY);
@ -560,7 +577,7 @@ char *get_areacode(char *code, int *Len, int flag)
{
auto char *Ptr;
auto int i = 0;
register int prefix = strlen(S_COUNTRY_PREFIX);
register int prefix = strlen(countryprefix);
if (Len != NULL)
@ -623,7 +640,7 @@ static char *_get_areacode(char *code, int *Len, int flag)
{
static int opened = 0;
static char s[BUFSIZ];
int prefix = strlen(S_COUNTRY_PREFIX);
int prefix = strlen(countryprefix);
int ll=0;
int l;
@ -691,7 +708,7 @@ static char *_get_areacode(char *code, int *Len, int flag)
auto char *err;
static acInfo ac;
static int warned = 0;
int prefix = strlen(S_COUNTRY_PREFIX);
int prefix = strlen(countryprefix);
if (!warned && (cc = GetAreaCodeInfo(&ac, code + prefix)) == acOk)
{

View File

@ -1,5 +1,5 @@
/* $Id: libisdn.h,v 1.5 1997/04/08 00:02:25 luethje Exp $
/* $Id: libisdn.h,v 1.6 1997/04/08 21:57:07 luethje Exp $
*
* ISDN accounting for isdn4linux.
*
@ -20,6 +20,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: libisdn.h,v $
* Revision 1.6 1997/04/08 21:57:07 luethje
* Create the file isdn.conf
* some bug fixes for pid and lock file
* make the prefix of the code in `isdn.conf' variable
*
* Revision 1.5 1997/04/08 00:02:25 luethje
* Bugfix: isdnlog is running again ;-)
* isdnlog creates now a file like /var/lock/LCK..isdnctrl0
@ -103,11 +108,13 @@ extern char *basename __P((__const char *__name));
/****************************************************************************/
#define CONF_SEC_GLOBAL "GLOBAL"
#define CONF_ENT_COUNTRY "COUNTRYCODE"
#define CONF_ENT_AREA "AREACODE"
#define CONF_ENT_AREALIB "AREALIB"
#define CONF_ENT_AVONLIB "AVON"
#define CONF_SEC_GLOBAL "GLOBAL"
#define CONF_ENT_COUNTRY_PREFIX "COUNTRYPREFIX"
#define CONF_ENT_AREA_PREFIX "AREAPREFIX"
#define CONF_ENT_COUNTRY "COUNTRYCODE"
#define CONF_ENT_AREA "AREACODE"
#define CONF_ENT_AREALIB "AREALIB"
#define CONF_ENT_AVONLIB "AVON"
#define CONF_SEC_VAR "VARIABLES"
@ -139,14 +146,20 @@ extern char *basename __P((__const char *__name));
#ifdef _ISDNTOOLS_C_
#define _EXTERN
#define SET_NULL = ""
#define SET_NULL = ""
#define SET_AREA_PREFIX = S_AREA_PREFIX
#define SET_COUNTRY_PREFIX = S_COUNTRY_PREFIX
#else
#define _EXTERN extern
#define SET_NULL
#define SET_AREA_PREFIX
#define SET_COUNTRY_PREFIX
#endif
_EXTERN char *mycountry SET_NULL;
_EXTERN char *myarea SET_NULL;
_EXTERN char *mycountry SET_NULL;
_EXTERN char *myarea SET_NULL;
_EXTERN char *areaprefix SET_AREA_PREFIX;
_EXTERN char *countryprefix SET_COUNTRY_PREFIX;
_EXTERN void set_print_fct_for_lib(int (*new_print_msg)(const char *, ...));
_EXTERN int num_match(char *Pattern, char *number);
@ -160,6 +173,8 @@ _EXTERN int read_conffiles(section **Section, char *groupfile);
_EXTERN int paranoia_check(char *cmd);
#undef SET_NULL
#undef SET_AREA_PREFIX
#undef SET_COUNTRY_PREFIX
#undef _EXTERN
/****************************************************************************/